Jump to content
Rpg²S Forum
  • 0

Aiuto con uno scripts Giorno/Notte


Michael xp
 Share

Question

Girando in internet ho trovato questo scripts. Però, dato che non sono molto ferrato, non riesco a farlo partire..

 

Istruzioni:

1)Inserire questo script sopra main

2)Modificare i seguenti valori:

$mappe_interni (le mappe che non dovranno diventare scure durante la notte)

$special_events (gli eventi come Natale etc)

3)Per far avanzare il tempo, basta scrivere (anche da evento):

$timeControl.add_time "01:02:03"

In questo esempio il tempo avanzerà di un ora, 2 minuti e 3 secondi.

Il massimo è 23:59:59

 

4)Per conoscere l'ora scrivere:

timeControl.what_time?

Ritorno: "10:02:24"

il ritorno sarà una stringa

 

5)Per sapere se ci sono eventi speciali:

$timeControl.special_event?

Ritorno: "Natale"(nome evento)

 

6)Per conoscere altre cose:

$timeControl.sec | Secondi

$timeControl.min | Minuti

$timeControl.ora | Ore

$timeControl.gg | Giorno

$timeControl.mm | Mese

$timeControl.aaaa | Anno

 

Compatibile:

ScriptFiles:

-Standard Scripts RPGMaker Xp 1.01

-Standard Scripts RPGMaker Xp 1.02

-TimeOut 2 Scripts

 

Script:

-BS Laterale

-BS ATB

-Ogni tipo di menù

###################################

=end

 

 

$mappe_interni = [2]

$special_events = [[25,12,0,"Natale"],

[12,9,2006,"Demo TimeOut 2",true], #come primo elemento il giorno, secondo il mese, terzo l'anno che però

[1,1,0,"Nuovo Anno!"], #non verrà considerato se come 5° ci sarà l'elemento "true". come 4° ci sarà il nome

[31,12,0,"Ultimo giorno dell'anno"]] #dell'evento

 

class TimeControl

def today_is?(gga,mma,aaaaa)

return (@giorno == gga and @mese.numero = mma and @anno = aaaaa)

end

 

def what_time?

return sprintf("%02d:%02d:%02d",@ora,@minuto,@secondo)

end

 

def initialize

@initialized = true

@secondo = 0

@minuto = 0

@ora = 0

@giorno = 1

@ggiorno = 1

@nome_gg = "Lunedì"

@mese = Mese.new

@mese.numero = 1

@mese.nome = "Gennaio"

@mese.durata = 32

@mese.bisestile = false

@anno = 2006

