Randomised 3D Decoration Rotation
Credit to Grim Dev for this great little FSM
In this FSM the 3D decoration (a model in .MD3 format) road block has been set with a random variable of 1 to 8, what ever number it lands on it then jumps to that state for example if the random number generated is 3 it will use this JUMPIFEQUALS command > frame 1 0.001 0 0 0 JUMPIFEQUALS ROTVAR 3 STOP3 making it move to
state STOP3 NONE 0
frame 3 0.001 0 0 0 NONE
frame 3 0.001 0 0 0 NONE
setting it to the rotation of that state
This is particularly useful for things like rocks, trees bushes or in this case road blocks to add a new element to the level and a sense that it is not all the same asset even though it is.
image roadblock 0 8 state IDLE NONE 0 frame 1 0.001 0 0 0 NONE frame 1 0.001 0 0 0 SETVAR ROTVAR RANDOM(1,8) frame 1 0.001 0 0 0 JUMPIFEQUALS ROTVAR 1 STOP1 frame 1 0.001 0 0 0 JUMPIFEQUALS ROTVAR 2 STOP2 frame 1 0.001 0 0 0 JUMPIFEQUALS ROTVAR 3 STOP3 frame 1 0.001 0 0 0 JUMPIFEQUALS ROTVAR 4 STOP4 frame 1 0.001 0 0 0 JUMPIFEQUALS ROTVAR 5 STOP5 frame 1 0.001 0 0 0 JUMPIFEQUALS ROTVAR 6 STOP6 frame 1 0.001 0 0 0 JUMPIFEQUALS ROTVAR 7 STOP7 frame 1 0.001 0 0 0 JUMPIFEQUALS ROTVAR 8 STOP8 state STOP1 NONE 0 frame 1 0.001 0 0 0 NONE frame 1 0.001 0 0 0 NONE state STOP2 NONE 0 frame 2 0.001 0 0 0 NONE frame 2 0.001 0 0 0 NONE state STOP3 NONE 0 frame 3 0.001 0 0 0 NONE frame 3 0.001 0 0 0 NONE state STOP4 NONE 0 frame 4 0.001 0 0 0 NONE frame 4 0.001 0 0 0 NONE state STOP5 NONE 0 frame 5 0.001 0 0 0 NONE frame 5 0.001 0 0 0 NONE state STOP6 NONE 0 frame 6 0.001 0 0 0 NONE frame 6 0.001 0 0 0 NONE state STOP7 NONE 0 frame 7 0.001 0 0 0 NONE frame 7 0.001 0 0 0 NONE state STOP8 NONE 0 frame 8 0.001 0 0 0 NONE frame 8 0.001 0 0 0 NONE