Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

CogWheel Style Menu Bars

CogWheel Style Menu Bars
Version: 1.5

Introduction

I noticed that VX has it's own bar code. So I made some bars that look exactly like CogWheel ones.
I also made them for the Parameters.

Script

Code:
#==============================================================================
# ** COGWHEEL Style Menu Bars
#-------------------------------------------------------------------------------
# by Syvkal
# Version 1.5
# 04-26-08
#==============================================================================


module COG
  # Use built in RTP colors taken from the current system skin
    USE_WINDOWSKIN = true
  # Parameter Max Value
    P_MAX = 999
  # Gauge Border Colors
    COLOR1 = Color.new(0, 0, 0, 192)         # Outer Border
    COLOR2 = Color.new(255, 255, 192, 192)   # Inner Border
  # Gauge Empty filler
    COLOR3 = Color.new(0, 0, 0, 12)         # Half of Inner Shading
    COLOR4 = Color.new(64, 0, 0, 92)        # Half of Inner Shading
end
  
class Window_Base < Window
  alias draw_actor_hp_gauge_original draw_actor_hp_gauge
  def draw_actor_hp_gauge(actor, x, y, width = 120)
    if actor.maxhp != 0
      rate = actor.hp.to_f / actor.maxhp
    else
      rate = 0
    end
    if actor.maxhp != 0
      gw = width * actor.hp / actor.maxhp
    else
      gw = 0
    end
    gc1 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
    gc2 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
    self.contents.fill_rect(x-2, y + WLH - 10, width+4, 10, COG::COLOR1)
    self.contents.fill_rect(x-1, y + WLH - 9, width+2, 8, COG::COLOR2)
    self.contents.gradient_fill_rect(x, y + WLH - 8, width, 6, COG::COLOR3, COG::COLOR4)
    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  end
  
  alias draw_actor_mp_gauge_original draw_actor_mp_gauge
  def draw_actor_mp_gauge(actor, x, y, width = 120)
    if actor.maxmp != 0
      rate = actor.mp.to_f / [actor.maxmp, 1].max
    else
      rate = 1
    end  
    if actor.maxmp != 0
      gw = width * actor.mp / [actor.maxmp, 1].max
    else
      gw = width  
    end
    gc1 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
    gc2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
    self.contents.fill_rect(x-2, y + WLH - 10, width+4, 10, COG::COLOR1)
    self.contents.fill_rect(x-1, y + WLH - 9, width+2, 8, COG::COLOR2)
    self.contents.gradient_fill_rect(x, y + WLH - 8, width, 6, COG::COLOR3, COG::COLOR4)
    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  end
  
  alias draw_actor_parameter_original draw_actor_parameter
  def draw_actor_parameter(actor, x, y, type)
    draw_actor_parameter_gauge(actor, x, y, type)
    draw_actor_parameter_original(actor, x, y, type)
  end
  
  def draw_actor_parameter_gauge(actor, x, y, type)
    case type
    when 0
      e1 = actor.atk
      COG::USE_WINDOWSKIN ? gc1 = text_color(20) : gc1 = Color.new(253, 53, 56, 192)
      COG::USE_WINDOWSKIN ? gc2 = text_color(2) : gc2 = Color.new(242, 74, 6, 192)
    when 1
      e1 = actor.def
      COG::USE_WINDOWSKIN ? gc1 = text_color(21) : gc1 = Color.new(238, 254, 124, 192)
      COG::USE_WINDOWSKIN ? gc2 = text_color(17) : gc2 = Color.new(228, 253, 48, 192)
    when 2
      e1 = actor.spi
      COG::USE_WINDOWSKIN ? gc1 = text_color(31) : gc1 = Color.new(119, 203, 254, 192)
      COG::USE_WINDOWSKIN ? gc2 = text_color(30) : gc2 = Color.new(8, 160, 253, 192)
    when 3
      e1 = actor.agi
      COG::USE_WINDOWSKIN ? gc1 = text_color(4) : gc1 = Color.new(124, 254, 155, 192)
      COG::USE_WINDOWSKIN ? gc2 = text_color(12) : gc2 = Color.new(33, 253, 86, 192)
    end
    # Calculate Bar Gradiation
    e2 = COG::P_MAX
    if e1.to_f != 0
      rate = e1.to_f / e2.to_f
    else
      rate = 1
    end
    # Adjust Bar Color based on Gradiation & Parameter Type
    for i in 0..3
      r = gc2.red * rate
      g = (gc2.green - 72) * rate
      b = gc2.blue  * rate
      a = gc2.alpha
    end
    # Calculate Bar Width
    width = 168
    if e1.to_f != 0
      par = width * e1.to_f / e2.to_f
    else
      par = width
    end
    # Equipment Calc Fix    
    case type
    when 0
      if e1 == 0
        par = 0
      end
    when 1
      if e1 == 0
        par = 0
      end
    end
    self.contents.fill_rect(x-2, y + WLH - 10, width+4, 10, COG::COLOR1)
    self.contents.fill_rect(x-1, y + WLH - 9, width+2, 8, COG::COLOR2)
    self.contents.gradient_fill_rect(x, y + WLH - 8, width, 6, COG::COLOR3, COG::COLOR4)
    self.contents.gradient_fill_rect(x, y + WLH - 8, par, 6, Color.new(r, g, b, a), gc1)
  end
