Jump to content
Rpg²S Forum

-OPZIONI


amivaleo
 Share

Recommended Posts

OPZIONI

 

 

Descrizione

 

Con questo script potrete visualizzare un menu Opzioni in cui è possibile modificare:

- Volume Suoni (SE)

- Volume Musica (BGM e ME)

- Velocità ATB (da 1 a 5)

- Modalità ATB (Attesa/Azione)

- Windowskin

Premendo "Predefinito", tutte le modifiche apportate verranno annullate e tutti i parametri ritorneranno ai valori stabiliti nel Main.

 

 

Autore

 

Ziel van Brand

 

 

Allegati

 

Screen dello script completo:

http://img292.imageshack.us/img292/4311/screenbd0.png

 

Screen dello script senza le opzioni sull'ATB:

http://img89.imageshack.us/img89/4536/screen2yx0.png

 

 

 

Istruzioni per l'uso

 

Copiate lo script riportato di seguito in una nuova classe sopra il
Main
e chiamatelo "OPZIONI".

 

 

#==============================================================================
# ■ Window_Base
#==============================================================================

class Window_Base
 #--------------------------------------------------------------------------
 def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color )
self.contents.fill_rect(x, y, width, height, Color.new(0,0,0,255))
now = now > max ? max : now
percentage = max != 0 ? (width) * now / max.to_f : 0
if start_color == end_color
  self.contents.fill_rect(x, y, percentage, height, start_color)
else
  for i in 0..percentage-1
	r = start_color.red + (end_color.red - start_color.red) / percentage * i
	g = start_color.green + (end_color.green - start_color.green) / percentage * i
	b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
	a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
	self.contents.fill_rect(x+i, y, 1, height, Color.new(r, g, b, a))
  end
end
 end
 #--------------------------------------------------------------------------
end


#==============================================================================
# ■ Window_Option
#==============================================================================

class Window_Option < Window_Selectable
 #--------------------------------------------------------------------------
 def initialize
super(6*32, 128, 13*32+16, 4*24+32)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
if $game_system.atb_attesa == true then self.index = 0 end
if $game_system.atb_attesa == false then self.index = 1 end
self.active = false
@commands = ["Attesa", "Azione"]
@description = ["L'ATB aspetta la mossa del giocatore",
							"L'ATB aumenta durante la selezione della mossa"]
@item_max = 2
@column_max = 2
refresh
 end
 #--------------------------------------------------------------------------
 def refresh
self.contents.clear

self.contents.fill_rect(20, 0+10, 200, 6, Color.new(0, 0, 0, 255))
self.contents.fill_rect(20, 24+10, 200, 6, Color.new(0, 0, 0, 255))
self.contents.fill_rect(20, 48+10, 200, 6, Color.new(0, 0, 0, 255))

draw_meter($game_system.se_volume, 100, 21, 1+10, 198, 4, Color.new(255, 255, 255, 255))
draw_meter($game_system.me_volume, 100, 21, 25+10, 198, 4, Color.new(255, 255, 255, 255))
draw_meter($game_system.atb-1, 4, 21, 49+10, 198, 4, Color.new(255, 255, 255, 255))	

self.contents.font.color = normal_color
self.contents.draw_text(0, 0, width-32, 24, "0")
self.contents.draw_text(224, 0, 32, 24, "100")
self.contents.draw_text(0, 0, width-32-2, 24, $game_system.se_volume.to_s + "/ 100", 2)

self.contents.draw_text(0, 24, width-32, 24, "0")
self.contents.draw_text(224, 24, 32, 24, "100")
self.contents.draw_text(0, 24, width-32-2, 24, $game_system.me_volume.to_s + "/ 100", 2)

self.contents.draw_text(0, 48, width-32, 24, "1")
self.contents.draw_text(224, 48, 32, 24, "5")
self.contents.draw_text(0, 48, width-32-2, 24, $game_system.atb.to_s + "/ 5", 2)

for i in 0..@item_max-1
  x = i % @column_max * (width-32)/2
  y = i / @column_max * 24 + 72
  self.contents.font.color = normal_color
  self.contents.draw_text(x, y, (width-32)/2, 24, @commands[i], 1)
end
 end
 #--------------------------------------------------------------------------
 def update_cursor_rect
x = index % @column_max * (width-32)/2
y = index / @column_max * 24 + 72
self.cursor_rect.set(x, y, (width-32)/2, 24)
 end
 #--------------------------------------------------------------------------
 def update_help
@help_window.set_text(@description[index], 1)
 end
 #--------------------------------------------------------------------------
end


#==============================================================================
# ■ Window_OptionCommand
#==============================================================================

class Window_OptionCommand < Window_Selectable
 #--------------------------------------------------------------------------
 def initialize
super(16, 160, 5*32, 6*24+32)
@commands = ["Suoni", "Musica", "Velocità ATB", "ATB", "Finestre", "Predefinito"]
@description = ["Modifica il volume dei suoni",
							"Modifica il volume della musica",
							"Modifica la velocità di caricamento della barra ATB",
							"Seleziona la modalità di battaglia ATB",
							"Cambia la grafica corrente delle finestre",
							"Applica le impostazioni predefinite"]