@giorn = ["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]

@mesi = ["",

"Gennaio","Febbraio","Marzo",

"Aprile","Maggio","Giugno",

"Luglio", "Agosto","Settembre",

"Ottobre","Novembre","Dicembre"]

@durata =[0,31,28,31,30,31,30,31,31,30,31,30,31]

update

end

 

def special_event?

for i in $special_events

if i[4]

if today_is?(i[0],i[1],i[2])

return i[3]

end

else

if today_is?(i[0],i[1],@anno)

return i[3]

end

end

end

end

 

def add_time(format)

secondo = @secondo

minuto = @minuto

ora = @ora

secondo += format[6,2].to_i

minuto += format[3,2].to_i

ora += format[0,2].to_i

secondo %= 60

minuto %= 60

ora %= 24

until (@ora == ora and @minuto == minuto and secondo == secondo)

update

end

end

#Esportazione

def sec

return @secondo

end

def min

return @minuto

end

def ora

return @ora

end

def gg

return @giorno

end

def nome_gg

return @nome_gg

end

def mm

return @mese

end

def aaaa

return @anno

end

 

def update

@secondo += 1

@secondo %= 60

if @secondo == 0

@minuto += 1

@minuto %= 60

if @minuto == 0

@ora += 1

@ora %= 24

if @ora == 0

@ggiorno += 1

@giorno += 1

@nome_gg = @giorn[@ggiorno%7]

@giorno %= @mese.durata

if @giorno == 0

@giorno = 1

@mese.numero += 1

@mese.nome = @mesi[@mese.numero]

@mese.bisestile = (@anno%4 == 0)

@mese.durata = (@mese.numero == 2 and @mese.bisestile) ? @durata[@mese.numero]+2 : @durata[@mese.numero]+1

@mese.numero %= 12

if @mese.numero == 0

@mese.numero = 1

@mese.nome = @mesi[@mese.numero]

@anno += 1

end

end

end

end

end

return if $game_screen == nil

return if $mappe_interni.include?($game_map.map_id)

duration = (@initialized ? 0 : 200)

@initialized = false

if @ora.between?(0,4)

$game_screen.start_tone_change(Tone.new(-170,-170,-170,0), duration)

elsif @ora.between?(6,8)

$game_screen.start_tone_change(Tone.new(-85,-68,-18,0), duration)

elsif @ora.between?(8,11)

$game_screen.start_tone_change(Tone.new(-68,-34,-18,0), duration)

elsif @ora.between?(11,17)

$game_screen.start_tone_change(Tone.new(0,0,0,0), duration)

elsif @ora.between?(17,18)

$game_screen.start_tone_change(Tone.new(-34,-51,-136,0), duration)

elsif @ora.between?(18,20)

$game_screen.start_tone_change(Tone.new(-85,-68,-18,0), duration)

elsif @ora >= 20

$game_screen.start_tone_change(Tone.new(-170,-170,-170,0), duration)

end

end

end

 

class Mese

attr_accessor :numero

attr_accessor :nome

attr_accessor :durata

attr_accessor :bisestile

def initialize

@numero = 1

@nome = ""

@durata = 30

@bisestile = false

end

end

 

class Scene_Title

alias cngt command_new_game

def command_new_game

$timeControl = TimeControl.new

cngt

end

end

 

class Scene_Save

alias wsdt write_save_data

def write_save_data(file)

wsdt(file)

Marshal.dump($timeControl,file)

end

end

 

class Scene_Load

alias lsdt read_save_data

def read_save_data(file)

lsdt(file)

$timeControl = Marshal.load(file)

end

end

 

class Window_Time < Window_Base

def initialize

super(340,0,300,128)

self.contents = Bitmap.new(300-32,128-32)

refresh

end

def refresh

self.contents.clear

self.contents.font.color = normal_color

str = sprintf("%02d:%02d:%02d",$timeControl.ora.to_s,$timeControl.min.to_s ,$timeControl.sec.to_s)

self.contents.draw_text(0,0,100,32,str)

self.contents.draw_text(0,32,100,32,$timeControl.nome_gg)

self.contents.draw_text(0,64,200,32,$timeControl.gg.to_s + "° "+$timeControl.mm.nome + " "+$timeControl.aaaa.to_s)

self.opacity = 160

end

end

 

class Scene_Map

def main

# Make sprite set

@time = Window_Time.new

@spriteset = Spriteset_Map.new

# Make message window

@message_window = Window_Message.new

@wait = 50

# Transition run

Graphics.transition

# Main loop

loop do

# Update game screen

Graphics.update

# Update input information

Input.update

# Frame update

update

# Abort loop if screen is changed

if $scene != self

break

end

end

# Prepare for transition

Graphics.freeze

# Dispose of sprite set

@spriteset.dispose

@time.dispose

# Dispose of message window

@message_window.dispose

# If switching to title screen

if $scene.is_a?(Scene_Title)

# Fade out screen

Graphics.transition

Graphics.freeze

end

end

alias aggiorna update

def update

@wait -= 1

if @wait == 0

@wait = 50

$timeControl.update

end

@time.refresh

@time.update

aggiorna

end

end

 

 

Grazie in anticipo. Se non dovesse funzionare mi sapreste consigliare un buon scripts per il ciclo giorno notte??

Grazie ancora

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
1)Inserire questo script sopra main
devi entrare nello sript editor, e sopra l'ultima classe (appunto "main" crearne una nuova e iinserire questo script

 

 

Queste sono le istruzioni per configurarlo e quindi permettere agli eventi di chiamare lo script:

 

