TechSkylander1518

Swap Poke Balls from Bag

Sep 18th, 2021 (edited)
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.34 KB | None | 0 0
  1. https://reliccastle.com/resources/817/
  2.  
  3. #Whether the player should receive the Pokemon's old Poke Ball to use again
  4. RECEIVE_OLD = true
  5. #Whether the player should receive a Master Ball doing this. (Note that they could have unlimited Master Balls doing this)
  6. RECEIVE_MASTER = false
  7.  
  8.  
  9. ItemHandlers::UseOnPokemon.addIf(proc { |item| GameData::Item.get(item).is_poke_ball? },
  10.   proc { |item,pkmn,scene|
  11.     ballname = GameData::Item.get(item).name
  12.     if pkmn.poke_ball != item
  13.       if pbConfirmMessage(_INTL("Place {1} in the {2}?",pkmn.name,ballname))
  14.         pbMessage(_INTL("{1} was placed in the {2}.",pkmn.name,ballname))
  15.         if RECEIVE_OLD == true
  16.           newitem = pkmn.poke_ball
  17.           newname = GameData::Item.get(newitem).name
  18.           if pkmn.poke_ball!=:MASTERBALL || RECEIVE_MASTER == true
  19.             pbMessage(_INTL("Took {1}'s old {2}.",pkmn.name,newname))
  20.             $PokemonBag.pbStoreItem(newitem)
  21.           else
  22.             pbMessage(_INTL("{1}'s old {2} broke when you tried to remove it!",pkmn.name,newname))
  23.           end
  24.         end
  25.         pkmn.poke_ball = item
  26.         next true
  27.       end
  28.     end
  29.     pbMessage(_INTL("{1} is already stored in a {2}.",pkmn.name,ballname))
  30.     next false
  31.   }
  32. )
  33.  
  34. #Remember to set the usability outside of battle for all Poke Balls to 1 (use on a Pokemon, consumed after use)
Add Comment
Please, Sign In to add comment