- 232
- Posts
- 8
- Years
- Seen Jun 2, 2025
This script has no crashes, but for some reason the item drop does not work on the part of Pokémon ... This works perfectly on v17, how do I update it to v18?
Spoiler:
class PokeBattle_Battler
def pbFainted(showMessage=true)
unless fainted?
PBDebug.log("!!!***Can't faint with HP greater than 0")
return true
end
if @fainted
# PBDebug.log("!!!***Can't faint if already fainted")
return true
end
@battle.scene.pbFainted(self)
pbInitEffects(false)
# Reset status
self.status=0
self.statusCount=0
if @pokemon && @battle.internalbattle
@pokemon.changeHappiness("faint")
end
@pokemon.makeUnmega if self.isMega?
@pokemon.makeUnprimal if self.isPrimal?
@fainted=true
# reset choice
@battle.choices[@index]=[0,0,nil,-1]
pbOwnSide.effects[PBEffects::LastRoundFainted][email protected]
@battle.pbDisplayPaused(_INTL("{1} fainted!",pbThis)) if showMessage
if [email protected] && @pokemon.item >0 && @index % 2 == 1
$PokemonBag.pbStoreItem(@pokemon.item,1)
itemname=PBItems.getName(@pokemon.item)
pocket=pbGetPocket(@pokemon.item)
pbJessAutoSave
@battle.pbDisplayPaused(_INTL("The wild {1} dropped\n{2} <icon=bagPocket#{pocket}> x 1!",@pokemon.name,itemname)) if showMessage
pbJessAutoSave
end
PBDebug.log("[Pokémon fainted] #{pbThis}")
return true
end
end
def pbFainted(showMessage=true)
unless fainted?
PBDebug.log("!!!***Can't faint with HP greater than 0")
return true
end
if @fainted
# PBDebug.log("!!!***Can't faint if already fainted")
return true
end
@battle.scene.pbFainted(self)
pbInitEffects(false)
# Reset status
self.status=0
self.statusCount=0
if @pokemon && @battle.internalbattle
@pokemon.changeHappiness("faint")
end
@pokemon.makeUnmega if self.isMega?
@pokemon.makeUnprimal if self.isPrimal?
@fainted=true
# reset choice
@battle.choices[@index]=[0,0,nil,-1]
pbOwnSide.effects[PBEffects::LastRoundFainted][email protected]
@battle.pbDisplayPaused(_INTL("{1} fainted!",pbThis)) if showMessage
if [email protected] && @pokemon.item >0 && @index % 2 == 1
$PokemonBag.pbStoreItem(@pokemon.item,1)
itemname=PBItems.getName(@pokemon.item)
pocket=pbGetPocket(@pokemon.item)
pbJessAutoSave
@battle.pbDisplayPaused(_INTL("The wild {1} dropped\n{2} <icon=bagPocket#{pocket}> x 1!",@pokemon.name,itemname)) if showMessage
pbJessAutoSave
end
PBDebug.log("[Pokémon fainted] #{pbThis}")
return true
end
end