$timeControl.sec 
$timeControl.min
$timeControl.ora
$timeControl.gg
$timeControl.mm
$timeControl.aaaa

questi comandi, ti informano dei secondi, minuti, ora, giorno, mese e anno correnti (nell'istante in cui sono chiamati)

 

Credo di aver scritto correttamente (io non sono scripter^^) ma senza demo e istruzioni, non è facile capire tutto il funzionamento.

Se ritorni sul sito da cui l'hai scaricato, probabilmente potrai scaricare una DEMO che ti illustra le potenzialità e il funzionamento^^.

Anzi, se non è un problema, metteresti un bel link al sito?

Grazie

Edited by Losco individuo

http://i428.photobucket.com/albums/qq5/losco_individuo/2cmly83.png

 

http://i428.photobucket.com/albums/qq5/losco_individuo/BannerNGMI-1.png

Membro Alfa della: "Nuova Generazione del Making Italiano"

"Richiedi anche tu il bannerino della NGdMI e contribuisci alla sopravvivenza della specie...avrai un numero tuo di identificazione e un posto nella storia del making!"

Il making con il cuore

http://i62.servimg.com/u/f62/13/12/87/37/nuovob11.png

Nuovo LegendRpgMania

Link to comment
Share on other sites

  • 0

si, li devi chiamare con il comando call script.

 

se con autostart, common event o action key, sta' a te, dipende cosa devi farne...per esempio

 

se metti sul muro, un orologio, e vuoi che cliccandoci sopra, si visualizza l'ora, allora sarà action key, altrimenti se vuoi che ogni ora, tu possa vedere che ore sono, allora sarà un common event e così via.

http://i428.photobucket.com/albums/qq5/losco_individuo/2cmly83.png

 

http://i428.photobucket.com/albums/qq5/losco_individuo/BannerNGMI-1.png

Membro Alfa della: "Nuova Generazione del Making Italiano"

"Richiedi anche tu il bannerino della NGdMI e contribuisci alla sopravvivenza della specie...avrai un numero tuo di identificazione e un posto nella storia del making!"

Il making con il cuore

http://i62.servimg.com/u/f62/13/12/87/37/nuovob11.png

Nuovo LegendRpgMania

Link to comment
Share on other sites

  • 0

scusami il doppio post: io l'ho provato, ma parte di notte, e si vede quasi completamente nero...qualche scriptrer, lo può modificare? perchè è davvero deprimente....poi si vede sgranatissimo

 

edit: per mio allenamento personale, l'ho modificato io stesso, inserendo io i colori più realistici, attendi un po' e ti inserirò lo script modificato da me

Edited by Losco individuo

http://i428.photobucket.com/albums/qq5/losco_individuo/2cmly83.png

 

http://i428.photobucket.com/albums/qq5/losco_individuo/BannerNGMI-1.png

Membro Alfa della: "Nuova Generazione del Making Italiano"

"Richiedi anche tu il bannerino della NGdMI e contribuisci alla sopravvivenza della specie...avrai un numero tuo di identificazione e un posto nella storia del making!"

Il making con il cuore

http://i62.servimg.com/u/f62/13/12/87/37/nuovob11.png

Nuovo LegendRpgMania

Link to comment
Share on other sites

  • 0

eccolo qui, provalo se ti piace, ho solo modificato i colori del giorno/notte, non so se vanno bene tutti, perchè l'ho testato male e in fretta.

Poi conta che è la prima volta che modifico uno script.

 

Provalo e dimmi se ti piace^^

 

=begin
###################################
Script: Gestione Tempo
Autore: Intersimone999
Creato per: Ghost-Dog
Data inizio: 30/07/2006
Data fine: 30/07/2006

Istruzioni:
1)Inserire questo script sopra main
2)Modificare i seguenti valori:
$mappe_interni (le mappe che non dovranno diventare scure durante la notte)
$special_events (gli eventi come Natale etc)
3)Per far avanzare il tempo, basta scrivere (anche da evento):
$timeControl.add_time "01:02:03"
In questo esempio il tempo avanzerà di un ora, 2 minuti e 3 secondi.
Il massimo è 23:59:59

