- 3
- Posts
- 5
- Years
- Seen Dec 14, 2020
I found a script last year that will give items held by wild Pokemon to the player if they win the battle, but it doesn't seem to be working anymore. My guess is that "genwildpoke" no longer properly refers to the wild Pokemon you just fought and it has a different name now (when I altered the code to give a specific item to the player after battle if they win, regardless of what the wild Pokemon was holding, i.e. a green apricorn, it worked fine) but tbh I don't know enough about Ruby to be sure. I tried fixing the code myself and I can't get it to work.
Quote of the post in question:
Quote of the post in question:
Spoiler:
Wild pokémon sometimes hold items. Previously, the only ways that I know of to get these items is to use a move like Thief during battle or to capture the pokémon. The latter is exceptionally tedious if you are trying to get a rare item. Nobody wants to catch tons and tons of Pikachu just to get one Light Ball.
Since crafting plays a large role in my current game, players need a way to acquire crafting materials without it being so tedious that material gathering takes up too much gameplay time. I added a small but significant tweak to change that. Now, all you have to do to acquire an item held by a wild pokémon is to simply defeat that pokémon in battle. Since you are already battling wild pokémon to increase your levels anyway, this is killing two Spearow with one Roggenrola. You are still investing effort into resource gathering, but the fact that you are doing so by battling makes it less tedious.
This game is inspired in part by JRPGs, and it is a common practice in JRPGs to automatically acquire loot from defeated enemies. I figured I would just bring that same mechanic over to pokémon.
In the section PField_Battles, there is a method called pbWildBattle. Scroll down to the bottom of that method. Between the lines Events.onWildBattleEnd.trigger(nil,species,level,decision) and return (decision!=2), add this:
That's it. After a battle in which you defeat the wild pokémon, the battle screen will fade and you will be back in the overworld as normal. If the wild pokémon you defeated was holding an item, you will get a notification that you received that item.
Since crafting plays a large role in my current game, players need a way to acquire crafting materials without it being so tedious that material gathering takes up too much gameplay time. I added a small but significant tweak to change that. Now, all you have to do to acquire an item held by a wild pokémon is to simply defeat that pokémon in battle. Since you are already battling wild pokémon to increase your levels anyway, this is killing two Spearow with one Roggenrola. You are still investing effort into resource gathering, but the fact that you are doing so by battling makes it less tedious.
This game is inspired in part by JRPGs, and it is a common practice in JRPGs to automatically acquire loot from defeated enemies. I figured I would just bring that same mechanic over to pokémon.
In the section PField_Battles, there is a method called pbWildBattle. Scroll down to the bottom of that method. Between the lines Events.onWildBattleEnd.trigger(nil,species,level,decision) and return (decision!=2), add this:
Code:
if decision == 1 && genwildpoke.hasItem?
Kernel.pbReceiveItem(genwildpoke.item)
end
That's it. After a battle in which you defeat the wild pokémon, the battle screen will fade and you will be back in the overworld as normal. If the wild pokémon you defeated was holding an item, you will get a notification that you received that item.