• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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.

Easy Level Calculator

Luka S.J.

Jealous Croatian
  • 1,270
    Posts
    16
    Years
    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:
    Code:
    def pbLevelModifier(type,factor=nil)
      @levels=[]
      i=0
      ($Trainer.party.length).times do
        @levels.push($Trainer.party[i].level)
        i+=1
      end
      
      @[email protected]
      @sum=$Trainer.party[0].level
      
      i=1
      ($Trainer.party.length-1).times do
        @sum+=$Trainer.party[i].level
        i+=1
      end
      
      @averagelevel=@sum/($Trainer.party.length)
      
        if type=="max"
          level=@maxlevel*factor
        elsif type=="avg"
          level=@averagelevel
        end
      return level
    end
    The way you would use this is as follows: When creating a wild Pokemon Battle
    Code:
    pbWildBattle(species, pbLevelModifier([B]type[/B],[B]factor[/B]))
    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
    Code:
        level=poke[1]
    by
    Code:
    if $game_switches[[b]X[/b]]==true
        level=pbLevelModifier([B]type[/B],[B]factor[/B])
      else
        level=poke[1]
      end
    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.
     
    Going to bump this because it's my fault this was never approved.
     
    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
     
    Figured it out, it actually wasn't that difficult. Just added this in PokemonEncoutersModifiers section

    Spoiler:


    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?
     
    I can't locate "level=poke[1]". I did a search with ctrl+shift+f and I didn't find anything.
     
    Because now it is "level=poke[TPLEVEL]"
     
    The fact that it's outdated might help.
    ._.

    Anyway, thanks, Venom12! It worked perfectly!
     
    Back
    Top