Luka S.J.

Jealous Croatian

Age 26
Male
Croatia
Seen 6 Days Ago
Posted 6 Days Ago
1,142 posts
10.7 Years
If you're still looking for explanation, I've added some comments and fixed up parts of your code from two posts above this one
# indenting your code will not only clean it up visually, but allow you to
# more easily identify which parts of the code belong to which block of
# logic
Events.onWildPokemonCreate += proc{|sender,e|
  pokemon = e[0]
  if $game_switches[89]
    if pbBalancedLevel($Trainer.party) <= 20
      newlevel = pbBalancedLevel($Trainer.party) + 5
      newlevel = 1 if newlevel < 1
    elsif pbBalancedLevel($Trainer.party) <= 30
      newlevel = pbBalancedLevel($Trainer.party) + 7
    elsif pbBalancedLevel($Trainer.party) <= 40
      newlevel = pbBalancedLevel($Trainer.party) + 9
    elsif pbBalancedLevel($Trainer.party) <= 60
      newlevel = pbBalancedLevel($Trainer.party) + 12
    elsif pbBalancedLevel($Trainer.party) <= 80
      newlevel = pbBalancedLevel($Trainer.party) + 15
    else
      newlevel = pbBalancedLevel($Trainer.party) + 20
    # newlevel = PBExperience::MAXLEVEL if newlevel > PBExperience::MAXLEVEL
      # the Pokemon levels and stats will only get calculated in this branch
      # of the conditional statement, hence they will not be applied if your
      # other conditions are met. You want to take this out of here
      # and apply it post the conditional branch
    # pokemon.level = newlevel
    # pokemon.calcStats
    # pokemon.resetMoves
    end
    newlevel = PBExperience::MAXLEVEL if newlevel > PBExperience::MAXLEVEL
    pokemon.level = newlevel
    pokemon.calcStats
    pokemon.resetMoves
    # as Vendily mentioned the '=' operator assigns whatever value is defined
    # on the right side to the variable on the left
  # if pokemon.species = 212
    # hence your if statement here is incorrect, as you should be checking
    # whether or not the two variables are of equal value
    # you do this with the '==' operator (don't miss out on the double equals sign)
    # so your condition should look like the following
    if pokemon.species == 212
      pokemon.pbLearnMove(:METALCLAW)
      pokemon.pbLearnMove(:ICEPUNCH)
      pokemon.pbLearnMove(:THUNDERPUNCH)
    end
  end
}