Game Development Community

Schedule... holy, uhh ya..

by Jon C · in Torque Game Engine · 03/13/2007 (4:53 am) · 1 replies

I hate schedule, i cant even grasp the concept of how to uses it, i've ready every single piece of paper on how to use it i could possibly find, and it all comes down to it just being to darned confusing.

Basically this is what I am trying to do. I am trying to have it so onCollision from my weapon, this modifier is applied. that works no problems.

What doesnt work and I want to get working is for it to automatically turn back to the default settings.. which i setup as .fronstpeed,backspeed,sidespeed in the player datablock, after a period of 10 seconds. Well even better after a period of %freezetime

function player::freeze(%player,%col)
{
%col.maxforwardspeed=5;
%col.maxbackwardspeed=5;
%col.maxsidespeed=5;
echo("red light");
}

function player::unfreeze(%player,%col)
{
%player.maxforwardspeed=%player.frontspeed;
%player.maxbackwardspeed=%player.backspeed;
%player.maxsidespeed=%player.sidespeed;
echo("green light");
}

I know the schedule i THINK is supposed to go in here function player::freeze(%player,%col) but like I said I am totally clueless.

and here is the extents of my projectiles collision

function MagicMissileProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
%col.freeze;
echo(%col);
}

i dont even know anymore... this dont work at all.. any help greatly appreciated. wow im so lost

#1
03/13/2007 (5:19 am)
function player::freeze(%this)
{
   %this.maxforwardspeed = 5;
   %this.maxbackwardspeed=5;
   %this.maxsidespeed=5;
   echo("red light");

   %this.schedule($freeze_time, unfreeze);
}

function player::unfreeze(%this)
{
   %this.maxforwardspeed = %this.frontspeed;
   %this.maxbackwardspeed= %this.backspeed;
   %this.maxsidespeed= %this.sidespeed;
   echo("green light");
}

The above should work... be sure and define the global $freeze_time variable someplace and set its value. I removed the %col variable, since it wasn't being used, and was just the player object anyway. If you replace the $freeze_time with 10000, then it will wait 10 seconds.

Last things, for the freeze, shouldn't you stop the movement, or does it only slow them down?