Odd bug....
by Justin Morris · in Torque Game Engine · 12/16/2004 (11:06 pm) · 3 replies
Ok i dont think i have made any conflicting changes to my player death code... (ammo hud resource only)
//reset AmmoAmountHud
%this.setAmmoAmountHud("0");
// 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 killed by %2!',%this.name,%sourceClient.name);
if (%sourceClient.score >= $Game::EndGameScore)
cycleGame();
}
which leads me to beleive my bug may be weapon based...
when i ctrl+k it shows that i did infact kill myself... but if i kill myself with a weapon (or kill anyone else) it shows displays "Player got killedby !" and does not increment their score... the only thing i can really see that could be causing this bug is the damage type on my weapons maybe? but no matter what it is, the else should atleast get run... and when i kill myself with a gun instead of it saying "player killed himself" it says "Player was killed by !" so maybe the problem is with source client and not damage type... in any situation... i dont know where to start on this one...
//reset AmmoAmountHud
%this.setAmmoAmountHud("0");
// 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 killed by %2!',%this.name,%sourceClient.name);
if (%sourceClient.score >= $Game::EndGameScore)
cycleGame();
}
which leads me to beleive my bug may be weapon based...
when i ctrl+k it shows that i did infact kill myself... but if i kill myself with a weapon (or kill anyone else) it shows displays "Player got killedby !" and does not increment their score... the only thing i can really see that could be causing this bug is the damage type on my weapons maybe? but no matter what it is, the else should atleast get run... and when i kill myself with a gun instead of it saying "player killed himself" it says "Player was killed by !" so maybe the problem is with source client and not damage type... in any situation... i dont know where to start on this one...
About the author
#2
i currently use:
function GLProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
// Apply damage to the object all shape base objects
if (%col.getType() & $TypeMasks::ShapeBaseObjectType) {
%col.mountObject(%obj, 0);
%col.damage(%obj,%pos,%this.directDamage,"GLProjectile");
}
radiusDamage(%obj,%pos,%this.damageRadius,%this.radiusDamage,"Radius",%this.areaImpulse);
}
see anything wrong there?
12/17/2004 (11:36 am)
I couldnt find anything in my weapon.cs file, but if you meant like your-weapon.cs eg. "crossbow.cs" i have not made much of a mod to the collision but i do remember messing with it when trying to get a snapping projectile so maybe i fouled it up... i currently use:
function GLProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
// Apply damage to the object all shape base objects
if (%col.getType() & $TypeMasks::ShapeBaseObjectType) {
%col.mountObject(%obj, 0);
%col.damage(%obj,%pos,%this.directDamage,"GLProjectile");
}
radiusDamage(%obj,%pos,%this.damageRadius,%this.radiusDamage,"Radius",%this.areaImpulse);
}
see anything wrong there?
#3
12/20/2004 (5:35 pm)
Well, death is called in onDamage() I believe. Which calls GameConnection::onDeath() which is what displays the kill msg. (Unless things have changed alot since I last looked)
Torque 3D Owner Matthew Langley
Torque
(if this helps at all, maybe you already know this, if you do then forget what I said :) )