- 8
- Posts
- 13
- Years
- Seen Dec 28, 2016
I made this simple script to make wild pokemon drop the items they held.
HankMan and Nickalooose first discussed this subject in an old topic (I still can't post the link to the topic, but if you search for "Pokemon essentials dropping items" on Google you will find it) .
If a wild pokemon is holding an item when he is defeated, there is a 50% chance that he will drop it. The item is dropped right after the Exp Gain, as suggested by Nickalooose.
It won't work against another trainer (if you want to do so, you have to delete "!@opponent" in the function definition).
First, I added the highlited part at the end of PokeBattle_Battle:
Then I put the function after the exp gain at the end of pbGainExp, but before the battler's data are deleted ("@battlers.participants=[]"). It's in the PokeBattle_Battle section, around line 1799.
HankMan and Nickalooose first discussed this subject in an old topic (I still can't post the link to the topic, but if you search for "Pokemon essentials dropping items" on Google you will find it) .
If a wild pokemon is holding an item when he is defeated, there is a 50% chance that he will drop it. The item is dropped right after the Exp Gain, as suggested by Nickalooose.
It won't work against another trainer (if you want to do so, you have to delete "!@opponent" in the function definition).
First, I added the highlited part at the end of PokeBattle_Battle:
Code:
@scene.pbEndBattle(@decision)
for i in @battlers
i.pbResetForm
end
for i in $Trainer.party
i.item=i.itemInitial
i.itemInitial=i.itemRecycle=0
end
return @decision
end
[S-HIGHLIGHT]### Wild pokemon drops item if defeated
def pbDropItem (i)
if rand(100)>50 && @battlers[i].item!=0 && !@opponent
$PokemonBag.pbStoreItem(@battlers[i].item)
pbDisplay(_INTL("{1} picked up {2} from the pokemon!", $Trainer.name, PBItems.getName(@battlers[i].item)))
end
end [/S-HIGHLIGHT]
end
Code:
# Finding all moves learned at this level
movelist=thispoke.getMoveList
for k in movelist
if k[0]==thispoke.level # Learned a new move
pbLearnMove(j,k[1])
end
end
end
end
end
end
end
end
[S-HIGHLIGHT]pbDropItem (i)[/S-HIGHLIGHT]
# Now clear the participants array
@battlers[i].participants=[]
end
end
end