I am trying to make a reloading weapon, it works by calling the function setCC45A2Ammo when the gun is in the activate phase. Then while the gun fires the same function is called with %subtract set to 1. This is not the part i need help with though. I am trying to find out how to mount a diffrent image when ammo = 0. This image is basically the reloading gun then it switches back to the normal image.
function setCC45A2Ammo(%amount,%subtract)
{
%ammo = %amount;
%ammo -= %subtract;
if ( %ammo == 0 )
{
reloadThisstuff();
}
}
function reloadThisstuff(%client)
{
%client.player.mountImage(CC45A2CImage,0);
}
function CC45A2Reload(%client)
{
%client.player.mountImage(CC45A2Image,0);
}
This is where the function is called:
// Initial start up state
stateName[0] = "Activate";
stateTimeoutValue[0] = 0.15;
stateTransitionOnTimeout[0] = "Ready";
stateSound[0] = weaponSwitchSound;
stateName[1] = "Ready";
stateTimeoutValue[0] = 0.01;
stateTransitionOnTimeout[1] = "Reload";
stateAllowImageChange[1] = true;
stateSequence[1] = "Ready";
stateName[2] = "Reload";
stateSequence[2] = "Reload";
stateScript[2] = "onReload";
stateTimeoutValue[2] = 2;
stateTransitionOnTimeout[2] = "Wep";
stateName[3] = "Wep";
stateSequence[3] = "Reload";
stateScript[3] = "onWep";
stateTransitionOnTriggerUp[3] = "Ready";
stateSequence[3] = "Reload";
};
function CC45A2CImage::onWep()
{
CC45A2Reload();
}
I am not that great of a torque scripter. Although I did take the CTY program for the fundamentals of C++, I am still use to programing in BASIC and I am not use to the client\server format of TGE. Any help would be appreciated.