Maurili

Berry Trees

Dec 20th, 2019 (edited)
1,130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.50 KB | None | 0 0
  1. #=======BERRY TREES By Maurili(Derek)======#
  2. #to call this use berrytree(berry1,berry2,berry3) were BERRY is the name of the items#
  3. #you wish the tree to drop#
  4. #you need to add an encounter type "BerryTree" in PField_Encounters otherwise#
  5. #the script will break!#
  6. #==========================================#
  7. def berrytree(berry1,berry2,berry3)
  8. #===================#
  9. drops1 = 0
  10. drops2 = 0
  11. drops3 = 0
  12. total1 = 0
  13. total2 = 0
  14. total3 = 0
  15. #===============================#
  16. pbMessage(_INTL("Berries are in the tree!"))
  17. if pbConfirmMessage(_INTL("Would you like to shake this tree?"))
  18. loop do
  19. #============================#
  20. drops1 = 1 + rand(3)
  21. drops2 = 1 + rand(2)
  22. drops3 = 1 + rand(1)
  23. #=============================#
  24. if drops2 >0 && drops3 >0
  25. pbMessage(_INTL("The tree droped {1} x {2} , {3} x {4} , {5} x {6}",PBItems.getName(getID(PBItems,berry1)),drops1,PBItems.getName(getID(PBItems,berry2)),drops2 ,PBItems.getName(getID(PBItems,berry3)),drops3))
  26. elsif drops2 >0
  27. pbMessage(_INTL("The tree droped {1} x {2} , {3} x {4} ",PBItems.getName(getID(PBItems,berry1)),drops1,PBItems.getName(getID(PBItems,berry2)),drops2))
  28. else
  29. pbMessage(_INTL("The tree droped {1} x {2}. ",PBItems.getName(getID(PBItems,berry1)),drops1))
  30. end
  31.  
  32. #Pick all beries and generate agession#
  33. total1 = total1+drops1
  34. total2 = total2+drops2
  35. total3 = total3+drops3
  36. #===========#
  37. agression = rand(50)
  38. #============#
  39. if agression >= 10
  40. pbMessage(_INTL("The tree is shaking... maybe there's something in the tree?"))
  41. end
  42. if pbConfirmMessage(_INTL("Would you like to continue shaking the tree?"))
  43. #Shake tree
  44. if agression >= 30
  45. pbMessage(_INTL("A pokemon jumped from the tree!"))
  46. pbEncounter(:BerryTree)
  47. total1/2
  48. total2/2
  49. total3/2
  50. pbMessage(_INTL("The pokemon stole most of the berries..."))
  51. if total2 >0 && total3 >0
  52. pbMessage(_INTL("You pick up the leftover berries..."))
  53. #pbMessage(_INTL("{1} x {2} , {3} x {4} , {5} x {6}",PBItems.getName(getID(PBItems,berry1)),total1,PBItems.getName(getID(PBItems,berry2)),total2 ,PBItems.getName(getID(PBItems,berry3)),total3))
  54. pbItemBall(berry1,total1)
  55. pbItemBall(berry2,total2)
  56. pbItemBall(berry3,total3)
  57. return true
  58. elsif total2 >0
  59. pbMessage(_INTL("You pick up the leftover berries..."))
  60. #pbMessage(_INTL("{1} x {2} , {3} x {4} ",PBItems.getName(getID(PBItems,berry1)),total1,PBItems.getName(getID(PBItems,berry2)),total2))
  61. pbItemBall(berry1,total1)
  62. pbItemBall(berry2,total2)
  63. return true
  64. else
  65. pbMessage(_INTL("You pick up the leftover berries..."))
  66. #pbMessage(_INTL("{1} x {2}. ",PBItems.getName(getID(PBItems,berry1)),total1))
  67. pbItemBall(berry1,total1)
  68. return true
  69. end  
  70. else
  71. #Nothing Here
  72. end
  73. else
  74. #Quit shaking
  75. if total2 >0 && total3 >0
  76. pbMessage(_INTL("You pick up the berries"))
  77. #pbMessage(_INTL("{1} x {2} , {3} x {4} , {5} x {6}",PBItems.getName(getID(PBItems,berry1)),total1,PBItems.getName(getID(PBItems,berry2)),total2 ,PBItems.getName(getID(PBItems,berry3)),total3))
  78. pbItemBall(berry1,total1)
  79. pbItemBall(berry2,total2)
  80. pbItemBall(berry3,total3)
  81. return true
  82. elsif total2 >0
  83. pbMessage(_INTL("You pick up the berries"))
  84. #pbMessage(_INTL("{1} x {2} , {3} x {4} ",PBItems.getName(getID(PBItems,berry1)),total1,PBItems.getName(getID(PBItems,berry2)),total2))
  85. pbItemBall(berry1,total1)
  86. pbItemBall(berry2,total2)
  87. return true
  88. else
  89. pbMessage(_INTL("You pick up the berries"))
  90. #pbMessage(_INTL("{1} x {2}. ",PBItems.getName(getID(PBItems,berry1)),total1))
  91. pbItemBall(berry1,total1)
  92. return true
  93. loop end
  94. end  
  95. end  
  96. end
  97. return false
  98. end
  99. #===============================#
Add Comment
Please, Sign In to add comment