Pl0xability
Member
RMXP or RMVX:
RMXP
Detailed Description:
I need to be able to add time to the ingame timer, and if possible have a "+ 5 seconds" appear under the clock when time is added
Other Scripts I am using (in order):
The only script that actually affects the timer that I have is:
Please and thank you
RMXP
Detailed Description:
I need to be able to add time to the ingame timer, and if possible have a "+ 5 seconds" appear under the clock when time is added
Other Scripts I am using (in order):
The only script that actually affects the timer that I have is:
Code:
# Â Written by: Kain Nobel
# Â Version: 0.5
# Â Last Update: 5/13/2008
# Â Date Created: 10/17/2008
#===============================================================================
TimerCriticalSwitch = 0
#===============================================================================
# Â INSTRUCTIONS:
# Â Â This is just an enhanced version of Sprite_Timer default class, with a few
# Â small changes I decided to make to it. Now it not only displays minutes and
# Â seconds in the string, but also milli-seconds... yes, a fraction of a second,
# Â and it updates in real time too! (Provided your computer isn't fucked!)
# Â Â Lastly, it detects the total set time vs current time, and sets a caution
# Â and critical color when the timer reaches a certain point, such as 1/2 or 3/4
# Â the set time.
#-------------------------------------------------------------------------------
class Sprite_Timer < Sprite
 #------------------------
 # * Object Initialization
 #------------------------
 def initialize
  super
  # Variable used to determine timer critical
  @critical = -1
  self.bitmap = Bitmap.new(120, 48)
  self.bitmap.font.name = "Arial"
  self.bitmap.font.size = 32
  self.x = 640 - self.bitmap.width
  self.y = 0
  self.z = 500
  update
 end
 #------------------------
 # * Dispose
 #------------------------
 def dispose
  if self.bitmap != nil
   self.bitmap.dispose
  end
  super
 end
 #------------------------
 # * Frame Update
 #------------------------
 def update
  super
  # Set Timer to visible if working
  self.visible = $game_system.timer_working
  # If Timer needs to be withdrawn
  self.bitmap.clear
  # Get @total_sec value
  @total_sec = $game_system.timer / Graphics.frame_rate
  frac = $game_system.timer % Graphics.frame_rate
  sec_fraction = frac.to_f / Graphics.frame_rate.to_f
  sec_fraction *= 100
  min = @total_sec / 60
  sec = @total_sec % 60
  # Send min, sec, millisec info to a string.
  text = sprintf("%02d:%02d:%02d", min, sec, sec_fraction)
  # If Critical is equal or less than 0, set to @total_sec / 2
  if $game_switches[TimerCriticalSwitch] == true
   # Auto-Set critical time to 1/2 timer set time
   if @critical == -1
    @critical = (@total_sec / 2)
   end
   # If @total_sec is more than (Timer Setting / 2) ?
   if @total_sec >= @critical
    self.bitmap.font.color.set(204, 224, 240)
   # If @total_sec is equal to or more than (Timer Setting / 4) ?
   elsif @total_sec >= (@critical / 2)
    self.bitmap.font.color.set(255, 200, 0)
   else
   # @total_sec is less than Timer Critcal Variable!
    self.bitmap.font.color.set(255, 0, 0)
   end
  else
   # Switch is off, automatically set to default color
   self.bitmap.font.color.set(204, 224, 240)
  end
  # Draw the timer value from string 'text'
  self.bitmap.draw_text(self.bitmap.rect, text, 1)
 end
end
Please and thank you