Advertisement
kurashi

Gold Boost from Equipment [RGSS3]

Apr 22nd, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.32 KB | None | 0 0
  1. # Name: Gold Boost from Equipment
  2. # Author: Kio Kurashi
  3. # Usage: Credits required. Free for Commercial and non-Commerial.
  4. # Dependancies: Restricted to RPG Maker VX Ace
  5.  
  6. # Instructions: In the note box of the equipment use the tag:
  7. #                      <GoldBoost n>
  8. #      Where n is a number between 0 and 100, and is equal to n% more gold.
  9.  
  10.  
  11.  
  12. ####### DO NOT EDIT BEYOND THIS POINT #######
  13. module BattleManager
  14.   def self.collectGoldBoost
  15.     multi = 1 + ($game_party.totalgoldboost/100)
  16.     @total = ($game_troop.gold_total*multi).to_i
  17.   end
  18.   def self.gain_gold
  19.     collectGoldBoost
  20.     if $game_troop.gold_total > 0
  21.       text = sprintf(Vocab::ObtainGold, @total)
  22.       $game_message.add('\.' + text)
  23.       $game_party.gain_gold(@total)
  24.     end
  25.     wait_for_message
  26.   end
  27. end
  28. class Game_Party
  29.   def totalgoldboost
  30.     @boosttotal = 0.0 #Must be 0.0 for Float.
  31.     $game_party.members.each do |member|
  32.       member.equips.each do |item|
  33.         next unless item.is_a?(RPG::EquipItem)
  34.         @boosttotal += item.goldboost
  35.       end#Slot
  36.     end#Actor
  37.     return @boosttotal
  38.   end#Method
  39. end
  40. class RPG::EquipItem
  41.     def goldboost
  42.       return @goldboost unless @goldboost.nil?
  43.       regex = /<goldboost (.*)/i
  44.       @goldboost = self.note =~ regex ? $1.to_i : 0
  45.       return @goldboost
  46.     end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement