#============================================================================== # ■ Window_Command_Quest # creato per la gestione dei colori #------------------------------------------------------------------------------ class Window_Command_Quest < Window_Selectable #-------------------------------------------------------------------------- def initialize(width, commands) super(0, 0, width, commands.size * 32 + 32) @item_max = commands.size @commands = commands self.contents = Bitmap.new(width - 32, @item_max * 32) refresh self.index = 0 end #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...@item_max draw_item(i, normal_color) end end #-------------------------------------------------------------------------- def draw_item(index, color) self.contents.font.color = color rect = Rect.new(4, 24 * index, self.contents.width - 8, 24) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.draw_text(rect, @commands[index]) end #=================================================== # - CLASSE Scene_Quest #=================================================== class Scene_Quest #--------------------------------------------------------------------------------- def initialize(quest_index = 0) @quest_index = quest_index $MAP_BACKGROUND = true #Mappa in Background. True o false? imposta come preferisci. @quest_options = [] $quests_reputation = 0 $quests_completed = 0 end #------------------------------------------------ def main if $MAP_BACKGROUND @spriteset = Spriteset_Map.new end @window5 = Window_Quest_Diary.new @window5.z= 300 for i in 0.. $quest.size - 1 name = $quest[i].name @quest_options.push(name) end for i in 0.. $quest.size - 1 if $quest[i].state_number == 99 $quests_reputation += $quest[i].reputation $quests_completed += 1 end end @window6 = Window_Reputation.new @window6.z= 300 @command_window = Window_Command_Quest.new(160, @quest_options) @command_window.index = @quest_index @command_window.z = 255 @command_window.height = 150 for i in 0.. $quest.size - 1 if $quest[i].state_number == 1 @command_window.disable_item(i) elsif $quest[i].state_number == 99 @command_window.complete_item(i) elsif $quest[i].state_number == 98 @command_window.just_finish_item(i) end end Graphics.transition (20) loop do Graphics.update Input.update update if $scene != self break end end Graphics.transition Graphics.freeze @command_window.dispose @quest_options.clear @window5.dispose @window6.dispose if $MAP_BACKGROUND @spriteset.dispose end $quest_seen = false end #--------------------------------------------------------------------------------- def update @command_window.update if @command_window.active update_command return end if Input.trigger?(Input::B) if @command_window.active == false Sound.play_cancel @command_window.active = true @window1.dispose @window2.dispose @window3.dispose @window4.dispose @window7.dispose else Sound.play_cancel $scene = Scene_Map.new end return end end #--------------------------------------------------------------------------------- def update_command if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new return end if Input.trigger?(Input::C) for i in 0.. $quest.size - 1 case @command_window.index when i if $quest[i].state_number == 1 Sound.play_buzzer return end Sound.play_decision $ACTUAL_QUEST = $quest[i] update_quest end end end end def update_quest @command_window.active = false @window1 = Window1.new @window2 = Window2.new @window1.z= 220 @window2.z= 200 @window3.z= 230 @window4.z= 230 @window7.z= 230 end end class Window1 < Window_Base #--------------------------------------------------------------------------------- def initialize super(160, 0, 245,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Comic Sans MS" self.contents.font.size = 28 self.contents.font.color = text_color(3) #Colore del Nome della Missione self.contents.draw_text(0, 0, 400, 30, $ACTUAL_QUEST.name) end end class Window2 < Window_Base #--------------------------------------------------------------------------------- def initialize super(160, 60, 385, 357) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Comic Sans MS" self.contents.font.size = 26 self.contents.font.color = text_color(0) # Colore delle righe della Quest src_rect = Rect.new(0, 0, 370, 100) # Dimensione dell'Immagine 350*70 image = Cache.picture($ACTUAL_QUEST.image) self.contents.blt(0, 10, image, src_rect, 255) self.contents.draw_text(0, 100, 500, 33, $ACTUAL_QUEST.line1) self.contents.draw_text(0, 125, 500, 33, $ACTUAL_QUEST.line2) self.contents.draw_text(0, 150, 500, 33, $ACTUAL_QUEST.line3) self.contents.draw_text(0, 175, 500, 33, $ACTUAL_QUEST.line4) self.contents.draw_text(0, 200, 500, 33, $ACTUAL_QUEST.line5) end end #--------------------------------------------------- #Questa è la finestra del titolo pagina class Window_Quest_Diary < Window_Base def initialize super(405, 0, 140, 60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Comic Sans MS" self.contents.font.size = 20 self.opacity = 255 self.contents.font.color = text_color(4) self.contents.draw_text(0, 0, 100, 33, "Diario") end end class Quest attr_accessor :name attr_accessor :image attr_accessor :line1 attr_accessor :line2 attr_accessor :line3 attr_accessor :line4 attr_accessor :line5 #----------------------------------------------------- def initialize(name, image, line1, line2, line3, line4, line5) @name = name @image = image @line1 = line1 @line2 = line2 @line3 = line3 @line4 = line4 @line5 = line5 end #-----FINE------------- class Scene_Save < Scene_File alias samo_new_save write_save_data def write_save_data(file) File.open(Quests, "Missioni") { |f| Marshal.dump(obj, f) } end end class Scene_Load < Scene_File alias samo_new_load read_save_data def read_save_data(file) File.open(Quests, "Missioni") { |f| obj = Marshal.load(f) } end end end end
Salve a tutti, oggi ho preso uno script già bello pronto che serviva per gestire missioni, accettarle, visualizzarle ecc. Un vecchio script xp convertito per vx. Visto che non avevo necessità di questo ho deciso di modificarlo per avere un piccolo diario a menù così da evitare di farlo ad eventi che oltre che lungo l'aspetto stilistico lasciava a desiderare. Purtroppo mi da un errore quando aggiungo una "Missione", una pagina per intenderci, l'errore dice: "uninitialized costant Game_Interpreter::Quest" Però non mi segnala nessun errore nello script
Utilizzo questo nel call script:
$quest[0] = Quest.new("I Pagina",
"",
"Ciao",
"questa",
"è",
"una",
"prova")
Mi rimetto alla vostra sapienza!