end

class Window_SkillStatus < Window_Base
  alias refresh_original refresh
  def refresh
    draw_actor_name(@actor, 4, 0)
    draw_actor_level(@actor, 140, 0)
    draw_actor_hp(@actor, 238, 0)
    draw_actor_mp(@actor, 390, 0)
  end
end


  • Screenshots
    http://i25.photobucket.com/albums/c66/R ... elBars.jpg[/img]

    Instructions

    Put it under the Materials Section

    Updates

    Updated to version 1.5
    • I have addded the choice to use colours from the System Windowskin (Inspired by Kylock)
    • The new feature is currently only for Parameter bars, but will be updated for the main bars aswell if I like the colours
    • Easier way to customise max parameter values added


    Compatibility

    Should work with most things, but I'm not 100% sure

    Credits and Thanks
    I did take part of the coding for the Parameters from DerVVulfman's Plug 'n' Play CogWheel bars, but I kinda helped make that... so it's ok.
 
Nice script syvkal, these bars are quite nice! I especially like the parameter bars. The gradient_fill_rect method is such a nice feature :)
 
Umm a custom one. I'm kinda toying with it. I've got one with the wheel at the bottom too.
I've made the Menu, but not the actual Ring Menu code, so I haven't posted it up.


Oh and so this isn't a completely off topic post, I have updated it so it works (I put the wrong coding in ¬_¬ ) and changed a couple other useless things. Thinking about changing the maximum on the parameters, but that's not important either :P
 
It's only the bars that change, not the menu.
Maybe I should change the screenshot to a normal one ¬_¬
 
Updated
Version: 1.5

See 'Updates' on the first for the list of updates.


Oh yeah I added a module by accident while messing around with it, and decided to keep it ^_^
 
Updates

Updated to version 1.5
  • I have addded the choice to use colours from the System Windowskin (Inspired by Kylock)
    • This is currently only for Parameter bars, but will be updated for the main bars aswell if I like the colours
  • Easier way to customise max parameter values added
Updated to version 1.9
  • Add a way to make your own custom 'CogWheel Style' bars easily
Updated to version 2.0
  • I cleaned up the script
  • I added coding for DVVs Limit Break Bars
Updated to version 2.5
  • I cleaned up the script more
  • Added Slanted Bar Fill
Updated to version Beta 3.0
  • Added slanted bars
  • Errors and Bugs still present so in Beta...
Updated to version 3.0
  • Proper Slanted Bars finished
  • Vertical Bars - Both Slanted and Normal
  • Removed slanted bar gradient (no one would use it xD )


Current Version available over at rmvxpuniverse and RPG Revolution

Teaser
[/FONT]

This is what will be coming up in the next update xD
Everything is done except the colouring (I still have a few things left to do)

I put this scene together really quickly so the layout is crap, but here's what I've got so far:

http://i25.photobucket.com/albums/c66/R ... rsTest.jpg[/img]
http://i25.photobucket.com/albums/c66/RPG_Maker_XP/Screenies/CogWheelBars.jpg[/img]

http://i25.photobucket.com/albums/c66/R ... Status.jpg[/img]

http://i25.photobucket.com/albums/c66/R ... ntBars.jpg[/img]


I hope someone uses it when I finally release it ^_^

I've got in mind quite a few HUDs that could be made with this xD
 
First, I haven't updated it here, it is on Version 4.1 (I think) check on rpgrevolution, rpgmakervx or rmvxpuniverse. Sorry.

And I am on holiday so I won't be posting it up anyways ;)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top