Advertiser Content
Seen 2 Weeks Ago
Posted 2 Weeks Ago
51 posts
67 Days
Hello everyone it's me again!

I made this code copying the existing one so I can have a wild encounter adapting to my pokes level but with higher lvl (used for bosses). Then I wanted to add that if the encounter is a SCIZOR then it should learn some moves (because depending on the level it will be defied I'm afraid it has only bad moves).

Events.onWildPokemonCreate+=proc {|sender,e|
pokemon=e[0]
if $game_switches[89]
newlevel=pbBalancedLevel($Trainer.party) + 2 + rand(5)
newlevel=1 if newlevel<1
newlevel=PBExperience::MAXLEVEL if newlevel>PBExperience::MAXLEVEL
pokemon.level=newlevel
pokemon.calcStats
pokemon.resetMoves
end
if pokemon.species=[212]
pokemon.pbLearnMove(:VOLTTACKLE)
pokemon.pbLearnMove(:THUNDER)
pokemon.pbLearnMove(:FLAMETHROWER)
pokemon.pbLearnMove(:TACKLE)


end
}
This is the error I get:
---------------------------
Pokemon Essentials
---------------------------
[Pokémon Essentials version 17]

Exception: RuntimeError

Message: Script error within event 27 (coords 30,4), map 127 (Forêt):

Exception: TypeError

Message: MiscData:165:in `-'cannot convert Fixnum into Array

***Full script:

pbWildBattle(:SCIZOR,5,1,false,true)

Interpreter:243:in `pbExecuteScript'

MiscData:165:in `pbDexDataOffset'

PokeBattle_Pokemon:144:in `growthrate'

PokeBattle_Pokemon:123:in `level'

PokeBattle_Battler:209:in `__shadow_pbInitPokemon'

Pokemon_ShadowPokemon:525:in `pbInitPokemon'

PokeBattle_Battler:510:in `pbInitialize'

PokeBattle_Battle:2364:in `pbStartBattleCore'

PokeBattle_Battle:2340:in `pbStartBattle'

PField_Battles:98:in `pbWildBattle'



Interpreter:276:in `pbExecuteScript'

Interpreter:794:in `command_111'

Interpreter:320:in `execute_command'

Interpreter:193:in `update'

Interpreter:106:in `loop'

Interpreter:198:in `update'

Scene_Map:161:in `follow_update'

Scene_Map:159:in `loop'

Scene_Map:168:in `follow_update'

Follow:1551:in `update'


I don't understand which fix number is trying to be converted into array. Thanks in advance

Vendily

Female
Seen 9 Hours Ago
Posted 4 Days Ago
896 posts
4 Years
the botched line is this here
pokemon.species=[212]
instead of checking if the species is equal to 212, you've set it to an array containing 212. this breaks basically everything.
pokemon.species==212 is what you're looking for.
though you may want to move that whole if block inside the other one, else it'll always set all 212's to have the same moveset.

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 2 Hours Ago
Posted 3 Hours Ago
628 posts
335 Days
Well, i made this (item, ability, EV and IV included. Also, to trigger you need to put Switch Number 100 ON):
Spoiler:

# Used in the form>0
Events.onWildPokemonCreate+=proc {|sender,e|
   pokemon=e[0]
   if $game_switches[100] #Switch Number
     #pokemon.hp=((pokemon.totalhp/2)-5).ceil
     #pokemon.setAbility(2)
     pokemon.iv=[0,0,0,0,0,0]
     pokemon.ev=[0,0,0,0,0,0]
     #pokemon.form=1
     #pokemon.pbLearnMove(:TACKLE)
     #pokemon.pbLearnMove(:PLAYROUGH)
     #pokemon.pbLearnMove(:HEADBUTT)
     #pokemon.pbLearnMove(:OUTRAGE)
     if isConst?(pokemon.species,PBSpecies,:KYUREM)
       pokemon.form=1
     elsif isConst?(pokemon.species,PBSpecies,:GARDEVOIR)
       pokemon.form=1
       pokemon.pbLearnMove(:SUBSTITUTE)
     elsif isConst?(pokemon.species,PBSpecies,:CHARIZARD)
       pokemon.form=2
       pokemon.item=getConst(PBItems,:CHARIZARDITEY)
     elsif isConst?(pokemon.species,PBSpecies,:VENUSAUR)
       pokemon.form=1
       pokemon.item=getConst(PBItems,:VENUSAURITE)
     elsif isConst?(pokemon.species,PBSpecies,:ZOROARK)
       pokemon.form=1
       pokemon.item=getConst(PBItems,:ZOROANITE)
     elsif isConst?(pokemon.species,PBSpecies,:KYOGRE)
       pokemon.form=1
       pokemon.item=getConst(PBItems,:BLUEORB)
     #else
     end
   end
}
Seen 2 Weeks Ago
Posted 2 Weeks Ago
51 posts
67 Days
That is really usefull thank you.
I have a new problem with this code. I wanted to add that depending on the balanced party level the difference in level with the new encounter increases. For an unknown reason the level is not modified at all anymore. I don't understand where the error is (I don't get any error message, the level stays 5 if it's 5 in the event). (Ichecked that the switch was on using debug)
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
pokemon.level=newlevel
pokemon.calcStats
pokemon.resetMoves
end
if pokemon.species=212
pokemon.pbLearnMove(:METALCLAW)
pokemon.pbLearnMove(:ICEPUNCH)
pokemon.pbLearnMove(:THUNDERPUNCH)
end
end

}
Seen 2 Weeks Ago
Posted 2 Weeks Ago
51 posts
67 Days
I fixed it with this code if someone is interested by this.

if $game_switches[89] and if pbBalancedLevel($Trainer.party)>1
newlevel=pbBalancedLevel($Trainer.party) + 1
if pbBalancedLevel($Trainer.party)>10
newlevel=pbBalancedLevel($Trainer.party) + 2
end
if pbBalancedLevel($Trainer.party)>20
newlevel=pbBalancedLevel($Trainer.party) + 4
end
if pbBalancedLevel($Trainer.party)>30
newlevel=pbBalancedLevel($Trainer.party) + 6
end
if pbBalancedLevel($Trainer.party)>40
newlevel=pbBalancedLevel($Trainer.party) + 8
end
if pbBalancedLevel($Trainer.party)>50
newlevel=pbBalancedLevel($Trainer.party) + 10
end
if pbBalancedLevel($Trainer.party)>60
newlevel=pbBalancedLevel($Trainer.party) + 12
end
if pbBalancedLevel($Trainer.party)>70
newlevel=pbBalancedLevel($Trainer.party) + 14
end
if pbBalancedLevel($Trainer.party)>80
newlevel=pbBalancedLevel($Trainer.party) + 16
end
if pbBalancedLevel($Trainer.party)>90
newlevel=pbBalancedLevel($Trainer.party) + 10
end
end
newlevel=PBExperience::MAXLEVEL if newlevel>PBExperience::MAXLEVEL
pokemon.level=newlevel
I don't know why the previous code didn't work so if someone has an idea it would make me happy :)

Luka S.J.

Jealous Croatian

Age 26
Male
Croatia
Seen 3 Days Ago
Posted 3 Days Ago
1,136 posts
10.6 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
}
Advertiser Content