Please clarify image states....
by Erik Madison · in Torque Game Engine · 09/30/2002 (6:28 pm) · 12 replies
With lots of value fiddling, I've pretty much got the gist of these down. However, I don't really understand them :) Can anyone clarify the true meanings of these?
stateName[x] stateTransitionOnTimeout[x]
stateTransitionOnNoAmmo[x]
stateTimeoutValue[x]
stateFire[x]
stateRecoil[x]
stateAllowImageChange[x]
stateSequence[x]
stateScript[x]
stateEmitter[x]
stateEmitterTime[x]
(As well as any more available ones)
Also, I see this used a lot, and I'm not quite sure what its doing. Things break if I don't properly use it though...
%obj.setImageAmmo(%slot,false);
And finally, sometimes I need a bit more control over which state I'm currently in. Is there a way to set myself directly to stateName[x] for the next pass?
stateName[x] stateTransitionOnTimeout[x]
stateTransitionOnNoAmmo[x]
stateTimeoutValue[x]
stateFire[x]
stateRecoil[x]
stateAllowImageChange[x]
stateSequence[x]
stateScript[x]
stateEmitter[x]
stateEmitterTime[x]
(As well as any more available ones)
Also, I see this used a lot, and I'm not quite sure what its doing. Things break if I don't properly use it though...
%obj.setImageAmmo(%slot,false);
And finally, sometimes I need a bit more control over which state I'm currently in. Is there a way to set myself directly to stateName[x] for the next pass?
About the author
#2
09/30/2002 (8:10 pm)
Could you post this as a resource? That would be very helpful.
#3
If you have something like this:
Hope that helps.
09/30/2002 (8:35 pm)
Quote:Phil, that's not correct. What that function does is set the Ammo state to true or false, so you know if you have ammo or you don't. But it has nothing to do with the amount of ammo. Basically setting this to false would change the state to NoAmmo, thus disabling any firing... setting it back to true would enable changing to the fire state again.
Also, I see this used a lot, and I'm not quite sure what its doing. Things break if I don't properly use it though...
%obj.setImageAmmo(%slot,false);
// it sets the amount of ammo you have for a given image (usually weapon).
If you have something like this:
stateTransitionOnNoAmmo[2] = "NoAmmo";Then if you do setImageAmmo(%slot, false); when it gets to state "2" it will change to the NoAmmo state.
Hope that helps.
#4
09/30/2002 (11:14 pm)
Thanks everyone!
#5
10/01/2002 (3:03 am)
Hmm, one more question... Do the statenames correspond with the animation names?
#6
10/01/2002 (3:47 am)
Nope
#7
I'm actually working on a weapon reload C++ based..
Do you have any ideas ?
04/09/2003 (3:08 pm)
I'd like to control the states, Do you know to change with a keymap for example, change to another state ?I'm actually working on a weapon reload C++ based..
Do you have any ideas ?
#8
09/13/2003 (8:37 pm)
Is there away to know what an obkect is in? I ask because we want to use the fire button to cause the weapon to deploy when the button is first clicked and then to fire everytime after.
#9
09/13/2003 (10:57 pm)
Is there away to know what an obkect is in? I ask because we want to use the fire button to cause the weapon to deploy when the button is first clicked and then to fire everytime after.
#10
I think you can do this just by creative state machine design. The point of the state machine system is to make it so you don't need to deal with problems like this. :)
09/14/2003 (12:11 am)
Posting the same question twice, two hours apart, is not a wise thing. You'll get your answer regardless of whether you post more than once or not.I think you can do this just by creative state machine design. The point of the state machine system is to make it so you don't need to deal with problems like this. :)
#11
09/14/2003 (7:35 pm)
Sorry about the double post, I have no idea how it happened. I only wrote it once.
#12
09/14/2003 (10:51 pm)
Where can I find a good write up on just how the image states process works, how it is structured, etc?
Torque Owner Phil Carlisle
// The name of "this current" state
stateTransitionOnTimeout[x]
// the name of the state to switch to when the timeoutvalue elapses
stateTransitionOnNoAmmo[x]
// when we run out of ammo, the name of the state to go to
stateTimeoutValue[x]
// how soon to go to the next state
stateFire[x]
// if the state is a "fire" state
stateRecoil[x]
// the amount of recoil if applied
stateAllowImageChange[x]
// does this state allow us to change images
stateSequence[x]
// the sequence number for this state
stateScript[x]
// the script function to call for this state if any
stateEmitter[x]
// any active emitter for this state?
stateEmitterTime[x]
// how long do we emit for?
(As well as any more available ones)
Also, I see this used a lot, and I'm not quite sure what its doing. Things break if I don't properly use it though...
%obj.setImageAmmo(%slot,false);
// it sets the amount of ammo you have for a given image (usually weapon).
And finally, sometimes I need a bit more control over which state I'm currently in. Is there a way to set myself directly to stateName[x] for the next pass?
// there's probably a function to set the current state number.. havent looked at it that recently.
Phil.