Global Timer
Version: 1.0
Author: modern algebra
Date: September 4, 2009
Version History
- <Version 1.0> 09.04.2009 - Original Release
Description
This script allows you to have the timer update in any scenes you want, not just Scene_Map and Scene_Battle
Features
- Can have the timer active and updating in any scenes that you want
- Easy to specify which scenes the timer should not be updating in
Instructions
Please see the header of the script.
Script
#==============================================================================
# Global Timer
# Version: 1.0
# Author: modern algebra (rmrk.net)
# Date: September 4, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script allows you to update the timer in any scenes you want, not
# just Map and Battle.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Place this script above Main and below Materials.
#
# If you wish to not have the timer update in certain scenes, go to line 33
# and add the name of the class to the array.
#==============================================================================
# ** Scene Base
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new constant - GT_EXEMPT_SCENES
# aliased methods - start, update, terminate
#==============================================================================
class Scene_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * CONSTANTS
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Add all the scenes where you do not want the timer to update here.
# Scene_Map and Scene_Battle should ALWAYS be excluded since the timer is
# already updated in those scenes. Scene_Title should also be excluded
GT_EXEMPT_SCENES = [Scene_Map, Scene_Battle, Scene_Title, Scene_File,
Scene_Debug]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Start
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malg_timer_global_strt_6jx2 start
def start (*args)
malg_timer_global_strt_6jx2 (*args) # Run Original Method
# Unless in an exempt scene or one where timer already exists
GT_EXEMPT_SCENES.each { |scene| return if self.is_a? (scene) }
@timer_sprite = Sprite_Timer.new (nil) # Create Timer
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Dispose
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias moda_glbl_timr_term_7hf1 terminate
def terminate (*args)
moda_glbl_timr_term_7hf1 (*args) # Run Original Method
# Dispose Timer Sprite
@timer_sprite.dispose unless @timer_sprite.nil? || @timer_sprite.disposed?
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Frame Update
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_global_timer_upd_8gv2 update
def update (*args)
ma_global_timer_upd_8gv2 (*args) # Run Original Method
# Unless in an exempt scene or one where timer already exists
return if @timer_sprite.nil? || @timer_sprite.disposed?
timer_ending = $game_system.timer_working && $game_system.timer == 1
$game_system.update # Update Timer
@timer_sprite.update # Update Timer Sprite
# If Timer ending, go to Map
if timer_ending
Sound.play_buzzer
$scene = Scene_Map.new
end
end
end
Credit
Thanks
- XdragonSB, for the request
Support
For support or bug reports, please post in this topic.
Known Compatibility Issues
No known compatibility issues, though it should be noted that the timer will appear in the top right corner no matter if that blocks out important details of the scene.
This script by
modern algebra is licensed under a
Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.