Figuring out which entity type triggered a trigger?
by Nikhil Haldar-Sinha · in Torque Game Engine · 04/11/2006 (1:12 pm) · 4 replies
So triggers are setup in the following way...
function treeTrigger::onEnterTrigger( %this, %trigger, %obj )
{
...
}
From this, how do I figure out which entity and which entity type set off the trigger? This trigger goes off whenever a player or bot enters an area, but I want to set up a counter that only increments when a BOT (and not the player) enters the area.
Thanks.
-Nick
function treeTrigger::onEnterTrigger( %this, %trigger, %obj )
{
...
}
From this, how do I figure out which entity and which entity type set off the trigger? This trigger goes off whenever a player or bot enters an area, but I want to set up a counter that only increments when a BOT (and not the player) enters the area.
Thanks.
-Nick
#2
04/11/2006 (2:04 pm)
Is there an API that lists the different members of it?
#3
04/11/2006 (2:09 pm)
You could just do a call to %obj.getClassName(); to see what kind of object it is. If it's "Player" then ignore it, if it's an "AIPlayer" then proceed. Or, you could just compare %obj to all of the client players, and if it's the same, then ignore it.
#4
that will tell you the classname,
and a bunch of other useful stuff.
you can look the class up in script documentation.
04/11/2006 (2:09 pm)
Enter %obj.dump()that will tell you the classname,
and a bunch of other useful stuff.
you can look the class up in script documentation.
Associate Orion Elenzil
Real Life Plus