x


[Closed] How do you pick up pages like in "Slender"?

I have looked all over the internet and i know people dont like being asked for scripts but I'm only 14 and i dont know how to code yet... can someone please help me!!?

more ▼

asked Sep 23, 2012 at 06:17 AM

jordan1998 gravatar image

jordan1998
0 13 15 18

im 13 and i know how to code in javascript + little bit Csharp :)

Mar 27, 2013 at 08:01 PM riko4628
Sep 27, 2012 at 10:08 PM alucardj

My first question is : do you know how to make a terrain, then add a character controller? Follow this video : http://cgcookie.com/unity/2011/12/05/introduction-to-character-controllers/

For learning Unity, here is a list of tutorials to get you going :

Start at the bottom and work up : http://www.unity3dstudent.com/category/modules/essential-skills/

Start at the bottom and work up : http://www.unity3dstudent.com/category/modules/beginner/

here is the above playlist on YouTube : http://www.youtube.com/watch?v=-oXYHNSmTxg&list=PL27B696FB515608D2&feature=plcp

a little 2D space shooter : http://www.unityjumpstart.com/ProofOfConcept_1/

the Unity Wiki : http://wiki.unity3d.com/index.php/Tutorials

A list of resources : http://answers.unity3d.com/questions/12321/how-can-i-start-learning-unity-fast-list-of-tutori.html

Sep 26, 2012 at 02:16 AM alucardj
(comments are locked)
10|3000 characters needed characters left

The question has been closed Jan 02, 2013 at 11:58 AM by Fattie for the following reason:

Duplicate Question


4 answers: sort voted first

This Answer is now CLOSED#

Attention Slender Script Shoppers, this question will be closing in 2 minutes.

All future questions about my scripts will only be answered on the new forum page.

Here is the link you are looking for#

Unity Forum : http://forum.unity3d.com/threads/172415-Slender-Guide-by-alucardj

I shall not be responding to any more posts here or any other question on Unity Answers either. All future traffic to my 'Slender' Guide is going to be solely through the forum page. Any questions that appear on Unity Answers will be closed and redirected to the forum page.

If you post a new question on Unity Answers with my scripts, I shall bring the hammer down !#

While this may seem a little unfair, it is actually a good thing for all of your benefit. Every comment, change and update will appear there, for everyone to read and contribute to. No more searching through different questions just to get different parts of functionality, but everything you could need for starting your own horror survival game will be in one place. Doesn't that sound convenient ?!

See You there =]


Slender Guide Version 2

While I have finished writing the code, I don't have time to write a full guide explaining the steps taken and what I have coded in. I am changing the code in the below guide so people can still make their own rather than just using my package, and I really hope people write their own instead of just using my package.

Slender Guide Version 2 (I can only upload 5MB, so the project is very basic, but working!) : http://www.alucardj.net16.net/unityanswers/SlenderGuideV2-scene0.unitypackage

Fixed problems from Version 1 :

picking up papers in the editor - there were some issues with using LockCursor while running in the editor, hopefully these have been compensated for, recommend use the E key to pick up papers while running in the editor (but mouse still works). some movement issues - I had no problem, but it was brought up so I have tweaked the movement script.

New features :

The more papers picked up, the Man follows closer. Audio : when picking up paper, when the Man is first sighted, running and walking footsteps with adjustable audio gap between steps. Custom mesh with fading alpha fullscreen static effect.

And don't forget the awesome original flickering flashlight!

Here is the video link for the obstacle avoidance raycast : http://vimeo.com/9304844

Comments and feedback are welcome, as long as you have something more to say than just it doesn't work. The package proves it does. And please don't ask new questions, post comments here. If this keeps going or more people have requests, I might have to start a Unity Forum page.

Enjoy =]


How to make a 'Slender' game by Jay Kay (alucardj)

1- Create the terrain, and add a first person controller

there are many tutorials on both these topics, here are some quick links :

video : http://cgcookie.com/unity/2011/12/05/introduction-to-character-controllers/

written : http://wiki.unity3d.com/index.php?title=Terrain_tutorial

Some assets to help you out :

http://unity3d.com/support/resources/assets/terrain-assets

http://u3d.as/content/stormwater/heightfield-pack/2Q4

http://unity3d.com/support/resources/unity-extensions/terrain-toolkit

Also find some buildings (old shed, abandoned shack, etc) and anything you want to help the player use as 'landmarks' while searching around the terrain.

When you add a First Person Character Controller, Change the name of First Person Controller to Player.

2- Set the Ambience and Add a Flashlight

Here I am assuming you have created a terrain, added trees grass and buildings, and dropped in a first person character controller. Hopefully you have also pressed play and walked around the world you have created.

To give the scene a more 'spooky' feel, set the render settings.

In Unity, navigate to Edit > Render Settings

Enable (tick) the box that says Fog.

Click the Fog Colour box, set the ambient light to 29 on each of the RGB sliders. You can see the change in the scene, pick a colour that is dark but not pitch-black.

