The PokéCommunity Forums

The PokéCommunity Forums (
-   Scripts & Tutorials (
-   -   Essentials script Easy Level Calculator (

Luka S.J. March 16th, 2011 10:41 AM

Easy Level Calculator
Are you making your game with RMXP? Do you have loads of rebattles with the same trainer, where the trainer might have the same Pokemon, but they'd just be a different level? Or do you want to be able to rebattle a trainer, and have their Pokemon become stronger or weaker without creating a new PBS entry? There is a very simple solution for you, and it goes like this. Go to PokemonUtilities script and anywhere (outside a def of course) place the following code:

def pbLevelModifier(type,factor=nil)
  ($ do
  ($ do
    if type=="max"
    elsif type=="avg"
  return level

The way you would use this is as follows: When creating a wild Pokemon Battle

pbWildBattle(species, pbLevelModifier(type,factor))
Where type should either be "max" (to find the highest party level) or "avg" (to find the average party level). Quotation marks around the types are needed! The factor value has to be filled in if wanting to find the maximum level, whereby the max level would be multiplied by the factor percentage (where 0.01 is 1% and 1.00 is 100%)
If you'd like to place it within trainer battles, you'll have to go into PokemonTrainers, and replace


if $game_switches[X]==true

Where the switch X would be your trigger for level calculations. You can play around with the scripts to adjust it any way you want, but this is just a very basic method to return either the maximum level, or the average level.

Cilerba October 27th, 2012 7:23 AM

Going to bump this because it's my fault this was never approved.

mej71 March 16th, 2014 12:17 AM

Could you use this or something similar as a global modifier for all wild battles? I'm working on creating a pokemon game without a traditional storyline, so I'd really like to figure that out

PinkCatDragon March 16th, 2014 1:57 AM

hmm looking at the script it should be easy to add on to wild encounters its just finding the script its under is awkward

mej71 March 16th, 2014 11:54 AM

Figured it out, it actually wasn't that difficult. Just added this in PokemonEncoutersModifiers section

Events.onWildPokemonCreate+=proc {|sender,e|
if $game_switches[100]

The only problem I'm having is that I can't put any number that isn't an integer in the (type,factor) section. Is that something that is fixable?

joeyhugg March 18th, 2014 2:43 PM

I can't locate "level=poke[1]". I did a search with ctrl+shift+f and I didn't find anything.

Luka S.J. March 19th, 2014 4:00 AM


Originally Posted by joeyhugg (Post 8152592)
I can't locate "level=poke[1]". I did a search with ctrl+shift+f and I didn't find anything.

You do realize I've posted this in 2011. It may not correspond with today's Essentials.

venom12 March 19th, 2014 4:17 AM

Because now it is "level=poke[TPLEVEL]"

joeyhugg March 19th, 2014 4:03 PM

The fact that it's outdated might help.

Anyway, thanks, Venom12! It worked perfectly!

All times are GMT -8. The time now is 11:53 AM.

Like our Facebook Page Follow us on Twitter © 2002 - 2015 The PokéCommunity™,
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / Poké
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2015.