Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Script Name: Tag Nacht System
- Autor: Tajiin
- Datum: 04/12/2013 | tt/mm/jjjj
- Version: 1.5
- Versions Datum: 24.05.2015
- Beschreibung:
- Dieses Script färbt den Bildschirm nach einer bestimmten Zeit
- um, um einen Tag Nacht Effekt zu erzielen.
- Der Bildschirm wird wieder normal gefärbt wenn die eingestellte Zeit
- nochmals um ist.
- Das System kann gestoppt und die Wechsel (Tag -> Nacht; Nacht -> Tag)
- durch einen Befehl ausgeführt werden.
- Skript-Befehle:
- $game_system.daynightsystem.set_tone(t)
- - Mit diesem befehl kannst du auf einen bestimmen Farbton wechseln
- - t: ist der Farbton index (0-7)
- Was kann ich im EDIT-Bereich verändern:
- Switch_ID: Hier kannst du die Switch ID verändern mit der du das Script
- stoppen kannst. (True = An; False = Aus)
- Wenn du eine "0" einstellst wird diese Funktion deaktiviert.
- Tag_Nacht_Time: Hier kannst du die Zeit angeben von 0Uhr bis 12Uhr
- (in Minuten)
- Change_Time: Hier kannst du die Zeit einstellen die der Bildschirm brauch um
- sich umzufärben. (in Sekunden)
- Farbton: Hier kannst du die Farbton werte der einzelnen Tageszeiten ändern.
- Time_Variable_ID1: Hier kannst du die Variablen ID verändern in der die
- momentane Zeit ausgegeben wird. (in Frames)
- Wenn du eine "0" einstellst wird diese Funktion
- deaktiviert.
- Time_Variable_ID2: Hier kannst du die Variablen ID verändern in der die
- momentane Zeit ausgegeben wird. (in Stunden)
- Wenn du eine "0" einstellst wird diese Funktion
- deaktiviert.
- Time_Variable_ID3: Hier kannst du die Variablen ID verändern in der die
- momentane Zeit ausgegeben wird. (in Minuten)
- Wenn du eine "0" einstellst wird diese Funktion
- deaktiviert.
- DayCount_Variable: Hier kannst du die Variablen ID verändern in der die
- bereits vergangenen Tage gezählt werden.
- Wenn du eine "0" einstellst wird diese Funktion
- deaktiviert.
- Viel Spaß
- =end
- module TagNachtSystem
- #=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
- # EDIT-Bereich
- #=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
- Switch_ID = 10
- Tag_Nacht_Time = 0.2
- Change_Time = 5
- Farbton = [
- [-128, -128, -64, 128], #Mitternacht Index: 0
- [-34, -34, 0, 68], #Mitternacht > Morgen Index: 1
- [-16, -64, -64, 32], #Morgen Index: 2
- [0, 0, 0, 0], #Morgen > Mittag Index: 3
- [34, 34, 0, 0], #Mittag Index: 4
- [68, -34, -34, 0], #Mittag > Abend Index: 5
- [-68, -68, -68, 0], #Abend Index: 6
- [-68, -68, 0, 68] #Abend > Mitternacht Index: 7
- ]
- Time_Variable_ID1 = 10
- Time_Variable_ID2 = 11
- Time_Variable_ID3 = 12
- Time_Variable_ID4 = 13
- DayCount_Variable = 14
- #=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
- # END
- #=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
- end
- #==============================================================================
- # ** DataManager
- #------------------------------------------------------------------------------
- # This module manages the database and game objects. Almost all of the
- # global variables used by the game are initialized by this module.
- #==============================================================================
- module DataManager
- class << self
- alias taj_datamanager_creategameobjects_uzgv21 create_game_objects
- #--------------------------------------------------------------------------
- # * Create Game Objects
- #--------------------------------------------------------------------------
- def create_game_objects
- taj_datamanager_creategameobjects_uzgv21
- $game_system.daynightsystem = Day_Night.new
- end
- end
- end
- #==============================================================================
- # ** Game_System
- #------------------------------------------------------------------------------
- # This class handles system data. It saves the disable state of saving and
- # menus. Instances of this class are referenced by $game_system.
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :daynightsystem
- end
- #==============================================================================
- # ** Game_Map
- #------------------------------------------------------------------------------
- # This class handles maps. It includes scrolling and passage determination
- # functions. The instance of this class is referenced by $game_map.
- #==============================================================================
- class Game_Map
- alias taj_gamemap_update_jkbdsf9 update
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update(main = false)
- taj_gamemap_update_jkbdsf9(main)
- $game_system.daynightsystem.update if $game_switches[TagNachtSystem::Switch_ID]
- end
- end
- class Day_Night
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- t = Tone.new(TagNachtSystem::Farbton[0][0],TagNachtSystem::Farbton[0][1],TagNachtSystem::Farbton[0][2],TagNachtSystem::Farbton[0][3])
- $game_map.screen.start_tone_change(t, 0)
- t = nil
- @timer_in_value = 0
- @timer_in_hours = 0
- @timer_in_minutes = 0
- @timer_in_hours_temp = 0
- @daycount = 0
- a = TagNachtSystem::Tag_Nacht_Time*3600
- b = TagNachtSystem::Tag_Nacht_Time*3600*0.25
- c = TagNachtSystem::Tag_Nacht_Time*3600*0.5
- @timersettings = [
- 0, (b - a*0.02).round, c.round, (b + c + a*0.02).round,
- a.round, (a + b - a*0.02).round, (a + c).round,
- (a + b + c + a*0.02).round, (a * 2).round
- ]
- p @timersettings
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- testfortime()
- @timer_in_value += 1
- set_variables()
- end
- #--------------------------------------------------------------------------
- # * Sets the Variables
- #--------------------------------------------------------------------------
- def set_variables()
- $game_variables[TagNachtSystem::Time_Variable_ID1] = @timer_in_value if TagNachtSystem::Time_Variable_ID1 != 0
- if TagNachtSystem::Time_Variable_ID2 != 0
- max = (TagNachtSystem::Tag_Nacht_Time*3600*2).to_f
- mom = @timer_in_value.to_f
- x = (max/mom).to_f if mom != 0
- @timer_in_hours_temp = 24/x
- @timer_in_hours = (24/x).to_i if x != 0
- $game_variables[TagNachtSystem::Time_Variable_ID2] = "%02d" % @timer_in_hours
- x = 0
- end
- if TagNachtSystem::Time_Variable_ID3 != 0
- h = @timer_in_hours_temp - @timer_in_hours_temp.to_i
- h2 = (@timer_in_hours_temp+1).to_i - @timer_in_hours_temp.to_i
- x = (60*h/h2).to_i
- @timer_in_minutes = x
- $game_variables[TagNachtSystem::Time_Variable_ID3] = "%02d" % @timer_in_minutes
- x = 0
- end
- $game_variables[TagNachtSystem::Time_Variable_ID4] = get_time() if TagNachtSystem::Time_Variable_ID4 != 0
- end
- #--------------------------------------------------------------------------
- # * Test for Time
- #--------------------------------------------------------------------------
- def testfortime()
- case @timer_in_value
- when @timersettings[0] then set_color(0)
- when @timersettings[1] then set_color(1)
- when @timersettings[2] then set_color(2)
- when @timersettings[3] then set_color(3)
- when @timersettings[4] then set_color(4)
- when @timersettings[5] then set_color(5)
- when @timersettings[6] then set_color(6)
- when @timersettings[7] then set_color(7)
- end
- if @timer_in_value == @timersettings[8] #mitternacht
- set_color(0)
- @timer_in_value = 0
- @daycount += 1
- $game_varibales[TagNachtSystem::DayCount_Variable] = @daycount if TagNachtSystem::DayCount_Variable != 0
- end
- end
- #--------------------------------------------------------------------------
- # * Set Color
- #--------------------------------------------------------------------------
- def set_color(n)
- t = Tone.new(TagNachtSystem::Farbton[n][0],TagNachtSystem::Farbton[n][1],TagNachtSystem::Farbton[n][2],TagNachtSystem::Farbton[n][3])
- $game_map.screen.start_tone_change(t, TagNachtSystem::Change_Time*60)
- end
- #--------------------------------------------------------------------------
- # * Set Tone
- #--------------------------------------------------------------------------
- def set_tone(t)
- case t
- when 0 then @timer_in_value = @timersettings[0]
- when 1 then @timer_in_value = @timersettings[1]
- when 2 then @timer_in_value = @timersettings[2]
- when 3 then @timer_in_value = @timersettings[3]
- when 4 then @timer_in_value = @timersettings[4]
- when 5 then @timer_in_value = @timersettings[5]
- when 6 then @timer_in_value = @timersettings[6]
- when 7 then @timer_in_value = @timersettings[7]
- end
- end
- #--------------------------------------------------------------------------
- # * get Time
- #--------------------------------------------------------------------------
- def get_time()
- @t = false
- @timersettings.each_with_index do |x, i|
- if @timer_in_value >= @timersettings[i]
- @t = true
- else
- return i
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement