Detect Player entering ScriptArea:
void AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);
Calls a function when two entites collide.
Callback syntax: void MyFunc(string &in asParent, string &in asChild, int alState)
alState: 1 = enter, -1 = leave
asParentName - internal name of main object
asChildName - internal name of object that collides with main object (asterix (*) NOT supported!)
asFunction - function to call
abDeleteOnCollide - determines whether the callback after it was called
alStates - 1 = only enter, -1 = only leave, 0 = both
Turn lamp on:
void SetLampLit(string& asName, bool abLit, bool abEffects);
asName - name of the lamp
abLit - true = on, false = off
abEffects - true = use effects, false = don't use effects when turning on/off
Example:
void OnStart()
{
AddEntityCollideCallback("Player", "LAMPAREA", "CollideLAMPAREA", true, 1); //Add the callback for the player (calls "CollideLAMPAREA" when entering)
}
void CollideLAMPAREA(string &in asParent, string &in asChild, int alState)
{
SetLampLit("MYLAMP", true, true); //Turn lamp on
}
Script functions for further information in the future:
http://wiki.frictionalgames.com/hpl2/amn..._functions
-Inurias