Wondering if there's a way to randomize enemy parameters at the beginning of a battle.
Randomizing enemy stats
RPG Maker MV SupportHave a troop event that adds a random value into each stat based on the value of another variable - which determines how far int he game you are. done. 🙂
The script code within the aforementioned event might look like this:
The script code within the aforementioned event might look like this:
Code:
var id = 0;var val = 50; $gameTroop.members(1).addParam(id, val);
So my understanding of this would be:
- Var id = 0;
- Will be the RNG variable?
- How would this work if I want multiple stats randomized but not increased by the same amount?
- Var val = 50;
- It can only go up to 50?
- I'm assuming it can be a range starting from a negative number, right? If so, then I cut a few stats down so I don't have enemies that are too strong?
The id variable would be for the id of the stat, 0 is mhp, 1 is mmp, 2 is atk and so on.. The value of 50, is purely a randomized value I chose for this example, it could be higher, or lower (even negative, yes)
Thank you Dark Dekita, but I get Undefined is not an option.
I dont have Mv opened or anything atm, working on another project entirely. Its likely a problem with how the troop member is selected, cause i wasnt sure of that syntax.
Let me know when you get around to it.
Sorry I just correct the random value
I didn't tried his solution
I will figured the solution after the work 😉
EDIT:
var id = Math.randomInt(X)
var val = Math.randomInt(Y)
$gameTroop.members()[id].addState(val);
X for enemies number
Y for How many state you have
rJust adds status effects
I'm sorry, but could you explain this as in what I modify for each enemy and stat?
before that there is two questions
1- which parameters you want randomize?
2- you want it for all enemies or random enemy or single enemy?
For all enemies and parameters.
Edit:
Deleted post. Example I went with did not align up sufficiently with what OP was looking for.
Deleted post. Example I went with did not align up sufficiently with what OP was looking for.
I would rather add random numbers than a percentage as lower numbers won't result to much while higher numbers increase exponentially. Each enemy will have randomized stats.
No problemo. I got the wrong idea. Maybe you could post a mockup of an enemies stats. And how you would like them to be affected?
I was under the impression that you wanted a way to change them for positive or negative but remaining close enough to the original stat so as to not cause to much flux. (20% + or -) such as in the example with the HP (100 HP as the base stat. In battle it would be between 80 and 120 due to the 20% variance).
I'll update my comment as I mentioned so that they can focus on what you're trying to achieve.
I was under the impression that you wanted a way to change them for positive or negative but remaining close enough to the original stat so as to not cause to much flux. (20% + or -) such as in the example with the HP (100 HP as the base stat. In battle it would be between 80 and 120 due to the 20% variance).
I'll update my comment as I mentioned so that they can focus on what you're trying to achieve.
try this in troop event
for (var i = 0; i < $gameTroop.members().length; i++) {
var val = Math.randomInt(X);
var id = Math.randomInt(8);
$gameTroop.members().addParam(id, val);
}
X for the maximum number you want add
for (var i = 0; i < $gameTroop.members().length; i++) {
var val = Math.randomInt(X);
var id = Math.randomInt(8);
$gameTroop.members().addParam(id, val);
}
X for the maximum number you want add
Ah perfect. If I may make one more request though, it's that I know how to start at 2 for attack. What if I wanted the HP range to be higher? var "i" would = 0, but where do I go from there?
Original thread: https://forums.rpgmakerweb.com/threads/randomizing-enemy-stats.52375/