Is there a way to manually change an image's state? For instance, say I have a spear equipped. Here's it's state code for reference:
datablock ShapeBaseImageData(spearImage)
{
...
stateName[0] = "Activate";
stateTimeoutValue[0] = 0.1;
stateTransitionOnTimeout[0] = "Ready";
stateSequence[0] = "ready";
stateSound[0] = weaponSwitchSound;
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Charge";
stateAllowImageChange[1] = true;
stateName[2] = "Charge";
stateTransitionOnTimeout[2] = "Armed";
stateTimeoutValue[2] = 0.7;
stateWaitForTimeout[2] = false;
stateTransitionOnTriggerUp[2] = "AbortCharge";
stateScript[2] = "onCharge";
stateAllowImageChange[2] = false;
stateName[3] = "AbortCharge";
stateTransitionOnTimeout[3] = "Ready";
stateTimeoutValue[3] = 0.3;
stateWaitForTimeout[3] = true;
stateScript[3] = "onAbortCharge";
stateAllowImageChange[3] = false;
stateName[4] = "Armed";
stateTransitionOnTriggerUp[4] = "Fire";
stateAllowImageChange[4] = false;
stateName[5] = "Fire";
stateTransitionOnTimeout[5] = "Ready";
stateTimeoutValue[5] = 0.5;
stateFire[5] = true;
stateSequence[5] = "fire";
stateScript[5] = "onFire";
stateWaitForTimeout[5] = true;
stateAllowImageChange[5] = false;
stateSound[5] = spearFireSound;
};
Say I am in middle of the Charge state. How could I cut the Charge state short, and skip to the Fire state?
To contextualize my inquiry, I am trying to create an image which can have variable delay. The idea is to have a function that is called before the Charge state which schedules another function which will switch to the Fire state. To vary the delay, I would simply change the delay in the aforementioned state-switching function.
My current solution is to have several copies of the same image with different stateTimeoutValues. For different delays, I switch out different images. But this is very cumbersome, and makes adjusting the delay via preferences even more cumbersome. It is not an ideal solution, so I want to explore this option.