Well, I managed to make it, but they won't be shown on the screen (didn't have time to figure that out). You can still use it, though. I didn't test it completely, but it gave me no errors when doing some basic stuff with it.
If you do want to show the timers, I can make it for you, but it will take a bit longer, as I am quite busy as of tomorrow.
[rgss]#==============================================================================
# Multiple Timers by Ares
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 1. To set a new timer, use a call script command and enter this (without quote
# marks):
# "set_timer(name,time)" -> set_timer("timer1",40) [example]
# (where name is an identifier, like "timer1" (with quotation marks),
# and time is the amount of time in seconds.
#
# 2. To check wether a timer has reached a certain point(other than 0), use
# a conditional branch, toggle 'script' on page 3 and enter this
# (without quote marks):
# "at_time?(name,time)==true" -> at_time?("timer1",20)==true [example]
# (where 'time' represents the value (in seconds) you want to check the
# timer with, and 'name' the name of the timer you want to check)
#
# 3. To check wether a timer has reached 0, use a conditional branch, toggle
# 'script' on page 3 and enter this (without quotation marks):
# "finished?(name)" -> finished?("timer1")==true [example]
# (where 'name' is the name of the timer you want to check)
#
# $game_timer.timers returns an array of all timers
# $game_timer.active_timers returns an array of all active timers
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# The main timer class
#------------------------------------------------------------------------------
class Game_Timer
attr_accessor :timers
attr_reader :active_timers
def initialize
@timers=[]
@active_timers=get_active_timers
end
def update
for i in 0...@timers.size
if @timers.active==true
@timers.time-=1 if @timers.time>0
@timers.active=false if @timers.time==0
end
end
end
def add(timer)
@timers.push(timer)
end
def get_active_timers
result=[]
for i in 0...@timers.size
if @timers.active==true
result.push(@timers)
end
end
return result
end
end
# Timer Object
class Timer
def initialize(name,time,active=true)
@name=name
@time=time*Graphics.frame_rate
@active=active
end
attr_reader :name
attr_accessor :time
attr_accessor :active
end
# Create Timer instance
begin
$game_timer = Game_Timer.new
end
# Update timer class every frame refresh.
module Graphics
class << self
alias :timer_update :update
def update
timer_update
$game_timer.update
end
end
end
class Interpreter
def set_timer(name,time)
$game_timer.add(Timer.new(name,time,true))
end
def timer_exist?(name)
for timer in $game_timer.timers
return true if timer.name==name
end
end
def at_time?(name,time)
for timer in $game_timer.timers
unless timer.active==false
if timer.name==name
return true if timer.time==time*Graphics.frame_rate
end
end
end
end
def finished?(name)
for i in 0...$game_timer.timers.size
if $game_timer.timers.name==name
return true if $game_timer.timers.time==0
end
end
end
end
[/rgss]
The instructions are in the header of the script. To implement it into your game, copy the script (line numbers off!) and paste it into a new script slot above 'main'.
If you get any errors or if you have any questions, feel free to ask (you can also pm me).
Edit: Now that I think of it I'm not even sure you're using RMXP (I think so based on your reaction to me). Maybe next time you should use the rmxp topic icon, and/or clarify what engine you're using in the first post.