Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- ==============================================================================
- ________ __
- /\_____ \ /\ \ __
- \/____//'/' ___ ___ ___\ \ \___ /\_\ ___ __
- //'/' / __`\ /'___\ /'___\ \ _ `\/\ \ /' _ `\ /'__`\
- //'/'___ /\ \L\ \/\ \__//\ \__/\ \ \ \ \ \ \/\ \/\ \/\ \L\.\_
- /\_______\ \____/\ \____\ \____\\ \_\ \_\ \_\ \_\ \_\ \__/.\_\
- \/_______/\/___/ \/____/\/____/ \/_/\/_/\/_/\/_/\/_/\/__/\/_/
- ____ __
- /\ _`\ __ /\ \__
- \ \,\L\_\ ___ _ __ /\_\ _____\ \ ,_\
- \/_\__ \ /'___\/\`'__\/\ \/\ '__`\ \ \/
- /\ \L\ \/\ \__/\ \ \/ \ \ \ \ \L\ \ \ \_
- \ `\____\ \____\\ \_\ \ \_\ \ ,__/\ \__\
- \/_____/\/____/ \/_/ \/_/\ \ \/ \/__/
- \ \_\
- \/_/
- ==============================================================================
- ■ Time & Daily Events by Zocchina
- Versione di RPG Maker : Vx Ace
- Versione 1.2
- Difficoltà : ★
- Questo script permette di implementare un calendario "reale" all'interno
- del proprio progetto, un po' come nei giochi dei pokemon.
- Esso implementa:
- ● Ciclo Giorno/Notte
- ● Salvataggio dei dati relativi alla data corrente nelle variabili di
- gioco
- ● Possibilità di avviare script in determinate date in modo da creare
- i vostri eventi personalizzati senza aver bisogno di un aggiornamento!
- ● Sistema anti-imbroglioni
- ==============================================================================
- ■ Terms of Use
- When using any Zocchina script, you agree with the following terms:
- ● You must give credit to Zocchina;
- ● All Zocchina scripts are licensed under a Creative Commons license;
- ● You can’t give credit to yourself for posting any Zocchina script;
- ==============================================================================
- ■ Come usare lo script
- ● Per installare questo script apri il tuo script editor ed incolla
- questo codice sotto ▼ Materials/素材 ma sopra ▼ Main.
- Ricorda di salvare!
- ● Configura lo script come preferisci seguendo le istruzioni qui
- in basso
- ● Comandi:
- * Per forzare l'esecuzione di uno script dell'evento giornaliero usa
- => ZCN_RT::custom_event
- ==============================================================================
- =end
- module ZCN_RT
- #==============================================================================
- # * Vuoi che i dati relativi al giorno, mese ed anno correnti vengano
- # memorizzati in delle variabili di gioco?
- #
- # ● Se si, inserisci l'id della variabile in cui venga memorizzato il dato
- # ● Se no, scrivi 0
- #==============================================================================
- DAY_VAR = 1
- MONTH_VAR = 2
- YEAR_VAR = 3
- HOUR_VAR = 4
- MIN_VAR = 5
- #==============================================================================
- # * Stesso concetto della configurazione precedente.
- # NB La variabile assumenrà solo i seguenti valori a seconda della stagione.
- #
- # 1 => Inverno, 2 => Primavera, 3 => Estate, 4 => Autunno
- #
- #==============================================================================
- SEASON_VAR = 6
- #==============================================================================
- # * Vuoi attivare il ciclo Giorno/Notte?
- #==============================================================================
- DAY_NIGHT = true
- #==============================================================================
- # * Per disattivare il ciclo Giorno/Notte in relative mappe, scrivi nei commenti
- # del tileset che hai utilizzato per mappare il seguente codice:
- #
- # <Interno>
- #
- #==============================================================================
- #==============================================================================
- # * A seconda dell'orario lo schermo assumerà diverse colorazioni,
- # qui sotto puoi personalizzarle.
- #
- # Tra le parentesi del costruttore devi inserire :
- #
- # Tone.new(ROSSO,VERDE,BLU,GRIGIO)
- #
- # Puoi fare delle prove con gli eventi che mette a disposizione RPG Maker
- #==============================================================================
- DEEP_NIGHT_TONE = Tone.new(-136,-136,0,85)
- PRESUNRISE_TONE = Tone.new(-68,-68,-20,76)
- SUNRISE_TONE = Tone.new(-34,-34,17,0)
- NOONSTART_TONE = Tone.new(0,0,0,0)
- NOONEND_TONE = Tone.new(8,8,0,0)
- PRESUNSET_TONE = Tone.new(15,8,0,0)
- SUNSET_TONE = Tone.new(17,-17,-34,0)
- TWILIGHT_TONE = Tone.new(-17,-68,17,0)
- MIDNIGHT_TONE = Tone.new(-68,-68,0,68)
- #==============================================================================
- # * A che ora inizia una determinata fase del giorno?
- #==============================================================================
- DEEP_NIGHT = 0
- PRESUNRISE_TIME = 4
- SUNRISE_TIME = 7
- NOONSTART_TIME = 10
- NOONEND_TIME = 13
- PRESUNSET_TIME = 15
- SUNSET_TIME = 17
- TWILIGHT_TIME = 19
- NIGHT_TIME = 21
- #==============================================================================
- # * In quanti secondi lo schermo deve cambiare colore quando si passa da una
- # fase all'altra del giorno?
- #==============================================================================
- ZCN_CHANGE_TIME = 1
- #==============================================================================
- # * Vuoi attivare gli eventi personalizzati?
- #==============================================================================
- CUSTOM_EVENTS = true
- #==============================================================================
- # * Configurazione eventi personalizzati
- #==============================================================================
- $events_datas = {
- #==============================================================================
- # L'evento attiverà lo switch scelto nei giorni compresi tra le date dell'evento
- # Per configurare una data segui il seguente schema:
- # Time.local(ANNO,MESE,GIORNO)
- #
- # Se vuoi che l'evento venga ripetuto ogni anno setta true, altrimenti setta
- # false nell'ultima opzione del vettore sottostante.
- #
- # NB : Per gli eventi che si ripetono setta la data di inizio nell'anno 0
- # e la fine nell'anno 0(oppure 1 se l'inizio e la fine non sono nello
- # stesso anno)
- #=============================================================================
- # ID INIZIO EVENTO FINE EVENTO SWITCH RIPETI OGNI ANNO
- #==============================================================================
- 1 => [Time.local(0,12,30), Time.local(1,2,1) , 4 ,true],
- 2 => [Time.local(2012,12,30), Time.local(2013,2,1) , 2 ,false],
- 3 => [Time.local(2012,12,30), Time.local(2013,2,1) , 3 ,true]}
- #==============================================================================
- # Vuoi che il salvatggio venga corrotto nel caso il giocatore inizi ad
- # imbrogliare modificando data e ora?
- #
- # Il sistema funziona quando si carica il gioco in una data antecedente
- # alla data del salvataggio.
- #
- # Durante il debug(quando avvii il gioco da RPG maker) il sistema è disattivato
- # in modo da facilitare i test.
- #==============================================================================
- ANTI_CHEAT = true
- #==============================================================================
- # Che messaggio vuoi che compaia nel msgbox di errore?
- #==============================================================================
- MESSAGE = "Dati danneggiati"
- =begin
- #==============================================================================#
- # If you don't wanna cry, don't edit anything after this point #
- #==============================================================================#
- .ed"""" """$$$$be.
- -" ^""**$$$e.
- ." '$$$c
- / "4$$b
- d 3 $$$$
- $ * .$$$$$$
- .$ ^c $$$$$e$$$$$$$$.
- d$L 4. 4$$$$$$$$$$$$$$b
- $$$$b ^ceeeee. 4$$ECL.F*$$$$$$$
- e$""=. $$$$P d$$$$F $ $$$$$$$$$- $$$$$$
- z$$b. ^c 3$$$F "$$$$b $"$$$$$$$ $$$$*" .=""$c
- 4$$$$L $$P" "$$b .$ $$$$$...e$$ .= e$$$.
- ^*$$$$$c %.. *c .. $$ 3$$$$$$$$$$eF zP d$$$$$
- "**$$$ec " %ce"" $$$ $$$$$$$$$$* .r" =$$$$P""
- "*$b. "c *$e. *** d$$$$$"L$$ .d" e$$***"
- ^*$$c ^$c $$$ 4J$$$$$% $$$ .e*".eeP"
- "$$$$$$"'$=e....$*$$**$cz$$" "..d$*"
- "*$$$ *=%4.$ L L$ P3$$$F $$$P"
- "$ "%*ebJLzb$e$$$$$b $P"
- %.. 4$$$$$$$$$$ "
- $$$e z$$$$$$$$$$%
- "*$c "$$$$$$$P"
- ."""*$$$$$$$$bc
- .-" .$***$$$"""*e.
- .-" .e$" "*$c ^*b.
- .=*"""" .e$*" "*bc "*$e..
- .$" .z*" ^*$e. "*****e.
- $$ee$c .d" "*$. 3.
- ^*$E")$..$" * .ee==d%
- $.d$$$* * J$$$e*
- """"" "$$$"
- #==============================================================================#
- # If you don't wanna cry, don't edit anything after this point #
- #==============================================================================#
- =end
- #--------------------------------------------------------------------------
- # * Ciao scripter che sta leggendo il codice per capire come funziona!
- # Se hai qualche idea su come migliorare lo script scrivimi
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # * Cambia colore dello schermo
- #--------------------------------------------------------------------------
- def self.changetone
- if SceneManager::scene_is?(Scene_Map) then else return end
- if DAY_NIGHT == true then else return end
- #Cambia il tono in base all'intervallo
- case Time.now.hour
- when DEEP_NIGHT..PRESUNRISE_TIME-1
- $game_map.screen.start_tone_change(DEEP_NIGHT_TONE, 60*ZCN_CHANGE_TIME)
- when PRESUNRISE_TIME..SUNRISE_TIME-1
- $game_map.screen.start_tone_change(PRESUNRISE_TONE, 60*ZCN_CHANGE_TIME)
- when SUNRISE_TIME..NOONSTART_TIME-1
- $game_map.screen.start_tone_change(SUNRISE_TONE, 60*ZCN_CHANGE_TIME)
- when NOONSTART_TIME..NOONEND_TIME-1
- $game_map.screen.start_tone_change(NOONSTART_TONE, 60*ZCN_CHANGE_TIME)
- when NOONEND_TIME..PRESUNSET_TIME-1
- $game_map.screen.start_tone_change(NOONEND_TONE, 60*ZCN_CHANGE_TIME)
- when PRESUNSET_TIME..SUNSET_TIME-1
- $game_map.screen.start_tone_change(PRESUNSET_TONE, 60*ZCN_CHANGE_TIME)
- when SUNSET_TIME..TWILIGHT_TIME-1
- $game_map.screen.start_tone_change(SUNSET_TONE, 60*ZCN_CHANGE_TIME)
- when TWILIGHT_TIME..NIGHT_TIME-1
- $game_map.screen.start_tone_change(TWILIGHT_TONE, 60*ZCN_CHANGE_TIME)
- when NIGHT_TIME..24
- $game_map.screen.start_tone_change(MIDNIGHT_TONE, 60*ZCN_CHANGE_TIME)
- end
- end# Chiudo change tone
- #--------------------------------------------------------------------------
- # * Calcola stagione
- #--------------------------------------------------------------------------
- def self.season_calc
- orario = Time.now
- case orario.month
- when 1..2
- $game_variables[SEASON_VAR] = 1
- when 3..5
- if orario.month == 3 && orario.day < 21
- $game_variables[SEASON_VAR] = 1
- else
- $game_variables[SEASON_VAR] = 2
- end
- when 6..8
- if orario.month == 6 && orario.day < 21
- $game_variables[SEASON_VAR] = 2
- else
- $game_variables[SEASON_VAR] = 4
- end
- when 9..12
- if orario.month == 9 && orario.day < 21
- $game_variables[SEASON_VAR] = 4
- else
- $game_variables[SEASON_VAR] = 1
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Calcola game variables
- #--------------------------------------------------------------------------
- def self.ass_game_var
- orario = Time.now
- $game_variables[DAY_VAR] = orario.day
- $game_variables[MONTH_VAR] = orario.month
- $game_variables[YEAR_VAR] = orario.year
- $game_variables[HOUR_VAR] = orario.hour
- $game_variables[MIN_VAR] = orario.min
- end
- #--------------------------------------------------------------------------
- # * Attiva gli eventi personalizzati
- #--------------------------------------------------------------------------
- def self.custom_event
- for c in 1..$events_datas.size
- if($events_datas[c][3]==true)
- repeat(c)
- else if(Time.now>=$events_datas[c][0] && Time.now<= $events_datas[c][1])
- $game_switches[$events_datas[c][2]] = true
- else
- $game_switches[$events_datas[c][2]] = false
- end
- end
- end
- end
- def self.repeat(c)
- if($events_datas[c][0].year==$events_datas[c][1].year) #Se gli anni rilevati sono uguali allora li pone = 0
- $events_datas[c][0] = Time.local(0,$events_datas[c][0].month,$events_datas[c][0].day)
- $events_datas[c][1] = Time.local(0,$events_datas[c][1].month,$events_datas[c][1].day)
- else #Altrimenti il primo = 0 e il secondo = 1
- $events_datas[c][0] = Time.local(0,$events_datas[c][0].month,$events_datas[c][0].day)
- $events_datas[c][1] = Time.local(1,$events_datas[c][1].month,$events_datas[c][1].day)
- end
- for d in 0..1
- now=Time.local(d,Time.now.month,Time.now.day)
- #Controllo se la data odierna (Senza considerare gli anni è compresa nella data dell'evento)
- if (now>=$events_datas[c][0] && now<= $events_datas[c][1])
- $game_switches[$events_datas[c][2]] = true
- return
- else
- $game_switches[$events_datas[c][2]] = false
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Metodo che si attiva quando i dati di gioco sono corrotti
- #--------------------------------------------------------------------------
- def self.anti_cheat
- Audio.se_play("Audio/SE/Buzzer1.ogg", 100, 100)
- msgbox(MESSAGE)
- SceneManager.goto(Scene_Title)
- end
- end #Chiudo il modulo
- #--------------------------------------------------------------------------
- # Modifica delle Scene
- #--------------------------------------------------------------------------
- class Scene_Map < Scene_Base
- alias zcn_update_map update
- def update
- zcn_update_map
- ZCN_RT::season_calc
- unless $game_map.tileset.note =~ /<Interno>/
- ZCN_RT::changetone
- ZCN_RT::ass_game_var
- else
- $game_map.screen.start_tone_change(Tone.new(0,0,0,0),0)
- end
- end
- end
- #--------------------------------------------------------------------------
- # Sistema Anitcheat
- #--------------------------------------------------------------------------
- class Scene_Load < Scene_File
- alias zcn_loadevent on_load_success
- def on_load_success
- zcn_loadevent
- ZCN_RT::custom_event
- if(Time.now<$game_variables[5001])
- if(ZCN_RT::ANTI_CHEAT==true && $TEST == false) then ZCN_RT::anti_cheat end
- end
- end
- end
- module DataManager
- def self.save_game_without_rescue(index)
- $game_variables[5001]=Time.now
- File.open(make_filename(index), "wb") do |file|
- $game_system.on_before_save
- Marshal.dump(make_save_header, file)
- Marshal.dump(make_save_contents, file)
- @last_savefile_index = index
- end
- return true
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement