try setting smokea/b/c to timeout 0 maybe
They actually were set to 0 but I had two timeoutValue definitions in many of the smoke states. It was really messy in general so I rewrote it
Okay, so now I'm really confused. I re-wrote the state system from scratch, to this:
// Initial start up state
stateName[0] = "Activate";
stateTimeoutValue[0] = 0.15;
stateTransitionOnTimeout[0] = "ReadyA";
stateSound[0] = weaponSwitchSound;
// 0-60
stateName[1] = "ReadyA";
stateTransitionOnTriggerDown[1] = "FireA";
stateTransitionOnNoAmmo[1] = "ImageReload";
stateAllowImageChange[1] = true;
stateSequence[1] = "ReadyA";
stateName[2] = "FireA";
stateTransitionOnTimeout[2] = "SmokeA";
stateTimeoutValue[2] = 0.5;
stateFire[2] = true;
stateAllowImageChange[2] = false;
stateSequence[2] = "FireA";
stateScript[2] = "onFire";
stateWaitForTimeout[2] = true;
stateEmitter[2] = HL1BulletFlashEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";
stateSound[2] = HL1MagnumFireSound;
stateEjectShell[2] = true;
stateName[3] = "SmokeA";
stateEmitter[3] = HL1BulletSmokeEmitter;
stateEmitterTime[3] = 0.2;
stateEmitterNode[3] = "muzzleNode";
stateTimeoutValue[3] = 0.0;
stateTransitionOnTimeout[3] = "WaitA";
stateTransitionOnNoAmmo[3] = "ImageReload";
stateName[4] = "WaitA";
stateTransitionOnTriggerUp[4] = "ReadyA";
// 60-120
stateName[5] = "ReadyB";
stateTransitionOnTriggerDown[5] = "FireB";
stateTransitionOnNoAmmo[5] = "ImageReload";
stateAllowImageChange[5] = true;
stateSequence[5] = "ReadyB";
stateName[6] = "FireB";
stateTransitionOnTimeout[6] = "SmokeB";
stateTimeoutValue[6] = 0.5;
stateFire[6] = true;
stateAllowImageChange[6] = false;
stateSequence[6] = "FireB";
stateScript[6] = "onFire";
stateWaitForTimeout[6] = true;
stateEmitter[6] = HL1BulletFlashEmitter;
stateEmitterTime[6] = 0.05;
stateEmitterNode[6] = "muzzleNode";
stateSound[6] = HL1MagnumFireSound;
stateEjectShell[6] = true;
stateName[7] = "SmokeB";
stateEmitter[7] = HL1BulletSmokeEmitter;
stateEmitterTime[7] = 0.2;
stateEmitterNode[7] = "muzzleNode";
stateTimeoutValue[7] = 0.0;
stateTransitionOnTimeout[7] = "WaitB";
stateTransitionOnNoAmmo[7] = "ImageReload";
stateName[8] = "WaitB";
stateTransitionOnTriggerUp[8] = "ReadyB";
// 120-180
stateName[9] = "ReadyC";
stateTransitionOnTriggerDown[9] = "FireC";
stateTransitionOnNoAmmo[9] = "ImageReload";
stateAllowImageChange[9] = true;
stateSequence[9] = "ReadyC";
stateName[10] = "FireC";
stateTransitionOnTimeout[10] = "SmokeC";
stateTimeoutValue[10] = 0.5;
stateFire[10] = true;
stateAllowImageChange[10] = false;
stateSequence[10] = "FireC";
stateScript[10] = "onFire";
stateWaitForTimeout[10] = true;
stateEmitter[10] = HL1BulletFlashEmitter;
stateEmitterTime[10] = 0.05;
stateEmitterNode[10] = "muzzleNode";
stateSound[10] = HL1MagnumFireSound;
stateEjectShell[10] = true;
stateName[11] = "SmokeC";
stateEmitter[11] = HL1BulletSmokeEmitter;
stateEmitterTime[11] = 0.2;
stateEmitterNode[11] = "muzzleNode";
stateTimeoutValue[11] = 0.0;
stateTransitionOnTimeout[11] = "WaitC";
stateTransitionOnNoAmmo[11] = "ImageReload";
stateName[12] = "WaitC";
stateTransitionOnTriggerUp[12] = "ReadyC";
// Reload effects
// Cyl Out
stateName[13] = "ImageReload";
stateScript[13] = "CylOut";
stateSequence[13] = "CylOut";
stateTimeoutValue[13] = 0.25;
stateTransitionOnTimeout[13] = "Unload";
// Unload
stateName[14] = "Unload";
stateScript[14] = "UnLoad";
stateSequence[14] = "UnLoad";
stateTimeoutValue[14] = 0.1;
stateTransitionOnTimeout[14] = "Load";
// Mag in
stateName[15] = "Load";
stateScript[15] = "Load";
stateSequence[15] = "Load";
stateTimeoutValue[15] = 1;
stateTransitionOnTimeout[15] = "CylIn";
// Chamber
stateName[16] = "CylIn";
stateScript[16] = "CylIn";
stateSequence[16] = "CylIn";
stateTimeoutValue[16] = 0.25;
stateTransitionOnTimeout[16] = "Activate";
So obviously it's not correct, as in, if
stateTransitionOnTimeout[0] is set to ReadyA, it will constantly loop through A states instead of A->B->C, and the same applies if I set it to B or C. I did it for debugging purposes. What I found out was: ReadyA works, but ReadyB and ReadyC are broken. What I mean by this is that ReadyA produces correct results when automatically reloading when the gun is empty, but ReadyB and ReadyC states will create half a second of lag. This also means that if the states are set to loop through A->B->C, if you fire 5 shots, de-equip and then re-equip the weapon and fire again, it will be in the ReadyA/FireA state block, and produce correct results.
The state blocks are literally the same, they're copied and pasted and then I switched around the A/B/C values. I really don't understand why B and C are broken if A works since they should be interchangeable. So naturally I assumed there might be something wrong with the actual animations I made in Blender.
What's even
more loving confusing is that to test it further, I went ahead and swapped out ReadyA/FireA's sequences with ReadyB/FireB's sequences, and ReadyA still works and B and C are still broken. So what this leads me to believe is that the animations I made in Blender are totally fine, the issue is, I'm assuming, caused by the index of the state. Because anything I plug into states 1-4 will work, but but the exact same state definitions in indexes 5-12 wont work. Any clarification how the state system actually works would be greatly appreciated.