tipsypastels

Untitled

Mar 8th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. def Kernel.pbItemBall(item,quantity=1)
  2. if item.is_a?(String) || item.is_a?(Symbol)
  3. item = getID(PBItems,item)
  4. end
  5. return false if !item || item<=0 || quantity<1
  6. itemname = (quantity>1) ? PBItems.getNamePlural(item) : PBItems.getName(item)
  7. pocket = pbGetPocket(item)
  8.  
  9. if pocket == 8 # Key item
  10. sound = "Evolution start" # <--- swap this out with the name of whatever the key item sound should be. files for this are stored in the Audio/ME folder
  11. else # not a Key Item
  12. sound = "Item get" # <--- Keep this the same
  13. end
  14.  
  15. if $PokemonBag.pbStoreItem(item,quantity) # If item can be picked up
  16. if isConst?(item,PBItems,:LEFTOVERS)
  17. Kernel.pbMessage(_INTL("\\me[#{sound}]You found some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
  18. elsif pbIsMachine?(item) # TM or HM
  19. Kernel.pbMessage(_INTL("\\me[#{sound}]You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,PBMoves.getName(pbGetMachine(item))))
  20. elsif quantity>1
  21. Kernel.pbMessage(_INTL("\\me[#{sound}]You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]",quantity,itemname))
  22. elsif ['a','e','i','o','u'].include?(itemname[0,1].downcase)
  23. Kernel.pbMessage(_INTL("\\me[#{sound}]You found an \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
  24. else
  25. Kernel.pbMessage(_INTL("\\me[#{sound}]You found a \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
  26. end
  27. Kernel.pbMessage(_INTL("You put the {1} away\\nin the <icon=bagPocket{2}>\\c[1]{3} Pocket\\c[0].",
  28. itemname,pocket,PokemonBag.pocketNames()[pocket]))
  29. return true
  30. else # Can't add the item
  31. if isConst?(item,PBItems,:LEFTOVERS)
  32. Kernel.pbMessage(_INTL("You found some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
  33. elsif pbIsMachine?(item) # TM or HM
  34. Kernel.pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,PBMoves.getName(pbGetMachine(item))))
  35. elsif quantity>1
  36. Kernel.pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]",quantity,itemname))
  37. elsif ['a','e','i','o','u'].include?(itemname[0,1].downcase)
  38. Kernel.pbMessage(_INTL("You found an \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
  39. else
  40. Kernel.pbMessage(_INTL("You found a \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
  41. end
  42. Kernel.pbMessage(_INTL("But your Bag is full..."))
  43. return false
  44. end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment