Game Development Community

Implementing t2dTrigger::onLeave callback

by Robert Dowling · in Torque Game Builder · 05/27/2008 (6:45 am) · 4 replies

I'm trying to implement the onLeave callback for a t2dTrigger derived object I've created. I've gotten the onEnter callback to work fine but it just doesn't want to call onLeave. Here is the following code:

function levelChangeTriggerZone::onEnter(%this, %object)
{
if( %object == $player )
{
echo("Player entered door zone. Teleports to: " @ %this.levelGoTo);

%object.setLevelChangeTo(%this.levelGoTo);
}
}

function levelChangeTriggerZone::onLeave(%this, %object)
{
if( %object == $player )
{
echo("Player left door zone.");
%object.clearLevelChangeTo();
}
}

Like I said, the onEnter works fine, but the onLeave doesn't (I also successfully implemented the onStay callback aswell). Any ideas?

#1
05/27/2008 (7:03 am)
There is a problem with TGB 1.7.3's trigger system. It has been fixed, but I don't think a build has been uploaded to the GG site (yet)
#2
05/27/2008 (2:34 pm)
Ah ok, good reply. I will try to do this some other way then. :)
#3
05/27/2008 (6:01 pm)
It hasn't been updated yet unfortunately. If you have the code Robert then I can provide the minor change required to make it work. It was Phillip who noticed it. :)

Melv.
#4
06/11/2008 (4:17 am)
Wow, Ok I'm not going crazy then!! Thanks. I had a post saying that triggers were broken in 1.7.3 but nobody responded ;(.

You know a chat system for garage games could be really handy to get quick answers to things.. but it may undermine the knowledge base a bit.. just a though.

Please Let us know when the triggers are fixed. How would I know when a new build is here? I'm really anxious to get my new project tested and I've been banging my head at a wall thinking I was an idiot or something not being able to get it working.

cheers!
-nic