Weapon animation not playing via state machine
by Craig Fortune · in Torque Game Engine Advanced · 03/02/2009 (5:44 pm) · 5 replies
I'm having a bit of an odd problem in regards to script state machines at the moment.
I have a state machine for a weapon which has the ability to reload upon a key press. What actually happens is that I empty out the inventory of the ammo for the weapon (hence going to a noAmmo state), and then fill up the inventory with one clip's worth of ammo. (We move onto reload state upon getting ammo when in the noAmmo state).
The issue is, sometimes the reload animation plays and sometimes it doesn't. On the face of it, it seems random and without obvious cause. I'm definitely entering the reload state and definitely staying in it for the full amount of time I expect to. Annoyingly, when I try to debug in Visual Studio, I can't get it to fail to play the reload animation, so I can't even do any useful debugging :S
Anyone suffered similar issues?
I have a state machine for a weapon which has the ability to reload upon a key press. What actually happens is that I empty out the inventory of the ammo for the weapon (hence going to a noAmmo state), and then fill up the inventory with one clip's worth of ammo. (We move onto reload state upon getting ammo when in the noAmmo state).
The issue is, sometimes the reload animation plays and sometimes it doesn't. On the face of it, it seems random and without obvious cause. I'm definitely entering the reload state and definitely staying in it for the full amount of time I expect to. Annoyingly, when I try to debug in Visual Studio, I can't get it to fail to play the reload animation, so I can't even do any useful debugging :S
Anyone suffered similar issues?
#2
03/03/2009 (7:10 am)
Care to elaborate Jaimi? Not quite sure what you are referring to.
#3
Have you made C++ changes? Or is this all in Script?
03/03/2009 (7:21 am)
@Craig - I'm sorry, I'm not saying for sure this is the problem. But whenever someone says it works in the debugger, or it sometimes works and sometimes doesn't, that sounds like classic uninitialized var behavior.Have you made C++ changes? Or is this all in Script?
#4
There are code changes but none related to this, this is all script behaviour, so I can't really see it being an uninitialised variable issue (unless we are looking at an issue in stock Torque...) I'm toying with the idea of it being more of a timing issue somehow. Hitting breakpoints is kind of bypassing the issue or something.
03/03/2009 (9:02 am)
Ah, I read your first posting as referring to a specific uninitialised variable, not in the general sense. :)There are code changes but none related to this, this is all script behaviour, so I can't really see it being an uninitialised variable issue (unless we are looking at an issue in stock Torque...) I'm toying with the idea of it being more of a timing issue somehow. Hitting breakpoints is kind of bypassing the issue or something.
#5
I never did find the cause of the issue I listed above. However, I rewrote the logic behind the reloading scripts to use setManualImageStage (resource on the website somewhere). Seems much tidier this way (although for some reason it feels weird to be manually forcing states rather han letting it "naturally" happen), it works fine too.
03/05/2009 (5:40 pm)
Thought I'd semi-close this thread.I never did find the cause of the issue I listed above. However, I rewrote the logic behind the reloading scripts to use setManualImageStage (resource on the website somewhere). Seems much tidier this way (although for some reason it feels weird to be manually forcing states rather han letting it "naturally" happen), it works fine too.
Associate Jaimi McEntire
King of Flapjacks