Author Topic: weapon image states SOLVED  (Read 1503 times)

ok so i have the following as my image for a shotgun im working on:
and sorry about the tabs all unaligned, idk what happened.

Code: [Select]
datablock ShapeBaseImageData(ADV_Shotgun_1AImage)
{
   // Basic Item properties
   shapeFile = "./DTS/Shotgun/Shotgun_1.dts";
   emap = true;
   mountPoint = 0;
   offset = "0 0 0";
   eyeOffset = "0"; //"0.7 0.9 -0.51";
   rotation = eulerToMatrix( "0 0 0" );
   correctMuzzleVector = true;
   className = "WeaponImage";
   item = ADV_Shotgun_1AItem;
   ammo = " ";
   projectile = ADV_ShotgunProjectile1;
   projectileType = Projectile;
   casing = ADV_Medium_gunShellDebris;
   shellExitDir        = "1.0 0.1 1.0";
   shellExitOffset     = "0 0 80";
   shellExitVariance   = 10.0;
   shellVelocity       = 5.0;
   melee = false;
   armReady = true;
   doColorShift = false;
   colorShiftColor = ADV_ShotgunItem.colorShiftColor;

// Initial start up state
stateName[0]                    = "Activate";
stateTimeoutValue[0]            = 0.05;
stateSequence[0]             = "Root1"; //blank animation that hides/unhides attachments
stateTransitionOnTimeout[0]     = "LoadCheckA";
stateSound[0] = ADV_Equip;

stateName[1]                    = "Ready";
stateTransitionOnNoAmmo[1]      = "NoAmmo";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1]        = false;

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Delay";
stateTimeoutValue[2]            = 0.05;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire1";
stateScript[2]                  = "onFire";
stateEmitter[2] = ADV_LargeGunFlashEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";
stateWaitForTimeout[2] = true;

stateName[3] = "Delay";
stateTimeoutValue[3]         = 0.2;
stateEmitter[3] = gunSmokeEmitter;
stateEmitterTime[3] = 0.15;
stateEmitterNode[3] = "muzzleNode";
stateTransitionOnTriggerUp[3]   = "ReloadA";
stateWaitForTimeout[3] = true;

stateName[4] = "ReloadA";
stateTransitionOnTimeout[4]     = "PlayerCMDAmmoSwap";
stateTimeoutValue[4]            = 0.25;
stateSequence[4]                = "Reload1A"; //animation for Reloading, must be animated with the same attachments as "Root"
stateAllowImageChange[4]        = true;
stateSound[4] = ADV_Shotgun_ReloadASound;

stateName[5] = "PlayerCMDAmmoSwap";//this is where the player can choose to add a different round
stateTransitionOnTriggerDown[5] = "ReloadB";
stateEjectShell[5]       = true;
stateAllowImageChange[5]        = false;

stateName[6] = "ReloadB";
stateTimeoutValue[6] = 0.25;
stateScript[6]   = "AmmoSwap";
stateSequence[6]                = "Reload1B"; //animation for Reloading, must be animated with the same attachments as "Root"
stateTransitionOnTriggerUp[6]   = "DisplayAmmo";
stateWaitForTimeout[6] = true;
stateSound[6] = ADV_Shotgun_ReloadBSound;
stateAllowImageChange[6]        = true;

stateName[7] = "DisplayAmmo";
stateScript[7] = "DisplayAmmo";
stateTimeoutValue[7] = 0.01;
stateTransitionOnTimeout[7] = "LoadCheckA";

stateName[8] = "LoadCheckA";
stateScript[8] = "onLoadCheck";
stateTimeoutValue[8] = 0.01;
stateTransitionOnTimeout[8] = "LoadCheckB";

stateName[9] = "LoadCheckB";
stateTransitionOnAmmo[9] = "Ready";
stateTransitionOnNoAmmo[9] = "NoAmmo";

stateName[10]                   = "NoAmmo";
stateScript[10]   = "AmmoSwap";
stateTimeoutValue[10] = 0.01;
stateTransitionOnTimeout[10] = "LoadCheckC";

stateName[11] = "LoadCheckC";
stateScript[11] = "onLoadCheck";
stateTimeoutValue[11] = 0.01;
stateTransitionOnTimeout[11] = "PlayerCMDEmptyAmmoSwap";

stateName[12] = "PlayerCMDEmptyAmmoSwap";//this is where the player can choose to add a different round
stateTransitionOnAmmo[12] = "ReloadA";
stateTransitionOnTriggerDown[12] = "DryFire";
stateAllowImageChange[12]       = true;

stateName[13]                   = "DryFire";
stateTransitionOnTimeout[13]    = "SemiAuto";
stateTimeoutValue[13]           = 0.1;
stateWaitForTimeout[13] = true;
stateSound[13] = ADV_Click;

stateName[14] = "SemiAuto";
stateScript[14] = "DisplayAmmo";
stateTransitionOnTriggerUp[14]  = "NoAmmo";
stateTimeoutValue[14]           = 0.01;
};

everything works great except one VERY odd occurence that i cant explain, when you unequip the weapon while its in the "PlayerCMDAmmoSwap" state the
Code: [Select]
stateName[5] = "PlayerCMDAmmoSwap" state and the
Code: [Select]
stateName[1]                    = "Ready";
 states get switched around, meaning when you are supposta be able to fire, you can switch ammo types, and when it switches to the PlayerCMDAmmoSwap state, the weapon fires, you can also reverse this by unequiping the weapon while its in its ready state, thus switching the two states again, and correcting the problem...

i am PRETTY sure it has somthing to do with the multiple OnTriggerDown states somehow switching...

i have tried alot of things such as changing the "stateAllowImageChange"s to every combination of true/false, and even hacky ways such as restricting the player from unequiping the weapon during that state, to no success...

basically i just need to know how i can stop the two from "swaping" places...

below is a console log where i replicate the bug with Trace() enabled
« Last Edit: December 20, 2014, 12:10:55 PM by zombekillz »

i'm stupid, the problem was this line: "stateTransitionOnTimeout[0]     = "LoadCheckA";" should have been referencing the "Ready" state

issue resolved. locking.