MV Having a random state problem.

so a while ago i snagged a snippet from somewhere else for a skill i wanted. the idea is, it will always give a state, but only one, randomly chosen from a number of them.

<Pre-Damage Eval> var rr = Math.floor(1 + Math.random() * 3); if(rr==1){ b.addState(1); } if(rr==2){ target.addState(2); } if(rr==3){ target.addState(3); } </Pre-Damage Eval>

looks a lot like that, though it was after damage eval, i think. point is... i'm not getting any states.

i've even gone so far as to drop it to just target.addState(1);, i've used b.addState(1); as well to see if it'll kill things, but it won't.

consider i have access to all yanfly plugins, but i'm using battleenginecore, buffs&states, damagecore, skillcore, and i think that's all the relevant ones.

this is really turning my brain to jelly, if anyone can tell me what i'm missing, or has any suggestions ;-;

no, no one has any resistance to knockout that i'm aware of,
First, a basic question:

Does the skill deal damage e.g. does it have anything in the damage formula?
Pre-Damage and Post-Damage Notetags won't work without a damage formula.

You'd use Before Eval and After Eval instead.

Also as a side-note;
I would refrain from using state 1 as that one is reserved for the death-state.
Unless of course, that's what you want. Edit: okay after reading again that seems to be your intention


Edit: This is how I would do it:

<After Eval>
var random = Math.randomInt(3)+1;
if (random==1) {target.addState(1);}
if (random==2) {target.addState(2);}
if (random==3) {target.addState(3);}
</After Eval>

In your very specific scenario, a short notetag like this should also work:

<After Eval>
target.addState(Math.randomInt(3)+1);
</After Eval>
i've tried <after eval> too. and sadly, no, all of the states it could add are not in order.

Spoiler: Skill
1648947484678.png
Spoiler: state
1648947531696.png
Spoiler: plugins
1648947636347.png
1648947668899.png

and Enemy Book

absolutely at a loss x.x

Original thread: https://forums.rpgmakerweb.com/threads/having-a-random-state-problem.146380/