Search Unity

Free Basic FPS Horror Type Package

Discussion in 'Assets and Asset Store' started by MadToLove, Sep 23, 2012.

  1. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    I wanted to share with everyone some things i found on the Unity Answers site and some things i worked on a bit, some scripts I have paid to make happen and some that were provided by awesome people. Very basic but a great start for some! Hope you enjoy. Put in all the notes and things I thought anyone might want to use.

    MOST RECENT UPDATE: -Flickering Light script
    -Object Movable Indicator
    -Item Pickup Indicator
    -PlayaudioOneshot script
    -Text Tooltip Script
    -Spawn Prefab Script
    -Kill Prefab Script


    Exisiting Functions: better flashlight, door sounds and lock/unlock functionality.



    MOST RECENT UPDATE 2.5 Download http://www.4shared.com/rar/Y4HG26O9/ScaryGame_3.html?


    UPDATE 2.5 Video Link http://www.youtube.com/watch?v=6Lzn_pRIfJI&list=PLwc2jb3IjPt6xmSeFI14WplwqER_DQkpf&index=5

    Special AWESOME KUDOS to combatDave for the door and key scripts, and Fuzzfas for making the walking sounds scripts possible and Jonas Planck for the spawn prefab and kill prefab scripts!

    Follow my personal project and some bits on this community project here on Facebook http://www.facebook.com/pages/The-Calling-Prologue/441265279269089?ref=hl

    If you would like to help add to this script collection/community shared project here are some things that would be great to add.

    - a script that can be attached to any object you can interact with the E key. EXAMPLE, you hit E on a coffee can or painting to examine it and it plays an the audio description but also gives you points. EXAMPLE 2, you pick up a note to read it with the E key and in addition it gives you points. These points add up and will be tracked through the entire game till the end when a grand total would be shown.

    -Improvements to the existing note script:
    A. once you have a note open and displayed on the screen, lock character and camera movements.
    B. Blur the background and or darken the background so focus is on the note not on the surroundings.
    C. Add a secondary Note type that once the character closes the note it teleports the character to a different level.
    D. Make it so you can display the note with actual writing you cannot really read but in the foreground have bold white text to display what the character is reading? IE like when reading notes or books in the popular games Penumbra/Amnesia

    -Safe/Comination Lock mini game/puzzle. You find numbers written on paper and then go to a safe or lock and apply those numbers to unlock the door.

    -Anything you think that would be awesome,fun, useful or add to gameplay for this community project.

    If you would like to submit a script to add to this community project and of course get your kudos, please download the project files as they exist now, make the script work with it and message me via these forums with the download link to see if we can make it an offical update/addon.

    Be aware that any scripts that you submit for this project will then become public domain and may be used in any project, commercial or otherwise.
     
    Last edited: Dec 30, 2012
  2. pspdude

    pspdude

    Joined:
    Dec 17, 2011
    Posts:
    43
    looks pretty good, Thanks :)
     
  3. RoyS

    RoyS

    Joined:
    Jan 12, 2009
    Posts:
    664
    Nice code snippets. Thank you for sharing.
     
  4. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    Your Welcome pspdude and no problem RoyS :)
     
  5. suctioncup

    suctioncup

    Joined:
    May 19, 2012
    Posts:
    273
    Thankyou. I had a look at this and underestimated its usefullness... until I needed one of the scripts. Thank you so much, you are awesome.
     
  6. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    Absolutely scutioncup! Happy you found a use!
     
  7. suctioncup

    suctioncup

    Joined:
    May 19, 2012
    Posts:
    273
    Are you okay if people expand upon this? I have a little downtime, and I think I could contribute some useful scripts/models or something.
     
  8. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    I have no problem with that suctioncup. Sharing is caring and I think the more we all share with each other the more awesome little games that will be floating along. :) Just give props where props are due, such as those that answer questions, help you, etc...its all about paying it forward :)
     
  9. b45h05h4

    b45h05h4

    Joined:
    Dec 22, 2011
    Posts:
    6
    Hey, thanks it helped a lot :)
    I made use of the mouseLook.cs
     
  10. suctioncup

    suctioncup

    Joined:
    May 19, 2012
    Posts:
    273
    Here is another torch script (I didn't use the tutorial you linked to, but it does the same thing)

    Code (csharp):
    1. #pragma strict
    2. //Makes you write with stricter formatting, which in turn increases the efficiency of the script
    3.  
    4. //Batteries
    5. var batteries : int = 5;
    6.  
    7. //How much charge per battery
    8. var charge : float = 100;
    9.  
    10. private var chargeDisp : float = 0;
    11. /*^^ this is just used to display the variable through GUI.Label -- when a (Long) variable changes
    12. many times, very fast, unity cannot keep up with redrawing the variable at that speed,
    13. and so the text flashes. I don't like the look of it. This converts it down
    14. a couple of decimal places, which makes it easier on the engine. I like how it looks at 2
    15. decimal places. Convert it to 1, for no decimal places, and 100 for two decimal places.
    16. 1 is the number, 0 is a decimal place*/
    17.  
    18. //The actual torchlight object
    19. var torch : Light;
    20.  
    21. //Speed at which the light decreases
    22. var speed : float = 5;
    23.  
    24. //Used to turn light on or off
    25. private var lightState : boolean = false;
    26.  
    27.  
    28. function Awake() //Called before anything in a script, even called before start
    29. {
    30. torch.intensity = 1; //Set the intensity to 1 (1 is defined as 100 charge)
    31. }
    32.  
    33. function Update ()
    34. {
    35.     chargeDisp = Mathf.Round(charge * 100) / 100; //See line under variable declaration
    36.    
    37.     if(lightState  charge > 0) //If mouse has been pressed, and there is still charge in the battery
    38.     {
    39.         torch.enabled = true; //Turn on the torch
    40.         charge -= Time.deltaTime * speed; //Decrease the charge
    41.     } else { //If one of the terms has not been met (IE, mouse isn't pressed or there is no charge
    42.         torch.enabled = false; //Turn the torch off
    43.     }
    44.    
    45.     if(charge <= 0  batteries > 0) //If charge is less or equal to 0, and if batteries is above 0
    46.     {
    47.     batteries = batteries -1; //Take on from the batteries
    48.     lightState = !lightState; //Toggle lightState
    49.     charge = 100; //Charge equals 100 (This simulates putting another battery in the torch. 1 less battery, full charge
    50.     }
    51.    
    52.     if(batteries == 0) //If there is no batteries
    53.     {
    54.     charge = 0; //There is no charge. This stops 'Batteries 1', 'Charge 100' from happening
    55.     }
    56.    
    57.     if(Input.GetMouseButtonDown(0)) //Called when the mouse left click is down
    58.     {
    59.         lightState = !lightState; //Toggle lightState
    60.     }
    61.    
    62.     if(charge < 2) //If charge is less than 2
    63.     {
    64.         torch.intensity = charge; //The torches intensity equals its charge. This makes the torch brighter, but then it fades out pretty quickly
    65.     }
    66. }
    67.  
    68. function OnGUI()
    69. {
    70.     GUI.Label (Rect (10, 10, 100, 20), "Batteries:  " + batteries); //Display for batteries
    71.     GUI.Label (Rect (10, 50, 100, 20), "Charge:  " + chargeDisp); //Display for charge.
    72. }
    Heavily commented. Also, if you would like, I can add in torch fading. Like, if the battery charge was something like 10%, the torch would be pretty dim. Its pretty easy to implement.
    I put the fading thing in. It doesn't fade over the whole torch charge, but when the charge gets to 1 or so, the torch suddenly gets brighter, and then fades.

    Also, it is fairly trivial to add in a torch icon beside the text display. I can do that too, if anyone wants.
     
    Last edited: Sep 25, 2012
  11. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70

    Awesome man! I think one thing that would be great for us all to try to add is sound to the doors, when you click and drag to open the door it make a door opening sound if your no longer clicking and dragging the sound stops. Been trying to get answers to that one for awhile. It might be complex? I'm not sure. Also when you hover over an rigidbody object such as the door that you can manipulate a little 2 hand icon appears. hmmmmm
     
  12. pspdude

    pspdude

    Joined:
    Dec 17, 2011
    Posts:
    43
    Are you going to be updating this at all from time to time?
     
  13. technotdc

    technotdc

    Joined:
    Oct 21, 2011
    Posts:
    60
    thanks ¡¡¡
     
  14. suctioncup

    suctioncup

    Joined:
    May 19, 2012
    Posts:
    273
    Once my game is finished, I will most likely be contributing to this package, until then, its up to MadToLove.
     
  15. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70

    yes pspdude, as I move forward with my game and find other things I think would suit this I will. And when I finish my game, I will probably release a basic level with the majority of my game mechanics in tact.
     
  16. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    your welcome technodc!
     
  17. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,997
    Looks good, thanks for sharing!
     
  18. pspdude

    pspdude

    Joined:
    Dec 17, 2011
    Posts:
    43
    Sweet, btw your game looks really nice :) love that source of light :p

    EDIT: Oh wait.. wasn't your game >.< My bad :p
     
    Last edited: Oct 2, 2012
  19. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70

    Got it updated and the update is released :)
     
  20. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    You're Welcome Rush, Update released yesterday with some more goodies. Hope you enjoy!
     
  21. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    Hey suctioncup! Should check out the new release. Has some more goodies added.
     
  22. technotdc

    technotdc

    Joined:
    Oct 21, 2011
    Posts:
    60
    Thanks for sharing MadToLove ¡¡¡¡

    I hope a new fantastic update
     
  23. pspdude

    pspdude

    Joined:
    Dec 17, 2011
    Posts:
    43
    Sorry to say, but the download is still the same package >.<
     
  24. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    Last edited: Oct 13, 2012
  25. pspdude

    pspdude

    Joined:
    Dec 17, 2011
    Posts:
    43
  26. pallinarozza

    pallinarozza

    Joined:
    Jul 24, 2012
    Posts:
    14
    can't pickup the key ._. LOL :roll:
     
  27. pwnisher

    pwnisher

    Joined:
    Sep 14, 2012
    Posts:
    3
    Thanks a lot dude, make more updates of this package :)))) u rock !
     
  28. HyeMyNameIs

    HyeMyNameIs

    Joined:
    Sep 26, 2012
    Posts:
    170
    This is great!

    I'm definety going to utilize this package for my next horror game, which will be soon.

    Giving credit where credit is due of course.

    I'm subscribing and will post here when I have a prototype running.

    I already have lots of ideas for this package, but have to do something creative.
     
  29. HyeMyNameIs

    HyeMyNameIs

    Joined:
    Sep 26, 2012
    Posts:
    170
    If you watch his YouTube video, he also had issues picking up the key.

    Main camera needs to be centered on the key to be able to pick it up.

    A small center cursor may help with this.
     
  30. pwnisher

    pwnisher

    Joined:
    Sep 14, 2012
    Posts:
    3
    i fix that puting the box collider of the key more bigger ;)
     
  31. technotdc

    technotdc

    Joined:
    Oct 21, 2011
    Posts:
    60

    Same here ¡¡¡
     
  32. HyeMyNameIs

    HyeMyNameIs

    Joined:
    Sep 26, 2012
    Posts:
    170
    Well that makes total sense!
     
  33. HyeMyNameIs

    HyeMyNameIs

    Joined:
    Sep 26, 2012
    Posts:
    170
    This pack is really helpful.

    I'm developing a horror/suspense game utilizing this pack, I'll upload the demo when I am further along.
     
  34. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    No problem technotdc! Hope you enjoy. I will have another update coming out sometime tomorrow hopefully with a new script added I think you all will enjoy.
     
  35. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70

    Thanks pwnisher. Due to work, having just gotten a new job, moving to a new state and lack of funds/time there will be quite a few delays. But thankfully I just had a great reply on one of my Unity Answers/Questions and will be hopefully releasing another update sometime tomorrow or in the next few days with another script added to this that i think is ESSENTIAL for any FPS.
     
  36. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70

    Absolutely true HyeMyNameIs, I should have kind of clarified this during my making of that video. I have not been on the forums in awhile so going to be doing some catchup and try to address these kinds of issues in the future when making videos. Sorry for this oversight but im happy you all sorted it out, ,its a pretty easy fix.
     
  37. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    Awesome HyMyNameIs I cannot wait to see what you come up with! Post the link on this forum when you got something together! Would love to see it!
     
  38. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    Excited man! Cant wait to see it! Keep an eye on my youtube channel and this forum for my update coming this week!
     
  39. swin129

    swin129

    Joined:
    Dec 21, 2012
    Posts:
    1
    Hello! Can you upload your archive on another site?
    I can't register on 4shared, and because of it I can't use your archive, it is sad.
     
  40. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    Hey I got your message! Sorry for the delay swin129 been working. I emailed you a copy of the project files :)
     
  41. hike1

    hike1

    Joined:
    Sep 6, 2009
    Posts:
    401
    Nice job, been looking for the 'read a note' code. How does the game know what kind of floor you're walking on? I kept having troubles with the mouse
    cursor, it disappears, can't get the flashlight or key sometimes.
     
  42. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    Thanks! I have it to where the mouse cursor is disabled. You should see a hide cursor script somewhere in there you can just get rid of it and you can see it again. as for the flashlight and key sometimes you want to make sure the collison/trigger box is bigger then those objects, its the little green outline that you can make bigger or smaller. In fact you know what, I talk about some of this in my youtube video, check it out it might help clarify a bit more and I talk about the floor walking script. http://www.youtube.com/watch?v=rcqW76fB4Ps
     
  43. hike1

    hike1

    Joined:
    Sep 6, 2009
    Posts:
    401
    I tried putting the note pickup thing in my own game, it's not working for some reason, the cursor is off to the left of center screen. Is there a way to just have the note appear if you collided with the piece of paper's mesh or box collider?
     
  44. Jonas Planck

    Jonas Planck

    Joined:
    Oct 11, 2012
    Posts:
    5
    I have some stuff I've been working at... I devised a system of simple triggers that summon prefabs relative to the players global position,...It works in conjunction with the Itween event script more than anything, (for doors, traps, sliding walls, I've been trying to come up with a sort of universal trigger script but that hasn't worked so far. What I do have is three simple scripts that seem to work pretty well with the previous code I, er, "borrowed" from this thread a while back. I need to test out the new stuff alongside it first before I post them here. . One triggered an event once depending on the colliding object's tag, another was player-triggered, and I had another one to respond to mouse clicks. By setting the variables to different prefabs, these could be used for almost any sort of effect. The problem is that if you use most of them WITHOUT a valid game object with an Itween event, they don't return the boolean that tells it it's been triggered. Also, the trigger areas block raycasting, but that might just be me being a noob and not setting the trigger object's properties right...

    This is what I'm doing with your scripts, by the way. http://forum.unity3d.com/threads/162975-Somnus Tell me what you think..

    Before I forget, I'm also trying to come up with some stuff for sound foley... a simple script to play one or more audio clips on a rigidbody depending on the type of surface it's colliding with, and I'll have a library of noises to go with it, at least, if it doesn't turn out too fancy... I'm new to scripting, so I'm trying to keep them short and simple. .
     
  45. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    Hey thanks for the comment Jonas, I played your game, I made it as far as the Piano room that played the very very cool music. Was not sure where to go from there but great work so far I love it. I would LOVE if you could share whatever scripts your using especially when it comes to the ghosts, did you make those? Great work! But I can see your dedicated to trying to make a awesome project and that makes me happy. Please do share any scripts you find helpful or that might add to this community project. I and others would surely appreciate it! Keep up the awesome work!
     
  46. Jonas Planck

    Jonas Planck

    Joined:
    Oct 11, 2012
    Posts:
    5
    This is one of the most useful ones I came up with:

    Code (csharp):
    1. #pragma strict
    2.  
    3. var cause: Collider;//object to hit this trigger
    4. var effect: GameObject;//prefab spawned by hit
    5. var offset: Vector3;//fine tune spawn point
    6. var taggery: String;//teg of "cause" object
    7. private var hasTriggered : boolean = false;
    8.  
    9.  
    10. function Update () {
    11.  
    12. }
    13.  
    14.  
    15.  
    16. function OnTriggerEnter (cause:Collider){
    17.     if(!hasTriggered){
    18.     if (cause.CompareTag(taggery)){
    19. Instantiate(effect,transform.position + offset,transform.rotation);
    20. print("collision's working"); //for debugging
    21. hasTriggered=true;
    22. }
    23. }
    24. }
    I was trying to spawn a dust cloud when a wall came sliding down, and I figured the best way to do it was to have an invisible trigger at the base that would spawn the dust when the wall object hit it. By changing the variables, it also works when the player object hits the trigger, or anything for that matter. This one doesn't invoke an Itween event so it should work without bugging out. The "cause" object has to be a rigidbody, or nothing happens.

    The ghosts and weird lights I made were all particle systems attached to an invisible parent cube. By setting up a nested prefab made of elements like that, the object can hold scripts of it's own and can also be ANOTHER trigger. I animated the particles' opacity and color with a simple gradient, and the lights were animated in Itween by using color from and color to events. By timing these to match the audio file, the prefab fades in, fades out, and destroys itself a few seconds after the last particle fades out, according to whatever it is, sparks, dust, a billboarded ghostly image... All those prefabs have this suicide script:

    Code (csharp):
    1. #pragma strict
    2. var toBeDied:GameObject;
    3. var timeToDie =(5);
    4.  
    5.  
    6. function Start () {
    7.  
    8. }
    9. Destroy (toBeDied, timeToDie);
    10.  
    11. function Update () {
    12.  
    13. }
    It's basically just a little timer for the prefab's life span.
     
  47. hike1

    hike1

    Joined:
    Sep 6, 2009
    Posts:
    401
    Never got the paper thing going, but I can click on a paper to display a bitmap, just have to use a text tool in Gimp I guess.


    http://answers.unity3d.com/questions/15438/trying-to-pick-up-and-see-paper-pop-up-gui-window.html
    The unitypackage
    http://dl.dropbox.com/u/102638093/paper_popup.unitypackage
    12k
    You need the character controllers unitypackage imported also

    This is good for showing maps, etc.

    put paper and paperpopup.js in your scripts directory

    make a cube called 'paper_cube' drag it into your scene

    in your /resources/prefabs make prefab 'paper_prefab', drag the paper_cube from hierarchy into your resources/prefabs/paper_prefab

    drag the paper.js script into your paper_prefab
    in paper.js the popup texture hit the little cirle with dot in it (these are mac icons apparently) and load a texture

    go gameobject create other guitexture it will be 'UnityWatermark-small' , set the guitexture to 'none' name the guitexture to Paper Popup, drag the PaperPopup.js onto it.

    now you can delete the original cube if you put it in your scene and just drag the paper_prefab cube into the scene
    now in the game click on the cube the texture you picked will appear.

    for other textures drag the prefab in again and change the texture.
     
  48. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    SO great man! I will defiantly find a use for these scripts. Took me a min to setup the suicide script right but got her done! thanks this will come in handy!
     
    Last edited: Dec 30, 2012
  49. MadToLove

    MadToLove

    Joined:
    Jul 22, 2012
    Posts:
    70
    Jonas I went and added those scripts to this community project! You can see a link to the video at the beginning of this thread. Of course gave you a special shout out thanks again!
     
  50. pallinarozza

    pallinarozza

    Joined:
    Jul 24, 2012
    Posts:
    14
    Can you make a mobile version??' Please is AWESOME