The question has been closed Jan 02, 2013 at 11:58 AM by Fattie for the following reason:
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#
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.
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 :
Some assets to help you out :
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 :
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 :
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 =]
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