@item_max = 6
@column_max = 1
self.contents = Bitmap.new(width - 32, height-32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0..(@item_max-1)
  draw_item(i, normal_color)
end
self.z = 200
self.index = 0
 end
 #--------------------------------------------------------------------------
 def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(0, 24*index, width-32, 24)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
 end
 #--------------------------------------------------------------------------
 def update_help
@help_window.set_text(@description[index], 1)
 end
 #--------------------------------------------------------------------------
 def update_cursor_rect
self.cursor_rect.set(0, 24*index, width-32, 24)
 end
 #--------------------------------------------------------------------------
end


#==============================================================================
# ■ Window_Windowskin
#==============================================================================

class Window_Windowskin < Window_Selectable
 #--------------------------------------------------------------------------
 def initialize
super(6*32, 128+4*24+32, 13*32+16, 32+64)
self.contents = Bitmap.new(width - 32, height - 32)
self.index = -1
self.active = false
@column_max = @item_max = 3#ZVB# Inserisci il numero di windowskin presenti nell'omonima cartella
refresh
 end
 #--------------------------------------------------------------------------
 def refresh
self.contents.clear
for i in 0..@item_max-1
  x = i % @column_max * (width-32)/@column_max
  y = i / @column_max * 64
  bitmap = RPG::Cache.windowskin("Windowskin#{i + 1}")
  self.contents.blt(x, y, bitmap, Rect.new(64, 0, 128, 64), 255)
end
 end
 #--------------------------------------------------------------------------
 def update_cursor_rect
x = index % @column_max * (width-32)/@column_max
y = index / @column_max * 64
if @index < 0
  self.cursor_rect.empty
else
  self.cursor_rect.set(x, y, 128, 64)
end
 end
 #--------------------------------------------------------------------------
end


#==============================================================================
# ■ Scene_Option
#==============================================================================

class Scene_Option
 #--------------------------------------------------------------------------
 def initialize(index=0)
@index = index
 end
 #--------------------------------------------------------------------------
 def main
@command_window = Window_OptionCommand.new
@help_window = Window_Help.new
@command_window.help_window = @help_window
@option_window = Window_Option.new
@windowskin_window = Window_Windowskin.new
@se_regulation = false
@me_regulation = false
@atb_regulation = false
Graphics.transition
loop do
  Graphics.update
  Input.update
  update
  if $scene != self
	break
  end
end
Graphics.freeze
@help_window.dispose
@command_window.dispose
@option_window.dispose
@windowskin_window.dispose
 end
 #--------------------------------------------------------------------------
 def update
@help_window.update
@command_window.update
@option_window.update
@windowskin_window.update
if @command_window.active
  @command_window.help_window = @help_window
  update_command
  return
end
if @option_window.active
  @option_window.help_window = @help_window
  update_atb
  return
end
if @windowskin_window.active
  @help_window.set_text("Seleziona la grafica delle finestre")
  update_windowskin
  return
end
if @se_regulation == true
  update_se_regulation
end
if @me_regulation == true
  update_me_regulation
end
if @atb_regulation == true
  update_atb_regulation
end
 end
 #--------------------------------------------------------------------------
 def update_command
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  $scene = Scene_Menu.new(4)
  return
end
if Input.trigger?(Input::C)
  case @command_window.index
  when 0
	$game_system.se_play($data_system.decision_se)
	@command_window.active = false
	@se_regulation = true
  when 1
	$game_system.se_play($data_system.decision_se)
	@command_window.active = false
	@me_regulation = true
  when 2
	$game_system.se_play($data_system.decision_se)
	@command_window.active = false
	@atb_regulation = true
  when 3
	$game_system.se_play($data_system.decision_se)
	@command_window.active = false
	@option_window.active = true
  when 4
	$game_system.se_play($data_system.decision_se)
	@command_window.active = false
	@windowskin_window.index = 0
	@windowskin_window.active = true
  when 5
	$game_system.se_play($data_system.decision_se)
	$game_system.se_volume = 100#ZVB#cambia il valore 100 per settare il volume di default per i SE
	$game_system.me_volume = 80#ZVB#cambia il valore 80 per settare il volume di default per i ME,BGM,BGS
	$game_system.atb = 3#ZVB#imposta la velocità di caricamento dell'ATB. valori possibili da 1 a 5
	$game_system.atb_attesa = true#ZVB#"true" = attesa, "false" = azione. setta il comportamento dell'ATB
	$game_system.windowskin_name = $data_system.windowskin_name = "Windowskin1"#ZVB#la windowskin1 è la windowskin di default
	@option_window.index = 0
	@option_window.refresh
  end
  return
end
 end
 #--------------------------------------------------------------------------
 def update_se_regulation
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @se_regulation = false
  @command_window.active = true
  return
end
if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  @se_regulation = false
  @command_window.active = true
  return
end
if Input.repeat?(Input::RIGHT) and $game_system.se_volume < 100
  $game_system.se_play($data_system.cursor_se)
  $game_system.se_volume += 1
  @option_window.refresh
end
if Input.repeat?(Input::LEFT) and $game_system.se_volume > 0
  $game_system.se_play($data_system.cursor_se)
  $game_system.se_volume -= 1
  @option_window.refresh
end
 end
 #--------------------------------------------------------------------------
 def update_me_regulation
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @me_regulation = false
  @command_window.active = true
  return
end
if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  @me_regulation = false
  @command_window.active = true
  return
end
if Input.repeat?(Input::RIGHT) and $game_system.me_volume < 100
  $game_system.me_volume += 1
  @option_window.refresh
end
if Input.repeat?(Input::LEFT) and $game_system.me_volume > 0
  $game_system.me_volume -= 1
  @option_window.refresh
end
 end
  #--------------------------------------------------------------------------
 def update_atb_regulation
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @atb_regulation = false
  @command_window.active = true
  return
end
if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  @atb_regulation = false
  @command_window.active = true
  return
end
if Input.repeat?(Input::RIGHT) and $game_system.atb < 5
  $game_system.se_play($data_system.cursor_se)
   $game_system.atb += 1
  @option_window.refresh
end
if Input.repeat?(Input::LEFT) and $game_system.atb > 1
  $game_system.se_play($data_system.cursor_se)
  $game_system.atb -= 1
  @option_window.refresh
end	
 end
 #--------------------------------------------------------------------------
 def update_atb
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @option_window.active = false
  @command_window.active = true
  return
end
if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  if @option_window.index == 0
	$game_system.atb_attesa = true
  elsif @option_window.index == 1
	$game_system.atb_attesa = false
  end
  @option_window.active = false
  @command_window.active = true
  return
end
 end
 #--------------------------------------------------------------------------
 def update_windowskin
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @windowskin_window.active = false
  @command_window.active = true
  @windowskin_window.index = -1
  return
end
if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  $data_system.windowskin_name = $game_system.windowskin_name = "Windowskin#{@windowskin_window.index + 1}"
  return
end
 end
 #--------------------------------------------------------------------------
end

 

 

Ora andate in
Game_System
e sostituitene il contenuto con questo:

 

 

#==============================================================================
# ■ Game_System
#==============================================================================

class Game_System
 #--------------------------------------------------------------------------
 attr_reader   :map_interpreter
 attr_reader   :battle_interpreter
 attr_accessor :timer
 attr_accessor :timer_working
 attr_accessor :save_disabled
 attr_accessor :menu_disabled
 attr_accessor :encounter_disabled
 attr_accessor :message_position
 attr_accessor :message_frame
 attr_accessor :save_count
 attr_accessor :magic_number
 attr_accessor :se_volume#ZVB#
 attr_accessor :me_volume#ZVB#
 attr_accessor :atb#ZVB#
 attr_accessor :atb_attesa#ZVB#
 #--------------------------------------------------------------------------
 def initialize
@map_interpreter = Interpreter.new(0, true)
@battle_interpreter = Interpreter.new(0, false)
@timer = 0
@timer_working = false
@save_disabled = false
@menu_disabled = false
@encounter_disabled = false
@message_position = 2
@message_frame = 0
@save_count = 0
@magic_number = 0
@se_volume = 100#ZVB#questo valore deve essere uguale a quello che trovi nello script OPZIONI
								   #alla riga 274
@me_volume = 80#ZVB#questo valore deve essere uguale a quello che trovi nello script OPZIONI
							   #alla riga 275
@atb = 3#ZVB#questo valore deve essere uguale a quello che trovi nello script OPZIONI
				#alla riga 276
@atb_attesa = true#ZVB#questo valore deve essere uguale a quello che trovi nello script OPZIONI
								  #alla riga 277. valori possibili "true"/"false"
 end
 #--------------------------------------------------------------------------
 def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil and bgm.name != ""
  Audio.bgm_play("Audio/BGM/" + bgm.name, @me_volume, bgm.pitch)#ZVB#
else
  Audio.bgm_stop
end
Graphics.frame_reset
 end
 #--------------------------------------------------------------------------
 def bgm_stop
Audio.bgm_stop
 end
 #--------------------------------------------------------------------------
 def bgm_fade(time)
@playing_bgm = nil
Audio.bgm_fade(time * 1000)
 end
 #--------------------------------------------------------------------------
 def bgm_memorize
@memorized_bgm = @playing_bgm
 end
 #--------------------------------------------------------------------------
 def bgm_restore
bgm_play(@memorized_bgm)
 end
 #--------------------------------------------------------------------------
 def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil and bgs.name != ""
  Audio.bgs_play("Audio/BGS/" + bgs.name, @me_volume, bgs.pitch)#ZVB#
else
  Audio.bgs_stop
end
Graphics.frame_reset
 end
 #--------------------------------------------------------------------------
 def bgs_fade(time)
@playing_bgs = nil
Audio.bgs_fade(time * 1000)
 end
 #--------------------------------------------------------------------------
 def bgs_memorize
@memorized_bgs = @playing_bgs
 end
 #--------------------------------------------------------------------------
 def bgs_restore
bgs_play(@memorized_bgs)
 end
 #--------------------------------------------------------------------------
 def me_play(me)
if me != nil and me.name != ""
  Audio.me_play("Audio/ME/" + me.name, @me_volume, me.pitch)#ZVB#
else
  Audio.me_stop
end
Graphics.frame_reset
 end
 #--------------------------------------------------------------------------
 def se_play(se)
if se != nil and se.name != ""
  Audio.se_play("Audio/SE/" + se.name, @se_volume, se.pitch)#ZVB#
end
 end
 #--------------------------------------------------------------------------
 def se_stop
Audio.se_stop
 end
 #--------------------------------------------------------------------------
 def playing_bgm
return @playing_bgm
 end
 #--------------------------------------------------------------------------
 def playing_bgs
return @playing_bgs
 end
 #--------------------------------------------------------------------------
 def windowskin_name
if @windowskin_name == nil
  return $data_system.windowskin_name
else
  return @windowskin_name
end
 end
 #--------------------------------------------------------------------------
 def windowskin_name=(windowskin_name)
@windowskin_name = windowskin_name
 end
 #--------------------------------------------------------------------------
 def battle_bgm
if @battle_bgm == nil
  return $data_system.battle_bgm
else
  return @battle_bgm
end
 end
 #--------------------------------------------------------------------------
 def battle_bgm=(battle_bgm)
@battle_bgm = battle_bgm
 end
 #--------------------------------------------------------------------------
 def battle_end_me
if @battle_end_me == nil
  return $data_system.battle_end_me
else
  return @battle_end_me
end
 end
 #--------------------------------------------------------------------------
 def battle_end_me=(battle_end_me)
@battle_end_me = battle_end_me
 end
 #--------------------------------------------------------------------------
 def update
if @timer_working and @timer > 0
  @timer -= 1
end
 end
 #--------------------------------------------------------------------------
end

 

 

Se avete già apportato delle modifiche a questa classe, è sufficiente che incolliate o sostituite in essa solo le stringhe seguite da "#ZVB#".

 

Per farlo funzionare, inserite un "call script" in un evento e dentro scriveteci:

 

$scene = Scene_Option.new

 

Per impostare i valori di default o modificare alcune impostazioni, cercate la stringa
#ZVB#
. Tutte le spiegazioni di cui avete bisogno le troverete accanto a questa stringa.

 

Per le Windowskin:

Le windowskin che inserite nell'omonima cartella devono chiamarsi "Windowskin#", dove # è un numero progressivo a partire da 1.

Ad esempio, se nella vostra cartella ci sono 4 windowskin, queste si dovranno chiamare: "Windowskin1", "Windowskin2", "Windowskin3", "Windowskin4".

La windoskin di default si chiama Windowskin1 (per cui, rinominate la windowskin che usate di default "Windowskin1" e ricordatevi di sostituire questo nome anche nel

 

database).

Le windowskin che hanno un nome diverso da "Windowskin#" non verranno rilevate.

Per impostare il numero di Windowskin selezionabili, cercate la stringa
#ZVB#
.

Se il numero di windowskin selezionabili che impostate è più alto di quelle effettivamente presenti nella cartella windowskin, il programma restituirà un errore.

Se saltate un numero durante il salvataggio delle windowskin nell'omonima cartella (ad esempio: "Windowskin1", "Windowskin2", "Windowskin4"), il programma restituirà un errore.

 

Per l'ATB

Se usate un BS con barra di caricamento stile ATB, sappiate che
$game_system.atb
e
$game_system.atb_attesa
sono le variabili che regolano rispettivamente la
velocità
e la
modalità
di caricamento.

Se avete problemi nell'utilizzare queste due caratteristiche, lasciate un messaggio in cui postate lo script del BS che usate, cercherò di aiutarvi.

Se non siete interessati ad avere queste due opzioni, incollate questo script "OPZIONI" sopra il
Main
:

 

 

#==============================================================================
# ■ Window_Base
#==============================================================================

class Window_Base
 #--------------------------------------------------------------------------
 def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color )
