Dilos Posted September 6, 2011 Share Posted September 6, 2011 (edited) Menu Mono-PG DescrizioneEcco un Custom Menu semplice e funzionale, di facile configurazione, non richiede competenze avanzate per utilizzarlo ed è ottimizzato per giochi che includono un unico Personaggio Giocante. AutoreRune, Modern Algebra AllegatiScreenshothttp://img830.imageshack.us/img830/1282/immaginetej.pngIstruzioni per l'uso Dovete inserire nella cartella Pictures tre immagini nominate "Barra_HP", "Barra_MP" e "Bordo_Barra" : nell' ordine sopra specificato, le prime due devono avere una dimensione compresa tra 100x4 e 100x10, mentre la terza deve avere 2 Pixel di lunghezza e altezza in più rispetto alle dimensioni scelte per le immagini precedenti (questa immagine rappresenta il bordo spesso 1 Pixel per lato delle barre HP/MP, il piano compreso tra i bordi deve invece essere riempito di nero). Script #============================================================= # # Menu Mono-PG # Autore: Rune, Modern Algebra # #------------------------------------------------------------------------------- # # Configurazione: # # Dovete inserire nella cartella Pictures tre immagini nominate "Barra_HP", # "Barra_MP" e "Bordo_Barra" : nell' ordine sopra specificato, le prime due # devono avere una dimensione compresa tra 100x4 e 100x10, mentre la terza # deve avere 2 Pixel di lunghezza e altezza in più rispetto alle dimensioni # scelte per le immagini precedenti(questa immagine rappresenta il bordo # spesso 1 Pixel per lato delle barre HP/MP, il piano compreso tra i bordi # deve invece essere riempito di nero). # #------------------------------------------------------------------------------- # # Descrizione: # # Questo menu è ottimizzato per giochi che includono un unico PG # Le Pictures che avete inserito precedentemente rappresentano rispettivamente # le barre HP ed MP e i loro bordi all' interno del menu. # #------------------------------------------------------------------------------- # # Configurazione Barre # #------------------------------------------------------------------------------- Barra_HP = RPG::Cache.picture("Barra_HP") # Nome della barra degli HP Barra_MP = RPG::Cache.picture("Barra_MP") # Nome della barra degli MP Bordo_Barra = RPG::Cache.picture("Bordo_Barra") # Nome del bordo delle barre HP/MP Stile_Dissolvenza = 0 # 0 =Smussato; 1 = Squadrato; #------------------------------------------------------------------------------- # # Configurazione Barra di Status del PG Selezionato # #------------------------------------------------------------------------------- $ID = 1 # ID PG Attivo # Il numero corrisponde all' ID del personaggio nel Database # Esempio: Arshes = 1; Basil = 2; Cyrus = 3; # Per cambiarlo durante il gioco fate un Call Script con il seguente codice: # $ID = ID del personaggio da sostituire #============================================================================== #============================================================================== # Window_Base Modificato #============================================================================== class Window_Base #-------------------------------------------------------------------------- # Draw Battler # actor : actor # x : draw spot x-coordinate # y : draw spot y-coordinate # opacity : opacity #-------------------------------------------------------------------------- def draw_actor_battler(actor, x, y, opacity) char = RPG::Cache.battler(actor.battler_name, actor.battler_hue) self.contents.blt(x, y, char, char.rect, opacity) end end #============================================================================== # Window_Command Riscritto #============================================================================== class Window_Command < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(width, commands, column_max = 1, style = 0, inf_scroll = 1) super(0, 0, width, (commands.size * 1.0 / column_max).ceil * 32 + 32) @inf_scroll = inf_scroll @item_max = commands.size @commands = commands @column_max = column_max @style = style self.contents = Bitmap.new(width - 32, (@item_max * 1.0 / @column_max).ceil * 32) self.contents.font.name = "Tahoma" self.contents.font.size = 22 refresh self.index = 0 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...@item_max draw_item(i, normal_color) end end #-------------------------------------------------------------------------- # * Draw_Item #-------------------------------------------------------------------------- def draw_item(index, color) self.contents.font.color = color rect = Rect.new(index%@column_max * (self.width / @column_max) + 4, 32 * (index/@column_max), self.width / @column_max - 40, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.draw_text(rect, @commands[index], @style) end #-------------------------------------------------------------------------- # * Disable Item #-------------------------------------------------------------------------- def disable_item(index) draw_item(index, disabled_color) end #-------------------------------------------------------------------------- # * Update Help #-------------------------------------------------------------------------- def update_help @help_window.set_actor($game_party.actors[$scene.actor_index]) end end #============================================================================== # Window_PlayTime Modificato #============================================================================== class Window_PlayTime def refresh self.contents.clear self.contents.font.color = system_color self.contents.draw_text(4, 0, 120, 32, "Tempo", 2) @total_sec = Graphics.frame_count / Graphics.frame_rate hour = @total_sec / 60 / 60 min = @total_sec / 60 % 60 sec = @total_sec % 60 text = sprintf("d:d:d", hour, min, sec) self.contents.font.color = normal_color self.contents.draw_text(4, 32, 120, 32, text, 2) end end #============================================================================== # Window_MenuStatus Riscritto #============================================================================== class Window_MenuStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(240, 32, 320, 416) self.contents = Bitmap.new(width - 32, height - 32) refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear actor = $game_actors[$ID] draw_actor_battler(actor, 128, 160, 160) self.contents.font.size = 32 self.contents.font.color = Color.new(0, 0, 0, 255) self.contents.draw_text(4, 4, 288, 32, actor.name, 1) self.contents.font.color = normal_color self.contents.draw_text(0, 0, 288, 32, actor.name, 1) self.contents.font.size = 22 draw_actor_class(actor, 16, 160) draw_actor_level(actor, 16, 128) draw_actor_state(actor, 16, 192) draw_actor_exp(actor, 0, 96) border = Bordo_Barra src_rect = Rect.new(0, 0, 102, 12) self.contents.blt(39, 71, border, src_rect) self.contents.blt(183, 71, border, src_rect) hp = Barra_HP sp = Barra_MP case Stile_Dissolvenza when 0 hp_percent = ((actor.hp.to_f / actor.maxhp.to_f) * 100).to_i dest_rect = Rect.new (40, 72, hp_percent, 10) self.contents.stretch_blt (dest_rect, hp, hp.rect) sp_percent = ((actor.sp.to_f / actor.maxsp.to_f) * 100).to_i dest_rect = Rect.new (184, 72, sp_percent, 10) self.contents.stretch_blt (dest_rect, sp, sp.rect) when 1 hp_percent = ((actor.hp.to_f / actor.maxhp.to_f) * 100).to_i src_rect = Rect.new (0, 0, hp_percent, 10) self.contents.blt (40, 72, hp, src_rect) sp_percent = ((actor.sp.to_f / actor.maxsp.to_f) * 100).to_i src_rect = Rect.new (0, 0, sp_percent, 10) self.contents.blt (184, 72, sp, src_rect) end draw_actor_hp(actor, 0, 48) draw_actor_sp(actor, 144, 48) draw_item_name($data_weapons[actor.weapon_id], 0, 224) draw_item_name($data_armors[actor.armor1_id], 0, 256) draw_item_name($data_armors[actor.armor2_id], 0, 288) draw_item_name($data_armors[actor.armor3_id], 0, 320) draw_item_name($data_armors[actor.armor4_id], 0, 352) end #-------------------------------------------------------------------------- # Dummy #-------------------------------------------------------------------------- def dummy self.contents.font.color = system_color self.contents.draw_text(0, 112, 96, 32, $data_system.words.weapon) self.contents.draw_text(0, 176, 96, 32, $data_system.words.armor1) self.contents.draw_text(0, 240, 96, 32, $data_system.words.armor2) self.contents.draw_text(0, 304, 96, 32, $data_system.words.armor3) self.contents.draw_text(0, 368, 96, 32, $data_system.words.armor4) draw_item_name($data_weapons[actor.weapon_id], 0, 144) draw_item_name($data_armors[actor.armor1_id], 0, 208) draw_item_name($data_armors[actor.armor2_id], 0, 272) draw_item_name($data_armors[actor.armor3_id], 0, 336) draw_item_name($data_armors[actor.armor4_id], 0, 400) end #-------------------------------------------------------------------------- # Cursor Rectangle Update #-------------------------------------------------------------------------- def update_cursor_rect if @index < 0 self.cursor_rect.empty else self.cursor_rect.set(0, @index * 116, self.width - 32, 96) end end end #============================================================================== # Scene_Menu #============================================================================== class Scene_Menu #-------------------------------------------------------------------------- # * Object Initialization # menu_index : command cursor's initial position #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Makes the Map appear in the background @spriteset = Spriteset_Map.new # Make command window s1 = "Inventario" s2 = "Abilità" s3 = "Equip" s4 = "Status" s5 = "Salva" s6 = "Esci" @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6], 1, 2) @command_window.index = @menu_index @command_window.y = 240 - @command_window.height / 2 @command_window.x = 80 # If number of party members is 0 if $game_party.actors.size == 0 # Disable items, skills, equipment, and status @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end # If save is forbidden if $game_system.save_disabled # Disable save @command_window.disable_item(4) end # Make status window @status_window = Window_MenuStatus.new # Make play time window @playtime_window = Window_PlayTime.new @playtime_window.x = 400 @playtime_window.y = 160 @playtime_window.opacity = 0 # Make gold window @gold_window = Window_Gold.new @gold_window.x = 400 @gold_window.y = 224 @gold_window.opacity = 0 # Execute transition 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 windows @command_window.dispose @playtime_window.dispose @spriteset.dispose @gold_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # Frame Update #-------------------------------------------------------------------------- def update # Update windows @command_window.update @playtime_window.update @spriteset.update @gold_window.update @status_window.update # If command window is active: call update_command if @command_window.active update_command return end # If status window is active: call update_status if @status_window.active update_status return end end #-------------------------------------------------------------------------- # Frame Update (Quando la finestra di comando è attiva) #-------------------------------------------------------------------------- def update_command # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to map screen $scene = Scene_Map.new return end # If C button was pressed if Input.trigger?(Input::C) # If command other than save or end game, and party members = 0 if $game_party.actors.size == 0 and @command_window.index < 4 # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Branch by command window cursor position case @command_window.index when 0 # Oggetti # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to item screen $scene = Scene_Item.new when 1 # Abilità # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to skill screen $scene = Scene_Skill.new when 2 # Equip # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to equip screen $scene = Scene_Equip.new when 3 # Status # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to status screen $scene = Scene_Status.new when 4 # Salva # If saving is forbidden if $game_system.save_disabled # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to save screen $scene = Scene_Save.new when 5 # Esci # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to end game screen $scene = Scene_End.new end return end end end Bugs e Conflitti Noti N/A Altri Dettagli La lavorazione sulle script è ferma...per ora. Quindi lascio a voi il piacere di migliorarlo, se volete. Spero vi sia utile come base da modificare opportunamente, adattandola a un vostro progetto. Edited April 28, 2013 by Dilos |FIRMA| http://img190.imageshack.us/img190/4826/pizzamannew.png Uomo Delle Pizze Uomo Misterioso http://img209.imageshack.us/img209/6190/dilos.jpg Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now