show variables on screen rpg maker xp - ThePrinceofMars - 10-09-2014
hello there I was wondering if there was a script which could show a variable on screen in both combat and exploration this could be useful as both a score counter and if I wanted to create a ammo counter anyway any help would be greatly appreciated thanks
RE: show variables on screen rpg maker xp - greenraven - 10-09-2014
Why are people so adamant about scripts? This can easily be evented and won't bog down your game in the slightest.
Simply set up a global even to display pictures in the form of numbers. If a variable equals 1 then show the picture that looks like a 1.
If you really want however to stick to scripting, just quickly modify the gold box and replace gold with the variable(s) of your choice.
RE: show variables on screen rpg maker xp - MechanicalPen - 10-09-2014
Yes let's write an 80 line long event and use up a bunch of our 50 picture slots just so we can show the player they have 30,000 GP.
...That was just me being grumpy! The real reason you shouldn't do these sorts of things in events is because of the overhead of the Interpreter. Doing one or three things with parallel process events won't matter, you'll start lagging if you do very many more than that. Best leave the event system for actual game control stuff. Also you can reuse scripts easily! For example, here I turned the first script I ever wrote (a script that shows HP and MP in a cute little window) into one that can show variables. It took me longer to write this post than it did to edit this script.
Code: #==============================================================================
# **
#------------------------------------------------------------------------------
#
#==============================================================================
class Window_Variable < Window_Base
WHICH_VARIABLE = 1 #change this to your variable number.
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 420, 640, 60) #the sets the X, Y, Width, and Height.
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 200 #text (kinda transparent)
self.back_opacity = 175 #backgrond (pretty transparent)
#old value for checking if refresh needed
@old_value = 0
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_variable(0, 0)
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
#do we need to update?
if $game_variables[WHICH_VARIABLE] != @old_value
refresh
end
end
#--------------------------------------------------------------------------
# * Draw Variable
#--------------------------------------------------------------------------
def draw_variable(x, y)
self.contents.draw_text(x, y-16, self.width, self.height,
$game_variables[WHICH_VARIABLE].to_s)
end
end
and now all you have to do is get Scene_Map to draw your window! Just do it like how the @message_window is done. in Scene_Map:
Find: Code: # Make message window
@message_window = Window_Message.new
Change to: Code: # Make message window
@message_window = Window_Message.new
#Our new Variable Window!
@variable_window = Window_Variable.new
Find: Code: # Dispose of message window
@message_window.dispose
Change to: Code: # Dispose of message window
@message_window.dispose
#We need to free our window from memory.
@variable_window.dispose
Find: Code: # Update message window
@message_window.update
Change to: Code: # Update message window
@message_window.update
#This is called every frame so don't do anything crazy in updates
@variable_window.update
You should study this script (and others, and the default ones) and learn how it works. And eventually you'll be able to code as well as me! Or at least make your own windows.
RE: show variables on screen rpg maker xp - ThePrinceofMars - 10-10-2014
thank you so much for your help but unfortunately I am getting to following error message
Script 'Scene_Map' line 80; NoMethodError occurred.
undefined method 'update' for nil:NilClass
if it helps here is my Scene_Map script
Code: #==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make sprite set
@spriteset = Spriteset_Map.new
# Make message window
@message_window = Window_Message.new
#Our new Variable Window!
@variable_window = Window_Variable.new
# Transition run
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of sprite set
@spriteset.dispose
# Dispose of message window
@message_window.dispose
#We need to free our window from memory.
@variable_window.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Loop
loop do
# Update map, interpreter, and player order
# (this update order is important for when conditions are fulfilled
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# Update system (timer), screen
$game_system.update
$game_screen.update
# Abort loop if player isn't place moving
unless $game_temp.player_transferring
break
end
# Run place move
transfer_player
# Abort loop if transition processing
if $game_temp.transition_processing
break
end
end
# Update sprite set
@spriteset.update
# Update message window
@message_window.update
#This is called every frame so don't do anything crazy in updates
@variable_window.update
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Change to title screen
$scene = Scene_Title.new
return
end
# If transition processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If showing message window
if $game_temp.message_window_showing
return
end
# If encounter list isn't empty, and encounter count is 0
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# If event is running or encounter is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# Confirm troop
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# If troop is valid
if $data_troops[troop_id] != nil
# Set battle calling flag
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
# If B button was pressed
if Input.trigger?(Input::B)
# If event is running, or menu is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# Set menu calling flag or beep flag
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
# If debug mode is ON and F9 key was pressed
if $DEBUG and Input.press?(Input::F9)
# Set debug calling flag
$game_temp.debug_calling = true
end
# If player is not moving
unless $game_player.moving?
# Run calling of each screen
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
#--------------------------------------------------------------------------
# * Battle Call
#--------------------------------------------------------------------------
def call_battle
# Clear battle calling flag
$game_temp.battle_calling = false
# Clear menu calling flag
$game_temp.menu_calling = false
$game_temp.menu_beep = false
# Make encounter count
$game_player.make_encounter_count
# Memorize map BGM and stop BGM
$game_temp.map_bgm = $game_system.playing_bgm
#$game_system.bgm_stop
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Straighten player position
$game_player.straighten
# Switch to battle screen
$scene = Scene_Battle.new
end
#--------------------------------------------------------------------------
# * Shop Call
#--------------------------------------------------------------------------
def call_shop
# Clear shop call flag
$game_temp.shop_calling = false
# Straighten player position
$game_player.straighten
# Switch to shop screen
$scene = Scene_Shop.new
end
#--------------------------------------------------------------------------
# * Name Input Call
#--------------------------------------------------------------------------
def call_name
# Clear name input call flag
$game_temp.name_calling = false
# Straighten player position
$game_player.straighten
# Switch to name input screen
$scene = Scene_Name.new
end
#--------------------------------------------------------------------------
# * Menu Call
#--------------------------------------------------------------------------
def call_menu
# Clear menu call flag
$game_temp.menu_calling = false
# If menu beep flag is set
if $game_temp.menu_beep
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Clear menu beep flag
$game_temp.menu_beep = false
end
# Straighten player position
$game_player.straighten
# Switch to menu screen
$scene = Scene_Menu.new
end
#--------------------------------------------------------------------------
# * Save Call
#--------------------------------------------------------------------------
def call_save
# Straighten player position
$game_player.straighten
# Switch to save screen
$scene = Scene_Save.new
end
#--------------------------------------------------------------------------
# * Debug Call
#--------------------------------------------------------------------------
def call_debug
# Clear debug call flag
$game_temp.debug_calling = false
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Straighten player position
$game_player.straighten
# Switch to debug screen
$scene = Scene_Debug.new
end
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player
# Clear player place move call flag
$game_temp.player_transferring = false
# If move destination is different than current map
if $game_map.map_id != $game_temp.player_new_map_id
# Set up a new map
$game_map.setup($game_temp.player_new_map_id)
end
# Set up player position
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
# Set player direction
case $game_temp.player_new_direction
when 2 # down
$game_player.turn_down
when 4 # left
$game_player.turn_left
when 6 # right
$game_player.turn_right
when 8 # up
$game_player.turn_up
end
# Straighten player position
$game_player.straighten
# Update map (run parallel process event)
$game_map.update
# Remake sprite set
@spriteset.dispose
@spriteset = Spriteset_Map.new
# If processing transition
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
Graphics.transition(20)
end
# Run automatic change for BGM and BGS set on the map
$game_map.autoplay
# Frame reset
Graphics.frame_reset
# Update input information
Input.update
end
end
any help would be greatly appreciated in fact if you could just post your scenemap script thank would be great
RE: show variables on screen rpg maker xp - MechanicalPen - 10-10-2014
I dunno! It works for me. Try it in a new project. If that works then you've got script conflicts (aka, more than one Scene_Map) try adding the window to a different Scene_Map
RE: show variables on screen rpg maker xp - ThePrinceofMars - 10-11-2014
your right it seems it be some sort of conflict with the FPLE engine I am using but I found a script that does work with it thats your hud by emeraldcyndaquil see
I know I am asking alot but could you take a look at the script and see if you can't add a line to show a variable as well as the hp mp exp
Code: class Window_YourHUD < Window_Base
def initialize
super(0, 0, 640, 64)
self.opacity = 0
self.contents = Bitmap.new(640 - 32, 64 - 32)
refresh
end
def refresh
self.contents.clear
reset_variables
return if !@actor
draw_actor_hp(@actor, 0, 0)
draw_actor_sp(@actor, 200, 0)
draw_actor_exp(@actor, 400, 0)
end
def reset_variables
@actor = $game_party.actors[0]
@old_hp = @actor ? @actor.hp : 0
@old_maxhp = @actor ? @actor.maxhp : 0
@old_sp = @actor ? @actor.sp : 0
@old_maxsp = @actor ? @actor.maxsp : 0
end
def update
super
refresh if (@actor = $game_party.actors[0] or
@old_hp = @actor ? @actor.hp : 0 or
@old_maxhp = @actor ? @actor.maxhp : 0 or
@old_sp = @actor ? @actor.sp : 0 or
@old_maxsp = @actor ? @actor.maxsp : 0)
end
end
class Scene_Map
alias yourhud_main main
alias yourhud_update update
def main
@yourhud = Window_YourHUD.new
yourhud_main
@yourhud.dispose
end
def update
@yourhud.update
yourhud_update
end
end
thanks again for trying to help
RE: show variables on screen rpg maker xp - MechanicalPen - 10-11-2014
No, but I'll sure try to teach you how to do it! Teach a man to fish, etc. First off, I have edited that script to be more readable. I also fixed the "Stack level too deep" error you'd get if you pushed F12. Keep in mind this won't fix it if you have other scripts that alias things dumbly.
Code: #==============================================================================
# ** Window_YourHUD
#------------------------------------------------------------------------------
# This Window displays relavent values to the player during gameplay.
# by emeraldcyndaquil
#==============================================================================
class Window_YourHUD < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.opacity = 0
self.contents = Bitmap.new(640 - 32, 64 - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
reset_variables
return if !@actor
draw_actor_hp(@actor, 0, 0)
draw_actor_sp(@actor, 200, 0)
draw_actor_exp(@actor, 400, 0)
end
#--------------------------------------------------------------------------
# * Reset Stored Variables
#--------------------------------------------------------------------------
def reset_variables
@actor = $game_party.actors[0]
@old_hp = @actor ? @actor.hp : 0
@old_maxhp = @actor ? @actor.maxhp : 0
@old_sp = @actor ? @actor.sp : 0
@old_maxsp = @actor ? @actor.maxsp : 0
end
#---------------------------------------------------------------------------
# * Update (called once a frame)
#---------------------------------------------------------------------------
def update
super
refresh if (@actor = $game_party.actors[0] or
@old_hp = @actor ? @actor.hp : 0 or
@old_maxhp = @actor ? @actor.maxhp : 0 or
@old_sp = @actor ? @actor.sp : 0 or
@old_maxsp = @actor ? @actor.maxsp : 0)
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# We've edited this to add a HUD
#==============================================================================
class Scene_Map
#---------------------------------------------------------------------------
# * Alias Listings (fixes F12 bug)
#---------------------------------------------------------------------------
unless method_defined?(:yourhud_main)
alias_method(:yourhud_main, :main)
alias_method(:yourhud_update, :update)
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@yourhud = Window_YourHUD.new
yourhud_main
@yourhud.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@yourhud.update
yourhud_update
end
end
Step one, we need a way to draw the variable, so grab the draw_variable(x, y) method from my script and put in into Window_YourHUD. For it to work it has to go after the end of a method but before the def of another. So put it between Code: end
#--------------------------------------------------------------------------
Now there are only three more steps! Next we want to tell the script to draw our Event Variable. So we add a call to our method, draw_variable(x, y). But where? See if you can't figure it out (HINT: look for other draw_stuff)
The next thing to do is to add our own variable to track the game's Event Variables. We do this because drawing something on-screen takes a long time and so we only want to do it if we need to (when the number changes).
Variables in ruby are made by typing a word. old_ammo would be a variable! We also have a thing called Scope, which means "who can look at my variable?" Putting an @ in front of a word means the entire class can access its value, and putting $ means the entire game can access it. So look at the reset_variables method, and add: Code: @old_ammo = $game_variables[WHICH_VARIABLE]
Now the whole Window_YourHUD can see the value of @old_ammo. Don't forget to change WHICH_VARIABLE to your Event Variable number.
Now we just have to modify the update method, so it can check our ammo and call refresh if it is different. The update method currently looks like Code: #---------------------------------------------------------------------------
# * Update (called once a frame)
#---------------------------------------------------------------------------
def update
super
refresh if (@actor = $game_party.actors[0] or
@old_hp = @actor ? @actor.hp : 0 or
@old_maxhp = @actor ? @actor.maxhp : 0 or
@old_sp = @actor ? @actor.sp : 0 or
@old_maxsp = @actor ? @actor.maxsp : 0)
end
Wait... what? I think we found a bug! This code says "Refresh if, oh but also set these old variables to the current value." I am assume the author mean to use == which compares two values, but even that is wrong. What we want is "Refresh if our old variables do NOT equal the current value" The current way is going to draw on every frame, which is going to cause lag. It SHOULD be Code: #---------------------------------------------------------------------------
# * Update (called once a frame)
#---------------------------------------------------------------------------
def update
super
refresh if (@actor != $game_party.actors[0] or
@old_hp != @actor ? @actor.hp : 0 or
@old_maxhp != @actor ? @actor.maxhp : 0 or
@old_sp != @actor ? @actor.sp : 0 or
@old_maxsp != @actor ? @actor.maxsp : 0)
end
Sorry, got off track... We need to add a Conditional! So it knows to refresh if our ammo changed. Can you figure out what we need to add?
So now it should work!
Bonus: Maybe you want to make it say "Ammo: 12" instead of just "12"? Push CTRL+SHIFT+F in the script editor and search for "def draw_actor_hp". And then study how it is different from my draw_variable method.
Good luck!
RE: show variables on screen rpg maker xp - ThePrinceofMars - 10-12-2014
THANK YOU THANK YOU SO MUCH!!!!!!!!!!!! it works perfectly I shall be sure to include your name in the games credits if this project ever gets finished I just spent the last hour going over your post and slowly figure out where to put things I really think I learned something
I don't suppose there is away it show that variable on screen during combat is there?
RE: show variables on screen rpg maker xp - MechanicalPen - 10-12-2014
You could actually show the whole HUD if you wanted. Find your Scene_Battle and look for the main method. Then we just have to add a Code: @yourhud = Window_YourHUD.new
to it. Just look how that @status_window is controlled, and under any @status_window you find, do the same thing with @yourhud
so if the code says Code: @status_window.dispose
you add a under it. And where it says Code: @status_window.refresh
add a
it should be that easy!
RE: show variables on screen rpg maker xp - ThePrinceofMars - 10-12-2014
it didn't seem to work I am posting the scene_battle script here see if you can see the problem
Code: #==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Initialize each kind of temporary battle data
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
# Initialize battle event interpreter
$game_system.battle_interpreter.setup(nil, 0)
# Prepare troop
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
# Make actor command window
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s3 = $data_system.words.guard
s4 = $data_system.words.item
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
@actor_command_window.y = 160
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
# Make other windows
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
@status_window = Window_BattleStatus.new
@yourhud = Window_YourHUD.new
@message_window = Window_Message.new
# Make sprite set
@spriteset = Spriteset_Battle.new
# Initialize wait count
@wait_count = 0
# Execute transition
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
# Start pre-battle phase
start_phase1
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Refresh map
$game_map.refresh
# Prepare for transition
Graphics.freeze
# Dispose of windows
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@yourhud.dispose
@message_window.dispose
if @skill_window != nil
@skill_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @result_window != nil
@result_window.dispose
end
# Dispose of sprite set
@spriteset.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
# If switching from battle test to any screen other than game over screen
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#--------------------------------------------------------------------------
# * Determine Battle Win/Loss Results
#--------------------------------------------------------------------------
def judge
# If all dead determinant is true, or number of members in party is 0
if $game_party.all_dead? or $game_party.actors.size == 0
# If possible to lose
if $game_temp.battle_can_lose
# Return to BGM before battle starts
$game_system.bgm_play($game_temp.map_bgm)
# Battle ends
battle_end(2)
# Return true
return true
end
# Set game over flag
$game_temp.gameover = true
# Return true
return true
end
# Return false if even 1 enemy exists
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
# Start after battle phase (win)
start_phase5
# Return true
return true
end
#--------------------------------------------------------------------------
# * Battle Ends
# result : results (0:win 1:lose 2:escape)
#--------------------------------------------------------------------------
def battle_end(result)
# Clear in battle flag
$game_temp.in_battle = false
# Clear entire party actions flag
$game_party.clear_actions
# Remove battle states
for actor in $game_party.actors
actor.remove_states_battle
end
# Clear enemies
$game_troop.enemies.clear
# Call battle callback
if $game_temp.battle_proc != nil
$game_temp.battle_proc.call(result)
$game_temp.battle_proc = nil
end
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Battle Event Setup
#--------------------------------------------------------------------------
def setup_battle_event
# If battle event is running
if $game_system.battle_interpreter.running?
return
end
# Search for all battle event pages
for index in 0...$data_troops[@troop_id].pages.size
# Get event pages
page = $data_troops[@troop_id].pages[index]
# Make event conditions possible for reference with c
c = page.condition
# Go to next page if no conditions are appointed
unless c.turn_valid or c.enemy_valid or
c.actor_valid or c.switch_valid
next
end
# Go to next page if action has been completed
if $game_temp.battle_event_flags[index]
next
end
# Confirm turn conditions
if c.turn_valid
n = $game_temp.battle_turn
a = c.turn_a
b = c.turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
end
# Confirm enemy conditions
if c.enemy_valid
enemy = $game_troop.enemies[c.enemy_index]
if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
next
end
end
# Confirm actor conditions
if c.actor_valid
actor = $game_actors[c.actor_id]
if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
next
end
end
# Confirm switch conditions
if c.switch_valid
if $game_switches[c.switch_id] == false
next
end
end
# Set up event
$game_system.battle_interpreter.setup(page.list, 0)
# If this page span is [battle] or [turn]
if page.span <= 1
# Set action completed flag
$game_temp.battle_event_flags[index] = true
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If battle event is running
if $game_system.battle_interpreter.running?
# Update interpreter
$game_system.battle_interpreter.update
# If a battler which is forcing actions doesn't exist
if $game_temp.forcing_battler == nil
# If battle event has finished running
unless $game_system.battle_interpreter.running?
# Rerun battle event set up if battle continues
unless judge
setup_battle_event
end
end
# If not after battle phase
if @phase != 5
# Refresh status window
@status_window.refresh
end
end
end
# Update system (timer) and screen
$game_system.update
$game_screen.update
# If timer has reached 0
if $game_system.timer_working and $game_system.timer == 0
# Abort battle
$game_temp.battle_abort = true
end
# Update windows
@help_window.update
@party_command_window.update
@actor_command_window.update
@status_window.update
@yourhud.update
@message_window.update
# Update sprite set
@spriteset.update
# If transition is processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If message window is showing
if $game_temp.message_window_showing
return
end
# If effect is showing
if @spriteset.effect?
return
end
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Switch to title screen
$scene = Scene_Title.new
return
end
# If battle is aborted
if $game_temp.battle_abort
# Return to BGM used before battle started
$game_system.bgm_play($game_temp.map_bgm)
# Battle ends
battle_end(1)
return
end
# If waiting
if @wait_count > 0
# Decrease wait count
@wait_count -= 1
return
end
# If battler forcing an action doesn't exist,
# and battle event is running
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# Branch according to phase
case @phase
when 1 # pre-battle phase
update_phase1
when 2 # party command phase
update_phase2
when 3 # actor command phase
update_phase3
when 4 # main phase
update_phase4
when 5 # after battle phase
update_phase5
end
end
end
|