2 questions about codesampler.com weapons damage tut
by Alex Rice · in Torque Game Engine · 10/09/2004 (11:48 am) · 3 replies
This is a great set of tuts, BTW! www.codesampler.com/torque.htm
1) What is the difference between MyBot, Player, MyPlayer and PlayerClass? I'm not understanding at all how inheritance works with classes vs. with datablocks.
2) I am getting a warning in console
game/server/scripts/player.cs (132): unable to find object : ' ' attempting to call function 'onDeath'.
That the line is in the function:
Is this a normal condition or is the example incorrect maybe?
1) What is the difference between MyBot, Player, MyPlayer and PlayerClass? I'm not understanding at all how inheritance works with classes vs. with datablocks.
2) I am getting a warning in console
game/server/scripts/player.cs (132): unable to find object : ' ' attempting to call function 'onDeath'.
That the line is in the function:
function PlayerClass::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
// If we're already dead, don't bother with it...
if( %obj.getState() $= "Dead" )
return;
%obj.applyDamage( %damage );
echo( "Damage Type = " @ %damageType );
// Deal with client callbacks here because we don't have this information
// in the onDamage or onDisabled methods
%client = %obj.client;
%sourceClient = %sourceObject ? %sourceObject.client : 0;
if( %obj.getState() $= "Dead" )
%client.onDeath( %sourceObject, %sourceClient, %damageType, %location );
}Is this a normal condition or is the example incorrect maybe?
About the author
#2
10/09/2004 (2:46 pm)
The player dies, and then calls "ondeath" to see what should happen when the player dies. If this function doesn't exist, you won't see the stuff that's supposed to happen when a player dies.
#3
I can try to debug it and see if %client exists and if onDeath() exists, I was just wondering if anyone else went though this tutorial and ran into the same warnings.
thx
10/09/2004 (3:01 pm)
Stefan, isn't the warning msg saying that the object %client does not exist? I can try to debug it and see if %client exists and if onDeath() exists, I was just wondering if anyone else went though this tutorial and ran into the same warnings.
thx
Torque Owner Alex Rice
Default Studio Name
www.garagegames.com/docs/torque/general/ch05s04.php
Still wondering about question2) though.