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.
Global Timer 1.0

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
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


Code: [Select]
#==============================================================================
#    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


  • modern algebra

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.


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: February 11, 2010, 09:48:07 PM by Modern Algebra »

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
I imagine a scenario where a player might be escaping from some collapsing cave and has 2 minutes to escape, but instead of pulling up the menu and going to eat dinner, you could set it so that the menu updates the timer as well? So basically, no dinner for you! For like 2 minutes lol.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Yeah, pretty much. I thought it was a pretty annoying script too, but it was an easy enough request so I did it anyway :P