Advertisement
mrbubble

KGC Generic Gauge for Zetu's Alternate MP X

Jul 7th, 2011
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.53 KB | None | 0 0
  1. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2. # KGC Generic Gauge for Zetu's Alternate MP X
  3. # v1.0
  4. # By Mr. Bubble
  5. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6. # Installation:
  7. #   Install this script below Alternate MP X in your script editor.
  8. # - - - -                                                               - - - -
  9. # Requirements:
  10. #   - Requires KGC_GenericGauge installed in your script editor.
  11. #   - Requires Zetu's Alternate MP X installed in your script editor.
  12. #   - Gauge images must follow the designated format for KGC Generic Gauge
  13. #   - Gauge images must be place in the .\Graphics\System folder.
  14. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  15. # This script aliases class Window_Base#draw_actor_ampx_gauge in AMPX.
  16. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  17.  
  18. module Bubs
  19. module AMPX_GG
  20.  
  21.   # Enable/Disable AMPX + KGC_GG
  22.   #   true  : Enable use of Generic Gauges for AMPX
  23.   #   false : Disable use of Generic Gauges for AMPX
  24.   USE_AMPX_GG = true
  25.  
  26.   # AMPX Generic Gauge Settings  
  27.   AMPX_GG_SETTINGS = {
  28.  
  29.   :mana     => ["GaugeMana",  # Gauge file name
  30.                          -4,  # Length Offset
  31.                          30,  # Gauge Slope (Must be between -89 ~ 89 degrees)
  32.                   [-23, -2]   # Gauge Position Offset [x,y]
  33.                           ],  # Closing bracket and comma
  34.                        
  35.   :rage     => ["GaugeRage",  # Gauge file name
  36.                          -4,  # Length Offset
  37.                          30,  # Gauge Slope (Must be between -89 ~ 89 degrees)
  38.                   [-23, -2]   # Gauge Position Offset [x,y]
  39.                           ],  # Closing bracket and comma
  40.                
  41.   :energy => ["GaugeEnergy",  # Gauge file name
  42.                          -4,  # Length Offset
  43.                          30,  # Gauge Slope (Must be between -89 ~ 89 degrees)
  44.                   [-23, -2]   # Gauge Position Offset [x,y]
  45.                           ],  # Closing bracket and comma
  46.                
  47.   :focus   => ["GaugeFocus",  # Gauge file name
  48.                          -4,  # Length Offset
  49.                          30,  # Gauge Slope (Must be between -89 ~ 89 degrees)
  50.                   [-23, -2]   # Gauge Position Offset [x,y]
  51.                           ],  # Closing bracket and comma
  52.                
  53.   # - - - - - - - - You can add more settings in here - - - - - - - - - - - -
  54.                
  55.  
  56.  
  57.  
  58.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  59.  
  60.   } # <-- Do not delete this.
  61.  
  62.   # AMPX Generic Gauge Default Settings
  63.   #   Gauges will use the following default settings if the specific gauge
  64.   #   settings in AMPX_GG_SETTINGS are not found.
  65.   AMPX_DEFAULT_FILE = "GaugeMana"
  66.   AMPX_LENGTH  = -4         # Length Adjustment
  67.   AMPX_SLOPE   = 30         # Gauge Slope (Must be between -89 ~ 89 degrees)
  68.   AMPX_OFFSET  = [-23, -2]  # Gauge Position Offset
  69.  
  70. end
  71. end
  72.  
  73. #  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  74. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  75. #  -  Do not edit anything below here unless you know what you're doing. - - -  
  76. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  77. #  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  78.  
  79. $zsys = {} if $zsys.nil?
  80. $imported = {} if $imported == nil
  81.  
  82. if $zsys[:ampx] && $imported["GenericGauge"]
  83.  
  84. class Window_Base < Window
  85.   include Bubs::AMPX_GG
  86.   alias draw_actor_ampx_gauge_kgc_genericgauge draw_actor_ampx_gauge unless $@
  87.   def draw_actor_ampx_gauge(actor, x, y, resource, width = 120)
  88.     if USE_AMPX_GG && AMPX_GG_SETTINGS[resource]
  89.       value = actor.ampx(resource)
  90.       limit = [actor.maxampx(resource), 1].max
  91.       file = AMPX_GG_SETTINGS[resource][0]
  92.       len_offset = AMPX_GG_SETTINGS[resource][1]
  93.       slope = AMPX_GG_SETTINGS[resource][2]
  94.       offset = AMPX_GG_SETTINGS[resource][3]
  95.     elsif USE_AMPX_GG && !AMPX_GG_SETTINGS[resource]
  96.       value = actor.ampx(resource)
  97.       limit = [actor.maxampx(resource), 1].max
  98.       file = AMPX_DEFAULT_FILE
  99.       len_offset = AMPX_LENGTH
  100.       slope = AMPX_SLOPE
  101.       offset = AMPX_OFFSET
  102.     else
  103.       return draw_actor_ampx_gauge_kgc_genericgauge(actor, x, y, resource, width = 120) # alias
  104.     end
  105.     return draw_gauge(file, x, y, width, value, limit, offset, len_offset, slope)
  106.   end
  107. end
  108.  
  109. end # if $zsys[:ampx] && $imported["GenericGauge"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement