Game Development Community

Weapon Fire after death

by Chris Labombard · in Torque Game Engine · 07/14/2005 (10:14 am) · 2 replies

I am using a player that uses weapons that are not in slot 0. I have set up my mouseFire method accordingly.

When the player dies, if the left mouse button was down, the dead player continues to shoot. Accordingly, the newly spawned player shoots when you pick up a weapon.

I noticed that in the stock TGE stronghold mission, it doesn't have this problem. You can't respawn until you let go of the mouse button.

I have tried everything from manually calling $mvTriggerCount[weapon]++; before death... to mounting an invisible weapon in the players slot 0... to see if the source was looking for it to have triggerDown or something.

Can anyone give me an idea to try ? It is quite an annoying problem.

About the author

I have been a professional game programmer for over 5 years now. I've worked on virtually every platform, dozens of games and released a few of my own games, including 2 iPhone titles and a title waiting release on Big Fish Games.


#1
07/14/2005 (2:18 pm)
I think that the way the DemoPlayer datablock does it is in the Armor::onDisabled callback:

function Armor::onDisabled(%this,%obj,%state)
{
   // The player object sets the "disabled" state when damage exceeds
   // it's maxDamage value.  This method is invoked by the ShapeBase
   // state mangement code.

   // If we want to deal with the damage information that actually
   // caused this death, then we would have to move this code into
   // the script "damage" method.
   %obj.playDeathCry();
   %obj.playDeathAnimation();
   %obj.setDamageFlash(0.75);

   // Release the main weapon trigger
   // No more firing for you, matey :)
   %obj.setImageTrigger(0,false);

   // Schedule corpse removal.  Just keeping the place clean.
   %obj.schedule($CorpseTimeoutValue - 1000, "startFade", 1000, 0, true);
   %obj.schedule($CorpseTimeoutValue, "delete");
}
#2
07/14/2005 (2:57 pm)
Ah... thank you, I must have over looked that somehow.