Click the Ambient Light Colour box, set the ambient light to 51 on each of the RGB sliders. You can see the change in the scene. Again, pick a colour that is dark but not pitch-black.

For a skybox I used the Moonshine skybox from the Standard Assets. (Assets > Import Package > Skyboxes). Drop Moonshine Skybox into Skybox Material (while in the Render Settings).

Now for the flashlight. Create a SpotLight, make it a child of the camera (so wherever the camera looks, the spotlight points). Set its Transform to X = 0; Y = 0.467; Z = 0; leave Rotations at 0, Scale at 1.

My settings for the spotlight are :

Range = 25; Spot Angle = 71.5870; Color I made very slightly yellow; Intensity = 1.85;

Now when you press play, you should be walking around your dark scene with a torchlight effect in front of where you look.

Advancing : I helped someone with a flickering flashlight, and have adapted that script to have the following behaviour. 1- light works for 1-2 minutes. 2- Light starts to flicker. 3- press F to reset light (light flashes twice as if being tapped/shaken) then light works again for another 1-2 minutes. I think it works well to add suspense (the flashlight suddenly flickers, and you have to reset it) . The link is : http://answers.unity3d.com/questions/316189/i-want-to-turn-my-flashlight-on-and-off-while-stil.html#answer-316302

3- How to Pick Up Papers

This one gets asked alot, and the usual response is a trigger-collider setup. For this tutorial, I am going to use a raycast method.

First create some papers. This part is easy =] Create a cube, scale it to X = 0.6; Y = 0.9; Z = 0.01;

Name it Paper. Now Duplicate it 7 times, so you have 8 Paper cubes total.

There are some images that can be found on page 5 of this thread : http://forum.unity3d.com/threads/134862-Slender-Man-Design-Outline

Create a material for each Paper, then apply them to the cubes. You can place these where you want around the scene, just make sure they are set at a realistic height, and preferably so they can only seen from one side (nailed to a thick tree, on the side of a shed).

Now to make it so these papers can be collected.

Create a new script, call it CollectPapers. Attach it to the Player. Here is the code :

  function Start()
  {
       Go TO THE FORUM PAGE !
  }


NOTE : in the Start function, there is the line Screen.lockCursor = true; this is to hide the cursor and lock it to the center of the screen. This can have some silly effects when you run in the editor and then click the mouse, but in a build you notice it works as expected. (this script is adapted from my answer here : http://answers.unity3d.com/questions/239927/Collecting-Papers-and-Keeping-Track-of-how-many-collected--need-help.html)

So, when the left mouse button is released, a ray is cast for a certain distance. If the player is close enough to something named Paper, and the ray hits Paper, then the count is increased and the Paper is destroyed.

At this stage you should be walking around your 'spooky' scene, collecting papers with the amount collected displayed at the top.

Advancing : I found this link for when the paper is found, first displaying the paper full-screen, then destroying the paper. I think that effect would be cool but havn't looked into it yet. The link is : http://answers.unity3d.com/questions/15438/trying-to-pick-up-and-see-paper-pop-up-gui-window.html

4- How to Have an Enemy Follow the Player at a Distance

If you were observant, you would have noticed a model where you got the images for the papers! You can use this, but as the 'man' always looks at the player, a 2D image can be used. Search for an image you want to use (), then make a material for that image. (http://forums.d2jsp.org/topic.php?t=64345908&f=202, http://www.zerochan.net/1271218, etc)

Create a Cube, name it Enemy, scale it to X = 1; Y = 2; Z = 0.1;

Remove or replace the Box Collider with a Capsule Collider ( Component > Physics > Capsule Collider ). My settings for the Capsule Collider are Center = 0 for XYZ, Radius = 0.5, Height = 1, Direction = Y-Axis.

Now also attach a Rigidbody Component ( Component > Physics > Rigidbody ). My settings for the Rigidbody are Mass = 1; Use Gravity = true.

Now for the script, create and call it EnemyScript. I have seen many answers use the Render.isVisible method. For this I am using a Dot.Product method. First there is a check if in a Dot.Product greater than 0.8, then check if within the maximum viewable distance, then check if there is a direct line-of-sight to the player (i.e. not occluded/behind a tree or building). Here is the code :

  function Start()
  {
       Go TO THE FORUM PAGE !
  }


5- Play and Test your Game =]

If all has gone well, you now have your very own Slender game !

This is just the start, try adding many more things :

Add Sounds !! Batteries to pick up for the Flashlight when it runs out of charge. Full screen display of the page when collected. A Game Over screen and a way to restart the game.

Hope you have found this useful and helpful =]

more ▼

answered Oct 21, 2012 at 06:42 AM

alucardj gravatar image

alucardj
29.3k 167 1044 206

hey jay kay, i love the tutorial :) it hellfull !!!

but i have 2 problems

  • when my slenderman fallows me , some time , "3 min" it disapear and dont come again !!!
  • the papers some times get grabed and some times no, "i think the mouse are not in the midle of the screen"

How i can solve this ¿¿

