state after attack not applying correctly

I have 10 possible states that the skill will randomly choose after the skill is performed...Problem is that one is not always applied.  Some times none will apply but then I can go 5 or 6 times in a row and the states will apply or reapply (if applicable).  I am asking if someone can see what is wrong with the (follow action) sequence and explain why isn't working the way I have intended.  I have copied all 10 states (for the moment they are the same one) , just a different icon for each to test if applying correctly.  Any help is very much appreciated.  Thank you.


I am using Yanfly Battle Core, asq 1 2 and 3, and Buff and States Core.


For some reason it likes state 69 the best...applies about 50% of the time vs all the others.


<setup action>


immortal: targets, true


camera focus: user


zoom: 150%, 30


wait for zoom


opacity not focus: 0, 60


wait for opacity


</setup action>


<target action>


camera focus: target


zoom: 120%, 30


wait for zoom


motion swing: user


action animation


camera focus: user


move user: target, front center, 10


wait: 5


move user: target, back center, 10


action effect


wait: 10


opacity user: 0%


wait: 10


opacity user: 20%


wait: 10


opacity user: 40%


wait: 10


opacity user: 70%


wait: 10


motion swing: user


move user: target, front base, 10


face user: backward


action effect


wait: 7


jump user: 150%, 15


face user: forward


action effect


move user: target, front center, 15


wait: 7


motion swing: user


move user: target, back base, 5


wait: 7


action effect


motion swing: user


face user: backward


move user: target, back center, 5


wait: 7


action effect


motion swing: user


face user: forward


move user: target, front center, 5


wait: 7


action effect


motion swing: user


face user: backward


action effect


move user: target, back head, 5


wait: 7


action effect


motion swing: user


face user: forward


move user: target, front base, 5


wait: 7


action effect


motion swing: user


face user: backward


move user: target, back center, 5


wait: 7


action effect


motion swing: user


face user: forward


move user: target, front head, 5


wait: 7


action effect


motion swing: user


face user: backward


move user: target, back base, 5


wait: 7


action effect


motion swing: user


face user: forward


move user: target, front center, 5


wait: 7


action effect


motion swing: user


face user: backward


move user: target, back center, 5


wait: 7


action effect


motion swing: user


face user: forward


move user: target, front center, 5


wait: 7


action effect


motion swing: user


face user: backward


move user: target, back center, 5


wait: 7


action effect


motion thrust: user


face user: forward


move user: target, front center, 10


wait: 7


action effect


move user: target, back center, 5


wait: 10


opacity user: 40%


wait: 5


opacity user: 20%


face user: forward


wait: 5


opacity user: 0%


wait: 30


opacity user: 30%


wait: 3


opacity user: 60%


motion thrust: user


wait: 5


action effect


move user: target, front center, 5


wait: 20


opacity user: 80%


wait: 5


opacity user: 100%


action effect


jump user: 100, 40


move user: return, 40


motion escape: user


wait for movement


immortal: target, false


action effect


clear battle log


perform finish


wait for movement


camera reset


opacity not focus: 100%, 60


wait for opacity


</target action>


<follow action>


if (Math.randomInt(99) < 10)


add state 67: target


else if (Math.randomInt(99) < 20)


add state 68: target


else if (Math.randomInt(99) < 30)


add state 69: target


else if (Math.randomInt(99) < 40)


add state 70: target


else if (Math.randomInt(99) < 50)


add state 71: target


else if (Math.randomInt(99) < 60)


add state 72: target


else if (Math.randomInt(99) < 70)


add state 73: target


else if (Math.randomInt(99) < 80)


add state 74: target


else if (Math.randomInt(99) < 90)


add state 75: target


else


add state 76: target


end


</follow action>
I don't know why NO state is being applied sometimes (check and make sure that ALL states from 67 to 76 have an icon and an appropriate number of Turns in the Auto Removal settings), but I can definitely see why some states are being "preferred" over others.  You are having the system choose a new Random Integer for each check, meaning that it can pick, for example, 92, then 56, then 5, and that will cause State 69 to be applied because 5 is less than 30.  States 69 and 70 will be the most commonly applied states (at just over 20% each if you run it enough times).  State 75 will be the least picked (at about 1%).


If this plug-in's syntax allows you to do so, set a variable equal to the Math.randomInt (var pick = Math.randomInt(99) ) and then compare your variable to the different numbers ( else if pick < 60) ), which will give you roughly a 10% chance to apply any given state.

Original thread: https://forums.rpgmakerweb.com/threads/state-after-attack-not-applying-correctly.59676/