RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Filling the Gauge?

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 55
Waiting ...
So I have the code listed bellow - the whole script works except for the fil_rate. It works if your max variable is 10, cause 0.1 * 10 = 1

So what should I change to allow people to have max variables for thier variables of say 675 or 324 or 15 or even 1?

If your looking to set this up your self to test it:

event script

$game_gauge.set_var_id(id of variable)
$game_gauge.set_var_max(the max amount a variable should be)
$game_gauge.set_show(true)

then in your event set up your variable as:

if v[id - should match variable_id] == max (should match variable_max)
    $game_gauge.set_show(false)
else
    v[id] += 1
end

For testing I used Variable id 10 with a max of ten to watch the gauge fill up.

Code: [Select]
module VP
  module Config
    WINDOW_WIDTH = 180
    WINDOW_HEIGHT = 0
    WINDOW_X = 0
    WINDOW_Y = 0
   
    GAUGE_X = 0
    GAUGE_Y = 0
    GAUGE_WIDTH = 160
    GAUGE_COLOR_ONE = 10
    GAUGE_COLOR_TWO = 6
  end
end


module DataManager
  class << self
    alias create_gameobjects_vp_hdsfy45 create_game_objects
  end

  def self.create_game_objects
    create_gameobjects_vp_hdsfy45
    $game_gauge = Game_Gauge.new
  end
   
end
 
class Game_Gauge
  attr_accessor :variable_id
  attr_accessor :variable_max
  attr_accessor :show
 
  def set_var_id(id)
    @variable_id = id
  end
 
  def set_var_max(max)
    @variable_max = max
  end
 
  def set_show(show)
    @show = show
  end
end

class Scene_Map
 
  alias create_all_windows_vp_fhhjse5 create_all_windows
  def create_all_windows
    create_all_windows_vp_fhhjse5
    create_gauge
  end
 
  def create_gauge
    @gauge = Window_Gauge.new()
  end
 
end

class Window_Gauge < Window_Base
 
  def initialize
    super(0, 0, window_width, window_height)
    refresh
  end

  def window_width
    if VP::Config::WINDOW_WIDTH == 0
      return 180
    else
      return VP::Config::WINDOW_WIDTH
    end
  end
 
   
  def window_height
    if VP::Config::WINDOW_HEIGHT == 0
      return fitting_height(1)
    else
      return VP::Config::WINDOW_HEIGHT
    end
  end
   

  def refresh
    contents.clear
  end
 
  def update
    super
    if $game_gauge.show
      self.visible = true
    else
      self.visible = false
    end
    draw_gauge(0, -5, 160, fil_rate, text_color(gauge_color_one),
      text_color(gauge_color_two))
  end

  def fil_rate
    if $game_gauge.variable_id != nil
      if $game_gauge.variable_max >= $game_variables[$game_gauge.variable_id]
        return 0.1 * $game_variables[$game_gauge.variable_id]
      end
    else
      return 0
    end
  end
 
  def gauge_color_one
    return VP::Config::GAUGE_COLOR_ONE
  end
 
  def gauge_color_two
    return VP::Config::GAUGE_COLOR_TWO
  end
 
  def open
    refresh
    super
  end
end