Hpl2:Tutorials:scripting:checkpoints using scriptarea s

From Frictional Wiki
Revision as of 14:48, 9 July 2020 by Maintenance script (talk | contribs) (Upload from wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Checkpoints using ScriptArea's

1. make a ScriptArea large enough for the player to walk through.


I named mine "ScriptArea_1"


[1]


2. create a PlayerStartArea this time I name mine "PlayerStartArea_1"


[2]


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/
}


and as for the .LANG file


<LANGUAGE>
<CATEGORY Name="DeathCategory">
<Entry Name="Deathtext">Text you want in the black screen after you die </Entry>
</CATEGORY>
</LANGUAGE>


Now if you walk through the ScriptArea and die, you respawn at the PlayerStartArea you created.