Next revision | Previous revision Next revision Both sides next revision | ||
hpl2:tutorials:scripting:checkpoints_using_scriptarea_s [2012/09/16 10:23] steve created |
hpl2:tutorials:scripting:checkpoints_using_scriptarea_s [2012/09/16 10:49] steve |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== **Checkpoints using Script area's** ====== | + | ====== Checkpoints using ScriptArea's ====== |
- | First of all you make a ScriptArea large enough for the player to walk through. | + | |
- | I call mine **"ScriptArea_1" ** | + | **1**. make a ScriptArea large enough for the player to walk through. |
- | {{http://i48.tinypic.com/5tz860.png?linkonly&300x299}} | + | I named mine **"ScriptArea_1" ** |
- | As second thing create a PlayerStartArea this time I call mine **"PlayerStartArea_1"** | + | [[{{http://i48.tinypic.com/5tz860.jpg?direct&300x299}}]] |
- | **{{http://i49.tinypic.com/2qs17op.png?linkonly&207x300}}** | + | **2**. create a PlayerStartArea this time I name mine **"PlayerStartArea_1"** |
- | as for the script: | + | {{http://i49.tinypic.com/2qs17op.png?direct&300x487}} |
- | [Spoiler] | + | as for the script: |
- | + | ||
- | + | ||
- | void OnStart() | + | |
- | + | ||
- | + | ||
- | { | + | |
- | + | ||
- | + | ||
- | AddEntityCollideCallback("Player", "ScriptArea_1", "Restart", true, 1); | + | |
- | + | ||
- | + | ||
- | } | + | |
- | + | ||
- | + | ||
- | void Restart(string &in asParent, string &in asChild, int alState)\\ | + | |
- | {\\ | + | |
- | CheckPoint ("FirstCheckpoint", "PlayerStartArea_1", "Happening", "DeathCategory", "Deathtext");\\ | + | |
- | } | + | |
- | + | ||
- | + | ||
- | void Happening(string &in asName, int alCount)\\ | + | |
- | { | + | |
- | + | ||
- | + | ||
- | /////////Stuff you want to happen after you die/////////// | + | |
- | + | ||
- | + | ||
- | } | + | |
- | + | ||
- | + | ||
- | [/Spoiler] | + | |
- | + | ||
- | + | ||
- | and for the .LANG file | + | |
- | + | ||
- | + | ||
- | [Spoiler] | + | |
- | <LANGUAGE> | + | |void OnStart() \\ { \\ AddEntityCollideCallback(“Player”, “ScriptArea_1”, “Restart”, true, 1); \\ } \\ \\ void Restart(string &in asParent, string &in asChild, int alState) \\ { \\ CheckPoint (“FirstCheckpoint”, “PlayerStartArea_1”, “Happening”, “DeathCategory”, “Deathtext”); \\ } \\ \\ void Happening(string &in asName, int alCount) \\ { \\ /Stuff you want to happen after you die/ \\ //}// | |
- | <CATEGORY Name="DeathCategory">\\ | + | //and as for the .LANG file// |
- | <Entry Name="Deathtext">Text you want in the black screen after you die</Entry>\\ | + | |
- | </CATEGORY> | + | |
- | </LANGUAGE> | + | |<//LANGUAGE> // \\ <//CATEGORY Name="DeathCategory">// \\ <//Entry Name="Deathtext">Text you want in the black screen after you die// <///Entry> \\ // <///CATEGORY> // \\ <///LANGUAGE> // | |
- | [/Spoiler] | + | //Now if you walk through the ScriptArea and die, you respawn at the PlayerStartArea you created. // |
- | Now if you die you respawn at the PlayerStartArea you created. | + | \\ |