- 143
- Posts
- 11
- Years
- Seen Jun 11, 2021
So I applied a really old script made for an older version of Essentials. This script was made by aramant16. I followed the installation scripts as close as I could since I'm using Version 16.2 rather than the old version the script was made for and I've had little to no problems with it until my game suddenly crashed with this error:
I've determined the error has something to do with this line of code:
The only problem is I don't know how to fix it. Here's where I inserted the main parts of the code, by the way:
Spoiler:
Code:
Exception: NoMethodError
Message: undefined method `<' for nil:NilClass
PSystem_Utilities:848:in `pbStoreItem'
PScreen_Bag:793:in `pbStoreItem'
PokeBattle_Battle:4314:in `nuzlocke_EndOfBattle'
PokeBattle_Battle:4302:in `each'
PokeBattle_Battle:4302:in `nuzlocke_EndOfBattle'
Nuzlocke:245:in `pbEndOfBattle'
PokeBattle_Battle:2772:in `pbStartBattleCore'
PokeBattle_Battle:2546:in `pbStartBattle'
InverseSkyBattles:49:in `pbWildBattle'
InverseSkyBattles:48:in `pbSceneStandby'
I've determined the error has something to do with this line of code:
Code:
def self.pbStoreItem(items,maxsize,maxPerSlot,item,qty,sorting=false)
raise "Invalid value for qty: #{qty}" if qty<0
Code:
elsif @decision==2
@scene.pbShowOpponent(0)
pbDisplayPaused(@endspeechwin.gsub(/\\[Pp][Nn]/,self.pbPlayer.name))
if @opponent.is_a?(Array)
@scene.pbHideOpponent
@scene.pbShowOpponent(1)
pbDisplayPaused(@endspeechwin2.gsub(/\\[Pp][Nn]/,self.pbPlayer.name))
end
end
[COLOR=Red][B]#### PICK UP POKEBALLS ####
when 1, 4
pokeballs=$PokemonGlobal.ballsused
ball_count=Hash.new(0)
pokeballs.each{|balltype| ball_count[balltype]+=1}
ball_count.each{|ball, thrown|
#Balls are not retrieved if they are thrown on or under water, or after a battle
if ball_count[ball]>1 && !@opponent && !$PokemonGlobal.diving && !$PokemonGlobal.surfing
chances=[40,9,1]
rnd=rand(100)
if rnd<chances[0]
retrieved=(thrown/3)
elsif rnd<(chances[0]+chances[1])
retrieved=(thrown/2)
elsif rnd<(chances[0]+chances[1]+chances[2])
retrieved=(thrown-1) #number of balls picked up shouldn't be superior to balls thrown (if pokemon is captured)
end
$PokemonBag.pbStoreItem(ball,retrieved)
if retrieved>0
pbDisplayPaused(_INTL("{1} picked up {2} {3} thrown during the fight", $Trainer.name, retrieved, PBItems.getName(ball)))
end
end
}
end
$PokemonGlobal.ballsused=[] #to reset the array after the battle[/B][/COLOR]
# Pass on Pokérus within the party
infected=[]