self.contents.fill_rect(x, y, width, height, Color.new(0,0,0,255))
now = now > max ? max : now
percentage = max != 0 ? (width) * now / max.to_f : 0
if start_color == end_color
  self.contents.fill_rect(x, y, percentage, height, start_color)
else
  for i in 0..percentage-1
	r = start_color.red + (end_color.red - start_color.red) / percentage * i
	g = start_color.green + (end_color.green - start_color.green) / percentage * i
	b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
	a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
	self.contents.fill_rect(x+i, y, 1, height, Color.new(r, g, b, a))
  end
end
 end
 #--------------------------------------------------------------------------
end


#==============================================================================
# ■ Window_Option
#==============================================================================

class Window_Option < Window_Base
 #--------------------------------------------------------------------------
 def initialize
super(6*32, 128, 13*32+16, 2*24+32)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
 end
 #--------------------------------------------------------------------------
 def refresh
self.contents.clear

self.contents.fill_rect(20, 0+10, 200, 6, Color.new(0, 0, 0, 255))
self.contents.fill_rect(20, 24+10, 200, 6, Color.new(0, 0, 0, 255))

draw_meter($game_system.se_volume, 100, 21, 1+10, 198, 4, Color.new(255, 255, 255, 255))
draw_meter($game_system.me_volume, 100, 21, 25+10, 198, 4, Color.new(255, 255, 255, 255))

self.contents.font.color = normal_color
self.contents.draw_text(0, 0, width-32, 24, "0")
self.contents.draw_text(224, 0, 32, 24, "100")
self.contents.draw_text(0, 0, width-32-2, 24, $game_system.se_volume.to_s + "/ 100", 2)

self.contents.draw_text(0, 24, width-32, 24, "0")
self.contents.draw_text(224, 24, 32, 24, "100")
self.contents.draw_text(0, 24, width-32-2, 24, $game_system.me_volume.to_s + "/ 100", 2)
 end
 #--------------------------------------------------------------------------
end


#==============================================================================
# ■ Window_OptionCommand
#==============================================================================

class Window_OptionCommand < Window_Selectable
 #--------------------------------------------------------------------------
 def initialize
super(16, 160, 5*32, 4*24+32)
@commands = ["Suoni", "Musica", "Finestre", "Predefinito"]
@description = ["Modifica il volume dei suoni",
							"Modifica il volume della musica",
							"Cambia la grafica corrente delle finestre",
							"Applica le impostazioni predefinite"]
