• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Pokemon Level Balance Script

1,748
Posts
14
Years
As the title suggests it balances the level of Pokemon. Well to be more precisely; it balances pokemon that the player does not own.

For this script to work you'll need to activate a switch. (Read the comments on how to change the Switch ID)

Code:
################################################################################
# Pokemon Level Balancing
# By Umbreon
################################################################################
# Balances any and all pokemon's levels towards the player's party level.
#
# NOTE: This won't affect any pokemon the player owns.
#
# To use: simply activate Switch Number X
#  (X = the number listed After "Switch = ", default is switch number 37.)
#
#
################################################################################


module LevelBalance
  Switch = 37 # The switch used to activate/deactivate the level balancing
end

class PokeBattle_Pokemon
  
  alias balanced_level_init initialize
  
  def initialize(species,level,player=nil,withMoves=true)
    
    if $game_switches && $game_switches[LevelBalance::Switch] && $Trainer &&
      $Trainer.party.length > 0
      level = pbBalancedLevel($Trainer.party)
    end
    
    balanced_level_init(species, level, player, withMoves)
  end
end
 

Radical Raptr

#BAMFPokemonNerd
1,121
Posts
13
Years
So you're saying that trainers will have pokemon that will change evolutionary lines and moves when this switch is activated?
 
1,748
Posts
14
Years
So you're saying that trainers will have pokemon that will change evolutionary lines and moves when this switch is activated?

No, I'm saying that any Wild/Trainer pokemon you encounter will have a balanced out level of your party.

So basically if you have a party of level 1s your enemy will also have a party of level 1 pokemon.

Pokemon like charizard will not turn into charmander.

But the same logic goes as a charmander will never turn into a charizard from this script.
 

Radical Raptr

#BAMFPokemonNerd
1,121
Posts
13
Years
No, I'm saying that any Wild/Trainer pokemon you encounter will have a balanced out level of your party.

So basically if you have a party of level 1s your enemy will also have a party of level 1 pokemon.

Pokemon like charizard will not turn into charmander.

But the same logic goes as a charmander will never turn into a charizard from this script.

Ah, I thought so, but I saw species and level, and got my hopes up
 
1,748
Posts
14
Years
Ah, I thought so, but I saw species and level, and got my hopes up

You see species there because I made an override onto the initialize script of PokeBattle_Pokemon. (which the initialization takes species, level, trainer, and a bool determining whether or not to add moves to the pokemon)
 
19
Posts
9
Years
  • Age 24
  • Seen Jul 25, 2015
I'm not great at scripting so this may be a question with an obvious answer but could I modify this to just affect wild Pokémon and not trainers?
 
14
Posts
9
Years
  • Age 33
  • Seen Sep 25, 2023
This is a late reply, but...

I'm not great at scripting so this may be a question with an obvious answer but could I modify this to just affect wild Pokémon and not trainers?
You can actually already do this in version 13 without adding a new script. Look in PokemonEncounterModifiers, and find the following code, in the bottom of the script section:

Code:
#Events.onWildPokemonCreate+=proc {|sender,e|
   pokemon=e[0]
   if $game_map.map_id==51
     pokemon.level=pbBalancedLevel($Trainer.party) - 4 + rand(5)   # For variety
     pokemon.calcStats
     pokemon.resetMoves
   end
}

Change map_id (in this case "51") to any map number where you want the script to apply.

You could use an array to make it apply to multiple maps, for example:
Code:
   if $game_map.map_id==[22,33,51]

Or, of course, you could just make it apply to all wild pokémon everywhere.

Anyway, you can also change "pbBalancedLevel" to "pbTopLevel" if you want the wild pokémon to be based the highest level in the player's party, and not the average level. That works better, in my opinion. (You'd need to have a little more setup to make that work right, though.)
 
Last edited:
19
Posts
9
Years
  • Age 24
  • Seen Jul 25, 2015
This is a late reply, but...


You can actually already do this in version 13 without adding a new script. Look in PokemonEncounterModifiers, and find the following code, in the bottom of the script section:

Code:
#Events.onWildPokemonCreate+=proc {|sender,e|
   pokemon=e[0]
   if $game_map.map_id==51
     pokemon.level=pbBalancedLevel($Trainer.party) - 4 + rand(5)   # For variety
     pokemon.calcStats
     pokemon.resetMoves
   end
}

Change map_id (in this case "51") to any map number where you want the script to apply.

You could use an array to make it apply to multiple maps, for example:
Code:
   if $game_map.map_id==[22,33,51]

Or, of course, you could just make it apply to all wild pokémon everywhere.

Anyway, you can also change "pbBalancedLevel" to "pbTopLevel" if you want the wild pokémon to be based the highest level in the player's party, and not the average level. That works better, in my opinion. (You'd need to have a little more setup to make that work right, though.)

Could I make it depend on a variable? The game I'm making allows you to challenge any of the gym leaders in any order, and the game should balance itself around how many badges you have. Is there any way I can achieve this without too much modification to the scripts?
 

Bowlstir

Media Arts and Game Development
199
Posts
16
Years
Thanks a lot mate.

Works great.
=====
 
Last edited:
10
Posts
8
Years
  • Age 31
  • Seen Apr 27, 2016
thanks for the script! i've created this version:
Code:
module LevelBalance
  Switch = 81 # The switch used to activate/deactivate the level balancing
end

class PokeBattle_Pokemon
  
  alias balanced_level_init initialize
  
  def initialize(species,level,player=nil,withMoves=true)
    
    if $game_switches && $game_switches[LevelBalance::Switch] && $Trainer &&
      $Trainer.party.length > 0
      #level = pbBalancedLevel($Trainer.party) #original version
      level = $Trainer.numbadges*10+ rand(5)
    end
    
    balanced_level_init(species, level, player, withMoves)
  end
end

levels are balanced around the number of badges!
 
1
Posts
6
Years
  • Age 30
  • Seen Mar 18, 2022
Hey there, if you dont mind, where exactly do I add this piece of script? Do i plug it in above "main", add it in with "pfield_encountermodifiers", or somewhere in "NPC_Trainers"?
 
15
Posts
7
Years
Is it also possible to balance your party to your encounter? Like i have a charizard lvl 55 but i fight a trainer with a lvl5 pokemon my char izard will be lvl 5 also?
 

WolfPP

Spriter/ Pixel Artist
1,309
Posts
5
Years
Is it also possible to balance your party to your encounter? Like i have a charizard lvl 55 but i fight a trainer with a lvl5 pokemon my char izard will be lvl 5 also?

No. If you have a charizard lvl 55 and fight to a trainer with a lvl 5 pokemon, that pokemon will be a lvl 50~60.

Your PT lvl dont be affect by that script. Only lvl to wild encounter and trainers battle.

EDIT:

So, take a look to that script, its a little better:
https://www.pokecommunity.com/showthread.php?t=409828
 
Last edited:
5
Posts
6
Years
  • Age 28
  • Seen Mar 3, 2021
So I know this thread is old, but maybe someone can still help me. I'm essentially trying to get this script, but with something added to evolve the pokemon as well. I tried the one by Joltik, however it doesn't quite meet my needs. I like the balancing this script gives more. Any help would be appreciated
 
Back
Top