- Home /
Slender Man scripting troubles- Enemy movement, page collecting, music effects, death on contact, and sanity loss
Im making a game based off of Slender: The Eight Pages by Parsec Productions. I got Slender Man in the game....I got the flashlight, sprinting, etc. down, but I need a few scripts. When i collect pages, they dont disapear(this means you can collect one page eight times to win). Ive gotten scripts for it but none of them work. The Slender Man in my game moves fast when youre not looking, but when you are he moves extemely slow. I want him to be idle when looked at but there are no scripts for it, he also walks through walls when youre not looking which would make the game extremely hard. I also want the player to instantly die when in close contact with the Slender Man. For music, I want a script that makes music harsher as pages are collected. Lastly, I want a sanity loss effect to where the screen gets fuzzy when you look at him. I dont want this to happen when looking in his direction but through a wall. I know its probably alot to ask but I need help. If there are any people who are good at writing scripts, help on any one of these subjects would be GREATLY appreciated. Thanks for any help or advice.
Answer by CrucibleLab · Nov 16, 2012 at 08:14 PM
So, let me state the obvious first:
No one's going to touch your question with a 10-foot pole due to the way you addressed your issues - in one big, messy blob of text. Your title alone probably scared away 95% of the community members. I am feeling patient today so let me tell you something more important than just getting this question answered; if you intend to remain a part of this community, that is.
Break down your problem, one at a time if at all possible.
You shouldn't just tell us your script doesn't work. Show us the script.
Be patient and learn from others how to get your questions answered.
If you're unwilling to follow these guidelines, you're probably at the wrong place. Sorry, but it's true. By the way, I will be more than happy to lend you my help if you can do #2. :)
Umm okay I hope this is alot better. Im new to this whole question and answer thing and I didnt know it had to be in some kind of neat order....okay so the problem id like to address first is page collecting. I got a script that works okay but the pages dont disappear when collected. Here is the script for it:
pragma strict
script RequireComponent( AudioSource )
var papers : int = 0; var papersToWin : int = 8; var distanceToPaper : float = 2.5;
public var paperPickup : AudioClip;
var theEnemy : EnemyScript;
function Start() { Screen.lockCursor = true;
// find and store a reference to the enemy script (to reduce distance after each paper is collected)
if ( theEnemy == null )
{
theEnemy = GameObject.Find( "Enemy" ).GetComponent( EnemyScript );
}
}
function Update() { //if ( Input.Get$$anonymous$$ouseButtonUp(0) ) // use E in editor as LockCursor breaks with left mouseclick if ( Input.Get$$anonymous$$ouseButtonDown(0) || Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.E) ) { //var ray = Camera.main.ScreenPointToRay( Input.mousePosition ); // always cast ray from center of screen var ray = Camera.main.ScreenPointToRay( Vector3( Screen.width 0.5, Screen.height 0.5, 0.0 ) ); var hit : RaycastHit; if ( Physics.Raycast( ray, hit, distanceToPaper ) ) { //Destroy ( hit.collider.gameObject.tag == "Paper" ) if ( hit.collider.gameObject.name == "Paper" ) { papers += 1; //Debug.Log( "A paper was picked up. Total papers = " + papers );
audio.PlayClipAtPoint( paperPickup, transform.position );
// make enemy follow closer
theEnemy.ReduceDistance();
}
}
}
}
function OnGUI() { if ( papers < papersToWin ) { GUI.Box( Rect( (Screen.width * 0.5) - 60, 10, 120, 25 ), "" + papers.ToString() + " Papers" ); } else { GUI.Box( Rect( (Screen.width/2)-100, 10, 200, 35 ), "8/8 Pages" ); // Application.LoadLevel( "mainmenu" ); } }
If you know what I need to add to make the pages disappear please tell me and if theres a specific place I need to add it let me know. Thank you
Sorry I dont know why it broke the script into pieces, I hope this isnt too hard to work with...
Have you called your object with the collider of the page : Paper ?
if ( hit.collider.gameObject.name == "Paper" )
It's right there, read and do my guide again. I also said to ask questions on one of the 2 places I put the guide :/
Edit : before this line, add this :
Debug.Log( "Ray Hit " + hit.collider.gameObject.name );
what does it print in the console ?
Okay let me answer your first question: Yes I named it "Paper" and tagged it as "Paper"
I will edit the script and add your line momentarily....
Your answer

Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Mute volume / sound problem 1 Answer
Death Scene (zooms into Enemy's face)? 2 Answers
Play Death Animation After Death 1 Answer