thanks a lote (sorry for my bad english, im from argentina"

Oct 22, 2012 at 09:07 PM pwnisher

In the script CollectPapers, there is a variable called distanceToPaper, I have set it to 2.5 so the player has to be within 2.5 units from the paper. Try and change this value to something higher until you get the papers picking up at a distance you like. As the cursor is locked, the raycast is done from the center of the screen, so yes the paper has to have a part of it in the center of the screen to work. You can move the raycast, just change the line to something like :

 var ray = Camera.main.ScreenPointToRay( Vector3( Screen.width * 0.5, Screen.height * 0.25, 0.0 ) );

this will have the ray cast from the center of the Screen X-axis but in the top 1/4 of the Screen Y-axis.

As to the enemy disappearing, I just don't know. I had the scene playing for several minutes when I was testing the random time for the flickering flashlight, and the enemy was always behind or close to me. I did notice there was an area between being onscreen but not in-view, the enemy fell over and started rolling around on its capsule collider. I think I have found the problem in the enemy script. Delete the MoveEnemy() function, and replace it with this.

 function MoveEnemy() 
 {
     // Check the Follow Distance
     CheckDistance();
     
     // if not too close, move
     if ( !isInRange )
     {
         transform.LookAt( thePlayer );
         rigidbody.velocity = Vector3( 0, rigidbody.velocity.y, 0 ); // maintain gravity
         transform.position += transform.forward * speed * Time.deltaTime;
     }
     else
     {
         StopEnemy();
     }
 }
 

Thanks for your feedback, it is most helpful. Keep me posted if the enemy is still disappearing after the function change, and when I have time again I look into if I can get this problem to happen for me. It is the most basic AI, there can be lots added to it, like raycasts so it walks around objects instead of just bumping into/around objects.

Oct 23, 2012 at 12:56 AM alucardj

Thanks a lot :) i will try that u say..

another thing.

  • how i can put the slenderman invisible when i have 0 papers colected and when i colect each paper it appear close to me or more clouser when i grab more pages..
  • and the little error again, when i add ur script, then im in front of slenderman and it crouch or something like sleep in the ground, its not colliding and stay there, when i crash with him, the slenderman model lie in the ground and then disapears "i think the colliders are not working well, because the model fall of the floor and cant come again..."

want a video??? i can post one for u

Thanks a lot :)

u are awesome !

Oct 23, 2012 at 01:54 AM pwnisher

I have been testing the enemy script this morning and have made some minor changes. Try this out for now, but I shall probably make a Version 2 to this guide (this weekend if I'm not busy). It will include all the stuff like making the enemy walk around objects and the enemy comes closer for every paper collected.

I have to go now, but shall look at this maybe tonight. If you want to post a video then that would help me understand the problem, in the meantime try my latest script (replace the old script with the new updated one in the answer).

Oct 23, 2012 at 03:01 AM alucardj

omg omg u are amazing dude !!!!! send me the link when u make it please :DDD

PD: I already put the new script but is the same :/ i will make a video and post here the link PDD: try to make (in the weekend when u do the guide) slender is invisible when u dont collect any nothe and then when u collect 1 note it apear randomly.

Oct 23, 2012 at 12:12 PM pwnisher
(comments are locked)
10|3000 characters needed characters left

Hey man! I put together a free little basic package it has some things I think you might like or want. http://forum.unity3d.com/threads/152174-Free-Basic-FPS-Horror-Type-Package?p=1042943#post1042943 Let me know if any of that helps. Threw it together tonight to share with everyone. Pretty basic stuff for most people but a awesome start.

Link to video of what that package includes/does http://www.youtube.com/watch?v=5mYia5afJ-o&feature=youtu.be

more ▼

answered Sep 23, 2012 at 07:55 AM

MadToLove gravatar image

MadToLove
48 20 18 38

the script called pickupnote is telling me the type namespace name note could not be found

Sep 25, 2012 at 03:08 AM jordan1998

Did you change any code or change the name of any of the scripts? What is the exact error? The only way I was able to try to recreate that error was by going into the note script and changing the public class name at the beginning of the script.

Sep 25, 2012 at 03:33 AM MadToLove

HOW DO U ADD 1 TO A PAGE COUNTER

Sep 26, 2012 at 01:09 AM jordan1998
(comments are locked)
10|3000 characters needed characters left

you would destroy the object, and add one to the page counter

more ▼

answered Sep 25, 2012 at 05:52 AM

ibayibay1 gravatar image

ibayibay1
18 11 14 18

how ......

Sep 26, 2012 at 01:10 AM jordan1998
(comments are locked)
10|3000 characters needed characters left

no i didnt change anything and i tryed changing the name but it just gives me more errors

more ▼

answered Sep 26, 2012 at 12:21 AM

jordan1998 gravatar image

jordan1998
0 13 15 18

wait i got it working now but it wont let me pickup the note

Sep 26, 2012 at 12:10 AM jordan1998
(comments are locked)
10|3000 characters needed characters left

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3638
x487
x17

asked: Sep 23, 2012 at 06:17 AM

Seen: 9619 times

Last Updated: Mar 27, 2013 at 08:01 PM