Game Development Community

Starter.fps Kork problem

by DejaBlue · in Torque Game Engine · 10/28/2005 (1:54 am) · 5 replies

OK this is on a fresh install. i go into game and kill Kork after he dies i get a

starter.fps/server/scripts/player.cs (810): Unable to find object: '' attempting to call function 'onDeath'

player.cs line 810 is

%client.onDeath(%sourceObject, %sourceClient, %damageType, %location);

which is part of

function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
if (%obj.getState() $= "Dead")
return;
%obj.applyDamage(%damage);
%location = "Body";

// Deal with client callbacks here because we don't have this
// information in the onDamage or onDisable methods
%client = %obj.client;
%sourceClient = %sourceObject ? %sourceObject.client : 0;

if (%obj.getState() $= "Dead")
%client.onDeath(%sourceObject, %sourceClient, %damageType, %location);
}


just to show you ondeath found in game.cs

function GameConnection::onDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc)
{
// Clear out the name on the corpse
%this.player.setShapeName("");

// Switch the client over to the death cam and unhook the player object.
if (isObject(%this.camera) && isObject(%this.player)) {
%this.camera.setMode("Corpse",%this.player);
%this.setControlObject(%this.camera);
}
%this.player = 0;

// Doll out points and display an appropriate message
if (%damageType $= "Suicide" || %sourceClient == %this) {
%this.incScore(-1);
messageAll('MsgClientKilled','%1 takes his own life!',%this.name);
}
else {
%sourceClient.incScore(1);
messageAll('MsgClientKilled','%1 gets nailed by %2!',%this.name,%sourceClient.name);
if (%sourceClient.score >= $Game::EndGameScore)
cycleGame();
}
}


this is after i kill Kork... been all over the search feature but nothing fixes this that i can find

#1
10/28/2005 (1:57 am)
Basically the thing is that Kork isn't a client.

A fix would looks something like

if (%client && %obj.getState() $= "Dead")
%client.onDeath(%sourceObject, %sourceClient, %damageType, %location);

but since its not a fatal error, no one really bothers. :D
#2
10/28/2005 (2:05 am)
Thanks Paul

i didnt even think of it as client or not
#3
10/28/2005 (2:13 am)
Fix worked fine to get rid of the error. but i am not getting the msg

messageAll('MsgClientKilled','%1 gets nailed by %2!',%this.name,%sourceClient.name);

Happen to know what would cause this?
#4
10/31/2005 (10:11 pm)
I didn't look around but there may just me no code to handel MsgCleintKilled. Look through the code.

*steals fix* ;D
#5
10/31/2006 (4:36 am)
I dunno if this is any use, but I also got past this using some advice from here.

The key is that any animation called "Death" is significant to Torque. So name your death animations something else, like "die" or "argh." I renamed my death animation to "die" and made the following changes. In armor::damage,..

if(%client) {
%client.onDeath(%sourceObject, %sourceClient, %damageType, %location);
} else {
if(%obj)
%obj.death();

And on the object, in this case AIManager:

function AIPlayer::death(%this) {
%this.setActionThread("die");
}//F

This worked a treat :)