- Home /
how to make an objective for a game (like slender)
im trying to make a game kinda like slender but i need to know how to make it when u click on a note or something it triggers something and if u collect all of them u trigger something else. thnx :-D
So many Slender Questions! I am ready to make a tutorial just to stop them! And so it cannot be said that I wasn't constructive or helpful, everything you want is here :
http://answers.unity3d.com/questions/287355/slender-like-game.html
http://answers.unity3d.com/questions/296068/how-to-make-a-slender-man-follow-character-script.html
http://answers.unity3d.com/questions/319733/how-to-make-enemy-kill-you-if-starring-at-it.html
http://forum.unity3d.com/threads/134862-Slender-$$anonymous$$an-Design-Outline
http://www.parsecproductions.net/slendermangame.txt
http://forum.unity3d.com/threads/141488-Slender-Beta-0.9
http://forum.unity3d.com/threads/138399-Slender-$$anonymous$$an-WIP
It's up to you to find the useful information among that. Read.
Break it down to one simple thing. Work out how to find if one object can "see" another. Once you do that, you can make it do anything you like with that as a trigger. And you can do it both for the player and the 'man' .
http://answers.unity3d.com/questions/323129/if-anyones-looking-for-a-flashlight-script-with-a.html
http://answers.unity3d.com/questions/316189/i-want-to-turn-my-flashlight-on-and-off-while-stil.html
http://www.youtube.com/watch?v=nmvCaqNGEFU&feature=related
http://answers.unity3d.com/questions/15438/trying-to-pick-up-and-see-paper-pop-up-gui-window.html
http://answers.unity3d.com/questions/321749/how-do-you-pick-up-pages-like-in-slender.html
http://cgcookie.com/unity/2011/12/05/introduction-to-character-controllers/
http://unity3d.com/support/resources/assets/terrain-assets
http://unity3d.com/support/resources/unity-extensions/terrain-toolkit
Well to answer some questions like 'How to pick up papers' and how to have the enemy follow when not looking', I have written a 'Slender' guide, here is the link ($$anonymous$$ $$anonymous$$ay) : http://answers.unity3d.com/questions/321749/how-do-you-pick-up-pages-like-in-slender.html
Answer by chrisall76 · Jul 30, 2012 at 06:16 AM
You should learn the Unity engine a bit more and the basic scripting, because it's pretty simple. I won't exacly give you the code, but I'll give you the basic idea of what I know. You need to apply a collider to the object you want clicked, and then put a tag on it (most likely want "paper"). When the player collides with it and checks it's tag for "paper", make it delete the gameobject and add 1 to the total of collected items.
ok i will try and learn a bit more about the engine and a bit more of scripting. thnx for the advice :-D
Check my answer on this question, it should help =]
http://answers.unity3d.com/questions/240136/sliding-door-animation-question.html
Answer by williampigmeu · Jul 30, 2012 at 04:44 AM
Simply, there is an algorithm (not an script):
when Player:Click Note do show Note NoteCount = +1 end when
if NoteCount = TotalNoteCount do GameIsComplete = true end if
Now, just ask for someone for any script, or try to make yours one.
im a beginner at this and i dont know where u r meant to actually input this code and link it to when someone clicks on the object.
I said that's not a script, if you don't know scripting, ask someone to make it for you, it's sorta easy (not for me) for the pros.
but were do u input this to make it work in game?
He said, you cannot put that anywhere, you need to make from that an script, or let some one make a script for you, when you've done that, you will be able to put that "script" you / somebody made for you into the engine.
Answer by williampigmeu · Aug 01, 2012 at 06:57 PM
This above example in form of an algorithm: You will need: A note texture placed in a Plane with isTrigger Collider, a invisible Sphere (search for Occlusion Culling) with an Collider, attached to the main player camera, and this algorithm (in form of script, obviously):
Array NoteCount = 5 Int NotesYouHave = 0
If Mouse.LeftClickPressed do: Sphere.Z = this + 5 If Sphere.Collider touch Paper.Collider do: PickupPaper(Paper.Id) end if Wait 1 Second Sphere.Z = this - 5 end if
PickupPaper function do: NotesYouHave = this + 1 if NotesYouHave = NoteCount do: GameFinished() end if end if
It's very easy to do.
It works like that: When you click left mouse button, it moves the invisible Sphere to your front, like a punch, and checks if it collided with a Paper, if yes, it adds this paper to the count and check if you have all the Papers, and it moves the Sphere back to you.
Ive been trying to make this work, this is the code ive come up with:
Array NoteCount = 5; int NotesYouHave = 0;
If ($$anonymous$$ouse.LeftClickPressed){ Sphere.Z = this + 5 If (Sphere.Collider Touch Paper.Collider) { PickupPaper }
}
Function PickupPaper { NotesYouHave = this + 1 if(NotesYouHave = NoteCount){ } }
but i get errors! could someone help?
You can't define an array using "Array" in Unity, in "if (Sphere.Collider Touch Paper.Collider)", first: You can't use "Touch", search for Collision Events in the documentation, second: "Sphere" and "Paper" needs to be defined first.
Whoops, there is no need for an array, you will use: "int NoteCount = 5", it was my mistake in the algorithm.
Your answer
![](https://koobas.hobune.stream/wayback/20220613074907im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
GUI message scripting need help to create a info box 0 Answers
How to make a pedometer in UNITY 1 Answer
Making a GTA-style game 1 Answer
How to make NPC Routine Movements? 1 Answer
One Action/Mission at a time 1 Answer