View Full Version : [Question] Balanced levels?

March 28th, 2012, 05:30 PM
I read somewhere on the wiki, I think it was in the dungeons section, where you could do something with the scripts to keep the Pokémon at a balanced level with the trainers Pokémon.
Is there a way to do this with trainers?
I want a trainer to have balanced Pokémon with the trainer.
Also, the wiki didn't say how to setup the scripts to allow the ballanced level thing/.

March 29th, 2012, 09:28 AM
The wiki says a lot of things, but doesn't say how easy (or difficult, usually) it would be to do them.

It will be possible to use pbBalancedLevel for trainer Pokémon as well as wild Pokémon, but there's a lot of things to consider (special movesets, possible underlevelled Pokémon, strangely overlevelled unevolved Pokémon, etc. etc.).

For starters, go into the script section PokemonTrainers and find the def pbLoadTrainer (it's right at the top). Find the following lines and change the red one:

for poke in trainer[3]
iv=poke[2]This should set all trainer Pokémon's levels to the weighted mean level of the player's party, plus or minus 2 for randomness.

There's plenty of scope for improving this. When defining the trainer Pokémon, instead of the level you could put a given value which is then added to, say, "pbBalancedLevel-10", so that you have some sort of control over the difficulty of each Pokémon. Alternatively, make the defined level be a minimum level only. You could make the level changing apply only to certain trainers, or only while on certain maps. With a fair amount of effort, you could evolve overlevelled Pokémon (the chance of evolving them increases the more overlevelled they are) - this would allow you to define the Pokémon as the lowest evolutions, and let the scripts take care of evolving them where necessary, which avoids the underlevelled problem. And there's many other ideas too.

You'll need to watch out for trainers that you can rebattle, since it's possible their Pokémon may lose levels if the player changes their party. You'll also need to watch out for min-maxing, to make sure a player doesn't breeze through with one really powerful Pokémon and a stack of Level 2 Pidgeys.

Essentially, what you're doing here is letting the player influence the difficulty of the trainers, and that's open for abuse. You also need to thoroughly make sure the system works well, as I suggested in my "scope for improvement" paragraph.

March 29th, 2012, 11:24 AM
Okay, but what I need is for just 1 or 2 trainers to have balanced levels.
Can I make the balanced thing happen only when, oh say, switch 500 is on?
Also, how can they change the difficulty of the game?
If you have one powerful Pokémon, wouldn't the pidgeys be powerful, not level 2?
I couldn't see the red part of the code, sorry.
I'm that blind dude again.

March 29th, 2012, 12:04 PM
In that case, make the code look like this:

for poke in trainer[3]
level=pbBalancedLevel($Trainer.party)-2+rand(5) if $game_switches[500]
iv=poke[2]Just add in the second "level=" line to the existing code.

pbBalancedLevel returns the weighted mean of the levels of all Pokémon in the party (including eggs) plus 2. That's a mathematical term, and involves calculating the standard deviation of the levels, then weighting each level's contribution to the mean according to the standard deviation, and using those weighted contributions to calculate a weighted mean.

In practice, I don't know how it affects things. I think if there's a big level gap between the Pokémon in your party, the higher-levelled Pokémon make much bigger contributions, so the opposing Pokémon are about as powerful as them (effectively ignoring the weak Pokémon in the player's party). It's something you can try out.

March 30th, 2012, 04:09 PM
I'll check that out.

Okay, It's definitely done something.
I won't know what level it is until someone gets home who can read me the screen (screen readers can't read in the game window)
I set CorruptedJirachi's level to 1, and it definitely wasn't level one.
So, it probably worked, I'll see when they get home.
Thanks so much.