Author Topic: Key-Press Other Mounted Image Sequence  (Read 1011 times)

Imagine I mounted a cape to my backslot. I want this cape to play certain sequences during key presses such as spacebar,shift,etc. I know I can "loop" a sequence or play through a series of them using weapon states and transition on timeout, but it appears only models in the handslot 0 animate via trigger?

How would I go about telling a mounted image not in the hand slot to play its script? (such as onFire, onReady, etc) or would I have to manually add sequences to the shape and use playThread?


setImageAmmo(slot, 0 or 1) can cause stateTransitionOnAmmo and stateTransitionOnNoAmmo. Idle --(onAmmo)--> Animate --(onTimeout)--> Idle would keep looping while Ammo is set. There's another pair of transitions used with setImageLoaded for more complicated branching.

Functions are triggered by entering a state with e.g. stateScript[1] = "onReady", just being named "Ready" won't work.

you can also use setImageTrigger(slot,bool) but you might want to create several sets of states for ammo checks

There's another pair of transitions used with setImageLoaded for more complicated branching.

Functions are triggered by entering a state with e.g. stateScript[1] = "onReady", just being named "Ready" won't work.
I understand the function is called when the state is triggered. I never thought to try and manipulate the ammo state though. What is the other pair of transitions used with setImageLoaded? (onImageLoaded, onImageDone) ?

you can also use setImageTrigger(slot,bool) but you might want to create several sets of states for ammo checks
THANK YOU!! You guys are the best

Code: [Select]
stateName[0] = "Check1A";
stateScript[0] = "onCheck1";
stateTimeoutValue[0] = 0.01;
stateTransitionOnTimeout[0] = "Check1B";

stateName[1] = "Check1B";
stateTransitionOnAmmo[1] = "Cape_Crouch";
stateTransitionOnNoAmmo[1] = "Check2A";

stateName[2] = "Check2A";
stateScript[2] = "onCheck2";
stateTimeoutValue[2] = 0.01;
stateTransitionOnTimeout[2] = "Check2B";

stateName[3] = "Check2B";
stateTransitionOnAmmo[3] = "Cape_Jump";
stateTransitionOnNoAmmo[3] = "Cape_Idle";
};

function capeImage::onCheck1(%db,%pl,%slot)
{
     if(crouching)
       %pl.setImageAmmo(%slot,1);
     else
       %pl.setImageAmmo(%slot,0);
}
function capeImage::onCheck2(%db,%pl,%slot)
{
     if(inAir)
       %pl.setImageAmmo(%slot,1);
     else
       %pl.setImageAmmo(%slot,0);
}