(12-26-2015, 11:46 PM)Spelos Wrote: Although...
In my suggestion I called the function again, since I think it can't refresh the alState.
When it's called, it's 1 or -1 and it stays that way for the rest of the function.
Or was my whole life a complete lie?
If player goes and touches the area, won't it always be "1" just as he has it?
I can't imagine a situation where you leave the area (for it to be -1) that you haven't enter.
That's what I thought needed to be handled by the second callback.
I hope I'm not mistaken... I haven't tested it to be honest...
Using 0 will check for both, but it will only trigger -1 if the boolean is set to false (so that it can trigger multiple times). If it can only trigger once, then the player has to enter the area first, and if the callback is then removed, it won't check for exists. Therefore you can use 2 callbacks, one with '1' and one with '-1' using the "true" boolean and it will check enter and exit ONCE EACH. Alternatively you can use 0 in a single callback and it will check both, but the boolean must be "false" for this to work. This also means it will trigger both enter and exit EVERY TIME, unless you explicitly tell it not to.
If this event is meant to happen only once it might be best to use 2 callbacks:
AddEntityCollideCallback("Player", "spike_trap", "SpikeTrapAltar", true, 1);
AddEntityCollideCallback("Player", "spike_trap", "SpikeTrapAltar", true, -1);
PPS: I can't remember if using 0 and "true" can trigger exiting if the player starts the map within the area. It might not count spawning as entering, and thus trigger exit first.