Game Development Community

onTickTrigger no longer works in t3d?

by Nmuta Jones · in Torque 3D Beginner · 01/25/2010 (8:01 pm) · 1 replies

I created a trigger.

I am trying to do something simple every tick while a player is in the trigger. But it didn't work, so I tried to echo something out every tick.

That's not working either. I am wondering if onTickTrigger no longer is used in T3D? Or is there a simple error in the code.

It doesn't even tell me that its ticking ! I placed the trigger in game where I have myself (Gideon) and 4 other Ai bots who are also Gideon.... its pretty big and covers all the spawn points.

Also, by the way, I'm finding triggers to be hard to see in t3d. What happened to the very distinct boundary lines that allowed you to see the trigger like a big box instead of a hint of a box with only the outer corners highlighted?

//-----------------------------------------------------------------------------
// Torque Game Engine 
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// DefaultTrigger is used by the mission editor.  This is also an example
// of trigger methods and callbacks.

datablock TriggerData(DefaultTrigger)
{
   // The period is value is used to control how often the console
   // onTriggerTick callback is called while there are any objects
   // in the trigger.  The default value is 100 MS.
   tickPeriodMS = 100;
};

datablock TriggerData(ClientTrigger : DefaultTrigger)
{
   clientSide = true;
};

datablock TriggerData(flytrigger)
{
 
   tickPeriodMS = 5000;
};


                                          

function flytrigger::onEnterTrigger(%this,%trigger,%obj)
{


   }

function flytrigger::onTickTrigger(%this,%trigger){

echo ("I'm ticking"); 

                     for ( %i = 0; %i < %count; %i++ )  
                                       {  
				       // loop through and find a player.  
				       %colObj = %trigger.getObject( %i );  

				      // Now filter for what your looking for  
				 if ( %colObj.getDatablock().getName() $= "DefaultPlayerData" )  
						             
                                           {
		                          echo ("someone is here"); 
                                          %vec = "0 0 -100";  
	                                  %colObj.setVelocity(%vec);
                                           }else{
		 echo ("no players of that kind here."); 
                                           }//end if



             } //end for loop 
                                           
   Parent::onTickTrigger(%this,%trigger);
}

#1
01/25/2010 (8:30 pm)
Nevermind..... some how when creating a trigger, since there is no "Ok" button, you have to click away from it , then click back on it, that seems to "initialize" it I guess. Its works now. Mainly me not being used to some of the subtleties of the new editor.

Overall , I like the new editor..... much more powerful, more options, obviously, and easier to place/ manipulate objects.