• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Poké Ball Swap

v20.1 Poké Ball Swap 2022-05-20

This resource pertains to version 20.1 of Pokémon Essentials.
Pokémon Essentials Version
v20.1 ➖
ballswap.gif

Quick little script that lets the player use their Poké Balls from the bag to change the ball their Pokémon is stored in! Options to give the ball back can be turned on/off easily by the dev.
Code
Can be pasted in a new script section above Main, or downloaded as a plugin for v20 here.
Ruby:
RECEIVE_OLD = true
RECEIVE_MASTER = false
ItemHandlers::UseOnPokemon.addIf(proc { |item| GameData::Item.get(item).is_poke_ball? },
  proc { |item, qty, pkmn, scene|
    ballname = GameData::Item.get(item).name
    if pkmn.poke_ball != item
      if pbConfirmMessage(_INTL("Place {1} in the {2}?",pkmn.name,ballname))  { scene.pbUpdate }
        pbSEPlay("Battle recall")
        pbMessage(_INTL("{1} was placed in the {2}.",pkmn.name,ballname))  { scene.pbUpdate }
        if RECEIVE_OLD == true
          newitem = pkmn.poke_ball
          newname = GameData::Item.get(newitem).name
          if pkmn.poke_ball!=:MASTERBALL || RECEIVE_MASTER == true
            pbSEPlay("Battle catch click")
            pbMessage(_INTL("Took {1}'s old {2}.",pkmn.name,newname))  { scene.pbUpdate }
            $bag.add(newitem)
          else
            pbSEPlay("Battle damage weak")
            pbMessage(_INTL("{1}'s old {2} broke when you tried to remove it!",pkmn.name,newname))  { scene.pbUpdate }
          end
        end
        pkmn.poke_ball = item
        next true
      end
    end
    pbMessage(_INTL("{1} is already stored in a {2}.",pkmn.name,ballname))  { scene.pbUpdate }
    next false
  }
)
Paste in a new script section above Main!
Ruby:
RECEIVE_OLD = true
RECEIVE_MASTER = false
ItemHandlers::UseOnPokemon.addIf(proc { |item| GameData::Item.get(item).is_poke_ball? },
  proc { |item,pkmn,scene|
    ballname = GameData::Item.get(item).name
    if pkmn.poke_ball != item
      if pbConfirmMessage(_INTL("Place {1} in the {2}?",pkmn.name,ballname))
        pbSEPlay("Battle recall")
        pbMessage(_INTL("{1} was placed in the {2}.",pkmn.name,ballname))
        if RECEIVE_OLD == true
          newitem = pkmn.poke_ball
          newname = GameData::Item.get(newitem).name
          if pkmn.poke_ball!=:MASTERBALL || RECEIVE_MASTER == true
            pbSEPlay("Battle catch click")
            pbMessage(_INTL("Took {1}'s old {2}.",pkmn.name,newname))
            $PokemonBag.pbStoreItem(newitem)
          else
            pbSEPlay("Battle damage weak")
            pbMessage(_INTL("{1}'s old {2} broke when you tried to remove it!",pkmn.name,newname))
          end
        end
        pkmn.poke_ball = item
        next true
      end
    end
    pbMessage(_INTL("{1} is already stored in a {2}.",pkmn.name,ballname))
    next false
  }
)
Ruby:
RECEIVE_OLD = true
RECEIVE_MASTER = false

