Game Development Community

issues with delay in schedule() command

by Jeff Yaskus · in Torque Game Engine · 01/24/2010 (1:53 am) · 2 replies

I'm trying to place an object with its "building in progress" animation ... and 80 seconds later, change to its "idle" animation which shows building completed.

However, it automatically goes to "idle" ... unless I comment out the schedule command.

Is there something wrong with my syntax ?

//   %b.playRootAnimation();
   %b.setActionThread("Create");  // start building out as under construction
   Schedule(80000, 0,%b.setActionThread("idle") , 1);

Note; This is using TGE 152 and RTS kit ...

#1
01/24/2010 (2:04 am)
this approach works much better -
%b.schedule(30000, setActionThread,"idle");

and actually seemed to take ~30 seconds
#2
01/24/2010 (9:43 am)

As you have found yourself, this part in your first version immediately invokes the going to idle state rather than deferring the call through schedule:

%b.setActionThread( "idle" );

'schedule' needs to be passed an object (optional) to call a function on, a function to call (i.e. it's name), and the parameters to be passed to the function.

Your second version does just that.