Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # [RGSS 2] Battle Variable Window
- # Version : 1.0
- # Author : LowlingLife
- #==============================================================================
- # Script ini akan memunculkan window yang men-display variable di Battle.
- #==============================================================================
- module VariableWindow
- # ID dari switch yang akan mengaktivasikan script.
- SWITCH_ID = 5
- # Lokasi window.
- # 0 - Kiri Atas
- # 1 - Kanan Atas
- # 2 - Tengah Atas
- WINDOW_LOCATION = 0
- # Variable dan Icon yang akan di-display di Window.
- # [Variable ID, Icon Index]
- VAR_WINDOW = [1, 5]
- end
- #==============================================================================
- # EDITING BEYOND THIS LINE CAN CAUSE DAMAGE TO YOUR GAME, THEREFORE EDIT
- # WITH YOUR OWN RISK.
- #==============================================================================
- class Window_BVariable < Window_Base
- include VariableWindow
- def initialize(x, y)
- super(x, y, 160, 64)
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.draw_text(32, 0, 160, 32, $game_variables[VAR_WINDOW[0]].to_s)
- draw_icon(VAR_WINDOW[1], 0, 0, enabled = true)
- end
- end
- class Scene_Battle < Scene_Base
- include VariableWindow
- alias var_window_start start
- def start
- var_window_start
- super
- if $game_switches[SWITCH_ID]
- if WINDOW_LOCATION == 0
- @battle_var_window = Window_BVariable.new(0, 0)
- elsif WINDOW_LOCATION == 1
- @battle_var_window = Window_BVariable.new(384, 0)
- elsif WINDOW_LOCATION == 2
- x = (Graphics.width - 160) / 2
- @battle_var_window = Window_BVariable.new(x, 0)
- end
- end
- end
- alias var_window_terminate terminate
- def terminate
- var_window_terminate
- @battle_var_window.dispose if $game_switches[SWITCH_ID]
- end
- alias var_window_update update_basic unless $@
- def update_basic(*args, &block)
- var_window_update(*args, &block)
- @battle_var_window.update if $game_switches[SWITCH_ID]
- end
- #----------------------------------------------------------------------------
- # END OF SCRIPT
- #----------------------------------------------------------------------------
- end
Advertisement
Add Comment
Please, Sign In to add comment