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
#3
RE: Making a Trap

Your last argument in the AddEntityCollideCallback should be 0 if you'd like to test it for both leaving and entering of the area. If you set it to 1, it will only run the check upon entering, meaning it cannot be -1 (leaving). Set it to -1 and it will be opposite. That's why 0 exists, because it acts as both.

And also as Spelos said, your == 0 check is never fulfilled. You probably meant to put -1 there if you wanted to test it upon leaving the area. Since the state is either one or the other, you could use the "else" keyword for simplification:

PHP Code: (Select All)
if (alState == 1)
    
AddTimer("dead"0.7f"YourDeadBoy");
else 
    
AddTimer("pierce1"0.3f"TimerStopPierce"); 

PS: If you use only one line after an if-statement, the block itself isn't necessary.

FORGOT TO MENTION AN IMPORTANT DETAIL:
You must set the boolean in your callback to "false" or else it will never trigger upon exit because it triggers entering first and is then removed. This means you need to manually prevent this event from happening more than wanted.

(This post was last modified: 12-26-2015, 11:55 PM by Mudbill.)
12-26-2015, 11:39 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)