Search Unity

Slender Guide by alucardj

Discussion in 'Scripting' started by AlucardJay, Mar 2, 2013.

Thread Status:
Not open for further replies.
  1. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    I'm getting the same errors. I did comment those out.

     
  2. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    And I did close and re-open.
     
  3. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    Ok, sorry but I'm about to fall asleep at the keyboard. For now, just scratch all that and go back to my first suggestion. Start a new project, just import the Character Controller, and then follow video 10

     
  4. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    I'll post results tomorrow when I have the energy to do it. Thanks for all the help.
     
  5. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    Okay so I followed the video and it's still not collecting as shown in console. I stopped (I still have the video up) after you were able to and I'm not.

    The script:
    But I am getting this caution:
     
  6. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    After a lot of trail and error I found a way to get the note system to work.
     
  7. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    I do still need help with the Slender script although.
     
  8. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    This is where I get really confused and even a bit frustrated.

    How is that possible? If you start in a new project, then follow the one video, there is only one script. That just does my head in. Also, you should leave the debug lines in, they show what the script is doing, to help understand, and it also becomes useful when things don't work as expected. You can see when and where the ray/spherecast is being cast.

    Well, what did you do? How can it be that it works for me and so many others, but not you. And if you fixed it, exactly what did you do to fix it? I would like to know, and if for some reason anybody else has this trouble, what can you tell them so they know? Really, I am confused, this does my head in.

    What you are doing is the old guide. The videos are there just to show how it works. And to prove to all the people who say it doesn't, that it does. Everyone just needs to pay attention to the instructions given, and their results should be exactly as they appear in the videos.

    Now all that said, this is the Old guide. I really shouldn't be supporting it anymore. Why? because I have just spent the last 3 weekends recording all new videos with much more detail, and all new scripts, that are written from a blank document, presented there with detailed explanation for all to see, learn from, and become able to write scripts for themselves.

    I am going on a bit because there are alot of comments appearing on youtube "please post the scripts". That's not the point of my videos. They are there to teach everyone how to write code for themselves. My aim is to teach, not give stuff away.

    Every video tutorial I ever did, I had to pause, take screenshots, and then check the code compared to mine. There are only a few out there that provide packages, and I see there they have the same problem. Some people just want to copy, and use it without knowing how it works or understanding why. (then come back with "it doesn't work").

    From the errors you had after just doing a single stand-alone video, I can see no way that I can fix your slender script. This all sounds negative, but I Want you to learn, I want you to see how these scripts work, and how to be able to make your own scripts.

    For people that just want the scripts, I am seriously considering selling my working project just like Burgzerg Arcade does. Then I know what they have is working, and they just get what they want.

    SO that was my big rant. This is not because of you, but from all the comments and questions that have appeared from the original old written guide. For you and MegaStevenLP, I suggest looking at the video in the new series : 45 _ Slender 1-15 : Using a Model

    Here it shows how to use your own model, whatever guide you are following. Export your terrain, start a new project (without any scripts), import the terrain, then put in a character controller, then do Video_10 Collect papers from scratch using spherecast, then go to the new videos on making a NPC character. NPC 1-1 to NPC 1-8 in Programming and Making Games playlist, then jump to the new Slender guide to continue. This is much better than trying to hack together the old guide (and the whole point of me doing videos). Everything there is written from a blank script, with detailed explanation.

    I hope you don't take all this the wrong way, it is just my frustration because I cannot simply implant my knowledge in peoples heads, so I am trying to explain everything I know, so it becomes their knowledge, and everyone can understand how to read and write code, and make their own scripts, and much faster than it took me when I had to teach myself from scratch.

    Please consider following along, and see what you can learn.

    Just look at the size of this comment. If I didn't care, I wouldn't bother. I havn't even played a game or done my own projects in 3 weeks.

    Edit : Now I am going to finally play some Far Cry 3
     
    Last edited: Mar 26, 2013
  9. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    How To Collect Papers From Scratch Using a SphereCast :

    1/ create a new scene
    2/ create a cube, name it floor. Set the position to ( 0, -0.5, 0 ). Set the scale to ( 100, 1, 100 ).

    3/ delete the main camera from the scene.
    4/ import the first person controller
    5/ Drag the first person controller into the scene

    6/ create a cube, name it Paper. Duplicate this as many times as you want, and scatter them around the scene.

    7/ to the first person controller, add this script :

    Code (csharp):
    1.  
    2. #pragma strict
    3.  
    4. var papers : int = 0; // counter of how many papers collected
    5. var papersToWin : int = 8; // total number of papers in the scene
    6.  
    7. var distanceToPaper : float = 5.5; // maximum distance that the raycast will detect
    8.  
    9. var sphereRadius : float = 1.0; // the width of the sphere that is being SphereCast
    10.  
    11. function Update()
    12. {
    13.     if ( Input.GetMouseButtonDown(0) || Input.GetKeyDown( KeyCode.E ) ) // use the left mouse button or the E key
    14.     {
    15.         var hit : RaycastHit; // variable to store hit information
    16.        
    17.         var rayOrigin : Ray = Camera.main.ScreenPointToRay( Vector3( Screen.width * 0.5, Screen.height * 0.5, 0 ) ); // casting a ray from the center of the screen in the direction the camera is facing
    18.        
    19.         if ( Physics.SphereCast( rayOrigin, sphereRadius, hit, distanceToPaper ) ) // cast a sphere from the camera, of sphere radius, getting hit information, for a set distance
    20.         {
    21.             Debug.Log( "SphereCast Hit : " + hit.collider.gameObject.name ); // show in the console the name of the collider object that was hit
    22.            
    23.             Debug.DrawLine( Camera.main.transform.position, hit.point, Color.red, 1.5 ); // show in the scene view a line where the raycast went
    24.            
    25.             if ( hit.collider.gameObject.name == "Paper" ) // check if the collider gameObject name was Paper
    26.             {
    27.                 Debug.Log( "SPHERE hit Paper for sure : " + hit.collider.gameObject.name ); // debug to confirm
    28.                
    29.                 papers += 1; // increment papers
    30.                
    31.                 Destroy( hit.collider.gameObject ); // destroy the Paper
    32.                
    33.                 if ( papers == papersToWin ) // check if all the papers have been collected
    34.                 {
    35.                     Debug.Log( "You have collected All Papers !" );
    36.                    
    37.                     // Here is the Win condition
    38.                    
    39.                     // load the win scene or the next level here
    40.                 }
    41.             }
    42.            
    43.         }
    44.     }
    45. }
    46.  

    8/ In the Inspector, change the value in papersToWin to your number of Paper (cube objects)

    9/ now run the scene. Check the console for hit information, and check the scene view for where the spherecast went.


    Information can be found here : http://www.youtube.com/watch?v=JaOsHCV_SZQ

    Here is the package from the video : http://www.alucardj.net16.net/unityanswers/CollectPaper_SphereCast.unitypackage
     
  10. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    How to Use a Model for the Enemy :

    1/ create a capsule

    2/ add a rigidbody, set use gravity to true, and also set the X Y Z freeze rotation constraints to true. (tick the boxes for gravity, and all the boxes under Constraints : Freeze Rotation)

    * it is important Not to scale the capsule, as it will do funny things to the model.

    3/ go to the capsule collider component, there set Radius to 0.75, and set the height to 3

    4/ now remove or disable the Renderer component of the capsule object.

    5/ now import your model. Most Importantly : do Not tick the Generate Colliders box. If it is ticked, UnTick it.

    6/ drag your model into the scene

    7/ make the model a Child of the capsule. In the Hierarchy window, drag and drop your model onto the capsule.

    8/ now you have to scale the model to fit in the capsule collider. Go back to the model import settings, and change the scale factor, then hit apply.

    9/ click on the capsule so you can see the collider. Check if the model is the right scale. If not, repeat step 8

    10/ you can move your model to place it in the correct position. Remember, move the model, then keep clicking on the Parent capsule to check it in relation to the collider.

    11/ when the model is at the correct scale and position, click on the capsule and move it around. You should see that the model goes everywhere the capsule goes, and the model stays inside the collider.

    12/ rename the capsule Enemy

    Information can be found at : http://www.youtube.com/watch?v=9hbjTOanljA

    Note : the script attached in that video is the script that is written in the new guide. For the old guide, you need to tick the boxes in the rigidbody component as in step 2
     
    Last edited: Mar 26, 2013
  11. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    So I couldn't use this script but I'll post what I found.

    Step 1: Have a first person controller (of course)

    Step 2: Make a cube and scale it.

    Step 3: Add new script name it 'PickupNote.cs"

    This code goes in it of course
    Now add that script into your First Person Controller if you haven't already

    Step 5: Make a new script inside of the cube and name it "Note.cs"
    The code is as follows
    You're almost finished look the inspector of the cube and you'll see "Mycustom Skin"

    Link to two custom skins:
    http://www.mediafire.com/download.php?uvbnwdf4l31t6e4
    Chose one of the two and drag and drop it into the custom skin part.

    If you followed this exactly you should be collecting notes!
     
  12. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    I need the NPCMovement script
     
  13. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    I did what you said with the capsule and model but I need the script for him to follow and look at you. And a script that would play when looking at him.
     
  14. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    While doing research I found this code

    It makes Slender whiz past me I won't lie it's quite funny but I'm trying to have him follow you not fly past you. I won't lie I'm a terrible scripter I'm more of map dev and modeler. But I'm watching your Slender tutorials.
     
  15. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    In the first post of this forum thread, there is a link to all the scripts for the old guide. Here it is again : http://answers.unity3d.com/questions/409270/what-happened-to-the-slender-guide-by-alucardj.html

    These are the scripts used in videos 1-7, but 8 and 11 easy to follow and add yourself. I don't know where you are getting these other scripts but they are not mine and are not compatible with my guide.

    I made a video about Dot Product ( http://youtu.be/JAAGdF-Wdas ) and in there I explain the reasons why isVisible will break. So I am not going to touch that last script you posted.

    Now with that collect papers you posted, as well as not being mine, it is written in C#. In the new guide, I am going to included where the paper becomes full screen then disappears when you collect it.

    SO to recap : if you are following my Old guide, use the scripts from the link in my first post. If you are following along with my new guide, use the scripts in the videos. I have made videos that review all the scripts so everyone can check that they have the same thing as mine.

    OK so you are following the old guide, did you see the post I did on the last page (page 3) that is called "How To Collect Papers From Scratch Using a SphereCast : " , if you saw it , then you would have also seen a link to a package I uploaded for you. This is definitive proof that my scripts and setup are functioning and do work. I am honestly worried about how some people are having trouble following the instructions. This is why I got frustrated before, I cannot work out how I can make this any clearer than in the stand-alone videos.

    So go to the page with all the scripts from the old guide, then please try to follow the old videos slowly, in there I show where and how to use all those scripts.

    The new guide is all about showing how I made scripts like these, and how you can learn to script, so you can read code and then write your own code. This is my wish and point to all my videos.

    Again, my scripts for the old guide are all on one page, and the old videos show how to use them.

    The new videos are made from a completely blank project, so all the scripts and steps are in there.
     
    Last edited: Mar 28, 2013
  16. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
  17. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    I got the script now it's not really working :/
     
    Last edited: Mar 28, 2013
  18. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    Yeah he's just sitting there.
     
  19. Moxiii

    Moxiii

    Joined:
    Mar 24, 2013
    Posts:
    53
    So I made it llook at me but not follow me -.-
     
  20. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    Moxiii, I have to say I really don't know how to help. Learning how to code is hard, yes, but there are so many tutorials out there to learn from. I started 15 months ago with zero knowledge, absolutely none, but I watched as much as I could, I have a million projects in my folder that are just tests on how to do different things, and then slowly doing tutorials I began to see if I could write my own code using these 'rules of coding' that I learned from all those tutorials I watched. Slowly I started to make things work, then only after that I tried to make bigger projects.

    So that is the way to do it. Start small, just make projects that are simple, and only do one thing. Then when you get better, then start thinking about making a big project or a real game from start to finish. If you learn all the little rules first, then it is much easier to put them into something bigger, like a full playable game.

    That's the other thing, you will never learn just by copying and pasting scripts you find. You need to understand them, know how they work, and why they work. Then when you have that understanding, then you can make them do what you want them to, more importantly, you can write your very own scripts that will do what you want them to.

    If you really are starting to code from the beginning, watch the new series. Start with a new blank empty project, then follow along. That was my purpose in making those videos, I wanted to help people like yourself learn to code much faster than it took me.

    SO I am going to leave this comment here on a positive note. Yes you can write code, soon you will find it easy, you just have to start small. Learn the basics, learn how to read code and what all the words mean, then you will be able to make bigger things. Then when things don't work, you can fix them, because you wrote the code, and you understand exactly what you put in the code, and what it is doing. Don't give up, just start by learning the basics.

    I put a link for a great starter series, here is the link again. They are only about 5 minutes each. Start at the bottom, then work up from E00 to B28 : http://www.unity3dstudent.com/category/modules/
     
  21. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    I just received an awesome message from someone else here who was having some problems, but they worked hard at it, and found out for themselves where the problems were. This is awesome to see someone actually trying to understand what is going on, and use it for themselves. And a young person too ! Check it out : http://forum.unity3d.com/threads/176174-Slender-The-Final-Night-Map-1?p=1204958#post1204958

    Here's one that was posted a long time ago, just using the written guide before I made any videos, old guide or new guide : http://forum.unity3d.com/threads/160994-Nightmare-(Slender-Clone)-WIP

    This is what I like to see and hear about. Somewhere someone is working with what I have given, putting it all together, understanding and then making their own modifications to make it do what they want.

    Hopefully this will show other people that it can and does work, just like in the videos. I made the new guide to show how the scripts are written from a blank script, I don't know how I can show people more clearly than there.It would be nice to have some positive feedback on the forum page instead of "it doesn't work" as the only posts here. It has really depressed me. I really don't know how to explain it any better. So when I see stuff like this, it makes me happy again.
     
  22. Slendyberkay

    Slendyberkay

    Joined:
    Feb 28, 2013
    Posts:
    20
    alucardj, sorry I know this is not the place to ask questions but I have no idea where can I find a unityscripter* online.

    Here is what I need:

    Which programs should I use for modelling and how can I model a player(should I make parts or make full body)
    How can I make different animations played( I tried third person comtroller that comes with unity but character only plays idle animation nothing else)( When I walk or run nothing changes the idle animation continues)
    I need to make a detection script for monster that works(ex: when player is 10 meters away from enemy the enemy roars 1 time and a chase starts {every monster detects player})
    I need a player health script that includes all these:
    -var maxHealth (ex: 100)
    -var halfHealth (ex:50)
    -var healthRegeneration (ex:30)
    if there is a monster nearby and that attacks to player (-20 hp for ex) reduce health
    if player health is <= 50 change all idle walk run animations like SH: Shattered Memories(watch vids and you will see what i tried to describe)
    if health is <30 regenerate health until it is 30.
    health drinks can be drinked and if our health > 100 it automatically turns 100

    Need a script to make an inventory
    contains items like keys and weapons
    take new items with e key (you can be able to pick up items like keys, weapons should be able to pick up different type of objects

    Need a combat system when player holds rightmousebutton (RMB)
    -while RMB is holding if player presses mouse button left with nothing pressed punch
    (but when player presses leftmousebutton several times he shouldnt punch too fast
    if 1 is pressed short shortrange weapon is chosed (ex: knife)(faster ataacks but lower damage)(breakable weapon ex: you can attack 7 times before knife breaks like SH)
    if 2 is pressed long shortrange weapon is chosed (ex: pipe)(slower attacks but higher damage)
    if 3 long range weapon is chosen (ex: shotgun)(needs ammo)fast and high damage)
    if 4 just punch

    make a key open a door
    make doors openable by just walking but the door closes after player moves away( if monster chase is triggered monsters still tries to catch him)

    can you explain me how to make scripts change other scripts (IDK what word should I use )
    can you explain can I use cloth physics to make a door opens if player runs thought it.

    and i need the script change other scripts because I need to make inventory change the weapon selector and combat and these two should change the inventory data too (already too much work)

    Thanks.
     
  23. MonsterGamingHD

    MonsterGamingHD

    Joined:
    Feb 15, 2013
    Posts:
    39
  24. sebcal75

    sebcal75

    Joined:
    Apr 7, 2013
    Posts:
    1
    Hi Alucard Jay,
    I have a question for you.
    How can I make a multiplayer Slender game after I created my game with your tutorial ?
    Is it possible to make it online for envoying it with friends ?
    And thanks alot for you tutorials, its great from you :)
     
  25. Slendyberkay

    Slendyberkay

    Joined:
    Feb 28, 2013
    Posts:
    20
    Jay do u know Amnesia? If u know u should know door opening true? Well, I need a door opening script but the door should open by just walking
    can u help?
     
  26. The-Walshinator

    The-Walshinator

    Joined:
    Dec 26, 2012
    Posts:
    4
    Could you please create a direct download link for the entire series so that I can also create while I'm offline. Thanks!
     
  27. Halo500

    Halo500

    Joined:
    Apr 24, 2013
    Posts:
    37
    Hello Alucard Jay! I really want to thank you for making this extremely helpful guide. I was wondering if you can answer a few questions for me.

    1) I have copied your NPCMovement.script and I was wondering how to have Slender have the sounds come up when he's nearby. (I have 4 sound files from when he is nearby and 3 of the jumpscare sounds when he pops up RIGHT IN FRONT of you. All these sounds are from The Arrival and have been given to me to use with the permission of Mark Hadley himself, and a his Slender soundtracks.)

    I will ask some more questions later. I have to go to school. :D
     
  28. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    So it's been a while since I was on this page or recorded any new videos.

    sebcal75 : it is possible to do a multiplayer game. I havn't done any multiplayer yet, but there are tutorials out there on how to do this : http://answers.unity3d.com/questions/47544/multiplayer-tutorials.html

    Slendyberkay : the easiest way to have a door open when close to it is to use a trigger volume and an animation. When the character enters the trigger, play the door open animation, when the trigger is exited, play the door close animation. I have a video playlist on triger volumes.

    The Walshinator : I don't have a host to put all my videos on. All I can suggest is that if you use Firefox, there is a plug-in called DownloadHelper. With this, you can download videos from youtube and save them to your harddrive to watch offline. I do this myself for alot of tutorials : https://addons.mozilla.org/en-US/firefox/addon/video-downloadhelper/

    Halo500 : it's been a while since I made any videos, they were not getting many views and I didn't know if it was worth continuing. The new Slender guide is not yet finished, and you must have read my mind because adding audio is the next step. I had an offer from UnityGems to have my Slender guide on their website, so am currently writing everything out and also doing a C# version as well as uJS. When I have done this, I shall go back and record some new videos to finish off the series.

    Here's how I played the sound when the enemy is visible in the old guide :

    first, create 2 variables :

    Code (csharp):
    1. public var enemySightedSFX : AudioClip;
    2. private var hasPlayedSeenSound : boolean = false;
    Then in the function SlenderDecisions where it says decrease the health of the player, you could add these lines :

    Code (csharp):
    1. // play sound only when the Man is first sighted
    2. if ( !hasPlayedSeenSound )
    3. {
    4.     audio.PlayClipAtPoint( enemySightedSFX, target.position );
    5. }
    6. hasPlayedSeenSound = true; // sound has now played
    then where it says else // is NOT visible, place this line before the if statement

    Code (csharp):
    1. // reset hasPlayedSeenSound for next time isVisible first occurs
    2. hasPlayedSeenSound = false;
    if you make enemySightedSFX an array of sounds,

    Code (csharp):
    1. public var enemySightedSFX : AudioClip[];
    then you can choose a random sound from that array with

    Code (csharp):
    1. audio.PlayClipAtPoint( enemySightedSFX[ Random.Range( 0, enemySightedSFX.Length) ], target.position );
     
  29. Halo500

    Halo500

    Joined:
    Apr 24, 2013
    Posts:
    37
    Wow, thank you so much for suck a quick reply and I really hope your guide gains a LOT more fame and credit. You answered worked out wonderfully! There's one more thing if you don't mind:

    --- After collecting 1-2 pages, how do you have the song activate? Then when getting 3-4, then 5-6, just like the original Slender?

    I'm trying to make a Slender game as close to the original Slenders from AgentParsec that you can get from Google Play. (Many Android Slender games are mediocre, besides Slender! - Chapter 1: Alone, so I'm trying my best to make one as good or better than that app. You can call it a tribute to Mark's Slender games.)
     
    Last edited: Apr 25, 2013
  30. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    This would be in the collect papers script. Where currently there is if ( papers == papersToWin ), you would set up something like :

    Code (csharp):
    1. if ( papers == 2 )
    2. {
    3.     audio.clip = music1;
    4.     audio.Play();
    5. }
    6. else if ( papers == 4 )
    7. {
    8.     audio.Stop();
    9.     audio.clip = music2;
    10.     audio.Play();
    11. }
    12. else if ( papers == 6 )
    13. {
    14.     audio.Stop();
    15.     audio.clip = music3;
    16.     audio.Play();
    17. }
    18. else if ( papers == papersToWin )
    19. {
    20.     Debug.Log( "You have collected All Papers !" );
    21.     // load Win Scene here !!!!
    22. }
    of course you would have to add variables for the audio, and attach an audioSource component.

    Code (csharp):
    1. public var music1 : AudioClip;
    2. public var music2 : AudioClip;
    3. public var music3 : AudioClip;
     
  31. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    After those replies, I suppose I really should make a video showing these !
     
  32. Halo500

    Halo500

    Joined:
    Apr 24, 2013
    Posts:
    37
    Umm, I seemed to have gotten a strange error on the NPCMovementScript.

    It says: Look rotation viewing vector is zero
    UnityEngine.Quaternion:LookRotation(Vector3)
    EnemyScript:Moving(Vector3) (at Assets/Scripts/EnemyScript.js:335)
    EnemyScript:Update() (at Assets/Scripts/EnemyScript.js:236)


    I rechecked your "Review Scripts 2" video to look over everything, I fixed some mistakes I did, and this error still seems to pop up...
    It's at the line: "var lookRot : Quaternion = Quaternion.LookRotation( lookDirection );"

    P.S. Thank you very much for the last post about the pages!
     
    Last edited: Apr 27, 2013
  33. Steve Cogbill

    Steve Cogbill

    Joined:
    Apr 23, 2013
    Posts:
    19
    Hey Jay!
    You're tutorial is fantastic! I have a question though:
    I want my enemy to be a capsule shaped object, since I don't really wanna make a Slender Man model haha.
    So I made the capsule, attached a rigidbody to it, Ticked the gravity and the freeze transformation boxes and then I attached you're enemy script. When I play the game, the enemy does not move. If I unTick the freeze transformation boxes then the enemy will move and follow me but it does not do any damage. Any suggestions?
    Thanks!
     
  34. Halo500

    Halo500

    Joined:
    Apr 24, 2013
    Posts:
    37
    Hello Alucardj, just wanted to say I have finally finished watching the last of the StaticScript videos and I have to say wow... Amazing tutorial! Hope you finish the playlist soon. Can you help me on how to add the StaticNoise to play whenever the static comes on the screen?

    The "Look Rotation Viewing Vector is Zero" error seem to make Slendy move to random places by itself, moving ahead of me and just minding it's own business, so I'm not sure what is going on with the Enemy....

    Also, I can not, for the life of me, find a Slender model that looks good! I searched it up on Google SO MANY TIMES and I keep seeing the same Slender model from Eight Pages, but that one looks fat and hideous. I've been finding Slender models for gMod only. Is there anywhere you can reference a 3D model for me Alucardj?
     
    Last edited: Apr 30, 2013
  35. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    Halo500 : change to

    Code (csharp):
    1.     var calcDir : Vector3 = Vector3.forward;
    This will give lookDirection a value if for some reason it is used before being recalculated.

    Models are the hardest things to find. Check my first post on assets, and the assets video in the "Programming and Making Games with Unity3D" playlist.

    Steve Cogbill : really not sure what could be happening there. Check the values in the variables for min and max distance. FOr the health not being deducted, put a Debug Log in both functions that use health . NPC script in SlenderDecisions() before the line playerHealthScript.DecreaseHealth(); and in the player script in DecreaseHealth() , just put a debug in both those functions to find out what functions are being called (or not).

    NPC script :

    Code (csharp):
    1. function SlenderDecisions()
    2. {
    3.     ......
    4.                 if ( hit.collider.gameObject.name == target.name )
    5.                 {
    6.                     Debug.Log( "Decrease Player Health NOW" );
    Player script :

    Code (csharp):
    1. function DecreaseHealth()
    2. {
    3.     Debug.Log( "DecreaseHealth is called" );
     
  36. Halo500

    Halo500

    Joined:
    Apr 24, 2013
    Posts:
    37
    Thank you alucardj! You have helped me SO MUCH with the Gide and your answers, I'm going to give you TREMENDOUS thanks in my game when I release it!

    I am now adding in the footstep and running from your old tutorial video. Can you help me out on how to add the static audio clip when the static is on the screen/when you're looking at him?

    Also, I found this model here:
    http://www.garrysmod.org/downloads/?a=view&id=132593

    But it's for gmod. I'll try and see if I can save that as a model through gmod or duplicate it with a 3Dfx modeling program of somesort. Other than this model, I only found some mediocre slender man models. I even tried the slender man model from the slender mod for SCP and it didn't work. Gotta keep searching! :D
     
    Last edited: May 2, 2013
  37. Halo500

    Halo500

    Joined:
    Apr 24, 2013
    Posts:
    37
    I also changed "var lookRot : Quaternion = Quaternion.LookRotation( lookDirection );" into "var calcDir : Vector3 = Vector3.forward;" and I get this error:

    Assets/Scripts/NPCMovement.js(364,72): BCE0005: Unknown identifier: 'lookRot'
     
  38. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    you changed the wrong thing. Where the variables are declared at the top, there is :

    Code (csharp):
    1. var calcDir : Vector3;
    change that to give calcDir a value that is not zero :

    Code (csharp):
    1. var calcDir : Vector3 = Vector3.forward;
    This gives calcDir a value that is not zero, and therefore should stop the error. Untested but the theory should work. I havn't opened that project in a while, shall look at it today and possibly record some videos for adding audio today.
     
  39. Halo500

    Halo500

    Joined:
    Apr 24, 2013
    Posts:
    37
    Oops, my bad. I was really having a bad day with trying the find ways to export the gmod model of Slendy into another 3D program. Seems like it isn't possible... :(

    Thank you for quickly answering my questions, and thanks for the heads up on the videos. It must be an annoyance to you for me to be throwing all these audio questions your way. I apologize for my lack of scripting skills. :D
     
    Last edited: May 3, 2013
  40. Halo500

    Halo500

    Joined:
    Apr 24, 2013
    Posts:
    37
    YES!!!!! I have finally found my problem after searching EVERY letter of the script. On Function Update() I accidently typed in:
    case NPC.Chasing :
    Moving( (myTransform.position - myTransform.position).normalized );

    Which completely contradicted the purpose of Slender chasing after me, leaving him nothing to do but wander off!!! Thank you so much for your patience and help for this problem I had for a LONG time. I can now move on to the next wall I have ran into: Finding a Slender Man model.

    I changed it back to what your video showed: Moving( (target.position - myTransform.position).normalized );

    It now works great!

    I have a little nuance at the moment, how do keep the page collecting songs on a loop, as in how would I put that in the script? Each song is about 2 minutes long, as how Mark Hadley left it as, and once the song is done, the song doesn't play anymore.
     
    Last edited: May 3, 2013
  41. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    That is good you found the problem. This is why I get so depressed when I get messages and emails saying 'it doesn't work'. This confuses me greatly, it's all there in the videos. In the new series every script start from blank. When I was starting, I once did a tutorial 3 times, and finally on the 4th time it worked, all because I missed a single minus sign. Not a single video, but a whole series, just because I missed a single @#$% minus sign! People should just do what I do when following a tutorial :

    1/ work slowly, just watch one part and if necessary, rewind and watch that part again.
    2/ constantly pause the video and check every single line of code that was just entered.
    3/ try and understand what you are typing in, learn what the commands are, look them up in the Unity Scripting Reference
    4/ watch all the videos, sometimes an error will not be noticed by the person doing the video until later. I'm not talking about mine here, for example this has happened to me following a 3D Buzz tutorial where errors were fixed in a later video. Although a lot of my later videos are quite messy (it was late and my brain wasn't working properly), the start of the next video is actually the end of the last one I noticed after watching them recently.
    5/ when you have finished, watch the video again. It is easier to check your code when you are not typing it in but it is there already. Again, constantly pause the video. And Work Slowly.

    This is what I do and how I learned to program.

    Regarding your model, I cannot find anywhere how to convert a garrys mod model to any other format. All I can suggest is find out how garry mod models are made, then try to reverse engineer the process.

    I have done some searching tonight to find a Slender model and have a few links for people to check out. I have not looked at any of these models, only found the links for them :

    http://thefree3dmodels.com/stuff/characters/simple_slenderman/14-1-0-2925
    http://thefree3dmodels.com/stuff/characters/slender/14-1-0-3440
    http://thefree3dmodels.com/stuff/characters/slender_man/14-1-0-4225
    http://forum.thegamecreators.com/?m=forum_view&t=203024&b=24
    http://deadlyneurot0xin.deviantart.com/art/MMD-Slenderman-v1-0-model-download-313419932
    http://deadlyneurot0xin.deviantart.com/art/MMD-Slenderman-v1-1-model-download-322960897

    the 4th one has a fbx link halfway down the page, and apparently it is even animated.

    Regarding how to keep the page collecting songs on a loop, PlayOneShot and PlayClipAtPoint are not loopable. The easiest way would be just to have an audioSource on the player so the audio can be looped, and have all the clips stored in the player script, then change the clip that is playing on the player after each paper is collected. Another way would be to create a prefab of an empty gameObject with an audioSource and the clip attached, set to loop. Then this would be instantiated when a paper is collected. Then store a reference to that instantiated object so when the next paper is collected it can be destroyed. The new audio prefab is instantiated and stored, and then continue this cycle. That's the beauty of coding, there are actually so many ways to do things.

    I still want to do some more videos, I have just been very busy lately, but they will be coming soon.
     
    Last edited: May 3, 2013
  42. Halo500

    Halo500

    Joined:
    Apr 24, 2013
    Posts:
    37
    Thank you for posting those links. I have finally gotten some help on Unity Answers on how to export gmod .mdl files into .obj files from a program called Craft3D from Nem's Tools. Also, the guy helped me out on exporting the .vtf files (textures) into .tga or .png files.

    I added the .obj file into Unity and the first thing that bothers me is Slender Man's arms are just sticking out to the sides, like a doll or action figure. Is there a way to change that to make his arms go down to his sides? There are four parts for his model, 2 for each side of his face, 1 for the entire body, ad 1 for his hands. I can't seem to bring down his arms.
     
    Last edited: May 6, 2013
  43. Steve Cogbill

    Steve Cogbill

    Joined:
    Apr 23, 2013
    Posts:
    19
    Alright Jay.
    So now it works...kind of.
    Slender follows me and does damage when I'm close but there are 2 problems:
    1) He moves extremely slowly and I can't seem to change his speed, I've tried everything I can think of.
    2) And he still doesn't teleport. Now I'm not sure if that's because he moves so slowly that I just haven't seen him teleport yet, I don't know.
    Any help would be great
    Steve
     
  44. Halo500

    Halo500

    Joined:
    Apr 24, 2013
    Posts:
    37
    Lol, I just found out this problem as well. Any ideas Jay?

    Also, I when I start the game, I watched Slender Man follow me and his body seems to slant when RIGHT next to me, as if he was looking over me when I'm sleeping in my bed kind of slant. He doesn't slant while chasing after me, so it's not a problem.

    But I still want him to teleport randomly in front or around me too, not just continuously slide towards me. That would just make the game too easy by NEVER looking behind you and that's all, you'll be safe.
     
    Last edited: May 6, 2013
  45. Steve Cogbill

    Steve Cogbill

    Joined:
    Apr 23, 2013
    Posts:
    19
    Haha I am having the same issue as well as the fact that he moves extremely slow
     
  46. Halo500

    Halo500

    Joined:
    Apr 24, 2013
    Posts:
    37
    Yeah, he seems to just slowly slide towards me, not really a threat. Hopefully the solution is a slight change of some sort to the script and not a huge overhaul. :D
     
    Last edited: May 7, 2013
  47. Steve Cogbill

    Steve Cogbill

    Joined:
    Apr 23, 2013
    Posts:
    19
    Agreed. Any help would be great!
     
  48. AlucardJay

    AlucardJay

    Joined:
    May 28, 2012
    Posts:
    328
    I have tried to address the problems mentioned. The slanting is because when Idle the enemy uses LookAt. Here is the change there :
    Code (csharp):
    1.  
    2.         case NPC.Idle :
    3.             // looking directly at player
    4.             //myTransform.LookAt( target );
    5.            
    6.             // looking towards player but upright
    7.             var targetLookRot : Vector3 = Vector3( target.position.x, myTransform.position.y, target.position.z );
    8.             myTransform.LookAt( targetLookRot );
    9.            
    10.              // only use the gravity Y velocity
    11.             desiredVelocity = new Vector3( 0, myRigidbody.velocity.y, 0 );
    12.         break;
    13.  
    For the teleporting not working, I really don't know. Unless your terrain is not named Terrain or the InvokeRepeating isn't working then the teleport should work. I have recorded and am currently uploading videos, on of them is majorly changing the teleporting.

    All the latest videos are a look at all the common problems that are mentioned. I am still uploading, but from 79 _ Slender the Examination I look at building the project from my current scripts, and look at these mentioned problems. I have released my scripts, the link is in the first post.

    Here is the new teleport function :

    Code (csharp):
    1.  
    2. function TeleportEnemy()
    3. {
    4.     CheckIfVisible();
    5.    
    6.     if ( !isVisible )
    7.     {
    8.         // find position left or right of the player target
    9.         var rndDir : int = Random.Range( 0, 2 );
    10.        
    11.         if ( rndDir == 0 )
    12.         {
    13.             rndDir = -1;
    14.         }
    15.        
    16.         var terrainPosCheck : Vector3 = target.position + ( rndDir * target.right * minimumRange );
    17.        
    18.         terrainPosCheck.y = 5000.0;
    19.        
    20.         // raycast to check if position on the terrain is free
    21.         var hit : RaycastHit;
    22.        
    23.         if ( Physics.Raycast( terrainPosCheck, -Vector3.up, hit, Mathf.Infinity ) )
    24.         {
    25.             if ( hit.collider.gameObject.name == "Terrain" )
    26.             {
    27.                 myTransform.position = hit.point + new Vector3( 0, 0.25, 0 );
    28.             }
    29.         }
    30.     }
    31. }
    32.  
     
    Last edited: May 13, 2013
  49. Halo500

    Halo500

    Joined:
    Apr 24, 2013
    Posts:
    37
    Thank you SOOOOOOO much alucardj. Without you my app would't be so close to being finished.

    Also, thank you for posting all these new videos and your scripts. I have finished you Reduced Distance video and it brought up something that is similar to this.

    I was wondering if it was possible to have your health rate be, lets say at 5 seconds at the beginning, but the more closer Slender Man gets with the more pages you collect, the health rate would go down by .5 seconds by each page collected, leaving you only over a second to stare at him to die if you were at the 7th page.
     
    Last edited: May 12, 2013
  50. Steve Cogbill

    Steve Cogbill

    Joined:
    Apr 23, 2013
    Posts:
    19
    Halo500, do you mind telling me where you changed the scripts? Like what did you do that made it work?
     
Thread Status:
Not open for further replies.