ItemHandlers::UseOnPokemon.addIf(proc{|item| pbIsPokeBall?(item)},
   proc{|item,pokemon,scene|
    ballname = PBItems.getName(item)
    if pokemon.ballused != pbGetBallType(item)
      if Kernel.pbConfirmMessage(_INTL("Place {1} in the {2}?",pokemon.name,ballname))  { scene.pbUpdate }
        pbSEPlay("Battle recall")
        Kernel.pbMessage(_INTL("{1} was placed in the {2}.",pokemon.name,ballname))  { scene.pbUpdate }
        if RECEIVE_OLD
          newitem = pbBallTypeToBall(pokemon.ballused)
          newname = PBItems.getName(newitem)
          if ![:MASTERBALL].include?(newitem) || RECEIVE_MASTER
            pbSEPlay("Battle ball drop")
            Kernel.pbMessage(_INTL("Took {1}'s old {2}.",pokemon.name,newname))  { scene.pbUpdate }
            $PokemonBag.pbStoreItem(newitem)
          else
            pbSEPlay("Battle damage weak")
            Kernel.pbMessage(_INTL("{1}'s old {2} broke when you tried to remove it!",pokemon.name,newname))  { scene.pbUpdate }
          end
        end
        pokemon.ballused = pbGetBallType(item)
        next true
      end
    end
    Kernel.pbMessage(_INTL("{1} is already stored in a {2}.",pokemon.name,ballname))  { scene.pbUpdate }
    next false
})
Using this script
There's two constants at the top to allow for a bit of customizing.

RECEIVE_OLD should be set to true if you want the player to get the old Poké Ball back, and false if you don't. The Master Ball gets its own separate constant, RECEIVE_MASTER.

If RECEIVE_OLD is true, but RECEIVE_MASTER is false, the player can change a Pokémon out of its Master Ball, but they'll get a message telling them the Master Ball broke, so they can't just use this to get unlimited Master Balls.

There's also some SFX in this script to make it a little more interesting, feel free to edit them (the lines beginning with pbSEPlay) to make things how you want them.


