03-30-2009, 07:10 AM
I know this is probably very easy to you big time scripters, but how would I go about fading a sound to a certain volume? I know bgm_fade(time),
but that doesn't include volume.
EDIT:
How would I go about editing this script to make time go by slower, I added / 5 to the @total_sec = Graphics.frame_count / Graphics.frame_rate and it seemed to have the correct effect, but it screws up the time for some reason.
ALSO, how come when I turn a switch on throught the script, the event on the map that it triggers does not show up. How do I update the map to show the switch changes? I mean it works when I have it in a conditional branch, but when I have it as a page condition it doesn't show.
The script
but that doesn't include volume.
EDIT:
How would I go about editing this script to make time go by slower, I added / 5 to the @total_sec = Graphics.frame_count / Graphics.frame_rate and it seemed to have the correct effect, but it screws up the time for some reason.
ALSO, how come when I turn a switch on throught the script, the event on the map that it triggers does not show up. How do I update the map to show the switch changes? I mean it works when I have it in a conditional branch, but when I have it as a page condition it doesn't show.
The script
Code:
#==============================================================================
# ** Window_PlayTime + Day & Night Settings Script
# Window_PlayTime Add-on
# modified by shadowball
# further modified for Yin by second_crimson
# further modified by Yin to use game switches
#
# On the Menu scene you'll see the current in-game day and time...
#==============================================================================
class Window_GameStats < Window_Base
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
@total_sec = Graphics.frame_count / Graphics.frame_rate
day = @total_sec / 60 / 24 % 7
hour = @total_sec / 60 % 24
minute = @total_sec % 60
if hour >= 12
meridian = " PM"
else
meridian = " AM"
end
if hour == 0 then hour = 12 end
if hour > 12 then hour -= 12 end
text = sprintf("%02d:%02d", hour, minute)
text = text + meridian
self.contents.font.color = system_color
shb_day = 'Sunday' if day == 0
shb_day = 'Monday' if day == 1
shb_day = 'Tuesday' if day == 2
shb_day = 'Wednesday' if day == 3
shb_day = 'Thursday' if day == 4
shb_day = 'Friday' if day == 5
shb_day = 'Saturday' if day == 6
shb_weekday = shb_day
self.contents.draw_text(4, -10, 120, 32, shb_weekday, 0)
self.contents.font.color = normal_color
self.contents.draw_text(4, 4, 120, 32, text, 2)
case $game_party.gold
when 0..9999
gold = $game_party.gold
when 10000..99999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+array[1].to_s+","+array[2].to_s+array[3].to_s+array[4].to_s
when 100000..999999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+array[1].to_s+array[2].to_s+","+array[3].to_s+array[4].to_s+array[5].to_s
when 1000000..9999999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+","+array[1].to_s+array[2].to_s+array[3].to_s+","+array[4].to_s+array[5].to_s+array[6].to_s
end
#Draw Gold
self.contents.font.color = system_color
gold_word = $data_system.words.gold.to_s
cx = contents.text_size(gold_word).width
cx2=contents.text_size(gold.to_s).width
self.contents.draw_text(4, 18, 120-cx-2, 32, gold_word)
self.contents.font.color = normal_color
self.contents.draw_text(124-cx2+1,32, cx2, 32, gold.to_s, 2)
self.contents.font.color = system_color
end
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# * Scene_Map - Modified
# modified by shadowball
#
# Screen tone will change depending on the in-game play time automatically
#==============================================================================
class Scene_Map
alias shb_map_up update
def update
@total_sec = Graphics.frame_count / Graphics.frame_rate
@shb_hour = @total_sec / 60 % 24
if @shb_hour < 5 || @shb_hour > 18 # 7 p.m. - 5 a.m.
$game_switches [11] = true
$game_switches [12] = false
$game_switches [13] = false
$game_switches [14] = false
$game_screen.start_tone_change(Tone.new(-120, -120, -120, 0), 1)
elsif @shb_hour > 4 && @shb_hour < 7 # 5 a.m. - 7 a.m.
$game_switches [12] = true
$game_switches [11] = false
$game_switches [13] = false
$game_switches [14] = false
$game_screen.start_tone_change(Tone.new(-40, -40, 0, 0), 1)
elsif @shb_hour > 6 && @shb_hour < 16 # 7 a.m. - 4 p.m.
$game_switches [13] = true
$game_switches [12] = false
$game_switches [11] = false
$game_switches [14] = false
$game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 1)
elsif @shb_hour > 15 && @shb_hour < 19 # 4 p.m. - 7 p.m.
$game_switches [14] = true
$game_switches [12] = false
$game_switches [13] = false
$game_switches [11] = false
$game_screen.start_tone_change(Tone.new(30, 10, 0, 0), 1)
end
shb_map_up
end
end
#=======================================================
# * Game_System Add-on v 1.0
# by shadowball
# 08.02.2008
#
# You can set the time in minutes, hours, days
# Syntax: $game_system.set_time(0, 30, 2, 3)
#=======================================================
class Game_System
def set_time(alter = 0, minute = 0, hour = 0, day = 0)
if minute >= 0
if minute >= 60
minute = 59
end
set_min = Graphics.frame_rate * minute
end
if hour >= 0
if hour >= 24
hour = 23
end
set_hour = Graphics.frame_rate * 60 * hour
end
if day >= 0
if day >= 31
day = 30
end
set_day = Graphics.frame_rate * 60 * 24 * day
end
case alter
when 0 # sets the time
Graphics.frame_count = 0 + set_day + set_hour + set_min
when 1 # adds the hours, minutes you specified to the current in-game playtime
Graphics.frame_count = Graphics.frame_count + set_day + set_hour + set_min
when 2 # this one does exactly the opposite...
Graphics.frame_count = Graphics.frame_count - set_day - set_hour - set_min
end
end
end
My partner in crime = TREXRELL