User Tools

Site Tools


hpl2:tutorials:scripting:crowbartutorialjenniferorange

Differences

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

Link to this comparison view

Next revision
Previous revision
hpl2:tutorials:scripting:crowbartutorialjenniferorange [2012/02/03 21:45]
jenniferorange created
hpl2:tutorials:scripting:crowbartutorialjenniferorange [2012/02/03 21:52] (current)
jenniferorange [The Script]
Line 15: Line 15:
  
  
-We're going to begin with a basic, easy set-up. ​+We're going to begin with a basic, easy set-up.
  
  
Line 24: Line 24:
  
  
-Now we can place the joint crowbar. It's used on the door. That's the part where you grab it and move it on a joint to a certain degree until the door breaks open. Select **crowbar_joint** ​ this time. When you place it in the door, avoid going too high. A tip to avoid this is to make the joint crowbar parallel to the door handle. Also make sure you're placing it on the right side. (Not where the hinges are.) See PICTURE 1. Once you're done, re-name it. I named mine **crowbar_joint_1**. Lastly, set it INACTIVE!+Now we can place the joint crowbar. It's used on the door. That's the part where you grab it and move it on a joint to a certain degree until the door breaks open. Select **crowbar_joint** this time. When you place it in the door, avoid going too high. A tip to avoid this is to make the joint crowbar parallel to the door handle. Also make sure you're placing it on the right side. (Not where the hinges are.) See [[http://​www.mediafire.com/?​27nb8xi6v78c8xb|PICTURE 1]]. Once you're done, re-name it. I named mine **crowbar_joint_1**. Lastly, set it INACTIVE!
  
  
Line 30: Line 30:
  
  
-The tall and skinny script area: This one is used for the joint crowbar. When you push it, the crowbar will hit the Script area and activate the dust and explosion effects, as well as open the door. Make sure you place it at a good distance from the joint crowbar. See PICTURE 2 and PICTURE 3. The tall and skinny script area is highlighted in white. My tall and skinny script area is called **ScriptArea_1**. ​+The tall and skinny script area: This one is used for the joint crowbar. When you push it, the crowbar will hit the Script area and activate the dust and explosion effects, as well as open the door. Make sure you place it at a good distance from the joint crowbar. See [[http://​www.mediafire.com/?​451lt5dbtzaduwx|PICTURE 2]] and [[http://​www.mediafire.com/?​wm3pf9s6jf84da9|PICTURE 3]]. The tall and skinny script area is highlighted in white. My tall and skinny script area is called **ScriptArea_1**.
  
  
-The short and chubby script area: This one is used for the dust effect. You can really place it anywhere around the door, but it's recommended you put it near the crowbar so the effect seems realistic. See PICTURE 4 and PICTURE 5. My short and chubby script area is called **AreaBreakEffect**.+The short and chubby script area: This one is used for the dust effect. You can really place it anywhere around the door, but it's recommended you put it near the crowbar so the effect seems realistic. See [[http://​www.mediafire.com/?​1w24a2huond7oh7|PICTURE 4]] and [[http://​www.mediafire.com/?​yccbb2oly3v9ec8|PICTURE 5]]. My short and chubby script area is called **AreaBreakEffect**.
  
  
 Now we can work on the script!! Now we can work on the script!!
- 
  
 ===== The Script ===== ===== The Script =====
Line 45: Line 44:
  
  
-<code actionscript>​ +<code actionscript>​void OnStart()
-void OnStart()+
 { {
 AddUseItemCallback("",​ "​crowbar_1",​ "​prison_1",​ "​UsedCrowbarOnDoor",​ true); AddUseItemCallback("",​ "​crowbar_1",​ "​prison_1",​ "​UsedCrowbarOnDoor",​ true);
 AddEntityCollideCallback("​crowbar_joint_1",​ "​ScriptArea_1",​ "​CollideAreaBreakDoor",​ true, 1); AddEntityCollideCallback("​crowbar_joint_1",​ "​ScriptArea_1",​ "​CollideAreaBreakDoor",​ true, 1);
 } }
- +  
 + 
 void UsedCrowbarOnDoor(string &in asItem, string &in asEntity) void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
  {  {
Line 58: Line 56:
  ​RemoveItem("​crowbar_1"​);​  ​RemoveItem("​crowbar_1"​);​
  }  }
- +  
 + 
 void TimerSwitchShovel(string &in asTimer) void TimerSwitchShovel(string &in asTimer)
  {  {
Line 65: Line 63:
  ​SetEntityActive("​crowbar_joint_1",​ true);  ​SetEntityActive("​crowbar_joint_1",​ true);
  }  }
- +  
 + 
 void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState) void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
  {  {
Line 81: Line 79:
  ​SetLocalVarInt("​Door",​ 1);  ​SetLocalVarInt("​Door",​ 1);
  ​} ​  ​} ​
- +  
 + 
 void OnEnter() void OnEnter()
 { {
 } }
- +  
 + 
 void OnLeave() void OnLeave()
 { {
Line 94: Line 92:
  
  
-It's such a long script, no? This one is pretty basic- the door will unlock, explode open, and the crowbar will be lost forever. However, we can make it so another crowbar, the "same one", is dropped back on the ground. We just have to add one function: SetEntityActive. ​+It's such a long script, no? This one is pretty basic- the door will unlock, explode open, and the crowbar will be lost forever. However, we can make it so another crowbar, the "same one", is dropped back on the ground. We just have to add one function: SetEntityActive.
  
  
Line 100: Line 98:
  
  
-Select a new plain old **crowbar** ​ and place it in the air. Make sure it's very close to the original crowbar joint, to make it seem like it fell down. See PICTURE 6. Set the new crowbar inactive. Put the function SetEntityActive("​crowbar_2",​ true); under the CollideAreaBreakDoor void. (The last one.) And that's it!+Select a new plain old **crowbar** and place it in the air. Make sure it's very close to the original crowbar joint, to make it seem like it fell down. See [[http://​www.mediafire.com/?​xvcydfk3hirr2v5|PICTURE 6]]. Set the new crowbar inactive. Put the function SetEntityActive("​crowbar_2",​ true); under the CollideAreaBreakDoor void. (The last one.) And that's it! 
 + 
 + 
 +I hope you enjoyed my tutorial, be sure to request some if you want! 
 + 
 + 
 +Created by JenniferOrange
  
hpl2/tutorials/scripting/crowbartutorialjenniferorange.1328305545.txt.gz · Last modified: 2012/02/03 21:45 by jenniferorange