@item_max = 4
@column_max = 1
self.contents = Bitmap.new(width - 32, height-32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0..(@item_max-1)
  draw_item(i, normal_color)
end
self.z = 200
self.index = 0
 end
 #--------------------------------------------------------------------------
 def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(0, 24*index, width-32, 24)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
 end
 #--------------------------------------------------------------------------
 def update_help
@help_window.set_text(@description[index], 1)
 end
 #--------------------------------------------------------------------------
 def update_cursor_rect
self.cursor_rect.set(0, 24*index, width-32, 24)
 end
 #--------------------------------------------------------------------------
end


#==============================================================================
# ■ Window_Windowskin
#==============================================================================

class Window_Windowskin < Window_Selectable
 #--------------------------------------------------------------------------
 def initialize
super(6*32, 128+3*24+8, 13*32+16, 32+64)
self.contents = Bitmap.new(width - 32, height - 32)
self.index = -1
self.active = false
@column_max = @item_max = 3#ZVB# Inserisci il numero di windowskin presenti nell'omonima cartella
refresh
 end
 #--------------------------------------------------------------------------
 def refresh
self.contents.clear
for i in 0..@item_max-1
  x = i % @column_max * (width-32)/@column_max
  y = i / @column_max * 64
  bitmap = RPG::Cache.windowskin("Windowskin#{i + 1}")
  self.contents.blt(x, y, bitmap, Rect.new(64, 0, 128, 64), 255)
end
 end
 #--------------------------------------------------------------------------
 def update_cursor_rect
x = index % @column_max * (width-32)/@column_max
y = index / @column_max * 64
if @index < 0
  self.cursor_rect.empty
else
  self.cursor_rect.set(x, y, 128, 64)
end
 end
 #--------------------------------------------------------------------------
end


#==============================================================================
# ■ Scene_Option
#==============================================================================

class Scene_Option
 #--------------------------------------------------------------------------
 def initialize(index=0)
@index = index
 end
 #--------------------------------------------------------------------------
 def main
@command_window = Window_OptionCommand.new
@help_window = Window_Help.new
@command_window.help_window = @help_window
@option_window = Window_Option.new
@windowskin_window = Window_Windowskin.new
@se_regulation = false
@me_regulation = false
Graphics.transition
loop do
  Graphics.update
  Input.update
  update
  if $scene != self
	break
  end
end
Graphics.freeze
@help_window.dispose
@command_window.dispose
@option_window.dispose
@windowskin_window.dispose
 end
 #--------------------------------------------------------------------------
 def update
@help_window.update
@command_window.update
@option_window.update
@windowskin_window.update
if @command_window.active
  @command_window.help_window = @help_window
  update_command
  return
end
if @windowskin_window.active
  @help_window.set_text("Seleziona la grafica delle finestre")
  update_windowskin
  return
end
if @se_regulation == true
  update_se_regulation
end
if @me_regulation == true
  update_me_regulation
end
 end
 #--------------------------------------------------------------------------
 def update_command
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  $scene = Scene_Menu.new(4)
  return
end
if Input.trigger?(Input::C)
  case @command_window.index
  when 0
	$game_system.se_play($data_system.decision_se)
	@command_window.active = false
	@se_regulation = true
  when 1
	$game_system.se_play($data_system.decision_se)
	@command_window.active = false
	@me_regulation = true
  when 2
	$game_system.se_play($data_system.decision_se)
	@command_window.active = false
	@windowskin_window.index = 0
	@windowskin_window.active = true
  when 3
	$game_system.se_play($data_system.decision_se)
	$game_system.se_volume = 100#ZVB#cambia il valore 100 per settare il volume di default per i SE
	$game_system.me_volume = 80#ZVB#cambia il valore 80 per settare il volume di default per i ME,BGM,BGS
	$game_system.windowskin_name = $data_system.windowskin_name = "Windowskin1"#ZVB#la windowskin1 è la windowskin di default
	@option_window.index = 0
	@option_window.refresh
  end
  return
end
 end
 #--------------------------------------------------------------------------
 def update_se_regulation
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @se_regulation = false
  @command_window.active = true
  return
end
if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  @se_regulation = false
  @command_window.active = true
  return
end
if Input.repeat?(Input::RIGHT) and $game_system.se_volume < 100
  $game_system.se_play($data_system.cursor_se)
  $game_system.se_volume += 1
  @option_window.refresh
end
if Input.repeat?(Input::LEFT) and $game_system.se_volume > 0
  $game_system.se_play($data_system.cursor_se)
  $game_system.se_volume -= 1
  @option_window.refresh
end
 end
 #--------------------------------------------------------------------------
 def update_me_regulation
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @me_regulation = false
  @command_window.active = true
  return
end
if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  @me_regulation = false
  @command_window.active = true
  return
end
if Input.repeat?(Input::RIGHT) and $game_system.me_volume < 100
  $game_system.me_volume += 1
  @option_window.refresh
end
if Input.repeat?(Input::LEFT) and $game_system.me_volume > 0
  $game_system.me_volume -= 1
  @option_window.refresh
end
 end
 #--------------------------------------------------------------------------
 def update_windowskin
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @windowskin_window.active = false
  @command_window.active = true
  @windowskin_window.index = -1
  return
end
if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  $data_system.windowskin_name = $game_system.windowskin_name = "Windowskin#{@windowskin_window.index + 1}"
  return
end
 end
 #--------------------------------------------------------------------------
end

 

 

E sostituite il contenuto di
Game_System
con questo:

 

 

#==============================================================================
# ■ Game_System
#==============================================================================

class Game_System
 #--------------------------------------------------------------------------
 attr_reader   :map_interpreter
 attr_reader   :battle_interpreter
 attr_accessor :timer
 attr_accessor :timer_working
 attr_accessor :save_disabled
 attr_accessor :menu_disabled
 attr_accessor :encounter_disabled
 attr_accessor :message_position
 attr_accessor :message_frame
 attr_accessor :save_count
 attr_accessor :magic_number
 attr_accessor :se_volume#ZVB#
 attr_accessor :me_volume#ZVB#
 #--------------------------------------------------------------------------
 def initialize
@map_interpreter = Interpreter.new(0, true)
@battle_interpreter = Interpreter.new(0, false)
@timer = 0
@timer_working = false
@save_disabled = false
@menu_disabled = false
@encounter_disabled = false
@message_position = 2
@message_frame = 0
@save_count = 0
@magic_number = 0
@se_volume = 100#ZVB#questo valore deve essere uguale a quello che trovi nello script OPZIONI
								   #alla riga 235
@me_volume = 80#ZVB#questo valore deve essere uguale a quello che trovi nello script OPZIONI
							   #alla riga 236
 end
 #--------------------------------------------------------------------------
 def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil and bgm.name != ""
  Audio.bgm_play("Audio/BGM/" + bgm.name, @me_volume, bgm.pitch)#ZVB#
else
  Audio.bgm_stop
end
Graphics.frame_reset
 end
 #--------------------------------------------------------------------------
 def bgm_stop
Audio.bgm_stop
 end
 #--------------------------------------------------------------------------
 def bgm_fade(time)
@playing_bgm = nil
Audio.bgm_fade(time * 1000)
 end
 #--------------------------------------------------------------------------
 def bgm_memorize
@memorized_bgm = @playing_bgm
 end
 #--------------------------------------------------------------------------
 def bgm_restore
bgm_play(@memorized_bgm)
 end
 #--------------------------------------------------------------------------
 def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil and bgs.name != ""
  Audio.bgs_play("Audio/BGS/" + bgs.name, @me_volume, bgs.pitch)#ZVB#
else
  Audio.bgs_stop
end
Graphics.frame_reset
 end
 #--------------------------------------------------------------------------
 def bgs_fade(time)
@playing_bgs = nil
Audio.bgs_fade(time * 1000)
 end
 #--------------------------------------------------------------------------
 def bgs_memorize
@memorized_bgs = @playing_bgs
 end
 #--------------------------------------------------------------------------
 def bgs_restore
bgs_play(@memorized_bgs)
 end
 #--------------------------------------------------------------------------
 def me_play(me)
if me != nil and me.name != ""
  Audio.me_play("Audio/ME/" + me.name, @me_volume, me.pitch)#ZVB#
else
  Audio.me_stop
end
Graphics.frame_reset
 end
 #--------------------------------------------------------------------------
 def se_play(se)
if se != nil and se.name != ""
  Audio.se_play("Audio/SE/" + se.name, @se_volume, se.pitch)#ZVB#
end
 end
 #--------------------------------------------------------------------------
 def se_stop
Audio.se_stop
 end
 #--------------------------------------------------------------------------
 def playing_bgm
return @playing_bgm
 end
 #--------------------------------------------------------------------------
 def playing_bgs
return @playing_bgs
 end
 #--------------------------------------------------------------------------
 def windowskin_name
if @windowskin_name == nil
  return $data_system.windowskin_name
else
  return @windowskin_name
end
 end
 #--------------------------------------------------------------------------
 def windowskin_name=(windowskin_name)
@windowskin_name = windowskin_name
 end
 #--------------------------------------------------------------------------
 def battle_bgm
if @battle_bgm == nil
  return $data_system.battle_bgm
else
  return @battle_bgm
end
 end
 #--------------------------------------------------------------------------
 def battle_bgm=(battle_bgm)
@battle_bgm = battle_bgm
 end
 #--------------------------------------------------------------------------
 def battle_end_me
if @battle_end_me == nil
  return $data_system.battle_end_me
else
  return @battle_end_me
end
 end
 #--------------------------------------------------------------------------
 def battle_end_me=(battle_end_me)
@battle_end_me = battle_end_me
 end
 #--------------------------------------------------------------------------
 def update
if @timer_working and @timer > 0
  @timer -= 1
end
 end
 #--------------------------------------------------------------------------
end

 

 

Anche in questo caso, in alternativa, potete copiare o sostituire solo le stringhe con accanto
#ZVB#
.

 

 

Bugs e Conflitti Noti

 

Lo script non modifica irrimediabilmente le altre classi. Si limita a sostituire variabili locali con variabili globali.

Il listato "OPZIONI" non contiene modifiche agli altri script. Il
Game_System
che ho postato contiene solo variabili in più e solo due di esse (quelle legate all'audio) sono state sostituite con variabili globali. Per questi motivi, non dovrebbe restituire alcun errore.

Potrebbe entrare in conflitto con altri script solo se questi riscrivono parte del
Game_System
, cancellando le modifiche apportate da questo script. In tal caso, è sufficiente copiare le stringhe con
#ZVB#
nel listato degli script che modificano il
Game_System
, ovviamente in corrispondenza del
Game_System
stesso.

Lasciate un messaggio se avete bisogno di aiuto.

 

In questa nuova versione dello script, le modifiche apportate vengono salvate quando salvate il gioco.

IMPORTANTE
: A causa delle modifiche apportate al
Game_System
non potete caricare un salvataggio preesistente se questo è stato salvato quando non avevate inserito questo script. In altre parole, dopo aver inserito questo script, le informazioni che vengono salvate nel file di salvataggio sono superiori a quelle salvate di default. Se caricate un file che non contiene queste informazioni (quindi, risalente a quando NON avevate questo script), il programma resituirà un errore.

 

 

Altri Dettagli

 

Sto attualmente lavorando per implementare la possibilità di cambiare font.

 

Sono disponibile a qualunque modifica dello script in qualunque sua parte anche ad ampliamenti di ogni genere.

Edited by Ziel van Brand
Link to comment
Share on other sites

Mamma..Un bello script..Un pochettino complicatino, ma comunque un gran lavorone!=0

http://www.freankexpo.net/signature/1129.png

2986.png

BIM_Banner3.png

Premi RpgMaker

 


http://www.rpg2s.net/forum/uploads/monthly_01_2017/msg-293-0-48316500-1483794996.jpghttp://www.rpg2s.net/dax_games/r2s_regali2.pngContesthttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gif http://rpg2s.net/gif/SCContest1Oct.gif http://rpg2s.net/gif/SCContest2Oct.gif http://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://www.rpg2s.net/awards/bestpixel2.jpghttp://www.rpg2s.net/awards/bestresourCSist2.jpghttp://www.rpg2s.net/awards/mostproductive1.jpghttp://i42.servimg.com/u/f42/13/12/87/37/iconap13.pnghttp://i42.servimg.com/u/f42/13/12/87/37/iconap14.pnghttp://i42.servimg.com/u/f42/13/12/87/37/iconap15.pnghttp://i42.servimg.com/u/f42/13/12/87/37/iconap16.pnghttp://i42.servimg.com/u/f42/13/12/87/37/screen10.pnghttp://www.rpgmkr.net/contest/screen-contest-primo.pnghttp://www.makerando.com/forum/uploads/jawards/iconawards3.png

Link to comment
Share on other sites

mamma mia ma quanta roba c'è da fare?comunque è un'ottimo script :sisi: :sisi:

Bisogno di creare un sito internet?Vai a visitare il White Rabbit ;D

Screen contest #23
http://rpg2s.net/gif/SCContest3Oct.gif


Partecipante al Rpg2s.net Game Contest 2008/2009
http://www.rpg2s.net/contest/GameContest0809/gc0809-bannerino.jpg
Gioco in Sviluppo: Restricted : Project 15

Link to comment
Share on other sites

  • 5 months later...

Lo script mi riporta un errore:

 

Errore di script 'Scene_Map' sulla 135 del tipo 'NameError'

 

uninitialized constant Scene_Map::R_Key_F3

 

Cosa significa? Il gioco si avvia ma non va oltre il menù principale, come scelgo di iniziare una nuova partita o di caricarna una precedente mi riporta questo errore.

Edited by agostino
Link to comment
Share on other sites

"Ho scelto di rendere disponibile questa schermata dopo aver premuto il tasto F3. Per far questo, è necessario lo script Keybord_Input di cybersam che ho riportato qui di seguito o che potrete trovare in questo link."

 

in altre parole, ti dà quell'errore perchè non hai inserito lo script "keyboard input"

Link to comment
Share on other sites

nell'elenco, puoi chiamare lo script come vuoi. l'importante è che non modifichi nulla nel listato se non sai dove mettere le mani.

 

io ho messo il keyboard input come primissimo script, in alto nell'elenco. non mi da' problemi. prova tu

Link to comment
Share on other sites

potresti incollare qui la riga 90 della scene_map?

negli script di default corrisponde ad una serie di cancelletti...

 

ps: vedo di sistemare lo script in modo che non serva inserire immagini per farlo funzionare. se riesco, edito il primo messaggio stasera col "nuovo" script.

 

EDIT:

ok, l'ho sistemato un pochino.

ho eliminato quel "premi F3 per modificare le opzioni".

rileggli il primo post e segui tutte le istruzioni per farlo funzionare, se dovessi avere ancora problemi, beh... scrivi qui!

Edited by Ziel van Brand
Link to comment
Share on other sites

ah bon!

sostituisci $fontsize con un numero qualsiasi (ti consiglio 18 o 20, giù di lì). $fontsize è una variabile globale, indica la grandezza dei caratteri nel gioco. non tutti la usano.

discorso simile vale per $fontface, che invece è la variabile che contiene il nome del font (Tipo "Times new roman", etc)

se ti dà errore anche $fontface quindi, sostituiscilo col nome di un font che possiedi.

Link to comment
Share on other sites

in altre parole, quando carichi il file salvato con le impostazioni modificate, ti carica le impostazioni di default?

 

uhm... questo non l'avevo assolutamente notato. vedrò di lavorarci domani... o meglio, oggi, ma MOLTO più tardi.

 

se intendi invece che ad ogni avvio del gioco (cioè quando selezioni "nuovo gioco") ti carica sempre le stesse impostazioni, beh... è normale.

Link to comment
Share on other sites

in altre parole, quando carichi il file salvato con le impostazioni modificate, ti carica le impostazioni di default?

 

Esattamente così

 

 

Ascolta, dato che io non uso quel BS che tu hai usato, come posso avere una schermata delle opzioni dove compaiano solo "volume musica" e "volume suoni"? Del resto a me serve solo questo.

 

Grazie

Edited by agostino
Link to comment
Share on other sites

ok, allora...

inserisci questo in window_base, prima dell'ultimo end:

 

  def black_color
return Color.new(0, 0, 0, 255)
 end
 #--------------------------------------------------------------------------
 def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color )
self.contents.fill_rect(x, y, width, height, black_color)
now = now > max ? max : now
percentage = max != 0 ? (width) * now / max.to_f : 0
if start_color == end_color
  self.contents.fill_rect(x, y, percentage, height, start_color)
else
  for i in 0..percentage-1
	r = start_color.red + (end_color.red - start_color.red) / percentage * i
	g = start_color.green + (end_color.green - start_color.green) / percentage * i
	b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
	a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
	self.contents.fill_rect(x+i, y, 1, height, Color.new(r, g, b, a))
  end
end
 end

 

 

vai in Game_System e aggiungi all'elenco degli attr_accessor queste due righe:

 

  attr_accessor :se_volume
 attr_accessor :me_volume

 

 

subito sotto troverai un "def initialize" e un altro elenco di variabili (cioè un elenco di... "parole" precedute da "@"). a questo elenco aggiungi:

 

  @me_volume = 80
 @se_volume = 80

 

 

sempre in game_sistem cerca la stringa bgm.volume e me.volume e sostituisci entrambe con @me_volume.

Cerca la stringa se.volume e sostituitela con @se_volume.

 

ora lo script:

 

#==============================================================================
# ■ Window_Option
#==============================================================================

class Window_Option < Window_Base
 #--------------------------------------------------------------------------
 def initialize
super(6*32, 128-48, 13*32+16, 2*24+32)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
 end
 #--------------------------------------------------------------------------
 def refresh
self.contents.clear

self.contents.fill_rect(20, 0+10, 200, 6, Color.new(0, 0, 0, 255))
self.contents.fill_rect(20, 24+10, 200, 6, Color.new(0, 0, 0, 255))

draw_meter($se_volume, 100, 21, 1+10, 198, 4, Color.new(255, 255, 255, 255))
draw_meter($me_volume, 100, 21, 25+10, 198, 4, Color.new(255, 255, 255, 255))

self.contents.font.color = black_color
self.contents.draw_text(2, 2, width-32, 24, "0")
self.contents.draw_text(2+224, 2, 32, 24, "100")
self.contents.draw_text(2, 2, width-32-2, 24, $se_volume.to_s + "/ 100", 2)

self.contents.draw_text(2, 2+24, width-32, 24, "0")
self.contents.draw_text(2+224, 2+24, 32, 24, "100")
self.contents.draw_text(2, 2+24, width-32-2, 24, $me_volume.to_s + "/ 100", 2)

self.contents.draw_text(2, 2+48, width-32, 24, "1")
self.contents.draw_text(2+224, 2+48, 32, 24, "5")
self.contents.draw_text(2, 2+48, width-32-2, 24, $atb.to_s + "/ 5", 2)


self.contents.font.color = normal_color
self.contents.draw_text(0, 0, width-32, 24, "0")
self.contents.draw_text(224, 0, 32, 24, "100")
self.contents.draw_text(0, 0, width-32-2, 24, $se_volume.to_s + "/ 100", 2)

self.contents.draw_text(0, 24, width-32, 24, "0")
self.contents.draw_text(224, 24, 32, 24, "100")
self.contents.draw_text(0, 24, width-32-2, 24, $me_volume.to_s + "/ 100", 2)

 end
 #--------------------------------------------------------------------------
end


#==============================================================================
# ■ Window_PartyCommand
#==============================================================================

class Window_OptionCommand < Window_Selectable
 #--------------------------------------------------------------------------
 def initialize
super(16, 160, 5*32, 3*24+32)
@commands = ["Suoni", "Musica", "Predefinito"]
@description = ["Modifica il volume dei suoni",
							"Modifica il volume della musica",
							"Applica le impostazioni predefinite"]
@item_max = 3
@column_max = 1
self.contents = Bitmap.new(width - 32, height-32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0..(@item_max-1)
  draw_item(i, normal_color)
end
self.z = 200
self.index = 0
 end
 #--------------------------------------------------------------------------
 def draw_item(index, color)
self.contents.font.color = black_color
rect = Rect.new(2, 24*index+2, width-32, 24)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
self.contents.font.color = color
rect = Rect.new(0, 24*index, width-32, 24)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
 end
 #--------------------------------------------------------------------------
 def update_help
@help_window.set_text(@description[index], 1)
 end
 #--------------------------------------------------------------------------
 def update_cursor_rect
self.cursor_rect.set(0, 24*index, width-32, 24)
 end
 #--------------------------------------------------------------------------
end


#==============================================================================
# ■ Scene_Option
#==============================================================================

class Scene_Option
 #--------------------------------------------------------------------------
 def initialize(index=0)
@index = index
 end
 #--------------------------------------------------------------------------
 def main
@command_window = Window_OptionCommand.new
@help_window = Window_Help.new
@command_window.help_window = @help_window
@option_window = Window_Option.new
@se_regulation = false
@me_regulation = false
Graphics.transition
loop do
  Graphics.update
  Input.update
  update
  if $scene != self
	break
  end
end
Graphics.freeze
@help_window.dispose
@command_window.dispose
@option_window.dispose
 end
 #--------------------------------------------------------------------------
 def update
@help_window.update
@command_window.update
@option_window.update
if @command_window.active
  @command_window.help_window = @help_window
  update_command
  return
end
if @se_regulation == true
  update_se_regulation
end
if @me_regulation == true
  update_me_regulation
end
 end
 #--------------------------------------------------------------------------
 def update_command
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  $scene = Scene_Map.new
  return
end
if Input.trigger?(Input::C)
  case @command_window.index
  when 0
	$game_system.se_play($data_system.decision_se)
	@command_window.active = false
	@se_regulation = true
  when 1
	$game_system.se_play($data_system.decision_se)
	@command_window.active = false
	@me_regulation = true
  when 5
	$game_system.se_play($data_system.decision_se)
	$game_system.se_volume = 100
	$game_system.me_volume = 80
	@option_window.refresh
  end
  return
end
 end
 #--------------------------------------------------------------------------
 def update_se_regulation
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @se_regulation = false
  @command_window.active = true
  return
end
if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  @se_regulation = false
  @command_window.active = true
  return
end
if Input.repeat?(Input::RIGHT) and $game_system.se_volume < 100
  $game_system.se_play($data_system.cursor_se)
  $game_system.se_volume += 1
  @option_window.refresh
end
if Input.repeat?(Input::LEFT) and $game_system.se_volume > 0
  $game_system.se_play($data_system.cursor_se)
  $game_system.se_volume -= 1
  @option_window.refresh
end
 end
 #--------------------------------------------------------------------------
 def update_me_regulation
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @me_regulation = false
  @command_window.active = true
  return
end
if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  @me_regulation = false
  @command_window.active = true
  return
end
if Input.repeat?(Input::RIGHT) and $game_system.me_volume < 100
  $game_system.me_volume += 1
  @option_window.refresh
end
if Input.repeat?(Input::LEFT) and $game_system.me_volume > 0
  $game_system.me_volume -= 1
  @option_window.refresh
end
 end
  #--------------------------------------------------------------------------
end

 

 

ho dato una controllatina veloce. scritto così, le impostazioni vengono salvate insieme a tutte le altre impostazioni del gioco, così le ritrovi quando carichi.

non ho sistemato le finestre, perchè nel mio progetto, ho settato a 24 pixel (e non a 32, come di default) l'altezza di ogni riga di testo. non avevo voglia di riportare tutto a 32 pixel... troppo tempo.

confido nel fatto che tu abbia una certa confidenza con il comando "super".

Link to comment
Share on other sites

super è il comando che gestisce la dimensione e la posizione delle finestre. in particolare:

 

super( x, y, larghezza, altezza)

 

guarda gli script che si chiamano "window_qualcosa". anzi, vai in "window_menustatus" cambia qualche numerino dentro il comando super, avvia il gioco e apri il menu. capirai subito come funzia ;)

 

 

per lo script, domani (e stavolta intendo proprio domani 29 gennaio, non oggi ma più tardi) vedrò di sistemare una volta per tutte questo script. forse riuscirò oggi - ma molto molto più tardi - a fare qualcosa, non ti prometto nulla, ho impegni.

 

(però strano... a me funzionava, boh! vabbeh, vedrò)

Link to comment
Share on other sites

agostino, prova questo:

 

Copia lo script riportato di seguito in una nuova classe sopra il Main e chiamalo "OPZIONI".

 

 

#==============================================================================
# ¦ Window_Base
#==============================================================================

class Window_Base
 #--------------------------------------------------------------------------
 def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color )
