Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # You may be wondering why Woratana's Neo Gauge is in here. Well, I love it so
- # much I couldn't bare to run a game without it, so it's included here. That
- # said, it's been edited by me so I've renamed it Neo Gauge Ultimate. This is
- # because it's not in PAC format, and I don't think I've edited it enough to
- # consider it an original work.
- #
- #===============================================================================
- #==============================================================================
- # [VX] <+ [Neo Gauge] ENGINE -> by Woratana
- #------------------------------------------------------------------------------
- # ◦ by Woratana [woratana@hotmail.com]
- # ◦ Released on: 25/12/2008 (D-M-Y)
- # ◦ Version: 2
- #---------------------------------------------------------------------------
- # ◦ Exclusive Script @ RPG RPG Revolution (http://www.rpgrevolution.com/)
- #---------------------------------------------------------------------------
- #### [FEATURES] ####
- # - Support horizontal/vertical gradient bar.
- # - Draw 3 colors gradient / user can choose spot to draw second color.
- # - Easy to setting gauge style.
- #------------------------------------------------------------------------------
- #==============================================================================
- class Window_Base < Window
- #==========================================================================
- # NEO GAUGE SETTING #
- # Color: Color.new(Red, Green, Blue) # Each number you can put integer 0-255
- # * You can use this site to get RGB color:
- # http://web.njit.edu/~kevin/rgb.txt.html
- #==========================================================================
- GAUGE_GLOW_EFFECT = true # Use glow effect?
- GAUGE_GLOW_COLOR = Color.new(0,0,0) # Glow color
- GAUGE_OUTSIDE_BORDER = true # Use outside border?
- GAUGE_OUTSIDE_BORDER_COLOR = Color.new(255,255,255)#Color.new(0, 0, 0)
- GAUGE_OUTSIDE_BORDER_COLOR2 = Color.new(255,255,255)#Color.new(0, 0, 0)
- GAUGE_CLEAR_CORNER_OUTSIDE_BORDER = true
- GAUGE_INSIDE_BORDER = false # Use inside border?
- GAUGE_INSIDE_BORDER_COLOR = Color.new(255, 255, 255)
- GAUGE_INSIDE_BORDER_COLOR2 = Color.new(0, 0, 0)
- #==========================================================================
- #=============================================================
- # NEO HP/MP/STATS GAUGE SETTING #
- #=============================================================
- HPMP_GAUGE_HEIGHT = 8 # gauge height (minumum: 6)
- # Recommend to use HPMP_GAUGE_HEIGHT at least 8,
- # if you're using GAUGE_INSIDE_BORDER in Neo-Gauge
- HPMP_GAUGE_X_PLUS = 0 # Move gauge horizontally (+,-)
- HPMP_GAUGE_Y_PLUS = ((-1)*(HPMP_GAUGE_HEIGHT - 6)) # (+,-)
- # Change '((-1)*(HPMP_GAUGE_HEIGHT - 6))' to number to move gauge vertically
- # BACK GAUGE COLORS
- BACK_GCOLOR_1 = Color.new(0, 0, 0) # Black [Color1]
- BACK_GCOLOR_2 = Color.new(100, 100, 100) # Dark Gray [Color2]
- BACK_GCOLOR_3 = Color.new(200, 200, 200) # Light Gray [Color3]
- USE_HP_GAUGE = true # Use HP Gauge? (true/false)
- USE_MP_GAUGE = true # Use MP Gauge?
- # HP GAUGE COLORS
- HP_GCOLOR_1 = Color.new(139,0,0) # Dark Red
- HP_GCOLOR_2 = Color.new(255,0,0) # Pure Red
- HP_GCOLOR_3 = Color.new(255,193,37) # Goldenrod
- # MP GAUGE COLORS
- MP_GCOLOR_1 = Color.new(0,0,128) # Dark Blue
- MP_GCOLOR_2 = Color.new(0,191,255) # Blue
- MP_GCOLOR_3 = Color.new(46,139,87) # Light Green
- #---------------------------------------------------------
- ADSA_GAUGE_MAX_MODE = 0
- # Mode for Attack/Defense/Spirit/Agility Gauge Max:
- # 0: use stats at level 99 for gauge's max
- # 1 or more: use that number for gauge's max
- USE_ADSA_GAUGE = true # Use Attack/Defense/Spirit/Agility Gauge?
- # ATTACK GAUGE COLORS
- ATK_GCOLOR_1 = Color.new(0,0,128)
- ATK_GCOLOR_2 = Color.new(0,191,255)
- ATK_GCOLOR_3 = Color.new(152,251,152)
- # DEFENSE GAUGE COLORS
- DEF_GCOLOR_1 = Color.new(0,0,128)
- DEF_GCOLOR_2 = Color.new(0,191,255)
- DEF_GCOLOR_3 = Color.new(152,251,152)
- # SPIRIT GAUGE COLORS
- SPI_GCOLOR_1 = Color.new(0,0,128)
- SPI_GCOLOR_2 = Color.new(0,191,255)
- SPI_GCOLOR_3 = Color.new(152,251,152)
- # AGILITY GAUGE COLORS
- AGI_GCOLOR_1 = Color.new(0,0,128)
- AGI_GCOLOR_2 = Color.new(0,191,255)
- AGI_GCOLOR_3 = Color.new(152,251,152)
- #-------------------------------------------------------------------
- USE_MOG_BASIC_MENU = false # Use Mog Basic Menu (EXP) Gauge?
- # Mog Basic Menu EXP GAUGE COLORS
- MOG_EXP_GCOLOR_1 = Color.new(0,100,0)
- MOG_EXP_GCOLOR_2 = Color.new(0, 255, 0)
- MOG_EXP_GCOLOR_3 = Color.new(173,255,47)
- #-------------------------------------------------------------------
- # [END] NEO GAUGE FINAL SETUP
- #===================================================================
- #------------------------------------------------------------
- # * Neo Gauge Back Color: Return back colors
- #------------------------------------------------------------
- def neo_gauge_back_color
- return BACK_GCOLOR_1, BACK_GCOLOR_2, BACK_GCOLOR_3
- end
- #--------------------------------------------------------------------------
- # [Rewrite] * Draw HP gauge
- #--------------------------------------------------------------------------
- if USE_HP_GAUGE
- def draw_actor_hp_gauge(actor, x, y, width = 120)
- gwidth = width * actor.hp / actor.maxhp
- cg = neo_gauge_back_color
- c1, c2, c3 = cg[0], cg[1], cg[2]
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + WLH - 8 + HPMP_GAUGE_Y_PLUS, width,
- HPMP_GAUGE_HEIGHT, c1, c2, c3)
- (1..3).each {|i| eval("c#{i} = HP_GCOLOR_#{i}") }
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + WLH - 8 + HPMP_GAUGE_Y_PLUS, gwidth, HPMP_GAUGE_HEIGHT,
- c1, c2, c3, false, false, width, 30)
- end
- end
- #--------------------------------------------------------------------------
- # [Rewrite] * Draw MP Gauge
- #--------------------------------------------------------------------------
- if USE_MP_GAUGE
- def draw_actor_mp_gauge(actor, x, y, width = 120)
- gwidth = width * actor.mp / [actor.maxmp, 1].max
- cg = neo_gauge_back_color
- c1, c2, c3 = cg[0], cg[1], cg[2]
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + WLH - 8 + HPMP_GAUGE_Y_PLUS, width,
- HPMP_GAUGE_HEIGHT, c1, c2, c3)
- (1..3).each {|i| eval("c#{i} = MP_GCOLOR_#{i}") }
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + WLH - 8 + HPMP_GAUGE_Y_PLUS, gwidth, HPMP_GAUGE_HEIGHT,
- c1, c2, c3, false, false, width, 40)
- end
- end
- #--------------------------------------------------------------------------
- # [Rewrite] * Draw Parameters
- #--------------------------------------------------------------------------
- if USE_ADSA_GAUGE
- def draw_actor_parameter(actor, x, y, type)
- case type
- when 0
- parameter_name = Vocab::atk
- parameter_value = actor.atk
- parameter_value_max = actor.maxatk
- (1..3).each {|i| eval("@c#{i} = ATK_GCOLOR_#{i}") }
- when 1
- parameter_name = Vocab::def
- parameter_value = actor.def
- parameter_value_max = actor.maxdef
- (1..3).each {|i| eval("@c#{i} = DEF_GCOLOR_#{i}") }
- when 2
- parameter_name = Vocab::spi
- parameter_value = actor.spi
- parameter_value_max = actor.maxspi
- (1..3).each {|i| eval("@c#{i} = SPI_GCOLOR_#{i}") }
- when 3
- parameter_name = Vocab::agi
- parameter_value = actor.agi
- parameter_value_max = actor.maxagi
- (1..3).each {|i| eval("@c#{i} = AGI_GCOLOR_#{i}") }
- end
- # Draw parameter gauge
- parameter_value_max = ADSA_GAUGE_MAX_MODE if ADSA_GAUGE_MAX_MODE > 0
- width = 156
- gwidth = width * parameter_value / [parameter_value_max, 1].max
- cg = neo_gauge_back_color
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + WLH - 8 + HPMP_GAUGE_Y_PLUS, width,
- HPMP_GAUGE_HEIGHT, cg[0], cg[1], cg[2])
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + WLH - 8 + HPMP_GAUGE_Y_PLUS, gwidth, HPMP_GAUGE_HEIGHT,
- @c1, @c2, @c3, false, false, width, 40)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 120, WLH, parameter_name)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 120, y, 36, WLH, parameter_value, 2)
- end
- end
- #--------------------------------------------------------------------------
- # [Rewrite] * Mog Basic Menu Plus EXP Gauge
- #--------------------------------------------------------------------------
- if USE_MOG_BASIC_MENU
- def draw_actor_exp_meter(actor, x, y, width = 100)
- if actor.next_exp != 0
- exp = actor.now_exp
- else
- exp = 1
- end
- gw = width * exp / [actor.next_exp, 1].max
- cg = neo_gauge_back_color
- c1, c2, c3 = cg[0], cg[1], cg[2]
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + WLH - 8 + HPMP_GAUGE_Y_PLUS, width,
- HPMP_GAUGE_HEIGHT, c1, c2, c3)
- (1..3).each {|i| eval("c#{i} = MOG_EXP_GCOLOR_#{i}") }
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + WLH - 8 + HPMP_GAUGE_Y_PLUS, gw, HPMP_GAUGE_HEIGHT,
- c1, c2, c3, false, false, width, 50)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 30, WLH, "Exp")
- self.contents.font.color = normal_color
- xr = x + width
- self.contents.draw_text(xr - 60, y, 60, WLH, actor.next_rest_exp_s, 2)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Neo Gauge: Draw Gauge with 3 Colors & Outline
- # x : draw spot x-coordinate
- # y : draw spot y-coordinate
- # width : gauge width
- # height : gauge height
- # color1 : first color (left side)
- # color2 : second color (center)
- # color3 : last color (right side)
- # vertical : vertical gauge? (true: vertical | false: horizontal)
- # outline : draw glow & outline? (true: draw | false: draw only gradient)
- # max_width : max_width that gradient will draw before cut to width
- # (max_width will becomes max_height in vertical gauge)
- # color2_spot = spot to draw color 2 [1:Left <- (default)50:Center -> 100:Right]
- #-------------------------------------------------------------------------
- def draw_neo_gauge(x, y, width, height, color1, color2, color3, vertical = false,
- outline = true, max_width = nil, color2_spot = 50)
- if max_width == nil
- max_width = vertical ? height : width
- end
- glow = GAUGE_GLOW_EFFECT # Set glow effect
- dx = x; dy = y # Store draw spot X/Y
- x = y = 0 # Change x, y for temp. bitmap
- bitmap = Bitmap.new(max_width, height) # Create temp. bitmap to draw gauge
- if glow # If GLOW
- if outline # If drawing outline
- # Create Glow rect
- if vertical; rect = Rect.new(x, y, width, max_width)
- else; rect = Rect.new(x, y, max_width, height)
- end
- bitmap.fill_rect(rect, GAUGE_GLOW_COLOR) # Draw Glow
- bitmap.neo_clear_corner(rect.x, rect.y, rect.width, rect.height) # Clear Corner
- else # Not drawing outline
- height -= 2; width -= 2; x += 1; y += 1
- if GAUGE_INSIDE_BORDER
- height -= 2; width -= 2; x += 1; y += 1
- end; end; end # End Draw Glow0
- # Set Position/Size for Gradient
- if vertical # If drawing vertical bar
- if glow; gx = gx2 = x + 1; gy = y + 1 # If GLOW
- else; gx = gx2 = x; gy = y # If NOT GLOW
- end
- gy2 = gy - 1 + ((color2_spot*max_width)/100)
- gw = gw2 = width - 2; gh = ((color2_spot*max_width)/100)
- gh2 = max_width - gh - 2
- # Draw Vertical Gradient Bar
- bitmap.gradient_fill_rect(gx, gy, gw, gh, color1, color2, true)
- bitmap.gradient_fill_rect(gx2, gy2, gw2, gh2, color2, color3, true)
- gh = (gh + gh2) # Change gauge height for draw border
- else # Drawing horizontal bar
- if glow; gx = x; gy = gy2 = y # If GLOW
- gx = x + 1; gy = gy2 = y + 1;
- else; gx = x; gy = gy2 = y # If NOT GLOW
- end
- gx2 = gx - 1 + ((color2_spot*max_width)/100)
- gw = ((color2_spot*max_width)/100); gh = gh2 = (height - 2)
- gw2 = max_width - gw - 2
- # Draw Horizontal Gradient Bar
- bitmap.gradient_fill_rect(gx, gy, gw, gh, color1, color2)
- bitmap.gradient_fill_rect(gx2, gy2, gw2, gh2, color2, color3)
- gw = (gw + gw2) # Change gauge width for draw border
- end
- if outline # If user want outline, draw borders
- if GAUGE_OUTSIDE_BORDER # Draw outside border
- bitmap.draw_neo_border(gx, gy, gw, gh, GAUGE_OUTSIDE_BORDER_COLOR, GAUGE_OUTSIDE_BORDER_COLOR2)
- bitmap.neo_clear_corner(gx, gy, gw, gh) if GAUGE_CLEAR_CORNER_OUTSIDE_BORDER
- end
- if GAUGE_INSIDE_BORDER # Draw inside border
- gx += 1; gy += 1; gw -= 2; gh -= 2
- bitmap.draw_neo_border(gx, gy, gw, gh, GAUGE_INSIDE_BORDER_COLOR, GAUGE_INSIDE_BORDER_COLOR2)
- end
- end
- # Cut gauge's width from 'max_width' to 'width'
- rect = Rect.new(0, 0, width, bitmap.height)
- self.contents.blt(dx, dy, bitmap, rect)
- bitmap.dispose # Delete bitmap
- end
- end
- #==============================================================================
- # [Bitmap: 2 New Methods] by Woratana
- # => Draw Neo Border: Draw border around specific area
- # => Neo Clear Corner: Clear 4 corners of specific area
- #------------------------------------------------------------------------------
- class Bitmap
- #--------------------------------------------------------------------------
- # * Draw Neo Border: Draw gradient border around specific area
- # x : area x-coordinate
- # y : area y-coordinate
- # width : area width
- # height : area height
- # color : border color (left side)
- # color2 : border color (right side)
- # size : border size (default is 1)
- #--------------------------------------------------------------------------
- def draw_neo_border(x, y, width, height, color, color2 = color, size = 1)
- gradient_fill_rect(x, y, width, size, color, color2) # Top
- fill_rect(x, y, size, height, color) # Left
- fill_rect(x + width - size, y, size, height, color2) # Right
- gradient_fill_rect(x, y + height - size, width, size, color, color2) # Down
- end
- #--------------------------------------------------------------------------
- # * Neo Clear Corner: Clear 4 corners of specific area
- # x : area x-coordinate
- # y : area y-coordinate
- # width : area width
- # height : area height
- # size : area (size * size) that will be clear from corners
- #--------------------------------------------------------------------------
- def neo_clear_corner(x, y, width, height, size = 1)
- clear_rect(x, y, size, size)
- clear_rect(x + width - size, y, size, size)
- clear_rect(x, y + height - size, size, size)
- clear_rect(x + width - size, y + height - size, size, size)
- end
- end
- #==============================================================================
- # [Game_Batter: 4 New Methods] by Woratana
- # Add method to find maximum stats
- #------------------------------------------------------------------------------
- class Game_Battler
- def maxatk
- n = atk
- n = n - actor.parameters[2, @level] + actor.parameters[2, 99] if self.is_a?(Game_Actor)
- return n
- end
- def maxdef
- n = atk
- n = n - actor.parameters[3, @level] + actor.parameters[3, 99] if self.is_a?(Game_Actor)
- return n
- end
- def maxspi
- n = atk
- n = n - actor.parameters[4, @level] + actor.parameters[4, 99] if self.is_a?(Game_Actor)
- return n
- end
- def maxagi
- n = atk
- n = n - actor.parameters[5, @level] + actor.parameters[5, 99] if self.is_a?(Game_Actor)
- return n
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement