• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] this script was made for v18 to lower pokemon levels by losing battles??

tomorrow i'll tell you if it worked! But, would there be a way to add a system that makes shinys Pokémon run away during the game, Roamings-style Pokémon that use the Roar attack? They don't need to use that move, just run away ... would it be possible?

In PField_EncounterModifiers under Events.onWildPokemonCreate paste this:
Code:
  if pokemon.shiny?
    setBattleRule("roamerFlees")
  end

This will treat all shiny Pokemon as a roaming Pokemon and they will run away. Unlike roaming Pokemon their data will not be saved for later.
 
In PField_EncounterModifiers under Events.onWildPokemonCreate paste this:
Code:
  if pokemon.shiny?
    setBattleRule("roamerFlees")
  end

This will treat all shiny Pokemon as a roaming Pokemon and they will run away. Unlike roaming Pokemon their data will not be saved for later.

you made the RPG of my game surreal, when a full version comes out I will be happy to show you that its growth was the result of your collaboration, thank you!
 
In PField_EncounterModifiers under Events.onWildPokemonCreate paste this:
Code:
  if pokemon.shiny?
    setBattleRule("roamerFlees")
  end

This will treat all shiny Pokemon as a roaming Pokemon and they will run away. Unlike roaming Pokemon their data will not be saved for later.

def pbWildBattleSuccess
if @battle.battlers[1].pokemon.hasItem?
qty=rand(3)+1
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

I believe this will be the last fragment to leave the new update of my full game.

About this item drop script, it is wonderful and totally necessary for my game. From what I realized the amount of items dropped varies. But I would like a quantity to be identified for certain items in the game. For example, a Charmander drops the following items in my game.
WildItemCommon = ESSENCEOFFIRE.
WildItemRare = FIRESTONE.
But I would like to have a variation of items dropped on EssenceOfFire, but FireStone is dropped by unit.
As well as configuring a Charmander to drop up to 10 EssenceOfFire, but a charmeleon up to 30 Essences ... If I can modify the Pokémon drops by PBS it would be incredible ... Even more incredible if I knew how to add a new category of dropable items.
 
Just making sure I understand.
You want the quantity of the dropped to be either a single item or multiple times, and the multiple items to be based on the Pokemon's species?


I wish I could select the number of items a Pokémon can drop. Like, for example, a Charmander up to 30 of a certain item and a Charmeleon up to 50. But rare items, be dropable in unit, only one at a time, because there is no sense in dropping more than one STONE for example.
 
I am looking forward

Okay, so I have a system that you might like. It's not as simple as adding a number to the Pokemon.txt file but it will do what you want.
This will allow you to control how much of an item drops after defeating a wild Pokemon. Items can have the following 3 values.
A single unit, this is set to default so you don't need to add an item to the list if you only want it to drop 1.
An item based amount, the quantity obtained will be based on the item instead of the Pokemon.
And an amount based on the Pokemon where different Pokemon have their own set value.

Above Main add 2 hashes:
Code:
ITEMDROPQTY = {}
PKMNDROPQTY = {}

First let's go over ITEMDROPQTY. This is a list of items that you want to drop. Since the default is set to 1 you don't need to list any items here that you only want 1 of.
For item dependent quantities I will be using the Nanab Berry (a.k.a. Bananas). I want all Nanab berries dropped by Tropius and various monkey Pokemon to be bunches of 3, so I will add this item to the ITEMDROPQTY like this.
ITEMDROPQTY = {406=>3}
406 is the number given to the Nanab Berry in the item.txt file and 3 is the amount I want dropped. Now I want to add Soft Sand to be dropped in groups of 5. The number for Soft Sand is 143.
ITEMDROPQTY = {406=>3,143=>5}

For Pokemon dependent quantities you will need to tell the script that you don't want to pull the amount of the dropped items from the ITEMDROPQTY list, but from the PKMNDROPQTY list. To do so you need to add the item to the ITEMDROPQTY list with a quantity of 0. Then you will need to add the Pokemon and the quantity associated to it to the PKMNDROPQTY list. I will be using the item Dragon Scale (203) and I will be having the item be dropped by Horsea and it's evolutions. Horsea = 116, Seadra = 117, and Kingdra = 230.

ITEMDROPQTY = {406=>3,143=>5,203=>0}
PKMNDROPQTY = {117=>10,230=20}

As you can see item 203 (Dragon Scale) is set to 0 so it will be based on the Pokemon with Seadra dropping 10 Dragon Scales and Kingdra dropping 20 Dragon Scales. Even though I did not list Horsea (116) in the PKMNDROPQTY hash, Horsea will drop 1 Dragon Scale since that is the default.

Now for the script to make this possible.
In PokeBattle_Scene find pbWildBattleSuccess and replace it with this:
Code:
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
 
Last edited:
Okay, so I have a system that you might like. It's not as simple as adding a number to the Pokemon.txt file but it will do what you want.
This will allow you to control how much of an item drops after defeating a wild Pokemon. Items can have the following 3 values.
A single unit, this is set to default so you don't need to add an item to the list if you only want it to drop 1.
An item based amount, the quantity obtained will be based on the item instead of the Pokemon.
And an amount based on the Pokemon where different Pokemon have their own set value.

Above Main add 2 hashes:
Code:
ITEMDROPQTY = {}
PKMNDROPQTY = {}

First let's go over ITEMDROPQTY. This is a list of items that you want to drop. Since the default is set to 1 you don't need to list any items here that you only want 1 of.
For item dependent quantities I will be using the Nanab Berry (a.k.a. Bananas). I want all Nanab berries dropped by Tropius and various monkey Pokemon to be bunches of 3, so I will add this item to the ITEMDROPQTY like this.
ITEMDROPQTY = {406=>3}
406 is the number given to the Nanab Berry in the item.txt file and 3 is the amount I want dropped. Now I want to add Soft Sand to be dropped in groups of 5. The number for Soft Sand is 143.
ITEMDROPQTY = {406=>3,143=>5}

For Pokemon dependent quantities you will need to tell the script that you don't want to pull the amount of the dropped items from the ITEMDROPQTY list, but from the PKMNDROPQTY list. To do so you need to add the item to the ITEMDROPQTY list with a quantity of 0. Then you will need to add the Pokemon and the quantity associated to it to the PKMNDROPQTY list. I will be using the item Dragon Scale (203) and I will be having the item be dropped by Horsea and it's evolutions. Horsea = 116, Seadra = 117, and Kingdra = 230.

ITEMDROPQTY = {406=>3,143=>5,203=>0}
PKMNDROPQTY = {117=>10,230=20}

As you can see item 203 (Dragon Scale) is set to 0 so it will be based on the Pokemon with Seadra dropping 10 Dragon Scales and Kingdra dropping 20 Dragon Scales. Even though I did not list Horsea (116) in the PKMNDROPQTY hash, Horsea will drop 1 Dragon Scale since that is the default.

Now for the script to make this possible.
In PokeBattle_Scene find pbWildBattleSuccess and replace it with this:
Code:
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=ITEMDROPQTY[dropitem]
    elsif ITEMDROPQTY.key?(dropitem) && ITEMDROPQTY[dropitem] == 0 && PKMNDROPQTY.key?(pkmnitem)
      qty=PKMNDROPQTY[pkmnitem]
    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

I'm crazy, I'm at a loss for words ... OH MY GOD, you're a script monster. I am very VERY HAPPY tomorrow I will add this to my project. Wow 😱😱😱
Gt-Baka, give me a Pokémon team that you use and I will put you in the Pokémon League of my game in honor and you will have a huge highlight in the credits of this project, thank you very much 😍😍😍😍
 
Okay, so I have a system that you might like. It's not as simple as adding a number to the Pokemon.txt file but it will do what you want.
This will allow you to control how much of an item drops after defeating a wild Pokemon. Items can have the following 3 values.
A single unit, this is set to default so you don't need to add an item to the list if you only want it to drop 1.
An item based amount, the quantity obtained will be based on the item instead of the Pokemon.
And an amount based on the Pokemon where different Pokemon have their own set value.

Above Main add 2 hashes:
Code:
ITEMDROPQTY = {}
PKMNDROPQTY = {}

First let's go over ITEMDROPQTY. This is a list of items that you want to drop. Since the default is set to 1 you don't need to list any items here that you only want 1 of.
For item dependent quantities I will be using the Nanab Berry (a.k.a. Bananas). I want all Nanab berries dropped by Tropius and various monkey Pokemon to be bunches of 3, so I will add this item to the ITEMDROPQTY like this.
ITEMDROPQTY = {406=>3}
406 is the number given to the Nanab Berry in the item.txt file and 3 is the amount I want dropped. Now I want to add Soft Sand to be dropped in groups of 5. The number for Soft Sand is 143.
ITEMDROPQTY = {406=>3,143=>5}

For Pokemon dependent quantities you will need to tell the script that you don't want to pull the amount of the dropped items from the ITEMDROPQTY list, but from the PKMNDROPQTY list. To do so you need to add the item to the ITEMDROPQTY list with a quantity of 0. Then you will need to add the Pokemon and the quantity associated to it to the PKMNDROPQTY list. I will be using the item Dragon Scale (203) and I will be having the item be dropped by Horsea and it's evolutions. Horsea = 116, Seadra = 117, and Kingdra = 230.

ITEMDROPQTY = {406=>3,143=>5,203=>0}
PKMNDROPQTY = {117=>10,230=20}

As you can see item 203 (Dragon Scale) is set to 0 so it will be based on the Pokemon with Seadra dropping 10 Dragon Scales and Kingdra dropping 20 Dragon Scales. Even though I did not list Horsea (116) in the PKMNDROPQTY hash, Horsea will drop 1 Dragon Scale since that is the default.

Now for the script to make this possible.
In PokeBattle_Scene find pbWildBattleSuccess and replace it with this:
Code:
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=ITEMDROPQTY[dropitem]
    elsif ITEMDROPQTY.key?(dropitem) && ITEMDROPQTY[dropitem] == 0 && PKMNDROPQTY.key?(pkmnitem)
      qty=PKMNDROPQTY[pkmnitem]
    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

wait, but does that vary the items? For example, does Nanab Berry's drop range from 0 to 3? I was testing and the value is fixed, how would I go from 0 to 3 to Nanab for example?
 
wait, but does that vary the items? For example, does Nanab Berry's drop range from 0 to 3? I was testing and the value is fixed, how would I go from 0 to 3 to Nanab for example?

Oops, forgot to re-add the ranged drops back in.

change qty=ITEMDROPQTY[dropitem] to qty=rand(ITEMDROPQTY[dropitem])+1
and
change qty=PKMNDROPQTY[dropitem] to qty=rand(PKMNDROPQTY[pkmnitem])+1

I will fix the script above in my previous post.
 
Back
Top