Beschreibung :
Ein simples Tag und Nacht script was den Bildschirm automatisch färbt um einen Tag und Nacht effekt zu erzielen anhand der Schritte die man macht oder einem Zeitsystem
Last Update : v1.12 - 15.05.08
Changelog :
-----------------------------------------------------------------------------------
v1.12
-----------------------------------------------------------------------------------
nen kleinen lade und anzeigebug gefixed
-----------------------------------------------------------------------------------
v1.1
-----------------------------------------------------------------------------------
savebug und scene bug behoben
-----------------------------------------------------------------------------------
v1.0
-----------------------------------------------------------------------------------
versionssprung auf 1.0
passend zu dem simple mapname hab mich entschlossen die nightlights
öffentlich zu stellen.
mit den nightlights könnt ihr nachts automatisch lightmaps anzeigen
lassen sobald es nacht wird.
auf interior und dark interior karten werden sie direkt angezeigt während sie auf
exterior karten gefaded werden, also langsam eingeblended bzw ausgeblended
-----------------------------------------------------------------------------------
v0.3.3
-----------------------------------------------------------------------------------
da das script noch kleinere probleme mit der startzeit hatte hab ich $starting_time hinzugefügt
da gehört dann halt "day" ,"dawn","dusk" und "night" rein, default wert is nacht und das aus guten grunde
da ich übern frame_counter rechne verändere ich dem framecounter daher werden berechnungen übern framecounter dann falsch berechnet bzw die zeit verschiebt sich ABER
da im standard game nur einmal wirklich was damit angezeigt wird ist das nich weiter schlimm,
und zwar beim speichern wird die spielzeit angezeigt , hab nen kleinen hotfix bei gepackt der dort diesen
fehler behebt und somit wird die richtige spielzeit beim speichern angezeigt
ne anpassung an custom scripte die damit rechnen ist aber auch super einfach wie mein hotfix zeigt,
also braucht man sich da absolut keine sorgen zu machen
-----------------------------------------------------------------------------------
v0.3.2
-----------------------------------------------------------------------------------
die dark_interior funktion is jetz auch drin , einfach [dint] vor den kartennamen pappen und diese karte wird zu einer dark interior karte. Wozu ? z.b. für höhlen oder häußer in denen ja kein tag und nacht wechsel zu sehen ist aber auch kein licht sein sollte
desweiteren gibts jetz noch paar methoden um sich die zeit in eine game variable zu laden oder sons was damit zu machen
die tageszeit selbst kann man immernoch holen wie vorher, also if $day, if $night , if $dawn ,if $dusk wobei ich glaube das nichtmal viele gemerkt haben dass das geht
-----------------------------------------------------------------------------------
v0.3
-----------------------------------------------------------------------------------
Map-Detection funktion hinzugefügt , indem man [int] vor den kartennamen packt ,markiert man diese map als interior/indoor karte, man brauch nun das script nicht mehr abschalten sondern das script entscheidet selbst ob es den bildschirm färbt oder nicht
betritt man nun eine interior karte schaltet das script auf tag um, geht man wieder aus der interior karte heraus weiss das script welche zeit vergangen is und schaltet wieder auf die korrekte tageszeit um
ich hab das script zwar schon paar tage aber ich hab mich mal durchgerungen das doch zu posten,
vielleicht kanns ja doch irgendwer gebrauchen
-----------------------------------------------------------------------------------
v0.2.1
-----------------------------------------------------------------------------------
mehr einstellungsmöglichkeiten ,sowieso eine beschleunigung/verlangsamung für das zeitsystem
-----------------------------------------------------------------------------------
v0.2
ein kleines Zeitsystem ist jetz implementiert , ebenso wie 2 neue zeitliche perioden , sonnenaufgang und sonnenuntergang
-----------------------------------------------------------------------------------
Anmerkung :
Viele wird es stören wenn ihre Karten aufeinmal [dint]mapname bzw. [int]mapname heißen wenn sie
den Kartennamen irgendwo anzeigen lassen.
Deshalb hab ich ein Script erstellt welches den Kartennamen anzeigt und diese kleinen "beigaben"
zum namen ignoriert und den richtigen Kartennamen ausgibt
Dieses Script findet ihr hier : Simple Map-Name (http://forum.rpgvx.net/index.php?showtopic=854)
Anleitung :
Viel gibts nich zu erklären, ich hab ein paar globale gesetzt die ihr
#===============================================================================
# Map-Detection F.A.Q.
#===============================================================================
# Wenn du auf einer interior/indoor karte bist, wo meistens keine tag und nacht
# effekte zu sehen sind packt einfach [int] vor den kartennamen.
# Das script sofort auf tag schalten wenn man eine solche karte betritt und alle
# screen tone effekte die dieses script verursachen würde werden ignoriert
#
# Während ihr auf einer interior karte seit wird die zeit weiterlaufen und sobald
# ihr die karte wieder verlasst wird auf die korrekte tageszeit umgeschaltet
#==============================================================================
# Nightslights F.A.Q.
#==============================================================================
# Erstellt ein Verzeichnis namens Nightlights in eurem Graphics - Verzeichnis und tut
# ein Bild mit dem selben namen und der selbe größe wie ihre Map hinein.
# Das Bild wird auf Exterior Maps eingeblended wenn es nacht wird und ausgeblended
# wenn es tag wird.
# Auf Interior und Dark-Interior Maps wird das Bild direkt angezeigt ohne Fader
#===============================================================================
# Get-Time F.A.Q.
#===============================================================================
# Wenn man die genaue Zeit braucht kann man dieses in ein Callscript packen
# um die genaue Uhrzeit zu bekommen :
# $game_variables[0001] = $dayandnight.getTime
# um die genaue Stunde zu bekommen :
# $game_variables[0001] = $dayandnight.getHour
# um die genaue Minute zu bekommen :
# $game_variables[0001] = $dayandnight.getMinute
#
# $game_variables[0001] entspricht der variable 0001 in eurer Datenbank.
# Wenn ihr eine andere variable benutzen wollt ändert das 0001 einfach in etwas >5000
#
#===============================================================================
# Main config
#------------------------------------------------------------------------------
PIC_FORMAT = "png" # Format für die Nachtlichter
$timesystem = 1 # Entscheidet welches System läuft
# 0 = Schritt-System
# 1 = Zeit-System
$fadingtime = 4 # Entscheidet wie schnell der Screen-Tone einsetzt (in sekunden)
#------------------------------------------------------------------------------
$dusktone = Tone.new(-68, -51, -9, 25) # Dusk-Screen-Tone
$nighttone = Tone.new(-136, -102, -17, 51) # Night-Screen-Tone
$dawntone = Tone.new(-20, -51, -68, 0) # Dawn-Screen-Tone
$daytone = Tone.new(0, 0, 0, 0) # Day-Screen-Tone
#------------------------------------------------------------------------------
# Timesystem config
#------------------------------------------------------------------------------
$starting_time = "night" # Bestimmt die Startphase
# "day" für tag ,"dusk" für dämmerung
# "dawn" für sonnenaufgang und "night" für nacht
# Anmerkung : Der standardwert ist "night";
# ALLE anderen berechnungen mit dem Graphics.frame_counter
# werden hier von beeinflusst.
# Für die Speicherzeit liegt bereits ein hotfix bei
$divider = 1 # Entscheidet wie schnell das Zeit-System läuft
# z.b. 2 = 2 mal so schnell (30 sekunden = 1 stunde)
# z.b. 0,5 = 2 mal so langsam (2 minuten = 1 stunde)
$dusktime = 7 # schaltet auf sonnenuntergang bei $dusktime
$daytime = 8 # schaltet auf tag bei $daytime
$dawntime = 19 # schaltet auf sonnenuntergang bei $dawntime
$nighttime = 20 # schaltet auf nacht bei $nighttime
#------------------------------------------------------------------------------
# Footstep config
#------------------------------------------------------------------------------
$count = 0 # Zähler der Schritte
$maxsteps = 200 # Wieviele Schritte zwischen den Phasen sind
Script v1.12
#==============================================================================
# Simple Day and Night Script
#
# Version : 1.12 - 15.05.08
# Created by : hellMinor
# Do NOT redistribute without my permission
# Description : A simple script which tones the screen to emulate a day and
# night system on the basis of your footsteps or a time system.
#
#==============================================================================
#==============================================================================
# Map-Detection F.A.Q.
#==============================================================================
# If you have an interior map on which most likely no day and night effects
# are shown just put [int] to front of the mapname.
# When entering such a map the script will immediately change the screen tone
# to the $daytone and all tone changes done by the script will be ignored.
#
# Sometimes interior maps need to be dark ,i.e. caves, just put [dint]
# to the front of the mapname to mark this map as a dark interior map.
# The script while change the tone to the $nighttone instead of $daytone
#
# While in the interior map the time will still pass and when you leave the
# interior map it will tone the screen to the current game time
#==============================================================================
# Nightslights F.A.Q.
#==============================================================================
# Create a folder named Nightlights in your Graphics folder and put a picture
# with the same name,width and height as your map into it.
# The picture will automatically fade in when its night and fade out when its
# day as long as you are on an exterior map.
# On Interior and Dark Interior the picture will be shown directly.
#==============================================================================
# Get-Time F.A.Q.
#==============================================================================
# If you need to get current time, you can use this code in a call script.
# to get the current time :
# $game_variables[0001] = $dayandnight.getTime
# to get the current hour :
# $game_variables[0001] = $dayandnight.getHour
# or to get the current minute :
# $game_variables[0001] = $dayandnight.getMinute
#
# $game_variables[0001] will be for example the first variable in your database.
# To use another variable just change the 0001 to something >5000
#==============================================================================
# Main config
#==============================================================================
PIC_FORMAT = "png" # Format for the Nightlight-Maps
$timesystem = 1 # Determines which time system is active
# 0 = Footstep-System
# 1 = Time-System
$fadingtime = 3 # How fast the tone changes (in seconds)
#------------------------------------------------------------------------------
$dusktone = Tone.new(-68, -51, -9, 25) # Dusk-Screen-Tone
$nighttone = Tone.new(-136, -102, -17, 51) # Night-Screen-Tone
$dawntone = Tone.new(-20, -51, -68, 0) # Dawn-Screen-Tone
$daytone = Tone.new(0, 0, 0, 0) # Day-Screen-Tone
#------------------------------------------------------------------------------
# Timesystem config
#------------------------------------------------------------------------------
$starting_time = "day" # Determines the starting phase
# "day" for day ,"dusk" for dusk
# "dawn" for dawn and "night" for night
# Notes : The default is "night",
# any other than night will change ALL calculations
# made with Graphics.frame_counter once !!!!!
$divider = 2 # Decides how fast the Time-System runs
# i.e. 2 = twice as fast (30 seconds = 1 hour)
# i.e. 0,5 = twice as slow (2 minutes = 1 hour)
$dawntime = 7 # turns into dawn on $dawntime
$daytime = 8 # turns into day on $daytime
$dusktime = 19 # turns into dusk on $dusktime
$nighttime = 20 # turns into night on $nighttime
#------------------------------------------------------------------------------
# Footstep config
#------------------------------------------------------------------------------
$count = 0 # Counter how many steps are made between one period
$maxsteps = 200 # How many footsteps between each phase
#------------------------------------------------------------------------------
# boolean checks
#------------------------------------------------------------------------------
$day = false # Checker if its day
$dusk = false # Checker if its dusk
$dawn = false # Checker if its dawn
$night = true # Checker if its night
#==============================================================================
class DayAndNight < Game_Screen
#==============================================================================
def change?
if $count >= $maxsteps
if $day
doDusk
end
if $dusk
doNight
end
if $night
doDawn
end
if $dawn
doDay
end
end
end
#------------------------------------------------------------------------------
def doNight
if $dayandnight.exterior?
$game_map.screen.start_tone_change($nighttone,$fadingtime*60)
end
$count = 0
$day = false
$dusk = false
$dawn = false
$night = true
end
#------------------------------------------------------------------------------
def doDay
if $dayandnight.exterior?
$game_map.screen.start_tone_change($daytone,$fadingtime*60)
end
$count = 0
$day = true
$night = false
$dawn = false
$dusk = false
end
#------------------------------------------------------------------------------
def doDawn
if $dayandnight.exterior?
$game_map.screen.start_tone_change($dawntone,$fadingtime*60)
end
$count = 0
$day = false
$night = false
$dusk = false
$dawn = true
end
#------------------------------------------------------------------------------
def doDusk
if $dayandnight.exterior?
$game_map.screen.start_tone_change($dusktone,$fadingtime*60)
end
$count = 0
$day = false
$night = false
$dusk = true
$dawn = false
end
#------------------------------------------------------------------------------
def updateclock
clocktime = Graphics.frame_count / (Graphics.frame_rate/$divider)
hour = clocktime / 60 % 24
minutes = clocktime % 60
if hour == $dawntime && minutes == 0
doDawn
end
if hour == $daytime && minutes == 0
doDay
end
if hour == $dusktime && minutes == 0
doDusk
end
if hour == $nighttime && minutes == 0
doNight
end
end
#------------------------------------------------------------------------------
def interior?
if($game_map.name.index("[int]") != nil)
return true
end
end
#------------------------------------------------------------------------------
def exterior?
if($game_map.name.index("[int]") == nil &&
$game_map.name.index("[dint]") == nil)
return true
end
end
#------------------------------------------------------------------------------
def dark_interior?
if($game_map.name.index("[dint]") != nil)
return true
end
end
#------------------------------------------------------------------------------
def get_state_tone
if $dawn
return $dawntone
end
if $day
return $daytone
end
if $dusk
return $dusktone
end
if $night
return $nighttone
end
end
#------------------------------------------------------------------------------
def getTime
clocktime = Graphics.frame_count / (Graphics.frame_rate/$divider)
hour = clocktime / 60 % 24
minutes = clocktime % 60
return hour.to_s+":"+minutes.to_s
end
#------------------------------------------------------------------------------
def getHour
clocktime = Graphics.frame_count / (Graphics.frame_rate/$divider)
hour = clocktime / 60 % 24
return hour
end
#------------------------------------------------------------------------------
def getMinute
clocktime = Graphics.frame_count / (Graphics.frame_rate/$divider)
minutes = clocktime % 60
return minutes
end
#------------------------------------------------------------------------------
def show_mapname
end
end
#==============================================================================
module Cache
#==============================================================================
def self.nightlights(filename)
load_bitmap("graphics/nightlights/", filename)
end
end
#==============================================================================
class Game_Character
#==============================================================================
def increase_steps
@stop_count = 0
if $timesystem == 0
$count += 1
$dayandnight.change?
end
update_bush_depth
end
end
#==============================================================================
class Game_Map
#==============================================================================
alias initialize_dayandnnight_adds initialize
def initialize
initialize_dayandnnight_adds
$dayandnight = DayAndNight.new
end
def setup(map_id)
@map_id = map_id
@map = load_data(sprintf("Data/Map%03d.rvdata", @map_id))
@display_x = 0
@display_y = 0
@passages = $data_system.passages
referesh_vehicles
setup_events
setup_scroll
setup_parallax
setup_nightlights
@need_refresh = false
end
#------------------------------------------------------------------------------
def setup_nightlights
@nightlights_mapname = $game_map.name
@nightlights_loop_x = 0
@nightlights_loop_y = 0
@nightlights_sx = 0
@nightlights_sy = 0
@nightlights_x = 0
@nightlights_y = 0
end
#------------------------------------------------------------------------------
def update
refresh if $game_map.need_refresh
update_scroll
update_events
update_vehicles
update_parallax
if $timesystem == 1
update_nightlights
$dayandnight.updateclock
end
@screen.update
end
#------------------------------------------------------------------------------
def update_nightlights
@nightlights_x += @nightlights_sx * 4 if @nightlights_loop_x
@nightlights_y += @nightlights_sy * 4 if @nightlights_loop_y
end
#------------------------------------------------------------------------------
alias set_display_pos_adds set_display_pos
def set_display_pos(x, y)
set_display_pos_adds(x,y)
@nightlights_x = x
@nightlights_y = y
end
#------------------------------------------------------------------------------
def calc_nightlights_x(bitmap)
if bitmap == nil
return 0
else
w1 = bitmap.width - 544
w2 = @map.width * 32 - 544
if w1 <= 0 or w2 <= 0
return 0
else
return @nightlights_x * w1 / w2 / 8
end
end
end
#------------------------------------------------------------------------------
def calc_nightlights_y(bitmap)
if bitmap == nil
return 0
else
h1 = bitmap.height - 416
h2 = @map.height * 32 - 416
if h1 <= 0 or h2 <= 0
return 0
else
return @nightlights_y * h1 / h2 / 8
end
end
end
#------------------------------------------------------------------------------
def scroll_down(distance)
if loop_vertical?
@display_y += distance
@display_y %= @map.height * 256
@parallax_y += distance
@nightlights_y += distance
else
last_y = @display_y
@display_y = [@display_y + distance, (height - 13) * 256].min
@parallax_y += @display_y - last_y
@nightlights_y += @display_y - last_y
end
end
#------------------------------------------------------------------------------
def scroll_left(distance)
if loop_horizontal?
@display_x += @map.width * 256 - distance
@display_x %= @map.width * 256
@parallax_x -= distance
@nightlights_x -= distance
else
last_x = @display_x
@display_x = [@display_x - distance, 0].max
@parallax_x += @display_x - last_x
@nightlights_x += @display_x - last_x
end
end
#------------------------------------------------------------------------------
def scroll_right(distance)
if loop_horizontal?
@display_x += distance
@display_x %= @map.width * 256
@parallax_x += distance
@nightlights_x += distance
else
last_x = @display_x
@display_x = [@display_x + distance, (width - 17) * 256].min
@parallax_x += @display_x - last_x
@nightlights_x += @display_x - last_x
end
end
#------------------------------------------------------------------------------
def scroll_up(distance)
if loop_vertical?
@display_y += @map.height * 256 - distance
@display_y %= @map.height * 256
@parallax_y -= distance
@nightlights_y -= distance
else
last_y = @display_y
@display_y = [@display_y - distance, 0].max
@parallax_y += @display_y - last_y
@nightlights_y += @display_y - last_y
end
end
#------------------------------------------------------------------------------
def name
$data_mapinfos[@map_id]
end
end
#==============================================================================
class Scene_Map
#==============================================================================
alias start_dayandnight_adds start
def start
start_dayandnight_adds
nightlights?
end
def fadein(duration)
Graphics.transition(0)
if $dayandnight.interior?
$game_map.screen.start_tone_change($daytone,1)
$nightlights.opacity = 255
else if $dayandnight.dark_interior?
$game_map.screen.start_tone_change($nighttone,1)
$nightlights.opacity = 255
else if $dayandnight.exterior?
$game_map.screen.start_tone_change($dayandnight.get_state_tone,1)
nightlights?
end
end
end
for i in 0..duration-1
Graphics.brightness = 255 * i / duration
update_basic
end
Graphics.brightness = 255
end
def nightlights?
$nightlights.opacity = 0 if $day
$nightlights.opacity = 255 if $night
$nightlights.opacity = 125 if $dawn or $dusk
end
end
#==============================================================================
class Scene_Title
#==============================================================================
alias load_database_additions load_database
def load_database
load_database_additions
$data_mapinfos = load_data("Data/MapInfos.rvdata")
for key in $data_mapinfos.keys
$data_mapinfos[key] = $data_mapinfos[key].name
end
end
alias command_new_game_additions command_new_game
def command_new_game
command_new_game_additions
$dayandnight = DayAndNight.new
Graphics.frame_count += 25200/$divider if $starting_time == "dawn"
Graphics.frame_count += 28800/$divider if $starting_time == "day"
Graphics.frame_count += 68400/$divider if $starting_time == "dusk"
end
end
#==============================================================================
class Spriteset_Map
#==============================================================================
def initialize
create_viewports
create_tilemap
create_parallax
create_characters
create_shadow
create_weather
create_pictures
create_timer
create_nightlights
update
end
#-------------------------------------------------------------------------------
def create_nightlights
$nightlights = Plane.new(@viewport3)
$nightlights.opacity = 0
end
#-------------------------------------------------------------------------------
alias dispose_addition dispose
def dispose
dispose_addition
dispose_nightlights
end
#-------------------------------------------------------------------------------
def dispose_nightlights
$nightlights.dispose
end
#-------------------------------------------------------------------------------
alias update_addition update
def update
update_addition
update_nightlights
end
#-------------------------------------------------------------------------------
def update_fading
if $dayandnight.exterior?
$nightlights.opacity += 1 if $night and $nightlights.opacity <= 255
$nightlights.opacity += 1 if $dusk and $nightlights.opacity <= 150
$nightlights.opacity -= 1 if $dawn and $nightlights.opacity >= 100
$nightlights.opacity -= 1 if $day and $nightlights.opacity >= 0
else
$nightlights.opacity = 255
end
end
#-------------------------------------------------------------------------------
def update_nightlights
if @nightlights_mapname != $game_map.name
@nightlights_mapname = $game_map.name
if $nightlights.bitmap != nil
$nightlights.bitmap.dispose
$nightlights.bitmap = nil
end
if @nightlights_mapname != ""
if File.exist?("Graphics/Nightlights/"+@nightlights_mapname+"."+PIC_FORMAT)
$nightlights.bitmap = Cache.nightlights(@nightlights_mapname)
end
end
Graphics.frame_reset
end
$nightlights.ox = $game_map.calc_nightlights_x($nightlights.bitmap)
$nightlights.oy = $game_map.calc_nightlights_y($nightlights.bitmap)
update_fading
end
end
#===============================================================================
class Scene_File
#===============================================================================
alias write_save_data_dn_adds write_save_data
def write_save_data(file)
write_save_data_dn_adds(file)
Marshal.dump($day, file)
Marshal.dump($dusk, file)
Marshal.dump($dawn, file)
Marshal.dump($night, file)
end
#-------------------------------------------------------------------------------
alias read_save_data_dn_adds read_save_data
def read_save_data(file)
read_save_data_dn_adds(file)
$day = Marshal.load(file)
$dusk = Marshal.load(file)
$dawn = Marshal.load(file)
$night = Marshal.load(file)
end
end
#===============================================================================
# Game-Time-Hotfix
#===============================================================================
#===============================================================================
class Window_SaveFile < Window_Base
#===============================================================================
def load_gamedata
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
begin
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
@game_system = Marshal.load(file)
@game_message = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
case $starting_time
when "night"
@total_sec = @frame_count / Graphics.frame_rate
when "dawn"
@total_sec = (@frame_count-(25200/$divider)) / Graphics.frame_rate
when "day"
@total_sec = (@frame_count-(28800/$divider)) / Graphics.frame_rate
when "dusk"
@total_sec = (@frame_count-(68400/$divider)) / Graphics.frame_rate
end
rescue
@file_exist = false
ensure
file.close
end
end
end
end
Alte Scripte
Script v1.0
[code]#==============================================================================
# Simple Day and Night Script
#
# Version : 1.0 - 23.04.08
# Created by : hellMinor
# Do NOT redistribute without my permission
# Description : A simple script which tones the screen to emulate a day and
# night system on the basis of your footsteps or a time system.
#
#==============================================================================
#==============================================================================
# Map-Detection F.A.Q.
#==============================================================================
# If you have an interior map on which most likely no day and night effects
# are shown just put [int] to front of the mapname.
# When entering such a map the script will immediately change the screen tone
# to the $daytone and all tone changes done by the script will be ignored.
#
# Sometimes interior maps need to be dark ,i.e. caves, just put [dint]
# to the front of the mapname to mark this map as a dark interior map.
# The script while change the tone to the $nighttone instead of $daytone
#
# While in the interior map the time will still pass and when you leave the
# interior map it will tone the screen to the current game time
#==============================================================================
# Nightslights F.A.Q.
#==============================================================================
# Create a folder named Nightlights in your Graphics folder and put a picture
# with the same name,width and height as your map into it.
# The picture will automatically fade in when its night and fade out when its
# day as long as you are on an exterior map.
# On Interior and Dark Interior the picture will be shown directly.
#==============================================================================
# Get-Time F.A.Q.
#==============================================================================
# If you need to get current time, you can use this code in a call script.
# to get the current time :
# $game_variables[0001] = $dayandnight.getTime
# to get the current hour :
# $game_variables[0001] = $dayandnight.getHour
# or to get the current minute :
# $game_variables[0001] = $dayandnight.getMinute
#
# $game_variables[0001] will be for example the first variable in your database.
# To use another variable just change the 0001 to something >5000
#==============================================================================
# Main config
#==============================================================================
PIC_FORMAT = "png" # Format for the Nightlight-Maps
$timesystem = 1 # Determines which time system is active
# 0 = Footstep-System
# 1 = Time-System
$fadingtime = 3 # How fast the tone changes (in seconds)
#------------------------------------------------------------------------------
$dusktone = Tone.new(-68, -51, -9, 25) # Dusk-Screen-Tone
$nighttone = Tone.new(-136, -102, -17, 51) # Night-Screen-Tone
$dawntone = Tone.new(-20, -51, -68, 0) # Dawn-Screen-Tone
$daytone = Tone.new(0, 0, 0, 0) # Day-Screen-Tone
#------------------------------------------------------------------------------
# Timesystem config
#------------------------------------------------------------------------------
$starting_time = "night" # Determines the starting phase
# "day" for day ,"dusk" for dusk
# "dawn" for dawn and "night" for night
# Notes : The default is "night",
# any other than night will change ALL calculations
# made with Graphics.frame_counter once !!!!!
$divider = 2 # Decides how fast the Time-System runs
# i.e. 2 = twice as fast (30 seconds = 1 hour)
# i.e. 0,5 = twice as slow (2 minutes = 1 hour)
$dawntime = 7 # turns into dawn on $dawntime
$daytime = 8 # turns into day on $daytime
$dusktime = 19 # turns into dusk on $dusktime
$nighttime = 20 # turns into night on $nighttime
#------------------------------------------------------------------------------
# Footstep config
#------------------------------------------------------------------------------
$count = 0 # Counter how many steps are made between one period
$maxsteps = 200 # How many footsteps between each phase
#------------------------------------------------------------------------------
# boolean checks
#------------------------------------------------------------------------------
$day = false # Checker if its day
$dusk = false # Checker if its dusk
$dawn = false # Checker if its dawn
$night = true # Checker if its night
#==============================================================================
class DayAndNight < Game_Screen
#==============================================================================
def change?
if $count >= $maxsteps
if $day
doDusk
end
if $dusk
doNight
end
if $night
doDawn
end
if $dawn
doDay
end
end
end
#------------------------------------------------------------------------------
def doNight
if $dayandnight.exterior?
$game_map.screen.start_tone_change($nighttone,$fadingtime*60)
end
$count = 0
$day = false
$dusk = false
$dawn = false
$night = true
end
#------------------------------------------------------------------------------
def doDay
if $dayandnight.exterior?
$game_map.screen.start_tone_change($daytone,$fadingtime*60)
end
$count = 0
$day = true
$night = false
$dawn = false
$dusk = false
end
#------------------------------------------------------------------------------
def doDawn
if $dayandnight.exterior?
$game_map.screen.start_tone_change($dawntone,$fadingtime*60)
end
$count = 0
$day = false
$night = false
$dusk = false
$dawn = true
end
#------------------------------------------------------------------------------
def doDusk
if $dayandnight.exterior?
$game_map.screen.start_tone_change($dusktone,$fadingtime*60)
end
$count = 0
$day = false
$night = false
$dusk = true
$dawn = false
end
#------------------------------------------------------------------------------
def updateclock
clocktime = Graphics.frame_count / (Graphics.frame_rate/$divider)
hour = clocktime / 60 % 24
minutes = clocktime % 60
if hour == $dawntime && minutes == 0
doDawn
end
if hour == $daytime && minutes == 0
doDay
end
if hour == $dusktime && minutes == 0
doDusk
end
if hour == $nighttime && minutes == 0
doNight
end
end
#------------------------------------------------------------------------------
def interior?
if($game_map.name.to_s.index("[int]") != nil)
return true
end
end
#------------------------------------------------------------------------------
def exterior?
if($game_map.name.to_s.index("[int]") == nil &&
$game_map.name.to_s.index("[dint]") == nil)
return true
end
end
#------------------------------------------------------------------------------
def dark_interior?
if($game_map.name.to_s.index("[dint]") != nil)
return true
end
end
#------------------------------------------------------------------------------
def get_state_tone
if $dawn
return $dawntone
end
if $day
return $daytone
end
if $dusk
return $dusktone
end
if $night
return $nighttone
end
end
#------------------------------------------------------------------------------
def getTime
clocktime = Graphics.frame_count / (Graphics.frame_rate/$divider)
hour = clocktime / 60 % 24
minutes = clocktime % 60
return hour.to_s+":"+minutes.to_s
end
#------------------------------------------------------------------------------
def getHour
clocktime = Graphics.frame_count / (Graphics.frame_rate/$divider)
hour = clocktime / 60 % 24
return hour
end
#------------------------------------------------------------------------------
def getMinute
clocktime = Graphics.frame_count / (Graphics.frame_rate/$divider)
minutes = clocktime % 60
return minutes
end
#------------------------------------------------------------------------------
def show_mapname
end
end
#==============================================================================
module Cache
#==============================================================================
def self.nightlights(filename)
load_bitmap("graphics/nightlights/", filename)
end
end
#==============================================================================
class Game_Character
#==============================================================================
def increase_steps
@stop_coun
im problembericht steht folgendes:
AppName: game.exe
AppVer: 2.0.0.1
ModName: rgss202e.dll
ModVer: 2.0.2.1
Offset: 000dcb59
@Herendil:
wat fürn treiber?
@hellMinor:
wenn ich das tag-nacht-system nicht drin habe, schmiert das Game auch nicht ab.
@Dainreth:
Folgende Scripte nutze ich noch:
Skill Shop for RMVX
GameBaker Battle Status Faces
Mog Basic Menu Plus
Target Flash
GameBaker Save Folder
TDS Sprite Reflect
[STR15] HP-Leiste bei Gegner
CATERPILLAR
Simple Map-Name
Simple Quest-Log
die hier:
#===============================================================================
# Main config
#------------------------------------------------------------------------------
PIC_FORMAT = "png" # Format für die Nachtlichter
$timesystem = 1 # Entscheidet welches System läuft
# 0 = Schritt-System
# 1 = Zeit-System
$fadingtime = 4 # Entscheidet wie schnell der Screen-Tone einsetzt (in sekunden)
#------------------------------------------------------------------------------
$dusktone = Tone.new(-68, -51, -9, 25) # Dusk-Screen-Tone
$nighttone = Tone.new(-136, -102, -17, 51) # Night-Screen-Tone
$dawntone = Tone.new(-20, -51, -68, 0) # Dawn-Screen-Tone
$daytone = Tone.new(0, 0, 0, 0) # Day-Screen-Tone
#------------------------------------------------------------------------------
# Timesystem config
#------------------------------------------------------------------------------
$starting_time = "night" # Bestimmt die Startphase
# "day" für tag ,"dusk" für dämmerung
# "dawn" für sonnenaufgang und "night" für nacht
# Anmerkung : Der standardwert ist "night";
# ALLE anderen berechnungen mit dem Graphics.frame_counter
# werden hier von beeinflusst.
# Für die Speicherzeit liegt bereits ein hotfix bei
$divider = 1 # Entscheidet wie schnell das Zeit-System läuft
# z.b. 2 = 2 mal so schnell (30 sekunden = 1 stunde)
# z.b. 0,5 = 2 mal so langsam (2 minuten = 1 stunde)
$dusktime = 4 # schaltet auf sonnenuntergang bei $dusktime
$daytime = 5 # schaltet auf tag bei $daytime
$dawntime = 9 # schaltet auf sonnenuntergang bei $dawntime
$nighttime = 10 # schaltet auf nacht bei $nighttime
#------------------------------------------------------------------------------
# Footstep config
#------------------------------------------------------------------------------
$count = 0 # Zähler der Schritte
$maxsteps = 200 # Wieviele Schritte zwischen den Phasen sind
ich hab nen prob. also das spiel startet nachts. wechselt dann zu morgen und danach zu tag. dann zu dämmerung und schließlich wieder zu nacht. aba ab dann bleibt es nacht. ich habe mal das "$dayandnight.getTime" benutzt und fest gestellt, dass es nach 4 min trotzdem weiter läuft. es müsste doch aber theoretisch bei mir wieder von null anfangen wenn es bei 4 angekommen ist oder?
hier das script so wie es bei mir derzeit drin is:
#==============================================================================
# Simple Day and Night Script
#
# Version : 1.12 - 15.05.08
# Created by : hellMinor
# Do NOT redistribute without my permission
# Description : A simple script which tones the screen to emulate a day and
# night system on the basis of your footsteps or a time system.
#
#==============================================================================
#===============================================================================
# Map-Detection F.A.Q.
#===============================================================================
# Wenn du auf einer interior/indoor karte bist, wo meistens keine tag und nacht
# effekte zu sehen sind packt einfach [int] vor den kartennamen.
# Das script sofort auf tag schalten wenn man eine solche karte betritt und alle
# screen tone effekte die dieses script verursachen würde werden ignoriert
#
# Während ihr auf einer interior karte seit wird die zeit weiterlaufen und sobald
# ihr die karte wieder verlasst wird auf die korrekte tageszeit umgeschaltet
#==============================================================================
# Nightslights F.A.Q.
#==============================================================================
# Erstellt ein Verzeichnis namens Nightlights in eurem Graphics - Verzeichnis und tut
# ein Bild mit dem selben namen und der selbe größe wie ihre Map hinein.
# Das Bild wird auf Exterior Maps eingeblended wenn es nacht wird und ausgeblended
# wenn es tag wird.
# Auf Interior und Dark-Interior Maps wird das Bild direkt angezeigt ohne Fader
#===============================================================================
# Get-Time F.A.Q.
#===============================================================================
# Wenn man die genaue Zeit braucht kann man dieses in ein Callscript packen
# um die genaue Uhrzeit zu bekommen :
# $game_variables[0001] = $dayandnight.getTime
# um die genaue Stunde zu bekommen :
# $game_variables[0001] = $dayandnight.getHour
# um die genaue Minute zu bekommen :
# $game_variables[0001] = $dayandnight.getMinute
#
# $game_variables[0001] entspricht der variable 0001 in eurer Datenbank.
# Wenn ihr eine andere variable benutzen wollt ändert das 0001 einfach in etwas >5000
#
#===============================================================================
# Main config
#------------------------------------------------------------------------------
PIC_FORMAT = "png" # Format für die Nachtlichter
$timesystem = 1 # Entscheidet welches System läuft
# 0 = Schritt-System
# 1 = Zeit-System
$fadingtime = 4 # Entscheidet wie schnell der Screen-Tone einsetzt (in sekunden)
#------------------------------------------------------------------------------
$dusktone = Tone.new(-68, -51, -9, 25) # Dusk-Screen-Tone
$nighttone = Tone.new(-136, -102, -17, 51) # Night-Screen-Tone
$dawntone = Tone.new(-20, -51, -68, 0) # Dawn-Screen-Tone
$daytone = Tone.new(0, 0, 0, 0) # Day-Screen-Tone
#------------------------------------------------------------------------------
# Timesystem config
#------------------------------------------------------------------------------
$starting_time = "night" # Bestimmt die Startphase
# "day" für tag ,"dusk" für dämmerung
# "dawn" für sonnenaufgang und "night" für nacht
# Anmerkung : Der standardwert ist "night";
# ALLE anderen berechnungen mit dem Graphics.frame_counter
# werden hier von beeinflusst.
# Für die Speicherzeit liegt bereits ein hotfix bei
$divider = 1 # Entscheidet wie schnell das Zeit-System läuft
# z.b. 2 = 2 mal so schnell (30 sekunden = 1 stunde)
# z.b. 0,5 = 2 mal so langsam (2 minuten = 1 stunde)
$dusktime = 1 # schaltet auf sonnenaufgang bei $dusktime
$daytime = 2 # schaltet auf tag bei $daytime
$dawntime = 3 # schaltet auf sonnenuntergang bei $dawntime
$nighttime = 4 # schaltet auf nacht bei $nighttime
#------------------------------------------------------------------------------
# Footstep config
#------------------------------------------------------------------------------
$count = 0 # Zähler der Schritte
$maxsteps = 200 # Wieviele Schritte zwischen den Phasen sind
#------------------------------------------------------------------------------
# boolean checks
#------------------------------------------------------------------------------
$day = false # Checker if its day
$dusk = false # Checker if its dusk
$dawn = false # Checker if its dawn
$night = true # Checker if its night
#==============================================================================
class DayAndNight < Game_Screen
#==============================================================================
def change?
if $count >= $maxsteps
if $day
doDusk
end
if $dusk
doNight
end
if $night
doDawn
end
if $dawn
doDay
end
end
end
#------------------------------------------------------------------------------
def doNight
if $dayandnight.exterior?
$game_map.screen.start_tone_change($nighttone,$fadingtime*60)
end
$count = 0
$day = false
$dusk = false
$dawn = false
$night = true
end
#------------------------------------------------------------------------------
def doDay
if $dayandnight.exterior?
$game_map.screen.start_tone_change($daytone,$fadingtime*60)
end
$count = 0
$day = true
$night = false
$dawn = false
$dusk = false
end
#------------------------------------------------------------------------------
def doDawn
if $dayandnight.exterior?
$game_map.screen.start_tone_change($dawntone,$fadingtime*60)
end
$count = 0
$day = false
$night = false
$dusk = false
$dawn = true
end
#------------------------------------------------------------------------------
def doDusk
if $dayandnight.exterior?
$game_map.screen.start_tone_change($dusktone,$fadingtime*60)
end
$count = 0
$day = false
$night = false
$dusk = true
$dawn = false
end
#------------------------------------------------------------------------------
def updateclock
clocktime = Graphics.frame_count / (Graphics.frame_rate/$divider)
hour = clocktime / 60 % 24
minutes = clocktime % 60
if hour == $dawntime && minutes == 0
doDawn
end
if hour == $daytime && minutes == 0
doDay
end
if hour == $dusktime && minutes == 0
doDusk
end
if hour == $nighttime && minutes == 0
doNight
end
end
#------------------------------------------------------------------------------
def interior?
if($game_map.name.index("[int]") != nil)
return true
end
end
#------------------------------------------------------------------------------
def exterior?
if($game_map.name.index("[int]") == nil &&
$game_map.name.index("[dint]") == nil)
return true
end
end
#------------------------------------------------------------------------------
def dark_interior?
if($game_map.name.index("[dint]") != nil)
return true
end
end
#------------------------------------------------------------------------------
def get_state_tone
if $dawn
return $dawntone
end
if $day
return $daytone
end
if $dusk
return $dusktone
end
if $night
return $nighttone
end
end
#------------------------------------------------------------------------------
def getTime
clocktime = Graphics.frame_count / (Graphics.frame_rate/$divider)
hour = clocktime / 60 % 24
minutes = clocktime % 60
return hour.to_s+":"+minutes.to_s
end
#------------------------------------------------------------------------------
def getHour
clocktime = Graphics.frame_count / (Graphics.frame_rate/$divider)
hour = clocktime / 60 % 24
return hour
end
#------------------------------------------------------------------------------
def getMinute
clocktime = Graphics.frame_count / (Graphics.frame_rate/$divider)
minutes = clocktime % 60
return minutes
end
#------------------------------------------------------------------------------
def show_mapname
end
end
#==============================================================================
module Cache
#==============================================================================
def self.nightlights(filename)
load_bitmap("graphics/nightlights/", filename)
end
end
#==============================================================================
class Game_Character
#==============================================================================
def increase_steps
@stop_count = 0
if $timesystem == 0
$count += 1
$dayandnight.change?
end
update_bush_depth
end
end
#==============================================================================
class Game_Map
#==============================================================================
alias initialize_dayandnnight_adds initialize
def initialize
initialize_dayandnnight_adds
$dayandnight = DayAndNight.new
end
def setup(map_id)
@map_id = map_id
@map = load_data(sprintf("Data/Map%03d.rvdata", @map_id))
@display_x = 0
@display_y = 0
@passages = $data_system.passages
referesh_vehicles
setup_events
setup_scroll
setup_parallax
setup_nightlights
@need_refresh = false
end
#------------------------------------------------------------------------------
def setup_nightlights
@nightlights_mapname = $game_map.name
@nightlights_loop_x = 0
@nightlights_loop_y = 0
@nightlights_sx = 0
@nightlights_sy = 0
@nightlights_x = 0
@nightlights_y = 0
end
#------------------------------------------------------------------------------
def update
refresh if $game_map.need_refresh
update_scroll
update_events
update_vehicles
update_parallax
if $timesystem == 1
update_nightlights
$dayandnight.updateclock
end
@screen.update
end
#------------------------------------------------------------------------------
def update_nightlights
@nightlights_x += @nightlights_sx * 4 if @nightlights_loop_x
@nightlights_y += @nightlights_sy * 4 if @nightlights_loop_y
end
#------------------------------------------------------------------------------
alias set_display_pos_adds set_display_pos
def set_display_pos(x, y)
set_display_pos_adds(x,y)
@nightlights_x = x
@nightlights_y = y
end
#------------------------------------------------------------------------------
def calc_nightlights_x(bitmap)
if bitmap == nil
return 0
else
w1 = bitmap.width - 544
w2 = @map.width * 32 - 544
if w1 <= 0 or w2 <= 0
return 0
else
return @nightlights_x * w1 / w2 / 8
end
end
end
#------------------------------------------------------------------------------
def calc_nightlights_y(bitmap)
if bitmap == nil
return 0
else
h1 = bitmap.height - 416
h2 = @map.height * 32 - 416
if h1 <= 0 or h2 <= 0
return 0
else
return @nightlights_y * h1 / h2 / 8
end
end
end
#------------------------------------------------------------------------------
def scroll_down(distance)
if loop_vertical?
@display_y += distance
@display_y %= @map.height * 256
@parallax_y += distance
@nightlights_y += distance
else
last_y = @display_y
@display_y = [@display_y + distance, (height - 13) * 256].min
@parallax_y += @display_y - last_y
@nightlights_y += @display_y - last_y
end
end
#------------------------------------------------------------------------------
def scroll_left(distance)
if loop_horizontal?
@display_x += @map.width * 256 - distance
@display_x %= @map.width * 256
@parallax_x -= distance
@nightlights_x -= distance
else
last_x = @display_x
@display_x = [@display_x - distance, 0].max
@parallax_x += @display_x - last_x
@nightlights_x += @display_x - last_x
end
end
#------------------------------------------------------------------------------
def scroll_right(distance)
if loop_horizontal?
@display_x += distance
@display_x %= @map.width * 256
@parallax_x += distance
@nightlights_x += distance
else
last_x = @display_x
@display_x = [@display_x + distance, (width - 17) * 256].min
@parallax_x += @display_x - last_x
@nightlights_x += @display_x - last_x
end
end
#------------------------------------------------------------------------------
def scroll_up(distance)
if loop_vertical?
@display_y += @map.height * 256 - distance
@display_y %= @map.height * 256
@parallax_y -= distance
@nightlights_y -= distance
else
last_y = @display_y
@display_y = [@display_y - distance, 0].max
@parallax_y += @display_y - last_y
@nightlights_y += @display_y - last_y
end
end
#------------------------------------------------------------------------------
def name
$data_mapinfos[@map_id]
end
end
#==============================================================================
class Scene_Map
#==============================================================================
alias start_dayandnight_adds start
def start
start_dayandnight_adds
nightlights?
end
def fadein(duration)
Graphics.transition(0)
if $dayandnight.interior?
$game_map.screen.start_tone_change($daytone,1)
$nightlights.opacity = 255
else if $dayandnight.dark_interior?
$game_map.screen.start_tone_change($nighttone,1)
$nightlights.opacity = 255
else if $dayandnight.exterior?
$game_map.screen.start_tone_change($dayandnight.get_state_tone,1)
nightlights?
end
end
end
for i in 0..duration-1
Graphics.brightness = 255 * i / duration
update_basic
end
Graphics.brightness = 255
end
def nightlights?
$nightlights.opacity = 0 if $day
$nightlights.opacity = 255 if $night
$nightlights.opacity = 125 if $dawn or $dusk
end
end
#==============================================================================
class Scene_Title
#==============================================================================
alias load_database_additions load_database
def load_database
load_database_additions
$data_mapinfos = load_data("Data/MapInfos.rvdata")
for key in $data_mapinfos.keys
$data_mapinfos[key] = $data_mapinfos[key].name
end
end
alias command_new_game_additions command_new_game
def command_new_game
command_new_game_additions
$dayandnight = DayAndNight.new
Graphics.frame_count += 25200/$divider if $starting_time == "dawn"
Graphics.frame_count += 28800/$divider if $starting_time == "day"
Graphics.frame_count += 68400/$divider if $starting_time == "dusk"
end
end
#==============================================================================
class Spriteset_Map
#==============================================================================
def initialize
create_viewports
create_tilemap
create_parallax
create_characters
create_shadow
create_weather
create_pictures
create_timer
create_nightlights
update
end
#-------------------------------------------------------------------------------
def create_nightlights
$nightlights = Plane.new(@viewport3)
$nightlights.opacity = 0
end
#-------------------------------------------------------------------------------
alias dispose_addition dispose
def dispose
dispose_addition
dispose_nightlights
end
#-------------------------------------------------------------------------------
def dispose_nightlights
$nightlights.dispose
end
#-------------------------------------------------------------------------------
alias update_additions update
def update
update_additions
update_nightlights
end
#-------------------------------------------------------------------------------
def update_fading
if $dayandnight.exterior?
$nightlights.opacity += 1 if $night and $nightlights.opacity <= 255
$nightlights.opacity += 1 if $dusk and $nightlights.opacity <= 150
$nightlights.opacity -= 1 if $dawn and $nightlights.opacity >= 100
$nightlights.opacity -= 1 if $day and $nightlights.opacity >= 0
else
$nightlights.opacity = 255
end
end
#-------------------------------------------------------------------------------
def update_nightlights
if @nightlights_mapname != $game_map.name
@nightlights_mapname = $game_map.name
if $nightlights.bitmap != nil
$nightlights.bitmap.dispose
$nightlights.bitmap = nil
end
if @nightlights_mapname != ""
if File.exist?("Graphics/Nightlights/"+@nightlights_mapname+"."+PIC_FORMAT)
$nightlights.bitmap = Cache.nightlights(@nightlights_mapname)
end
end
Graphics.frame_reset
end
$nightlights.ox = $game_map.calc_nightlights_x($nightlights.bitmap)
$nightlights.oy = $game_map.calc_nightlights_y($nightlights.bitmap)
update_fading
end
end
#===============================================================================
class Scene_File
#===============================================================================
alias write_save_data_dn_adds write_save_data
def write_save_data(file)
write_save_data_dn_adds(file)
Marshal.dump($day, file)
Marshal.dump($dusk, file)
Marshal.dump($dawn, file)
Marshal.dump($night, file)
end
#-------------------------------------------------------------------------------
alias read_save_data_dn_adds read_save_data
def read_save_data(file)
read_save_data_dn_adds(file)
$day = Marshal.load(file)
$dusk = Marshal.load(file)
$dawn = Marshal.load(file)
$night = Marshal.load(file)
end
end
#===============================================================================
# Game-Time-Hotfix
#===============================================================================
#===============================================================================
class Window_SaveFile < Window_Base
#===============================================================================
def load_gamedata
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
begin
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
@game_system = Marshal.load(file)
@game_message = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
case $starting_time
when "night"
@total_sec = @frame_count / Graphics.frame_rate
when "dawn"
@total_sec = (@frame_count-(25200/$divider)) / Graphics.frame_rate
when "day"
@total_sec = (@frame_count-(28800/$divider)) / Graphics.frame_rate
when "dusk"
@total_sec = (@frame_count-(68400/$divider)) / Graphics.frame_rate
end
rescue
@file_exist = false
ensure
file.close
end
end
end
end
und ist mir nochwas aufgefallen. das script läuft wie foglt ab: night -> dusk -> day -> dawn -> night...usw. müsste es aber eig nicht so sein: night -> dawn -> day -> dusk -> night usw?
weil dawn is die morgendämmerung und dusk die abenddämmerung. aber im script ist beides quasi vertauscht...oder irre ich mich da?