self.contents.fill_rect(x, y, width, height, Color.new(0,0,0,255))
now = now > max ? max : now
percentage = max != 0 ? (width) * now / max.to_f : 0
if start_color == end_color
  self.contents.fill_rect(x, y, percentage, height, start_color)
else
  for i in 0..percentage-1
	r = start_color.red + (end_color.red - start_color.red) / percentage * i
	g = start_color.green + (end_color.green - start_color.green) / percentage * i
	b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
	a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
	self.contents.fill_rect(x+i, y, 1, height, Color.new(r, g, b, a))
  end
end
 end
 #--------------------------------------------------------------------------
end



#==============================================================================
# ¦ Window_Option
#==============================================================================

class Window_Option < Window_Base
 #--------------------------------------------------------------------------
 def initialize
super(6*32, 160, 13*32+16, 3*32)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
 end
 #--------------------------------------------------------------------------
 def refresh
self.contents.clear

self.contents.fill_rect(20, 0+10, 200, 8, Color.new(0, 0, 0, 255))
self.contents.fill_rect(20, 32+10, 200, 8, Color.new(0, 0, 0, 255))

draw_meter($game_system.se_volume, 100, 21, 1+10, 198, 6, Color.new(255, 255, 255, 255))
draw_meter($game_system.me_volume, 100, 21, 33+10, 198, 6, Color.new(255, 255, 255, 255))

