Game Development Community

Schedule problem

by Very Interactive Person · in Torque Game Engine · 08/18/2004 (7:41 am) · 5 replies

function removeShield(%this){
	error("why isn't this workin???");

}

function ShieldPowerUp::onCollision(%this,%obj,%col)
{
	if(!%col.isShielded){
                //some code to add a shield here... not important
		%col.rs=%this.schedule(500, "removeShield");
		%obj.respawn();
	}
}

Can someone tell me why this isn't working? The removeShield function is never called. I assume its a scope problem or something like that, but I really don't see it.

#1
08/18/2004 (7:51 am)
You have to make the removeShield a method of the ShieldPowerUp so it would be like this

function ShieldPowerUp::removeShield(%this){
   error("why isn't this workin???");
}
Other wise you need to call shedual by it self
like this:

%col.rs= schedule(500, "removeShield", %this);
#2
08/30/2004 (11:24 am)
I'm having a similar problem like Ward:

....
%explosion = new StaticShape()
		{
			dataBlock 		= "BombExplosion";
			client      	= %proj.client;
			sourceObject	= %proj.sourceObject;
			position 		= %vec;
		};
		%explosion.strength = 1;
		%explosion.schedule(1, "update");
		MissionCleanup.add(%explosion);
....
datablock StaticShapeData( BombExplosion )
{
	Category = "Misc";
	shapeFile = "~/data/shapes/explosions/explosion_root.dts";
};

function BombExplosion::update(%this)
{
	echo("BombExplosion::update()");
}

the update() method of BombExplosion doesn't get called too. Any help ??
#3
08/30/2004 (11:36 am)
%explosion.schedule(1, "update");

How does this link to BombExplosion::update(%this)?
I'm not sure that's the problem, but as far as I could see it didn't look quite as what I'm used to.

Excuse me if I'm totally off though :)
#4
08/30/2004 (11:38 am)
You can't schedule the update untill the object actually exists...


%explosion = new StaticShape()
{
         dataBlock       = "BombExplosion";
         client         = %proj.client;
         sourceObject   = %proj.sourceObject;
         position       = %vec;
};
MissionCleanup.add(%explosion);

%explosion.strength = 1;
%explosion.schedule(1, "update");


First you define the object, then you add the object, then you manipulate the object.
#5
11/05/2004 (12:54 pm)
Hello, I'm looking for help with schedule as well... please dont take this as spam... I'm just trying to get help... and there appear to be a number of threads that apply to my situation... please check here

www.garagegames.com/mg/forums/result.thread.php?qt=9966

Thank you,

Ryan Champ