error handling in case the randomizer picks a pokemon that does not exist

This commit is contained in:
infinitefusion
2023-11-14 18:46:32 -05:00
parent d729a630e5
commit 2635217407
5 changed files with 11 additions and 5 deletions

View File

@@ -340,7 +340,11 @@ def pbWildBattle(species, level, outcomeVar=1, canRun=true, canLose=false)
dexnum = getDexNumberForSpecies(species)
if $game_switches[SWITCH_RANDOM_STATIC_ENCOUNTERS] && dexnum <= NB_POKEMON
newSpecies = $PokemonGlobal.psuedoBSTHash[dexnum]
species = getSpecies(newSpecies)
if !newSpecies
displayRandomizerErrorMessage()
else
species = getSpecies(newSpecies)
end
end
# Potentially call a different pbWildBattle-type method instead (for roaming