self.contents.font.color = normal_color
self.contents.draw_text(0, 0, width-32, 32, "0")
self.contents.draw_text(224, 0, 32, 32, "100")
self.contents.draw_text(0, 0, width-32-2, 32, $game_system.se_volume.to_s + "/ 100", 2)

self.contents.draw_text(0, 32, width-32, 32, "0")
self.contents.draw_text(224, 32, 32, 32, "100")
self.contents.draw_text(0, 24, width-32-2, 32, $game_system.me_volume.to_s + "/ 100", 2)
 end
 #--------------------------------------------------------------------------
end



#==============================================================================
# ¦ Window_OptionCommand
#==============================================================================

class Window_OptionCommand < Window_Selectable
 #--------------------------------------------------------------------------
 def initialize
super(16, 160, 5*32, 4*32)
@commands = ["Suoni", "Musica", "Predefinito"]
@description = ["Modifica il volume dei suoni",
							"Modifica il volume della musica",
							"Applica le impostazioni predefinite"]
@item_max = 3
@column_max = 1
self.contents = Bitmap.new(width - 32, height-32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0..(@item_max-1)
  draw_item(i, normal_color)
end
self.z = 200
self.index = 0
 end
 #--------------------------------------------------------------------------
 def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(0, 32*index, width-32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
 end
 #--------------------------------------------------------------------------
 def update_help
@help_window.set_text(@description[index], 1)
 end
 #--------------------------------------------------------------------------
 def update_cursor_rect
self.cursor_rect.set(0, 32*index, width-32, 32)
 end
 #--------------------------------------------------------------------------
end



#==============================================================================
# ¦ Scene_Option
#==============================================================================

class Scene_Option
 #--------------------------------------------------------------------------
 def initialize(index=0)
@index = index
 end
 #--------------------------------------------------------------------------
 def main
@command_window = Window_OptionCommand.new
@help_window = Window_Help.new
@command_window.help_window = @help_window
@option_window = Window_Option.new
@se_regulation = false
@me_regulation = false
Graphics.transition
loop do
  Graphics.update
  Input.update
  update
  if $scene != self
	break
  end
end
Graphics.freeze
@help_window.dispose
@command_window.dispose
@option_window.dispose
 end
 #--------------------------------------------------------------------------
 def update
@help_window.update
@command_window.update
@option_window.update
if @command_window.active
  @command_window.help_window = @help_window
  update_command
  return
end
if @se_regulation == true
  update_se_regulation
end
if @me_regulation == true
  update_me_regulation
end
 end
 #--------------------------------------------------------------------------
 def update_command
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  $scene = Scene_Menu.new(4)
  return
end
if Input.trigger?(Input::C)
  case @command_window.index
  when 0
	$game_system.se_play($data_system.decision_se)
	@command_window.active = false
	@se_regulation = true
  when 1
	$game_system.se_play($data_system.decision_se)
	@command_window.active = false
	@me_regulation = true
  when 2
	$game_system.se_play($data_system.decision_se)
	$game_system.se_volume = 100
	$game_system.me_volume = 80
	@option_window.refresh
  end
  return
end
 end
 #--------------------------------------------------------------------------
 def update_se_regulation
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @se_regulation = false
  @command_window.active = true
  return
end
if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  @se_regulation = false
  @command_window.active = true
  return
end
if Input.repeat?(Input::RIGHT) and $game_system.se_volume < 100
  $game_system.se_play($data_system.cursor_se)
  $game_system.se_volume += 1
  @option_window.refresh
end
if Input.repeat?(Input::LEFT) and $game_system.se_volume > 0
  $game_system.se_play($data_system.cursor_se)
  $game_system.se_volume -= 1
  @option_window.refresh
end
 end
 #--------------------------------------------------------------------------
 def update_me_regulation
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @me_regulation = false
  @command_window.active = true
  return
end
if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  @me_regulation = false
  @command_window.active = true
  return
end
if Input.repeat?(Input::RIGHT) and $game_system.me_volume < 100
  $game_system.me_volume += 1
  @option_window.refresh
end
if Input.repeat?(Input::LEFT) and $game_system.me_volume > 0
  $game_system.me_volume -= 1
  @option_window.refresh
end
 end
 #--------------------------------------------------------------------------
end

 

 

Poi sostituisci il contenuto della classe Game_System con questo:

 

 

#==============================================================================
# ¦ Game_System
#------------------------------------------------------------------------------
#  ???????????????????BGM ????????????????
# ???????? $game_system ????????
#==============================================================================

class Game_System
 #--------------------------------------------------------------------------
 # ? ??????????
 #--------------------------------------------------------------------------
 attr_reader   :map_interpreter		  # ??????????????
 attr_reader   :battle_interpreter	   # ??????????????
 attr_accessor :timer					# ????
 attr_accessor :timer_working			# ??????????
 attr_accessor :save_disabled			# ?????
 attr_accessor :menu_disabled			# ??????
 attr_accessor :encounter_disabled	   # ????????
 attr_accessor :message_position		 # ??????? ????
 attr_accessor :message_frame			# ??????? ??????
 attr_accessor :save_count			   # ?????
 attr_accessor :magic_number			 # ????????
 attr_accessor :se_volume ##########
 attr_accessor :me_volume ##########
 #--------------------------------------------------------------------------
 # ? ?????????
 #--------------------------------------------------------------------------
 def initialize
@map_interpreter = Interpreter.new(0, true)
@battle_interpreter = Interpreter.new(0, false)
@timer = 0
@timer_working = false
@save_disabled = false
@menu_disabled = false
@encounter_disabled = false
@message_position = 2
@message_frame = 0
@save_count = 0
@magic_number = 0
@me_volume = 100 #modifica questo valore per modificare il volume di default della musica
@se_volume = 80 #modifica questo valore per modificare il volume di default dei suoni
 end
 #--------------------------------------------------------------------------
 # ? BGM ???
 #	 bgm : ???? BGM
 #--------------------------------------------------------------------------
 def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil and bgm.name != ""
  Audio.bgm_play("Audio/BGM/" + bgm.name, @me_volume, bgm.pitch) ##########
else
  Audio.bgm_stop
end
Graphics.frame_reset
 end
 #--------------------------------------------------------------------------
 # ? BGM ???
 #--------------------------------------------------------------------------
 def bgm_stop
Audio.bgm_stop
 end
 #--------------------------------------------------------------------------
 # ? BGM ????????
 #	 time : ????????? (?)
 #--------------------------------------------------------------------------
 def bgm_fade(time)
@playing_bgm = nil
Audio.bgm_fade(time * 1000)
 end
 #--------------------------------------------------------------------------
 # ? BGM ???
 #--------------------------------------------------------------------------
 def bgm_memorize
@memorized_bgm = @playing_bgm
 end
 #--------------------------------------------------------------------------
 # ? BGM ???
 #--------------------------------------------------------------------------
 def bgm_restore
bgm_play(@memorized_bgm)
 end
 #--------------------------------------------------------------------------
 # ? BGS ???
 #	 bgs : ???? BGS
 #--------------------------------------------------------------------------
 def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil and bgs.name != ""
  Audio.bgs_play("Audio/BGS/" + bgs.name, @me_volume, bgs.pitch) ##########
else
  Audio.bgs_stop
end
Graphics.frame_reset
 end
 #--------------------------------------------------------------------------
 # ? BGS ????????
 #	 time : ????????? (?)
 #--------------------------------------------------------------------------
 def bgs_fade(time)
@playing_bgs = nil
Audio.bgs_fade(time * 1000)
 end
 #--------------------------------------------------------------------------
 # ? BGS ???
 #--------------------------------------------------------------------------
 def bgs_memorize
@memorized_bgs = @playing_bgs
 end
 #--------------------------------------------------------------------------
 # ? BGS ???
 #--------------------------------------------------------------------------
 def bgs_restore
bgs_play(@memorized_bgs)
 end
 #--------------------------------------------------------------------------
 # ? ME ???
 #	 me : ???? ME
 #--------------------------------------------------------------------------
 def me_play(me)
if me != nil and me.name != ""
  Audio.me_play("Audio/ME/" + me.name, @me_volume, me.pitch) ##########
else
  Audio.me_stop
end
Graphics.frame_reset
 end
 #--------------------------------------------------------------------------
 # ? SE ???
 #	 se : ???? SE
 #--------------------------------------------------------------------------
 def se_play(se)
if se != nil and se.name != ""
  Audio.se_play("Audio/SE/" + se.name, @se_volume, se.pitch) ##########
end
 end
 #--------------------------------------------------------------------------
 # ? SE ???
 #--------------------------------------------------------------------------
 def se_stop
Audio.se_stop
 end
 #--------------------------------------------------------------------------
 # ? ??? BGM ???
 #--------------------------------------------------------------------------
 def playing_bgm
return @playing_bgm
 end
 #--------------------------------------------------------------------------
 # ? ??? BGS ???
 #--------------------------------------------------------------------------
 def playing_bgs
return @playing_bgs
 end
 #--------------------------------------------------------------------------
 # ? ???????? ????????
 #--------------------------------------------------------------------------
 def windowskin_name
if @windowskin_name == nil
  return $data_system.windowskin_name
else
  return @windowskin_name
end
 end
 #--------------------------------------------------------------------------
 # ? ???????? ????????
 #	 windowskin_name : ??????????? ?????
 #--------------------------------------------------------------------------
 def windowskin_name=(windowskin_name)
@windowskin_name = windowskin_name
 end
 #--------------------------------------------------------------------------
 # ? ??? BGM ???
 #--------------------------------------------------------------------------
 def battle_bgm
if @battle_bgm == nil
  return $data_system.battle_bgm
else
  return @battle_bgm
end
 end
 #--------------------------------------------------------------------------
 # ? ??? BGM ???
 #	 battle_bgm : ?????? BGM
 #--------------------------------------------------------------------------
 def battle_bgm=(battle_bgm)
@battle_bgm = battle_bgm
 end
 #--------------------------------------------------------------------------
 # ? ????? BGM ???
 #--------------------------------------------------------------------------
 def battle_end_me
if @battle_end_me == nil
  return $data_system.battle_end_me
else
  return @battle_end_me
end
 end
 #--------------------------------------------------------------------------
 # ? ????? BGM ???
 #	 battle_end_me : ???????? BGM
 #--------------------------------------------------------------------------
 def battle_end_me=(battle_end_me)
@battle_end_me = battle_end_me
 end
 #--------------------------------------------------------------------------
 # ? ??????
 #--------------------------------------------------------------------------
 def update
# ????? 1 ???
if @timer_working and @timer > 0
  @timer -= 1
end
 end
end

 

 

Se hai già fatto delle modifiche a questa classe, sostituisci soltanto le righe in cui trovi questa serie di cancelletti "##########".

 

 

per usare lo script, crea un evento con un call_script in cui inserire "$scene = Scene_Option.new"

 

 

ps: l'ho provato io stesso in un progetto vuoto e funziona. se dovesse darti problemi, probabilmente usi altri script che vanno in conflitto con le modifiche apportate al Game_System.

Link to comment
Share on other sites

prova questo, contiene lo script che ti ho postato, se ti funziona. allora hai qualche script nel tuo progetto che modifica la classe game_system.

 

uhm... cerca in tutti gli script questa frase "class game_system" se ne trovi più di uno, beh... abbiamo trovato il problema.

Link to comment
Share on other sites

Si adesso la finestra viene visualizzata, ma ad uno spostamento della barra del volume non consegue una variazione del volume stesso... :rolleyes:

 

P.S.: Per far apparire la finestra ho dovuto iniziare una nuova partita percHé se ne apro una salvata mi da sempre lo stesso errore

Edited by agostino
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...