User Tools

Site Tools


hpl2:tutorials:scripting:scaresbyjenniferorange

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hpl2:tutorials:scripting:scaresbyjenniferorange [2012/02/26 18:36]
jenniferorange
hpl2:tutorials:scripting:scaresbyjenniferorange [2012/04/19 01:25] (current)
jenniferorange [Scare 5 - Kill The Lights]
Line 66: Line 66:
  
  
-===== Scare 2 - Flying Jesus ===== 
  
 +===== Scare 2 - Exploding Pots =====
  
-Requested by Datguy5! Check out his profile on FG! [[http://​www.frictionalgames.com/​forum/​user-18514.html|http://​www.frictionalgames.com/​forum/​user-18514.html]] ​ 
  
 +This scare is an unexpected one. I warn anyone who wants to use this scare to NOT over-use it. It's great to use when there is peaceful music and everything seems so perfect.. and then a pot explodes, dramatically changing the music to that of a nervous feeling. I won't be showing you guys how to get the music, only how to make the pot explode. The rest is up to you.<​nowiki>​%%</​nowiki></​nowiki>​%%*%%%%</​nowiki>​WARNING:​ THIS SCARE AS ONLY BEEN TESTED WITH VASE_01 AND VASE_02 FOUND IN ENTITIES>​CONTAINER<​nowiki>​*</​nowiki>​
  
-For the famous and most crap-your-pants scare called "​Flying Jesus",​ you'll need an area and a male corpse. 
  
- +First things first: grab yourself a potI'll be using vase_01 found under entities>​containerYou can experiment with different ceramicsbut only things Daniel can pick upthrow, and break will workPlace your chosen ceramic on a surface if you'd like. I'​ll ​just put mine on a small table. Re-name your 'pot grenade' to whatever ​you'd like. I'm naming ​mine **pot_explode**.
-    - Pick yourself a nice location for the script areaOne of the best spots is in a long corridorKeep in mind the script area is forwhen the player hits itthe "​Jesus" ​will fly down the corridorSo don't think he'​ll ​spawn there for something. Make sure you extend that sucker out to each end of the wall. There are some scared Players that try and sneak past the script areas. Re-name your Script Area. For this example, I'll name mine **FlyingJesus_1**. No pun intended. Don't forget ​to hit ENTER! +
-    - Now the best way to do this, and get it right, is to have the corpse spawn and then add a prop force. If the corpse is already active, he'll be lying on the ground in a heap and when the prop force is added he might just slide on the floor. However if you think that's scary you can try that one tooPlace your flying Jesus man a decent ways down the corridor, from the Script Area. The length of about 2 or 3 walls is good. Aim his face toward the direction the Player will come. Set him unactive and re-name him! I'll rename ​mine **Jesus_1**. (Don't forget, when you place him, to make him floating somewhat in the air to be sure he'll hit the player. See [[http://​www.mediafire.com/​i/?​49ps9q6p6j096dg|Picture 1]].) +
-    - Now we can script. Open your maps' .hps.+
  
  
 +Next, make a script area. It shouldn'​t be too far away from the exploding pot. Make sure it's big/tall enough so the player will collide with it! Re-name it as well. I named mine **explode_scare**. Now it's already time to script!
 <code actionscript>​void OnStart() <code actionscript>​void OnStart()
 { {
-AddEntityCollideCallback("​Player",​ "FlyingJesus_1", "HolyJesus",​ true, 1); +AddEntityCollideCallback("​Player",​ "explode_scare", "Explode", true, 1);
-AddEntityCollideCallback("​Jesus_1",​ "​FlyingJesus_1",​ "Sound", true, 1);+
 } }
    
    
-void HolyJesus(string &in asParent, string &in asChild, int alState)+void Explode(string &in asParent, string &in asChild, int alState)
 { {
-SetEntityActive("Jesus_1",​ true); +SetPropHealth("pot_explode", 0);
-AddPropForce("​Jesus_1", 0, 0, 30000, "​World"​);+
 } }
    
    
-void Sound(string &in asParent, string &in asChild, int alState)+void OnEnter()
 { {
-PlaySoundAtEntity("",​ "​24_iron_maiden.snt",​ "​FlyingJesus_1",​ 0, false); 
 } }
 + 
 + 
 +void OnLeave()
 +{
 +}
 + 
 </​code>​ </​code>​
  
  
-I added the scary Iron Maiden sound to play when the corpse hit the Script Area. It adds a scarier jump effect, but it's optional ​of course. For the AddPropForce,​ you may have to tweak it. For me30000 was perfect, and whether ​it goes in X, Y, or Z depends on your mapFor me it was Z. Here's one way to find out: Select a wall or object in the room. Click the + or - button under Position for X, Y, and Z and note which way the object goes. If it goes in the direction of the Script Area, (let's say it's X) then you put the 30000 under X.+The script is very self-explanatory. You collide with the script area, and the health ​of the pot goes to 0causing ​it to explodeFeel free to add some smoke particles ​or other
  
  
-Enjoy making your players freak out and pee their pants. :]+sounds!
  
  
-More pictures!+(I felt like this one didn't need any pictures, so..)
  
  
-[[http://​www.mediafire.com/​i/?​540yogtl38ldkdz|2]] [[http://​www.mediafire.com/​i/?​zj6c63dee6tvy58|3]] ​+Good luck
  
 +===== Scare 3 - Falling Objects =====
  
-===== Scare 3 - Exploding Pots ===== 
  
 +This one in particular is a great unexpected scare as well. Just a simple "box slides off of the top shelf and hits you in the head" scare. This is also not a complicated scare, though if you wish to make it complicated feel free to add health damage when the box collides with Daniel'​s head. I'd also like to mention I used a specific box for this one: storage_box_wood01 found under Entities>​Storage. You can experiment with different objects or boxes, but be sure they aren't static and Daniel can easily pick them up and toss them.
  
-This scare is an unexpected one. I warn anyone who wants to use this scare to NOT over-use it. It's great to use when there is peaceful music and everything seems so perfect.. and then a pot explodes, dramatically changing the music to that of a nervous feeling. I won't be showing you guys how to get the music, only how to make the pot explode. The rest is up to you. 
  
 +First get a box. As mentioned, I'm using storage_box_wood01 which I re-named to **box_1**. Now we need a shelf. Any shelf will do really, but I'm using shelf02 found under Entites>​Storage. The shelf does not need to be re-named as it's only purpose is to hold the box.
  
-%%*%%WARNING:​ THIS SCARE AS ONLY BEEN TESTED WITH VASE_01 AND VASE_02 FOUND IN ENTITIES>​CONTAINER%%*%% 
  
- +Place your box ontop of the shelfThe very very top is the preferred place, but if you use smaller objects ​like pots, it can go on any shelfJust be sure it fits right. Because the shelf chose has back, the box had to be placed slightly hanging off the edge of the shelfThis is perfectly fine to dojust make sure the box doesn'​t slide off before we add a prop force. Last thing we need is a script area. Because I want the Player to notice the box, I've placed my script area about a foot away from the actual shelfIf you place the script area right below the box, the box may not fall in time and scare the player, but confuse them. However you can place the script area wherever you'd like. I've re-named mine **box_fall**. Time for scripting
-First things first: grab yourself a potI'll be using vase_01 found under entities>​container. You can experiment with different ceramics, but only things Daniel can pick up, throw, and break will work. Place your chosen ceramic on a surface ​if you'​d ​like. I'll just put mine on small tableRe-name your 'pot grenade' ​to whatever you'd like. I'm naming mine **pot_explode**. +<code actionscript>​void OnStart()
- +
- +
-Next, make a script area. It shouldn't be too far away from the exploding potMake sure it's big/tall enough so the player ​will collide with it! Re-name it as well. I named mine **explode_scare**. Now it's already time to script! +
- +
- +
-<code actionscript>​ +
-void OnStart()+
 { {
-AddEntityCollideCallback("​Player",​ "explode_scare", "Explode", true, 1);+AddEntityCollideCallback("​Player",​ "box_fall", "Falling", true, 1);
 } }
- +  
- +  
-void Explode(string &in asParent, string &in asChild, int alState)+void Falling(string &in asParent, string &in asChild, int alState)
 { {
-SetPropHealth("pot_explode", 0);+AddPropForce("box_1", 0, 0, 1500, "​world"​);
 } }
- +  
 + 
 void OnEnter() void OnEnter()
 { {
 } }
- +  
 + 
 void OnLeave() void OnLeave()
 { {
 } }
 +</​code>​
  
  
-</​font>​ +Quite a few of you were confused on the prop force last time, by just copying what my script says. You NEED to check which way the object needs to go! For some it's Z and for others it will be X. It all depends on where you started on the map and the direction the shelf faces. To see how to find which variable to use, please refer back to my Flying Jesus scare.
-</​code>​+
  
  
-The script is very self-explanatory. ​You collide ​with the script area, and the health of the pot goes to 0causing ​it to explodeFeel free to add some smoke particles or other +The script ​here is rather ​self-explanatory. ​The Player collides ​with the script area, it triggers ​the prop forcethe box falls. Super easy! I also didn't add pictures for this one as I figured ​it wouldn'​t be too difficult ​to figure outThough if you need a picture reference I will add some.
  
 +===== Scare 4 - Kill The Lights =====
  
-sounds! 
  
 +This scare was requested by [[http://​www.frictionalgames.com/​forum/​user-15795.html|BrooksyFC]]. Check him out on Frictional Games!
  
-(I felt like this one didn't need any picturesso..)+ 
 +BrooksyFC was inspired by the ending of Penumbra: Overture and asked me to re-create ​this scare. All of the lights in a long corridor go out, one by one. Today I'll be showing you using **6** **wall candles**but feel free to use more or less; even a different lamp will do. 
 + 
 + 
 +As usual: we set up the script areas/lamps firstPlace as many lamps as you'd like in a long corridor. (Please note: the more lamps you use, the longer the script will be!Re-name the lamps something simple, like **lamp_1, lamp_2, lamp_3, lamp_4, ** etc. [TIP: NAME THE LAMPS IN THE NUMBER ORDER YOU WANT THEM TO GO OUT. I FIND IT MUCH EASIER!] Now, throw down a Script Area. I've named mine **KillTheLights**. 
 + 
 + 
 +Script time! 
 + 
 + 
 +<code actionscript>​void OnStart() 
 +
 +AddEntityCollideCallback("​Player",​ "​KillTheLights",​ "​LightsOut",​ true, 1); 
 +
 +  
 +  
 +void LightsOut(string &in asParent, string &in asChild, int alState) 
 +
 +SetLampLit("​lamp_1",​ false, true); 
 +AddTimer("",​ 2, "​Out2"​);​ 
 +
 +  
 +  
 +void Out2(string &in asTimer) 
 +
 +SetLampLit("​lamp_2",​ false, true); 
 +AddTimer("",​ 2, "​Out3"​);​ 
 +
 +  
 +  
 +void Out3(string &in asTimer) 
 +
 +SetLampLit("​lamp_3",​ false, true); 
 +AddTimer("",​ 2, "​Out4"​);​ 
 +
 +  
 +  
 +void Out4(string &in asTimer) 
 +
 +SetLampLit("​lamp_4",​ false, true); 
 +AddTimer("",​ 2, "​Out5"​);​ 
 +
 +  
 +  
 +void Out5(string &in asTimer) 
 +
 +SetLampLit("​lamp_5",​ false, true); 
 +AddTimer("",​ 2, "​Out6"​);​ 
 +
 +  
 +  
 +void Out6(string &in asTimer) 
 +
 +SetLampLit("​lamp_6",​ false, true); 
 +}  
 +  
 +  
 +void OnEnter() 
 +
 +
 +  
 +  
 +void OnLeave() 
 +
 +</​code>​ 
 + 
 + 
 +This script is only good for **6 lamps**. If you have more, the easiest way is to copy/paste a void Out# section and just adjust it. When you reach your last desired lamp, delete the last Timer. It's your last one, so you don't need another timer.
  
  
-Good luck!+Thanks for tuning in, and happy scaring!
  
  
hpl2/tutorials/scripting/scaresbyjenniferorange.1330281407.txt.gz · Last modified: 2012/02/26 18:36 by jenniferorange