Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ============================================================================
- if true # <-- set true buat nge-enable. false buat disable
- # ============================================================================
- module THEO
- # Nampilin variable antara = <start>..<akhir>
- VARIABLE_ID = 3..6
- # Maksimal nilai value ~
- # misalnya u tulis 1 => 100 maka ntar di window bakal ditampilin
- # nilai_variable[1] / 100
- MAX_VALUE = {
- 1 => 100,
- 2 => 100,
- # tambahin sendiri ~
- }
- # Kalo ga dispesifikasi sendiri di atas. Disini defaultnya :v
- DEFAULT_MAX = 100
- # Warna buat gaugenya
- # misalnya 1 => 0,0 >> berarti warnanya putih
- # formatnya [index variablenya] =>[warna pertama, warna kedua],
- # warna bisa dipilih dari 0 - 31
- BAR_COLOR = {
- 1 => [3,20],
- 2 => [1,25],
- 3 => [1,1],
- 4 => [1,1],
- 5 => [1,1],
- 6 => [1,1],
- # tambahin sendiri
- }
- # Variable icon ~
- # index variable => index iconnya
- VARIABLE_ICON = {
- 1 => 20,
- 2 => 30,
- 3 => 30,
- 4 => 30,
- 5 => 30,
- # tambahin sendiri
- }
- # Lebar gaugenya ~
- BAR_WIDTH = "contents.width" # <-- pake string
- # contents.width >> sama kek lebar window
- # ====== Settingan window ===== #
- WINDOW_X = 0 # Posisi X
- WINDOW_Y = 0 # Posisi Y
- WINDOW_W = Graphics.width # Lebar
- WINDOW_H = Graphics.height # Tinggi
- FONT_SIZE = 24 # gede kecilnya font. default 24
- OPACITY = 255 # transparansi default 255
- SHOW_VALUE = false # Kalo true, berarti ntar nampilin 1/100 (misalnya)
- # Untuk ngambil lebar layar game, tulis >> Graphics.width
- # Untuk ngambil tinggi layar game, tulis >> Graphics.height
- end
- class Window_Variable < Window_Base
- def initialize(x,y,width,height)
- super(x,y,width,height)
- contents.font.size = THEO::FONT_SIZE
- self.opacity = THEO::OPACITY
- refresh
- end
- def refresh
- contents.clear
- i = 1
- for index in THEO::VARIABLE_ID
- draw_variables(index,i)
- i += 1
- end
- end
- def draw_variables(index,i)
- current_value = $game_variables[index].to_f
- max_value = (THEO::MAX_VALUE.include?(index) ? THEO::MAX_VALUE[index] : THEO::DEFAULT_MAX)
- rate = current_value / max_value
- y_pos = THEO::FONT_SIZE
- icon_index = (THEO::VARIABLE_ICON.include?(index) ? THEO::VARIABLE_ICON[index] : 0)
- color1 = text_color(THEO::BAR_COLOR[index][0])
- color2 = text_color(THEO::BAR_COLOR[index][1])
- draw_gauge(24,(y_pos*i) - y_pos,eval(THEO::BAR_WIDTH)-24,rate,color1,color2)
- draw_icon(icon_index,0,(y_pos*i) - y_pos)
- draw_current_and_max_values(0,(y_pos*i) - y_pos,contents.width,current_value.to_i,max_value,
- text_color(0),text_color(0)) if THEO::SHOW_VALUE
- end
- end
- class Scene_Map < Scene_Base
- alias scene_start start
- def start
- scene_start
- create_variable_window
- end
- def create_variable_window
- wx = THEO::WINDOW_X
- wy = THEO::WINDOW_Y
- ww = THEO::WINDOW_W
- wh = THEO::WINDOW_H
- @window_variable = Window_Variable.new(wx,wy,ww,wh)
- @window_variable.viewport = @viewport
- end
- alias scene_update update
- def update
- scene_update
- @window_variable.refresh
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment