Seen 4 Days Ago
Posted 1 Week Ago
153 posts
2.7 Years
So been trying to set up headbutt tree encounters like in HGSS i've got the code for them to trigger all working its the encounter modifier side thats causing issues;

so the encounters scale to the parties level (with some randomness) and that part works fine; however
i'm trying to add code for the game to detect evolutions and evolve them;
Events.onWildPokemonCreate+=proc {|sender,e|
  pokemon=e[0]
  terrain=Kernel.pbFacingTerrainTag
  if PBTerrain.isHeadbuttable?(terrain) && 
      !pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
    newlevel=pbBalancedLevel($Trainer.party) - 4 + rand(5)   # For variety
    newlevel=1 if newlevel<1
    newlevel=PBExperience::MAXLEVEL if newlevel>PBExperience::MAXLEVEL
    pokemon.level=newlevel
    pokemon.level=newlevel
    pokemon.calcStats
    pokemon.resetMoves
    terrain=Kernel.pbFacingTerrainTag
    if PBTerrain.isHeadbuttable?(terrain) && 
        !pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
      evos=pbGetEvolvedFormData(pokemon.species)
      if evos && evos.length>0
        species=evos[rand(evos.length)][2]
        newspecies,newform=pbCheckEvolution(pokemon)
        #newspecies,newform=pbGetSpeciesFromSpecies(species)
        level=pbGetMinimumLevel(species)
        level=[level,pokemon.level].max
        #level+=rand(5)
        pokemon.species=newspecies
        pokemon.form=newform
        pokemon.level=level
        pokemon.name=PBSpecies.getName(newspecies)
        pokemon.calcStats
        pokemon.resetMoves
      elsif evos && evos.length==0 # no more evolutions
        for i in 0...6
          pokemon.iv[i]=31
        end
        pokemon.calcStats
      end
    end
  end
}
its based off another code (originally for 17.2 and downscaled to 16.2)

however the issue isn't evolving; as seen here



the pokemon can evolve fine its when they cant or dont evolve is the issue; with that latest code; this is the error i get;
Exception: Errno::EINVAL
Message: Invalid argument - Data/attacksRS.dat
File_Mixins:65:in `pos='
File_Mixins:65:in `getOffset'
PokeBattle_Pokemon:443:in `__mf_getMoveList'
Pokemon_MultipleForms:91:in `getMoveList'
PokeBattle_Pokemon:457:in `resetMoves'
PField_EncounterModifiers:135
PField_EncounterModifiers:107:in `call'
Event:54:in `trigger'
Event:49:in `each'
Event:49:in `trigger'
im guessing their is some issue with getting their attacks or something? sorry if its not much info nothing else has been changed towards this except some multiple form code.