You'll need to change your items PBS so that all your Poké Balls can be used on Pokémon outside of battle. Here's that for the default Poké Balls-
Ruby:
#-------------------------------
[MASTERBALL]
Name = Master Ball
NamePlural = Master Balls
Pocket = 3
Price = 0
BattleUse = OnFoe
Flags = PokeBall
FieldUse = OnPokemon
Description = The best Ball with the ultimate level of performance. It will catch any wild Pokémon without fail.
#-------------------------------
[ULTRABALL]
Name = Ultra Ball
NamePlural = Ultra Balls
Pocket = 3
Price = 800
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = An ultra-performance Ball that provides a higher Pokémon catch rate than a Great Ball.
#-------------------------------
[GREATBALL]
Name = Great Ball
NamePlural = Great Balls
Pocket = 3
Price = 600
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A good, high-performance Ball that provides a higher Pokémon catch rate than a standard Poké Ball.
#-------------------------------
[POKEBALL]
Name = Poké Ball
NamePlural = Poké Balls
Pocket = 3
Price = 200
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A device for catching wild Pokémon. It is thrown like a ball at the target. It is designed as a capsule system.
#-------------------------------
[SAFARIBALL]
Name = Safari Ball
NamePlural = Safari Balls
Pocket = 3
Price = 0
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A special Poké Ball that is used only in the Safari Zone. It is decorated in a camouflage pattern.
#-------------------------------
[SPORTBALL]
Name = Sport Ball
NamePlural = Sport Balls
Pocket = 3
Price = 300
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A special Poké Ball for the Bug-Catching Contest.
#-------------------------------
[NETBALL]
Name = Net Ball
NamePlural = Net Balls
Pocket = 3
Price = 1000
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A somewhat different Poké Ball that works especially well on Water- and Bug-type Pokémon.
#-------------------------------
[DIVEBALL]
Name = Dive Ball
NamePlural = Dive Balls
Pocket = 3
Price = 1000
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A somewhat different Poké Ball that works especially well on Pokémon that live underwater.
#-------------------------------
[NESTBALL]
Name = Nest Ball
NamePlural = Nest Balls
Pocket = 3
Price = 1000
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A somewhat different Poké Ball that works especially well on weaker Pokémon in the wild.
#-------------------------------
[REPEATBALL]
Name = Repeat Ball
NamePlural = Repeat Balls
Pocket = 3
Price = 1000
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A somewhat different Poké Ball that works especially well on Pokémon species that were previously caught.
#-------------------------------
[TIMERBALL]
Name = Timer Ball
NamePlural = Timer Balls
Pocket = 3
Price = 1000
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A somewhat different Ball that becomes progressively better the more turns there are in a battle.
#-------------------------------
[LUXURYBALL]
Name = Luxury Ball
NamePlural = Luxury Balls
Pocket = 3
Price = 3000
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A comfortable Poké Ball that makes a caught wild Pokémon quickly grow friendly.
#-------------------------------
[PREMIERBALL]
Name = Premier Ball
NamePlural = Premier Balls
Pocket = 3
Price = 200
SellPrice = 10
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A somewhat rare Poké Ball that has been specially made to commemorate an event of some sort.
#-------------------------------
[DUSKBALL]
Name = Dusk Ball
NamePlural = Dusk Balls
Pocket = 3
Price = 1000
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A somewhat different Poké Ball that makes it easier to catch wild Pokémon at night or in dark places like caves.
#-------------------------------
[HEALBALL]
Name = Heal Ball
NamePlural = Heal Balls
Pocket = 3
Price = 300
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A remedial Poké Ball that restores the caught Pokémon's HP and eliminates any status problem.
#-------------------------------
[QUICKBALL]
Name = Quick Ball
NamePlural = Quick Balls
Pocket = 3
Price = 1000
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A somewhat different Poké Ball that provides a better catch rate if used at the start of a wild encounter.
#-------------------------------
[CHERISHBALL]
Name = Cherish Ball
NamePlural = Cherish Balls
Pocket = 3
Price = 0
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A quite rare Poké Ball that has been specially crafted to commemorate an occasion of some sort.
#-------------------------------
[FASTBALL]
Name = Fast Ball
NamePlural = Fast Balls
Pocket = 3
Price = 300
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A Poké Ball that makes it easier to catch fast Pokémon.
#-------------------------------
[LEVELBALL]
Name = Level Ball
NamePlural = Level Balls
Pocket = 3
Price = 300
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A Poké Ball for catching Pokémon that are a lower level than your own.
#-------------------------------
[LUREBALL]
Name = Lure Ball
NamePlural = Lure Balls
Pocket = 3
Price = 300
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A Poké Ball for catching Pokémon hooked by a Rod when fishing.
#-------------------------------
[HEAVYBALL]
Name = Heavy Ball
NamePlural = Heavy Balls
Pocket = 3
Price = 300
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A Poké Ball for catching very heavy Pokémon.
#-------------------------------
[LOVEBALL]
Name = Love Ball
NamePlural = Love Balls
Pocket = 3
Price = 300
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A Poké Ball for catching Pokémon that are the opposite gender of your Pokémon.
#-------------------------------
[FRIENDBALL]
Name = Friend Ball
NamePlural = Friend Balls
Pocket = 3
Price = 300
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A Poké Ball that makes caught Pokémon more friendly.
#-------------------------------
[MOONBALL]
Name = Moon Ball
NamePlural = Moon Balls
Pocket = 3
Price = 300
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A Poké Ball for catching Pokémon that evolve using the Moon Stone.
#-------------------------------
[DREAMBALL]
Name = Dream Ball
NamePlural = Dream Balls
Pocket = 3
Price = 300
BattleUse = OnFoe
FieldUse = OnPokemon
Flags = PokeBall
Description = A somewhat different Poké Ball that makes it easier to catch wild Pokémon while they're asleep.
Ruby:
264,MASTERBALL,Master Ball,Master Balls,3,0,"The best Ball with the ultimate level of performance. It will catch any wild Pokémon without fail.",1,4,4,
265,ULTRABALL,Ultra Ball,Ultra Balls,3,800,"An ultra-performance Ball that provides a higher Pokémon catch rate than a Great Ball.",1,4,4,
266,GREATBALL,Great Ball,Great Balls,3,600,"A good, high-performance Ball that provides a higher Pokémon catch rate than a standard Poké Ball.",1,4,4,
267,POKEBALL,Poké Ball,Poké Balls,3,200,"A device for catching wild Pokémon. It is thrown like a ball at the target. It is designed as a capsule system.",1,4,4,
268,SAFARIBALL,Safari Ball,Safari Balls,3,0,"A special Poké Ball that is used only in the Safari Zone. It is decorated in a camouflage pattern.",1,4,4,
269,SPORTBALL,Sport Ball,Sport Balls,3,300,"A special Poké Ball for the Bug-Catching Contest.",1,4,4,
270,NETBALL,Net Ball,Net Balls,3,1000,"A somewhat different Poké Ball that works especially well on Water- and Bug-type Pokémon.",1,4,4,
271,DIVEBALL,Dive Ball,Dive Balls,3,1000,"A somewhat different Poké Ball that works especially well on Pokémon that live underwater.",1,4,4,
272,NESTBALL,Nest Ball,Nest Balls,3,1000,"A somewhat different Poké Ball that works especially well on weaker Pokémon in the wild.",1,4,4,
273,REPEATBALL,Repeat Ball,Repeat Balls,3,1000,"A somewhat different Poké Ball that works especially well on Pokémon species that were previously caught.",1,4,4,
274,TIMERBALL,Timer Ball,Timer Balls,3,1000,"A somewhat different Ball that becomes progressively better the more turns there are in a battle.",1,4,4,
275,LUXURYBALL,Luxury Ball,Luxury Balls,3,1000,"A comfortable Poké Ball that makes a caught wild Pokémon quickly grow friendly.",1,4,4,
276,PREMIERBALL,Premier Ball,Premier Balls,3,20,"A somewhat rare Poké Ball that has been specially made to commemorate an event of some sort.",1,4,4,
277,DUSKBALL,Dusk Ball,Dusk Balls,3,1000,"A somewhat different Poké Ball that makes it easier to catch wild Pokémon at night or in dark places like caves.",1,4,4,
278,HEALBALL,Heal Ball,Heal Balls,3,300,"A remedial Poké Ball that restores the caught Pokémon's HP and eliminates any status problem.",1,4,4,
279,QUICKBALL,Quick Ball,Quick Balls,3,1000,"A somewhat different Poké Ball that provides a better catch rate if used at the start of a wild encounter.",1,4,4,
280,CHERISHBALL,Cherish Ball,Cherish Balls,3,0,"A quite rare Poké Ball that has been specially crafted to commemorate an occasion of some sort.",1,4,4,
281,FASTBALL,Fast Ball,Fast Balls,3,300,"A Poké Ball that makes it easier to catch fast Pokémon.",1,4,4,
282,LEVELBALL,Level Ball,Level Balls,3,300,"A Poké Ball for catching Pokémon that are a lower level than your own.",1,4,4,
283,LUREBALL,Lure Ball,Lure Balls,3,300,"A Poké Ball for catching Pokémon hooked by a Rod when fishing.",1,4,4,
284,HEAVYBALL,Heavy Ball,Heavy Balls,3,300,"A Poké Ball for catching very heavy Pokémon.",1,4,4,
285,LOVEBALL,Love Ball,Love Balls,3,300,"A Poké Ball for catching Pokémon that are the opposite gender of your Pokémon.",1,4,4,
286,FRIENDBALL,Friend Ball,Friend Balls,3,300,"A Poké Ball that makes caught Pokémon more friendly.",1,4,4,
287,MOONBALL,Moon Ball,Moon Balls,3,300,"A Poké Ball for catching Pokémon that evolve using the Moon Stone.",1,4,4,
Ruby:
264,MASTERBALL,Master Ball,Master Balls,3,0,"The best Ball with the ultimate level of performance. It will catch any wild Pokémon without fail.",1,2,4,
265,ULTRABALL,Ultra Ball,Ultra Balls,3,1200,"An ultra-performance Ball that provides a higher Pokémon catch rate than a Great Ball.",1,2,4,
266,GREATBALL,Great Ball,Great Balls,3,600,"A good, high-performance Ball that provides a higher Pokémon catch rate than a standard Poké Ball.",1,2,4,
267,POKEBALL,Poké Ball,Poké Balls,3,200,"A device for catching wild Pokémon. It is thrown like a ball at the target. It is designed as a capsule system.",1,2,4,
268,SAFARIBALL,Safari Ball,Safari Balls,3,0,"A special Poké Ball that is used only in the Safari Zone. It is decorated in a camouflage pattern.",1,2,4,
269,SPORTBALL,Sport Ball,Sport Balls,3,0,"A special Poké Ball for the Bug-Catching Contest.",1,2,4,
270,NETBALL,Net Ball,Net Balls,3,1000,"A somewhat different Poké Ball that works especially well on Water- and Bug-type Pokémon.",1,2,4,
271,DIVEBALL,Dive Ball,Dive Balls,3,1000,"A somewhat different Poké Ball that works especially well on Pokémon that underwater.",1,2,4,
272,NESTBALL,Nest Ball,Nest Balls,3,1000,"A somewhat different Poké Ball that works especially well on weaker Pokémon in the wild.",1,2,4,
273,REPEATBALL,Repeat Ball,Repeat Balls,3,1000,"A somewhat different Poké Ball that works especially well on Pokémon species that were previously caught.",1,2,4,
274,TIMERBALL,Timer Ball,Timer Balls,3,1000,"A somewhat different Ball that becomes progressively better the more turns there are in a battle.",1,2,4,
275,LUXURYBALL,Luxury Ball,Luxury Balls,3,1000,"A comfortable Poké Ball that makes a caught wild Pokémon quickly grow friendly.",1,2,4,
276,PREMIERBALL,Premier Ball,Premier Balls,3,200,"A somewhat rare Poké Ball that has been specially made to commemorate an event of some sort.",1,2,4,
277,DUSKBALL,Dusk Ball,Dusk Balls,3,1000,"A somewhat different Poké Ball that makes it easier to catch wild Pokémon at night or in dark places like caves.",1,2,4,
278,HEALBALL,Heal Ball,Heal Balls,3,300,"A remedial Poké Ball that restores the caught Pokémon's HP and eliminates any status problem.",1,2,4,
279,QUICKBALL,Quick Ball,Quick Balls,3,1000,"A somewhat different Poké Ball that provides a better catch rate if used at the start of a wild encounter.",1,2,4,
280,CHERISHBALL,Cherish Ball,Cherish Balls,3,1000,"A quite rare Poké Ball that has been specially crafted to commemorate an occasion of some sort.",1,2,4,
281,FASTBALL,Fast Ball,Fast Balls,3,300,"A Poké Ball that makes it easier to catch fast Pokémon.",1,2,4,
282,LEVELBALL,Level Ball,Level Balls,3,300,"A Poké Ball for catching Pokémon that are a lower level than your own.",1,2,4,
283,LUREBALL,Lure Ball,Lure Balls,3,300,"A Poké Ball for catching Pokémon hooked by a Rod when fishing.",1,2,4,
284,HEAVYBALL,Heavy Ball,Heavy Balls,3,300,"A Poké Ball for catching very heavy Pokémon.",1,2,4,
285,LOVEBALL,Love Ball,Love Balls,3,300,"A Poké Ball for catching Pokémon that are the opposite gender of your Pokémon.",1,2,4,
286,FRIENDBALL,Friend Ball,Friend Balls,3,300,"A Poké Ball that makes caught Pokémon more friendly.",1,2,4,
287,MOONBALL,Moon Ball,Moon Balls,3,300,"A Poké Ball for catching Pokémon that evolve using the Moon Stone.",1,2,4,
Credits
Credit to TechSkylander1518, please!
Author
TechSkylander1518
Downloads
679
Views
5,587
First release
Last update
Rating
5.00 star(s) 2 ratings

More resources from TechSkylander1518

Latest updates

  1. v20 Update

    v20 compatible, included a plugin link.

Latest reviews

Worked like a charm! I personally didn't allow the Master Ball to be used this way in my project cause I feel like that'd be a dumb way to accidentally waste this way. Love how well this plugin runs though!
Back
Top