How do you stop the crossbow firing animation?
by Gregory Martino · in Torque Game Engine · 12/07/2004 (6:27 am) · 0 replies
I want the player to have to be in 'aim mode' in order to shoot. I've added a bool (bAimmode) to shapebase.cc and the console methods to get/set it.
In crossbow.cs I have:
function CrossbowImage::onFire(%this, %obj, %slot)
{
%bInAimMode = %obj.getAimMode();
if(%bInAimMode)
{
regular fire code...
}
else
{
messageClient(%obj.client, 'NotInAimMode', '\c1You must be in Aim Mode(shift-p) to shoot.');
return;
}
This stops a projectile from being launched, but the crossbow animation still plays.
I see there is a state system that calls OnFire, and stateSequence[3] = "Fire"; that I suppose plays the fire animation, but I have been unable to find where in the engine code to stop the animation from playing.
In ShapeBase::processTick, there is a call to: setImageWetState(0, mWaterCoverage > 0.4); // more than 40 percent covered
I tried co-opting this by making the call: mWaterCoverage > 0.4 || bInAimMode
However this does nothing, even if I hardcode the value to true, you can still fire.
I also considered checking the bool in default.bind.cs 's: function mouseFire(%val), but I don't know how to access the bool from the client side script.
Any suggestions on how to stop the animation from firing?
In crossbow.cs I have:
function CrossbowImage::onFire(%this, %obj, %slot)
{
%bInAimMode = %obj.getAimMode();
if(%bInAimMode)
{
regular fire code...
}
else
{
messageClient(%obj.client, 'NotInAimMode', '\c1You must be in Aim Mode(shift-p) to shoot.');
return;
}
This stops a projectile from being launched, but the crossbow animation still plays.
I see there is a state system that calls OnFire, and stateSequence[3] = "Fire"; that I suppose plays the fire animation, but I have been unable to find where in the engine code to stop the animation from playing.
In ShapeBase::processTick, there is a call to: setImageWetState(0, mWaterCoverage > 0.4); // more than 40 percent covered
I tried co-opting this by making the call: mWaterCoverage > 0.4 || bInAimMode
However this does nothing, even if I hardcode the value to true, you can still fire.
I also considered checking the bool in default.bind.cs 's: function mouseFire(%val), but I don't know how to access the bool from the client side script.
Any suggestions on how to stop the animation from firing?