- 107
- Posts
- 4
- Years
- Seen Apr 27, 2023
I have a script that drops items in the battle system, it consists of rewriting the Def pbWildBattleSuccess like this:
def pbWildBattleSuccess
if @battle.battlers[1].pokemon.hasItem?
dropitem = @battle.battlers[1].pokemon.item
pkmnitem = @battle.battlers[1].pokemon.species
if ITEMDROPQTY.key?(dropitem) && ITEMDROPQTY[dropitem] > 0
qty=rand(ITEMDROPQTY[dropitem])+1
elsif ITEMDROPQTY.key?(dropitem) && ITEMDROPQTY[dropitem] == 0 && PKMNDROPQTY.key?(pkmnitem)
qty=rand(PKMNDROPQTY[pkmnitem])+1
else
qty=1
end
if $PokemonBag.pbStoreItem(@battle.battlers[1].pokemon.item,qty)
itemname=PBItems.getName(@battle.battlers[1].pokemon.item)
pocket=pbGetPocket(@battle.battlers[1].pokemon.item)
@battle.pbDisplayPaused(_INTL("The wild {1} dropped\n{2} <icon=bagPocket#{pocket}> x{3}!",@battle.battlers[1].pbThis,itemname,qty))
end
end
@battleEnd = true
pbBGMPlay(pbGetWildVictoryME)
end
This seemed to work on early versions of EBDX in v18.1.
But on the latest EBDX1.0.15 this is simply not recognized. Drops don't happen.
How to fix?
On EBDX it is written like this:
def pbWildBattleSuccess
bgm = "EBDX/Victory Against Wild"
bgm = $PokemonGlobal.nextBattleME.clone if $PokemonGlobal.nextBattleME
if [email protected]
s = EliteBattle.getData(@battlers[1].species, PBSpecies, :VICTORYTHEME, (@battlers[1].form rescue 0))
bgm = s if !s.nil?
end
pbBGMPlay(bgm)
end
def pbWildBattleSuccess
if @battle.battlers[1].pokemon.hasItem?
dropitem = @battle.battlers[1].pokemon.item
pkmnitem = @battle.battlers[1].pokemon.species
if ITEMDROPQTY.key?(dropitem) && ITEMDROPQTY[dropitem] > 0
qty=rand(ITEMDROPQTY[dropitem])+1
elsif ITEMDROPQTY.key?(dropitem) && ITEMDROPQTY[dropitem] == 0 && PKMNDROPQTY.key?(pkmnitem)
qty=rand(PKMNDROPQTY[pkmnitem])+1
else
qty=1
end
if $PokemonBag.pbStoreItem(@battle.battlers[1].pokemon.item,qty)
itemname=PBItems.getName(@battle.battlers[1].pokemon.item)
pocket=pbGetPocket(@battle.battlers[1].pokemon.item)
@battle.pbDisplayPaused(_INTL("The wild {1} dropped\n{2} <icon=bagPocket#{pocket}> x{3}!",@battle.battlers[1].pbThis,itemname,qty))
end
end
@battleEnd = true
pbBGMPlay(pbGetWildVictoryME)
end
This seemed to work on early versions of EBDX in v18.1.
But on the latest EBDX1.0.15 this is simply not recognized. Drops don't happen.
How to fix?
On EBDX it is written like this:
def pbWildBattleSuccess
bgm = "EBDX/Victory Against Wild"
bgm = $PokemonGlobal.nextBattleME.clone if $PokemonGlobal.nextBattleME
if [email protected]
s = EliteBattle.getData(@battlers[1].species, PBSpecies, :VICTORYTHEME, (@battlers[1].form rescue 0))
bgm = s if !s.nil?
end
pbBGMPlay(bgm)
end