4)Per conoscere l'ora scrivere:
timeControl.what_time?
Ritorno: "10:02:24"
il ritorno sarà una stringa

5)Per sapere se ci sono eventi speciali:
$timeControl.special_event?
Ritorno: "Natale"(nome evento)

6)Per conoscere altre cose:
$timeControl.sec | Secondi
$timeControl.min | Minuti
$timeControl.ora | Ore
$timeControl.gg  | Giorno
$timeControl.mm | Mese
$timeControl.aaaa | Anno

Compatibile:
ScriptFiles:
-Standard Scripts  RPGMaker Xp 1.01
-Standard Scripts RPGMaker Xp 1.02
-TimeOut 2 Scripts

Script:
-BS Laterale
-BS ATB
-Ogni tipo di menù
###################################
=end


$mappe_interni = [2]
$special_events = [[25,12,0,"Natale"],
#come primo elemento il giorno, secondo il mese, terzo l'anno che però
[1,1,0,"Nuovo Anno!"], #non verrà considerato se come 5° ci sarà l'elemento "true". come 4° ci sarà il nome
[31,12,0,"Ultimo giorno dell'anno"]] #dell'evento

class TimeControl
  def today_is?(gga,mma,aaaaa)
 return (@giorno == gga and @mese.numero = mma and @anno = aaaaa)
  end
 
  def what_time?
 return sprintf("%02d:%02d:%02d",@ora,@minuto,@secondo)
  end
 
  def initialize
 @initialized = true
 @secondo = 0
 @minuto = 0
 @ora = 0
 @giorno = 1
 @ggiorno = 1
 @nome_gg = "Lunedì"
 @mese = Mese.new
 @mese.numero = 1
 @mese.nome = "Gennaio"
 @mese.durata = 31
 @mese.bisestile = false
 @anno = 1490
 @giorn = ["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]
 @mesi = ["",
 "Gennaio","Febbraio","Marzo",
 "Aprile","Maggio","Giugno",
 "Luglio", "Agosto","Settembre",
 "Ottobre","Novembre","Dicembre"]
 @durata =[0,31,28,31,30,31,30,31,31,30,31,30,31]
 update
  end
 
  def special_event?
 for i in $special_events
   if i[4]
	 if today_is?(i[0],i[1],i[2])
	   return i[3]
	 end
   else
	 if today_is?(i[0],i[1],@anno)
	   return i[3]
	 end
   end
 end
  end
 
  def add_time(format)
 secondo = @secondo
 minuto = @minuto
 ora = @ora
 secondo += format[6,2].to_i
 minuto += format[3,2].to_i
 ora += format[0,2].to_i
 secondo %= 60
 minuto  %= 60
 ora %= 24
 until (@ora == ora and @minuto == minuto and secondo == secondo)
   update
 end
  end
  #Esportazione
  def sec
 return @secondo
  end
  def min
 return @minuto
  end
  def ora
 return @ora
  end
  def gg
 return @giorno
  end
  def nome_gg
 return @nome_gg
  end
  def mm
 return @mese
  end
  def aaaa
 return @anno
  end
 
  def update
 @secondo += 1
 @secondo %= 60
 if @secondo == 0
   @minuto += 1
   @minuto %= 60
   if @minuto == 0
	 @ora += 1
	 @ora %= 24
	 if @ora == 0
	   @ggiorno += 1
	   @giorno += 1
	   @nome_gg = @giorn[@ggiorno%7]
	   @giorno %= @mese.durata
	   if @giorno == 0
		 @giorno = 1
		 @mese.numero += 1
		 @mese.nome = @mesi[@mese.numero]
		 @mese.bisestile = (@anno%4 == 0)
		 @mese.durata = (@mese.numero == 2 and @mese.bisestile) ? @durata[@mese.numero]+2 : @durata[@mese.numero]+1
		 @mese.numero %= 12
		 if @mese.numero == 0
		   @mese.numero = 1
		   @mese.nome = @mesi[@mese.numero]
		   @anno += 1
		 end
	   end
	 end
   end
 end
 return if $game_screen == nil
 return if $mappe_interni.include?($game_map.map_id)
 duration = (@initialized ? 0 : 200)
 @initialized = false
 if @ora.between?(0,4)
   $game_screen.start_tone_change(Tone.new(-100,-100,0,-80), duration)
 elsif @ora.between?(6,8)
   $game_screen.start_tone_change(Tone.new(0,-51,-75,0), duration)
 elsif @ora.between?(8,11)
   $game_screen.start_tone_change(Tone.new(0,-34,-93,0), duration)
 elsif @ora.between?(11,17)
   $game_screen.start_tone_change(Tone.new(0,0,0,0), duration)
 elsif @ora.between?(17,18)
   $game_screen.start_tone_change(Tone.new(0,0,0,0), duration)
 elsif @ora.between?(18,20)
   $game_screen.start_tone_change(Tone.new(0,-34,-93,0), duration)
 elsif @ora.betwee?(20,0)
   $game_screen.start_tone_change(Tone.new(-100,-100,0,-80), duration)
 end
  end
end

class Mese
  attr_accessor  :numero
  attr_accessor  :nome
  attr_accessor  :durata
  attr_accessor  :bisestile
  def initialize
 @numero = 1
 @nome = ""
 @durata = 32
 @bisestile = false
  end
end

class Scene_Title
  alias cngt command_new_game
  def command_new_game
 $timeControl = TimeControl.new
 cngt
  end
end

class Scene_Save
  alias wsdt write_save_data
  def write_save_data(file)
 wsdt(file)
 Marshal.dump($timeControl,file)
  end
end

class Scene_Load
  alias lsdt read_save_data
  def read_save_data(file)
 lsdt(file)
 $timeControl = Marshal.load(file)
  end
end

class Window_Time < Window_Base
  def initialize
 super(340,0,300,128)
 self.contents = Bitmap.new(300-32,128-32)
 refresh
  end
  def refresh
 self.contents.clear
 self.contents.font.color = normal_color
 str = sprintf("%02d:%02d:%02d",$timeControl.ora.to_s,$timeControl.min.to_s ,$timeControl.sec.to_s)
 self.contents.draw_text(0,0,100,32,str)
 self.contents.draw_text(0,32,100,32,$timeControl.nome_gg)
 self.contents.draw_text(0,64,200,32,$timeControl.gg.to_s + "° "+$timeControl.mm.nome + " "+$timeControl.aaaa.to_s)
 self.opacity = 160
  end
end

class Scene_Map
  def main
 # Make sprite set
 @time = Window_Time.new
 @spriteset = Spriteset_Map.new
 # Make message window
 @message_window = Window_Message.new
 @wait = 50
 # Transition run
 Graphics.transition
 # Main loop
 loop do
   # Update game screen
   Graphics.update
   # Update input information
   Input.update
   # Frame update
   update
   # Abort loop if screen is changed
   if $scene != self
	 break
   end
 end
 # Prepare for transition
 Graphics.freeze
 # Dispose of sprite set
 @spriteset.dispose
 @time.dispose
 # Dispose of message window
 @message_window.dispose
 # If switching to title screen
 if $scene.is_a?(Scene_Title)
   # Fade out screen
   Graphics.transition
   Graphics.freeze
 end
  end
  alias aggiorna update
  def update
 @wait -= 1
 if @wait == 0
   @wait = 50
   $timeControl.update
 end
 @time.refresh
 @time.update
 aggiorna
  end
end

http://i428.photobucket.com/albums/qq5/losco_individuo/2cmly83.png

 

http://i428.photobucket.com/albums/qq5/losco_individuo/BannerNGMI-1.png

Membro Alfa della: "Nuova Generazione del Making Italiano"

"Richiedi anche tu il bannerino della NGdMI e contribuisci alla sopravvivenza della specie...avrai un numero tuo di identificazione e un posto nella storia del making!"

Il making con il cuore

http://i62.servimg.com/u/f62/13/12/87/37/nuovob11.png

Nuovo LegendRpgMania

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...