Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2011
655
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.78 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Shanghai Simple Script - Randomized Gold
  4. # Last Date Updated: 2010.05.03
  5. # Level: Easy
  6. #
  7. # Instead of every single slime dropping exactly 100 gold, have them randomized
  8. # so that they drop anywhere from 90 to 110. The amount of variation can be
  9. # adjusted.
  10. #===============================================================================
  11. # Instructions
  12. # -----------------------------------------------------------------------------
  13. # To install this script, open up your script editor and copy/paste this script
  14. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  15. #===============================================================================
  16.  
  17. $imported = {} if $imported == nil
  18. $imported["RandomizedGold"] = true
  19.  
  20. module SSS
  21.   # This is the percentage used to randomize gold.
  22.   RANDOMIZED_GOLD_VARIATION = 20
  23. end
  24.  
  25. #==============================================================================
  26. # ** Game_Enemy
  27. #==============================================================================
  28.  
  29. class Game_Enemy < Game_Battler
  30.   #--------------------------------------------------------------------------
  31.   # * Get Gold
  32.   #--------------------------------------------------------------------------
  33.   def gold
  34.     default_gold = enemy.gold
  35.     variation = SSS::RANDOMIZED_GOLD_VARIATION
  36.     lower = Integer(default_gold * (100 - variation) / 100)
  37.     upper = Integer(default_gold * (100 + variation) / 100)
  38.     value = lower + rand(upper - lower + 1)
  39.     return value
  40.   end
  41. end
  42.  
  43. #===============================================================================
  44. #
  45. # END OF FILE
  46. #
  47. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement