Help! Random States in Damage Formula or Yanfly Buff/state Core

hi im trying to create a curse skill that randomly picks 1 out of 6 types of states. but im having trouble with it. none of my code works in the damage formula box. 


example.


x = Math.floor(Math.randomInt(6) + 1); x = 1 b.addState(2); x = 2 b.addState(3);  x = 3 b.addState(4);  x = 4 b.addState(5);  x = 5 b.addState(6);  x = 6 b.addState(7);


no errors but no state is applied. the code to me looks right but maybe its syntax got wrong idk. please help.


ive also tried using yanfly's buff state core using lunatic mode. but it pops up error messages when i enter a similiar but slighty different code then above.
Are you using if statements?  If not, that's the problem.  It's hard to determine much without seeing the code you used.  Post the lunatic mode code you used and maybe we can figure out the problem.
That code doesn't look right to me, because no matter what, you never used the x if that is exactly the code you placed, because all x is used in are assignments, there isn't a single if or any comparison using x (which would be x===2, not x=2)


That said, why using X at all?


b.addState(Math.floor(Math.randomInt(6) + 1));


Such a code will require you to have the states in a consequitive ID-sequence in the database, but ordering them is easier than placing half a dozen if-sequences in the damage formula.
thank you ANDAR!!! that code works like a charm!


b.addState(Math.floor(Math.randomInt(6) + 1));


I spent hours trying to figure this out.
if anyone wants the code for it. this skill i  call "Plague". it inflicts 5 types of states at random. and hits all enemies.


x = Math.floor(Math.randomInt(5) + 1); if (x === 1) {b.addState(46);} if (x === 2) {b.addState(47);} if (x === 3) {b.addState(49);} if (x === 4) {b.addState(50);} if (x === 5) {b.addState(51);}


im having so much fun with Math.randomInt here's another skill called, "Roulette". it adds a random multiplier with luck as its base damage type from 1-100 minus 0-25 of enemies luck stat. very fun skill to use. 


a.luk * (Math.floor(Math.randomInt(100) + 1)) - b.luk * (Math.floor(Math.randomInt(25)));

Original thread: https://forums.rpgmakerweb.com/threads/help-random-states-in-damage-formula-or-yanfly-buff-state-core.73522/