Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making a Trap
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#5
RE: Making a Trap

(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:

PHP Code: (Select All)
AddEntityCollideCallback("Player""spike_trap""SpikeTrapAltar"true1);
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.

(This post was last modified: 12-27-2015, 12:00 AM by Mudbill.)
12-26-2015, 11:53 PM
Find


Messages In This Thread
Making a Trap - by Southlaguna - 12-26-2015, 10:45 PM
RE: Making a Trap - by Spelos - 12-26-2015, 11:01 PM
RE: Making a Trap - by Mudbill - 12-26-2015, 11:39 PM
RE: Making a Trap - by Spelos - 12-26-2015, 11:46 PM
RE: Making a Trap - by Mudbill - 12-26-2015, 11:53 PM
RE: Making a Trap - by Spelos - 12-26-2015, 11:59 PM
RE: Making a Trap - by Southlaguna - 01-03-2016, 08:26 AM
RE: Making a Trap - by Traggey - 01-03-2016, 10:32 PM



Users browsing this thread: 1 Guest(s)