MV Randomize Enemy Starting States

Ok, I'm probably overlooking something obvious but I can't figure this out.

I am trying to implement a system in my game that is similar to the Pokemon Nature system. I am aware of SumRandomDudes Natures plugin but it does not work for enemies and since it's not applying a state it's a lot harder to reference in battle in the damage formula, action sequences, etc.

For those unaware of how the Pokemon Nature system works, it adds one of many states to each actor and enemy. These states boost one stat and lower another. For example, the Bold state raises defense and lowers Attack. This allows enemies to be a bit different from one another.

So what I need is a way to randomize the state an enemy has by pulling the state from a pool of states.

I know I can use Yanfly's Swap Enemies Plugin, but I don't want to have to make 12 copies for each enemy.

I think creating a troop event on turn 0 with Yanfly's Base Troop Events Plugin may be a starting place, but I'm not sure how to randomize the state I'm adding for each enemy in battle.

Any answers, plugins, workarounds, or alternative solutions would be greatly appreciated!
control variable to create a random number, followed by conditional branch to check which number and assign different states based on the result.

place that in your turn 0 event and it will work - it's just tedious to create the long lists of conditional branches for every actor and enemy in that event.
Ok, I'm probably overlooking something obvious but I can't figure this out.

I am trying to implement a system in my game that is similar to the Pokemon Nature system. I am aware of SumRandomDudes Natures plugin but it does not work for enemies and since it's not applying a state it's a lot harder to reference in battle in the damage formula, action sequences, etc.

For those unaware of how the Pokemon Nature system works, it adds one of many states to each actor and enemy. These states boost one stat and lower another. For example, the Bold state raises defense and lowers Attack. This allows enemies to be a bit different from one another.

So what I need is a way to randomize the state an enemy has by pulling the state from a pool of states.

I know I can use Yanfly's Swap Enemies Plugin, but I don't want to have to make 12 copies for each enemy.

I think creating a troop event on turn 0 with Yanfly's Base Troop Events Plugin may be a starting place, but I'm not sure how to randomize the state I'm adding for each enemy in battle.

Any answers, plugins, workarounds, or alternative solutions would be greatly appreciated!
I Think you could use yanfly buff and states core for this...
first create a "placeholder" state that you will apply to all the enemy at turn 0... (you can also use yanfly base troop event if you're lazy to add the event command to each troop)
then at that "placeholder" state give notetags that do something when that state applied
using the lunatic mode notatags
let's say you have 6 nature type stored as
state 71 - Stupid
state 72 - Lazy
state 73 - Brave
state 74 - Wise
state 75 - Smelly
state 76 - Gloomy
Code:
<Custom Apply Effect>
var rnum = Math.floor(Math.random() * 6) + 1;
if (rnum == 1) user.addState(71);
if (rnum == 2) user.addState(72);
if (rnum == 3) user.addState(73);
if (rnum == 4) user.addState(74);
if (rnum == 5) user.addState(75);
if (rnum == 6) user.addState(76);
</Custom Apply Effect>

explaination
the number of nature you have is in the
Code:
...
var rnum = Math.floor(Math.random() * 6) + 1;
...
just change 6 to any number you want...

BUT don't forget to add the conditional and stateId pair for each new nature you have
Code:
...
if (rnum == 7) user.addState(77);
if (rnum == 8) user.addState(78);
and so on until all nature covered...
...

i did not tested it though... sorry if there's mistake 😀... since i did not have access to yanfly plugin at the moment in my laptop.
hope this help.
Code:
<Custom Apply Effect>
var rnum = Math.floor(Math.random() * 6) + 1;
if (rnum == 1) user.addState(71);
if (rnum == 2) user.addState(72);
if (rnum == 3) user.addState(73);
if (rnum == 4) user.addState(74);
if (rnum == 5) user.addState(75);
if (rnum == 6) user.addState(76);
</Custom Apply Effect>
If all the states are together like that, I'd simplify it even more.
JavaScript:
<Custom Apply Effect>
var rnum = Math.floor(Math.random() * 6) + 71; //assuming 71 is the first such state.
user.addState(rnum);
</Custom Apply Effect>
Shouldn't need any branches that way.
Moved to: Plugin Requests

Game Mechanics Design is for discussion of mechanics, not for getting help actually implementing them.
If all the states are together like that, I'd simplify it even more.
JavaScript:
<Custom Apply Effect>
var rnum = Math.floor(Math.random() * 6) + 71; //assuming 71 is the first such state.
user.addState(rnum);
</Custom Apply Effect>
Shouldn't need any branches that way.
yes if the state in the straight order that will do 😀...
above code will be using state 71 - 76
if you want to use state 71 - 82 (12 type of nature) just change *6 to *12
hope this help
yes if the state in the straight order that will do 😀...
above code will be using state 71 - 76
if you want to use state 71 - 82 (12 type of nature) just change *6 to *12
hope this help
Thank you so much! This worked perfectly!

Original thread: https://forums.rpgmakerweb.com/threads/randomize-enemy-starting-states.134456/