Advertisement
AngryPacman

[VXA] Gold Variance

Feb 3rd, 2012
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.49 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Gold Variance (1.0)
  4. # 03/02/2012
  5. # By Pacman (based off a script by modern algebra)
  6. # Gold drops in RMVXA are static by default, with every creature always dropping
  7. # the exact same amount every time you kill them. This script allows you to
  8. # change that by making them drop a random amount between values that you
  9. # choose.
  10. # Set VARIANCE to the default amount gold drops will vary by.
  11. #
  12. #===============================================================================
  13. #
  14. # BEGIN CONFIGURATION
  15. #
  16.  
  17. module GOLD_VAR
  18.   VARIANCE = 20 # Amount gold drops will vary by default.
  19. end
  20.  
  21. #
  22. # END CONFIGURATION
  23. #
  24. #===============================================================================
  25.  
  26. #==============================================================================
  27. # ** RPG::Enemy
  28. #------------------------------------------------------------------------------
  29. #  Data class for enemies. Subclass of RPG::BaseItem.
  30. #==============================================================================
  31.  
  32. class RPG::Enemy < RPG::BaseItem
  33.   #--------------------------------------------------------------------------
  34.   # Public Instance Variables
  35.   #--------------------------------------------------------------------------
  36.   attr_accessor :gold_variance
  37.   #--------------------------------------------------------------------------
  38.   # Alias listing
  39.   #--------------------------------------------------------------------------
  40.   unless self.method_defined?(:pacman_goldvar_gold)
  41.     alias pacman_goldvar_gold gold
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # * Enemy Gold
  45.   #--------------------------------------------------------------------------
  46.   def gold(*args, &block)
  47.     g = pacman_goldvar_gold(*args, &block); n = gold_variance
  48.     g + (rand(n).to_i)
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # * Get Gold Variance
  52.   #--------------------------------------------------------------------------
  53.   def gold_variance
  54.     @gold_variance = GOLD_VAR::VARIANCE
  55.     if self.note[/\\GOLD[_ ]?VAR\[(\d+)\]/i] != nil
  56.       @gold_variance = $1.to_i
  57.     end
  58.     @gold_variance
  59.   end
  60. end
  61.  
  62. $imported ||= {}
  63. $imported[:pac_gold_variance]
  64.  
  65. #===============================================================================
  66. #
  67. # END OF SCRIPT
  68. #
  69. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement