Multi Timer?

I'm trying to make some bombs but this bombs have a different time to explode...

For example Bomb A need 10 minutes to explode and bomb B need 15 minutes to explode. I need two timer (or maybe more if there are more bomb) for this so player can easily check when is the bomb explode...

Is this even possible? I can't seems to find script that can do this
Try the following scripts or variants about them:


http://galvs-scripts.com/2013/02/23/respawn-timer/


http://galvs-scripts.com/2012/10/03/variable-timer-functions/
If I'm reading it right that two scripts can't make two timers that have different times simultaneously or so...

Well, I really wonder if this possible or not? If this is really impossible I guess I will just use this script and think of new trick for the game.

Thanks for suggestion, Andar but I hope there are someone who can explain whether it's possible or not
I have a multi-timer script also.


http://forums.rpgmakerweb.com/index.php?/topic/1516-extended-game-timers/
wrong - the respawn timers are one different timer per event - you just need to write the events so that something other than a respawn is triggered when that happens
Is it just me or I can't see your script in there, Shaz?

wrong - the respawn timers are one different timer per event - you just need to write the events so that something other than a respawn is triggered when that happens
Just tried it. But unfortunately it will be the same because it can't display two timers simultaneously and I need that..

But nice alternative~
Is it just me or I can't see your script in there, Shaz?
No, it isn't just you - the first post of that topic has been deleted by an archiving bug.
It was detected in about one or two dozen topics two weeks ago (if I remember correctly) but I don't know if a rollback to restore those posts is possible.


Please wait a bit until Shaz is able to repost her script.
No, it isn't just you - the first post of that topic has been deleted by an archiving bug.

It was detected in about one or two dozen topics two weeks ago (if I remember correctly) but I don't know if a rollback to restore those posts is possible.

Please wait a bit until Shaz is able to repost her script.
I see, I thought it was my browser. Thanks for the explanation Andar.
Shaz's script is probably better, but here is my go at a multi-timer script :

Spoiler
#==============================================================================# ** Game_MultiTimer#==============================================================================class Game_MultiTimer < Game_Timer #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :id # timer id attr_accessor :auto_hide # auto-hide timer attr_accessor :x # x-coordinate attr_accessor :y # y-coordinate attr_accessor :z # z-coordinate #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(id) super() @id = id @x = @y = @z = nil @auto_hide = false end #-------------------------------------------------------------------------- # * Start #-------------------------------------------------------------------------- def start(count, self_switch = nil, script = nil) super(count) # Key - [map_id, event_id, switch_id, true|false] @self_switch = self_switch @script = script end #-------------------------------------------------------------------------- # * Processing When Timer Reaches 0 #-------------------------------------------------------------------------- def on_expire if !@self_switch.nil? $game_self_switches[@self_switch.slice!(0,3)] = @self_switch.last @self_switch = nil end if [email protected]? Kernel.eval(@script) @script = nil end if @auto_hide self.stop @auto_hide = false end end end # Game_MultiTimer#==============================================================================# ** Game_MultiTimers#==============================================================================class Game_MultiTimers #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @data = [] end #-------------------------------------------------------------------------- # * Get Timer #-------------------------------------------------------------------------- def [](id) @data[id] ||= Game_MultiTimer.new(id) end #-------------------------------------------------------------------------- # * Iterator #-------------------------------------------------------------------------- def each @data.compact.each { |timer| yield timer } if block_given? end end # Game_Timers#==============================================================================# ** Game_Screen#==============================================================================class Game_Screen #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :timers # timers #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- unless method_defined?🙂mutlitimer_6XQP9OGB_gs_initialize) alias_method🙂mutlitimer_6XQP9OGB_gs_initialize, :initialize) end def initialize(*args, &block) @timers = Game_MultiTimers.new mutlitimer_6XQP9OGB_gs_initialize(*args, &block) end #-------------------------------------------------------------------------- # * Clear #-------------------------------------------------------------------------- unless method_defined?🙂mutlitimer_CMzUHKH2_gs_clear) alias_method🙂mutlitimer_CMzUHKH2_gs_clear, :clear) end def clear(*args, &block) mutlitimer_CMzUHKH2_gs_clear(*args, &block) clear_timers end #-------------------------------------------------------------------------- # * Clear Picture #-------------------------------------------------------------------------- def clear_timers @timers.each { |timer| timer.stop } end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- unless method_defined?🙂mutlitimer_n9noxN3q_gs_update) alias_method🙂mutlitimer_n9noxN3q_gs_update, :update) end def update(*args, &block) mutlitimer_n9noxN3q_gs_update(*args, &block) update_timers end #-------------------------------------------------------------------------- # * Update Pictures #-------------------------------------------------------------------------- def update_timers @timers.each { |timer| timer.update } endend # Game_Screen#==============================================================================# ** Sprite_Timer#==============================================================================class Sprite_MultiTimer < Sprite_Timer #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(viewport, timer) @timer = timer super(viewport) end #-------------------------------------------------------------------------- # * Update Transfer Origin Bitmap #-------------------------------------------------------------------------- def update_bitmap if @timer.sec != @total_sec @total_sec = @timer.sec redraw end end #-------------------------------------------------------------------------- # * Update Position #-------------------------------------------------------------------------- def update_position self.x = @timer.x || (Graphics.width - self.bitmap.width) self.y = @timer.y || (@timer.id * self.bitmap.height) self.z = @timer.z || 200 end #-------------------------------------------------------------------------- # * Update Visibility #-------------------------------------------------------------------------- def update_visibility self.visible = @timer.working? end end # Sprite_Timer#==============================================================================# ** Spriteset_Map#==============================================================================class Spriteset_Map #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- unless method_defined?🙂mutlitimer_Mnk4u1aL_ssm_initialize) alias_method🙂mutlitimer_Mnk4u1aL_ssm_initialize, :initialize) end def initialize(*args, &block) create_multi_timers mutlitimer_Mnk4u1aL_ssm_initialize(*args, &block) end #-------------------------------------------------------------------------- # * Free #-------------------------------------------------------------------------- unless method_defined?🙂mutlitimer_qSE7Wbej_ssm_dispose) alias_method🙂mutlitimer_qSE7Wbej_ssm_dispose, :dispose) end def dispose(*args, &block) mutlitimer_qSE7Wbej_ssm_dispose(*args, &block) dispose_multi_timers end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- unless method_defined?🙂mutlitimer_4ztr2G7t_ssm_update) alias_method🙂mutlitimer_4ztr2G7t_ssm_update, :update) end def update(*args, &block) mutlitimer_4ztr2G7t_ssm_update(*args, &block) update_multi_timers end #-------------------------------------------------------------------------- # * Create MultiTimer Sprites #-------------------------------------------------------------------------- def create_multi_timers @timer_sprites = [] end #-------------------------------------------------------------------------- # * Free MultiTimer Sprites #-------------------------------------------------------------------------- def dispose_multi_timers @timer_sprites.compact.each { |sprite| sprite.dispose } end #-------------------------------------------------------------------------- # * Update MultiTimer Sprites #-------------------------------------------------------------------------- def update_multi_timers $game_map.screen.timers.each do |timer| @timer_sprites[timer.id] ||= Sprite_MultiTimer.new(@viewport2, timer) @timer_sprites[timer.id].update end endend # Spriteset_Map
The script leaves the default timer intact.

Code:
# id - Numeric identifier for the timer #      The Y value of the timer sprite is equal to its ID times the height#      of the sprite's bitmap (default is 48 pixels).# self_switch - Activates the specified self-switch. The key must be as follows :# #               [map_id, event_id, switch_id, true/false]# script_call - Evaluates the passed code.$game_map.screen.timers[id].start(count, self_switch, script_call)# Example :$game_map.screen.timers[1].start(1200, [1, 1, 'A', true], "Sound.play_buzzer")# Also supports :## x         - Set the X value of the timer sprite# y         - Set the Y value of the timer sprite# z         - Set the Z value of the timer sprite# auto_hide - Automatically hides the sprite after the timer reaches zero.# Example :$game_map.screen.timers[1].start(1200, [1, 1, 'A', true], "Sound.play_buzzer")$game_map.screen.timers[1].x = 10$game_map.screen.timers[1].y = 55$game_map.screen.timers[1].z = 200$game_map.screen.timers[1].auto_hide = true
@Exhydra Thanks a lot! 🙂

EDIT: Looks like the self switch is not working or maybe I am doing something wrong?

EDIT 2: Never mind, it was me who didn't see the "Event ID"..Thanks again Exhydra it's working very well 😀
Thanks for the notification. I'll have to go through all my script threads and see how many of them are missing pages. It might take me a few days to update, but it seems you have an acceptable solution anyway 🙂

Original thread: https://forums.rpgmakerweb.com/threads/multi-timer.41943/