Schedule causing crash?
by James Hill · in Torque Game Engine · 10/26/2004 (8:40 pm) · 23 replies
I have a poison spell that applies damage every couple seconds. Currently I schedule a function that applies damage several times. But when I die from the damage, the game does a weird freeze then crashes. Can you not die with functions scheduled or the game crashes? Is the schedule what's even causing the crash? This is my code, if anyone has an idea of what is going wrong or a better way to go about this, your thoughts would be greatly appreciated.
%times = 5;
%amount = 5;
for(%index = 0; %index < %times; %index++)
{
%this.schedule(2000 * %index, poison, %amount);
}
function Player::poison(%this, %amount)
{
if(%this.getDamageLevel() <= 0) {
return;
} // this isn't helping
if(%this.getDamageLevel() != 0) {
%this.applyDamage(%amount);
}
}About the author
#22
08/02/2007 (4:11 pm)
Yes it is and the schedule is started in serverCmdAttack() So it should run server side.
#23
08/02/2007 (5:44 pm)
Argh RTFM RTFM!! %client.resolveObjectFromGhostIndex(%enemy) and .getGhostID() fixed it. I had assumed as another engine i work on, NetID's and clientID's were sync'ed but in Torque they are not. :)
Torque 3D Owner Stephen Zepp