Bonjour ! J'ai fait un petit menu pour encore m'amélioré et enfète il est pas mal alors ... :
News ! :
• Version : 2 ▼ Corrections et ajouts :
~ Correction du bug pour la selection des héros, ~ Ajout du Statut (Poison etc...), ~ Suppression des deux classe "Command", ~ Disposition du script changé. ~ Ajout de la surclasse Window_Base ~ Ajout de la scene Skill ~ Ajout de la scène Equip ~ Ajout de la scene Objet
Image a ajouter :
A appeler "EXP" :
A appeler "HP" :
A appeler "MP" :
A appeler "Fond_barre" :
Les screens :
Spoiler:
Le script :
Spoiler:
Code:
#============================================================================== # ** Menu #------------------------------------------------------------------------------ # C'est un module pour la Scene_Menu. #==============================================================================
~ Correction du bug pour la selection des héros, ~ Ajout du Statut (Poison etc...), ~ Suppression des deux classe "Command", ~ Disposition du script changé. ~ Ajout de la surclasse Window_Base ~ Ajout de la scene Skill ~ Ajout de la scène Equip ~ Ajout de la scene Objet
# Appellez les images : HP, MP, EXP et fond_barre.
# ▼ Menu :
# "norm" = Les fenêtres sont normal, "transpa" = Les fenêtres sont transparentes, "inv" = Il n'y a plus de fenêtre : Transparence = "norm"
# Noms affichés sur la commande principal du menu : Item = "Objets" Skill = "Sorts" Equip = "Equipements" Status = "Statut" Save = "Sauvegarder" Game_end = "Quitter"
# Textes des Fenêtres Help : Text_Help1 = "Selection" Text_Help2 = "Statut"
# Icon qui affiche un sac d'or : Icon_or = 147
# Textes Diverses sur la fenêtre de statut : Class = "Classe" Life = "Vie" Magie = "Magie" Exp = "Experience"
# Image (true = avoir une image, false = ne pas avoir d'image) et son nom ( à mettre à la place de "nil") : IMG = false NOM_IMG = nil # Position x (position horizontal) de l'image : SpriteX = 0 # Position y (position vertical) de l'image : SpriteY = 0
# Textes indiquants les touches qui change de personnage : Prev = "<= Gauche" Next = "Droite =>"
end
#============================================================================== # ** Scene_Menu #------------------------------------------------------------------------------ # Cette classe permet d'avoir un écran de menu. #==============================================================================
class Scene_Menu < Scene_Base #-------------------------------------------------------------------------- # * Defintion de Initialize #-------------------------------------------------------------------------- def initialize(menu_index = 0, actor_index = 0) @menu_index = menu_index @actor_index = actor_index end #-------------------------------------------------------------------------- # * Defintion de Start #-------------------------------------------------------------------------- def start super if Menu::IMG == true @sprite = Sprite.new @sprite.bitmap = Cache.picture(Menu::NOM_IMG) @sprite.x = Menu::SpriteX @sprite.y = Menu::SpriteY else @fond_map = Spriteset_Map.new end create_command_window @gold_window = Window_Or.new @status_window = Window_Stats.new(0) @stats_help_window = Window_Help_Stats.new @selection_window = Window_Selection.new @selection_actor = Window_SActor.new(0, 224) if Menu::Transparence == "norm" @selection_actor.opacity = 400 end if Menu::Transparence == "transpa" @selection_actor.opacity = 100 end if Menu::Transparence == "inv" @selection_actor.opacity = 0 end end #-------------------------------------------------------------------------- # * Defintion de Terminate #-------------------------------------------------------------------------- def terminate super @stats_help_window.dispose @command_window.dispose @gold_window.dispose @selection_window.dispose @status_window.dispose @selection_actor.dispose if Menu::IMG == true @sprite.dispose else @fond_map.dispose end end #-------------------------------------------------------------------------- # * Defintion de Update #-------------------------------------------------------------------------- def update super if Menu::IMG == true @sprite.update else @fond_map.update end @command_window.update @gold_window.update @selection_actor.update @selection_window.update @stats_help_window.update @status_window.update if @command_window.active update_command_selection elsif @selection_actor.active update_actor_selection end end #-------------------------------------------------------------------------- # * Defintion de Create Command Window #-------------------------------------------------------------------------- def create_command_window s1 = Menu::Item s2 = Menu::Skill s3 = Menu::Equip s4 = Menu::Status s5 = Menu::Save s6 = Menu::Game_end @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index @command_window.x = 0 @command_window.y = 48 if Menu::Transparence == "norm" @command_window.opacity = 400 end if Menu::Transparence == "transpa" @command_window.opacity = 100 end if Menu::Transparence == "inv" @command_window.opacity = 0 end if $game_party.members.size == 0 @command_window.draw_item(0, false) @command_window.draw_item(1, false) @command_window.draw_item(2, false) @command_window.draw_item(3, false) end if $game_system.save_disabled @command_window.draw_item(4, false) end end #-------------------------------------------------------------------------- # * Defintion de Update Command Selection #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @command_window.index < 4 Sound.play_buzzer return elsif $game_system.save_disabled and @command_window.index == 4 Sound.play_buzzer return end Sound.play_decision case @command_window.index when 0 # Item $scene = Scene_Item.new when 1,2,3 # Skill, equipment, status start_actor_selection when 4 # Save $scene = Scene_File.new(true, false, false) when 5 $scene = Scene_End.new end end end #-------------------------------------------------------------------------- # * Defintion de Start Actor Selection #-------------------------------------------------------------------------- def start_actor_selection @command_window.active = false @selection_actor.active = true @selection_actor.visible = true if $game_party.last_actor_index < @selection_actor.item_max @selection_actor.index = $game_party.last_actor_index else @selection_actor.index = 0 end end #-------------------------------------------------------------------------- # * Defintion de End Actor Selection #-------------------------------------------------------------------------- def end_actor_selection @command_window.active = true @selection_actor.active = false @selection_actor.visible = false @selection_actor.index = -1 end #-------------------------------------------------------------------------- # * Defintion de Update Actor Selection #-------------------------------------------------------------------------- def update_actor_selection if Input.trigger?(Input::B) Sound.play_cancel end_actor_selection elsif Input.trigger?(Input::C) @status_window.visible = false @selection_actor.active = false @selection_actor.visible = false @command_window.active = true $game_party.last_actor_index = @selection_actor.index Sound.play_decision case @command_window.index when 1 # skill $scene = Scene_Skill.new(@selection_actor.index) when 2 # equipment $scene = Scene_Equip.new(@selection_actor.index) when 3 # status @status_window = Window_Stats.new(@selection_actor.index) end end end end
#============================================================================== # ** Window_Or #------------------------------------------------------------------------------ # Fenêtre qui affiche l'Argent. #============================================================================== class Window_Or < Window_Base #-------------------------------------------------------------------------- # * Defintion de Initialize #-------------------------------------------------------------------------- def initialize super(0, 352, 160, 64) refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end #-------------------------------------------------------------------------- # * Defintion de Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear self;contents.font.size = 18 draw_currency_value($game_party.gold, 4, 2, 120) draw_icon(Menu::Icon_or, 0, 2, true) end end
#============================================================================== # ** Window_Help_Stats #------------------------------------------------------------------------------ # Fenêtre qui affiche : "Statut : ". #============================================================================== class Window_Help_Stats < Window_Base #-------------------------------------------------------------------------- # * Defintion de Initialize #-------------------------------------------------------------------------- def initialize super (160, 0, 384, 48) refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end #-------------------------------------------------------------------------- # * Defintion de Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = knockout_color self.contents.draw_text(150, -5, 115, 24, Menu::Text_Help2+" "+":", 0) end end
#============================================================================== # ** Window_Selection #------------------------------------------------------------------------------ # Fenêtre qui affiche : "Selection : ". #============================================================================== class Window_Selection < Window_Base #-------------------------------------------------------------------------- # * Defintion de Initialize #-------------------------------------------------------------------------- def initialize super (0, 0, 160, 48) refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end #-------------------------------------------------------------------------- # * Defintion de Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = knockout_color self.contents.draw_text(15, -5, 115, 24, Menu::Text_Help1+" "+":", 0) end end
#============================================================================== # ** Window_SActor #------------------------------------------------------------------------------ # Fenêtre qui affiche la selection des Personnages. #============================================================================== class Window_SActor < Window_Selectable #-------------------------------------------------------------------------- # * Defintion de Initialize #-------------------------------------------------------------------------- def initialize(x, y) if $game_party.members.size == 4 super(x, y, 160, 128) elsif $game_party.members.size == 3 super(x, y, 160, 106) elsif $game_party.members.size == 2 super(x, y, 160, 80) elsif $game_party.members.size == 1 super(x, y, 160, 56) end self.active = false self.visible = false self.index = -1 refresh end #-------------------------------------------------------------------------- # * Defintion de Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.members.size for actor in $game_party.members x = 27 y = actor.index * 24 + (WLH / 2)+20 draw_character(actor.character_name, actor.character_index, x-15, y) draw_actor_name(actor, x, y-32) end end end
class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Defintion de Current Exp #-------------------------------------------------------------------------- def current_exp return (@exp - @exp_list[@level]) end #-------------------------------------------------------------------------- # * Defintion de Next Exp #-------------------------------------------------------------------------- def next_exp return (@exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0) end end
#============================================================================== # ** Window_Base #------------------------------------------------------------------------------ # C'est une surclasse de toute les fenêtres dans le jeu. #==============================================================================
class Window_Base < Window #-------------------------------------------------------------------------- # * Defintion de Draw Equipement #-------------------------------------------------------------------------- def draw_equipments(x, y) self.contents.font.size = 17 self.contents.font.color = system_color self.contents.draw_text(x, y, 120, WLH, Vocab::equip+" "+":") for i in 0..4 draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1)) end end #-------------------------------------------------------------------------- # * Defintion de Draw Actor HP #-------------------------------------------------------------------------- def draw_actor_hp_barre(actor, x, y, width = 120) fond = Cache.system("Fond_barre") barre = Cache.system("HP") self.contents.blt(x, y, fond, fond.rect) built = Rect.new(0, 0, fond.width * actor.hp / actor.maxhp, fond.height) self.contents.blt(x, y, barre, built) self.contents.font.size = 16 self.contents.font.color = knockout_color self.contents.font.color = hp_color(actor) xr = x + width if width < 120 self.contents.draw_text(xr - 44, y-2, 44, WLH, actor.hp, 2) else self.contents.draw_text(xr - 110, y-2, 44, WLH, actor.hp, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 60, y-2, 11, WLH, "/", 2)#55 self.contents.draw_text(xr - 55, y-2, 44, WLH, actor.maxhp, 2) end end #-------------------------------------------------------------------------- # * Defintion de Draw Actor MP #-------------------------------------------------------------------------- def draw_actor_mp_barre(actor, x, y, width = 120) fond = Cache.system("Fond_barre") barre = Cache.system("MP") self.contents.blt(x, y, fond, fond.rect) built = Rect.new(0, 0, fond.width * actor.mp / actor.maxmp, fond.height) self.contents.blt(x, y, barre, built) self.contents.font.size = 16 self.contents.font.color = knockout_color self.contents.font.color = hp_color(actor) xr = x + width if width < 120 self.contents.draw_text(xr - 44, y-2, 44, WLH, actor.mp, 2) else self.contents.draw_text(xr - 110, y-2, 44, WLH, actor.mp, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 60, y-2, 11, WLH, "/", 2) self.contents.draw_text(xr - 55, y-2, 44, WLH, actor.maxmp, 2) end end #-------------------------------------------------------------------------- # * Defintion de Draw Actor EXP gauge #-------------------------------------------------------------------------- def draw_actor_exp_barre(actor, x, y, width = 120) s1 = actor.current_exp s2 = actor.next_exp s3 = actor.next_rest_exp_s fond = Cache.system("Fond_barre") barre = Cache.system("EXP") self.contents.blt(x, y, fond, fond.rect) built = Rect.new(0, 0, fond.width * s1 / s2, fond.height) self.contents.blt(x, y, barre, built) end #-------------------------------------------------------------------------- # * Defintion de Draw Actor Class Loup #-------------------------------------------------------------------------- def draw_actor_class_loup(actor, x, y) self.contents.font.color = crisis_color self.contents.draw_text(x, y, 108, WLH, actor.class.name) end end
#============================================================================== # ** Scene_Skill #------------------------------------------------------------------------------ # Cette classe montre les sorts. #==============================================================================
class Scene_Skill < Scene_Base #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super create_menu_background @actor = $game_party.members[@actor_index] @viewport = Viewport.new(0, 0, 544, 416) @help_window = Window_Help.new @help_window.viewport = @viewport @status_window = Window_SkillStatus.new(272, 56, @actor) @status_window.viewport = @viewport @skill_window = Window_Skill.new(0, 56, 272, 360, @actor) @skill_window.viewport = @viewport @skill_window.help_window = @help_window @target_window = Window_MenuStatus.new(0, 0) hide_target_window end #-------------------------------------------------------------------------- # * Update Skill Selection #-------------------------------------------------------------------------- def update_skill_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::RIGHT) Sound.play_cursor next_actor elsif Input.trigger?(Input::LEFT) Sound.play_cursor prev_actor elsif Input.trigger?(Input::C) @skill = @skill_window.skill if @skill != nil @actor.last_skill_id = @skill.id end if @actor.skill_can_use?(@skill) Sound.play_decision determine_skill else Sound.play_buzzer end end end end #============================================================================== # ** Window_Skill #------------------------------------------------------------------------------ # This window displays a list of usable skills on the skill screen, etc. #==============================================================================
class Window_Skill < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization # x : window x-coordinate # y : window y-coordinate # width : window width # height : window height # actor : actor #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor) super(x, y, width, height) @actor = actor @column_max = 1 @row_max = 12 self.index = 0 refresh end #-------------------------------------------------------------------------- # * Get Skill #-------------------------------------------------------------------------- def skill return @data[self.index] end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh @data = [] for skill in @actor.skills @data.push(skill) if skill.id == @actor.last_skill_id self.index = @data.size - 1 end end @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) skill = @data[index] if skill != nil rect.width -= 4 enabled = @actor.skill_can_use?(skill) draw_item_name(skill, rect.x, rect.y, enabled) self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2) end end #-------------------------------------------------------------------------- # * Update Help Text #-------------------------------------------------------------------------- def update_help @help_window.set_text(skill == nil ? "" : skill.description) end end
#============================================================================== # ** Window_SkillStatus #------------------------------------------------------------------------------ # This window displays the skill user's status on the skill screen. #==============================================================================
class Window_SkillStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization # x : window X coordinate # y : window Y corrdinate # actor : actor #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y, 272, 360) @actor = actor refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.size = 18 draw_actor_name(@actor, 4, 0) self.contents.draw_text(74, 0, 115, 24, "|") draw_actor_class_loup(@actor, 84, 0) draw_actor_face(@actor, 0, 30) self.contents.font.size = 20 draw_actor_level(@actor, 14, 105) self.contents.font.size = 17 self.contents.font.color = knockout_color self.contents.draw_text(0, 130, 115, 24, "Vie"+" "+":") draw_actor_hp_barre(@actor, 0, 150) self.contents.font.color = system_color self.contents.draw_text(0, 180, 115, 24, "Magie"+" "+":") draw_actor_mp_barre(@actor, 0, 200) self.contents.font.color = power_up_color self.contents.draw_text(0, 230, 115, 24, "Experience"+" "+":") self.contents.font.color = normal_color self.contents.draw_text(50, 248, 115, 24, "Max") draw_actor_exp_barre(@actor, 0, 250) if @actor.next_exp > 0 self.contents.font.color = text_color(2) self.contents.font.size = 18 self.contents.draw_text(5, 300, 115, 24, Menu::Prev) self.contents.draw_text(165, 300, 115, 24, Menu::Next) end end
#============================================================================== # ** Scene_Equip #------------------------------------------------------------------------------ # This class performs the equipment screen processing. #==============================================================================
class Scene_Equip < Scene_Base #-------------------------------------------------------------------------- # * Constants #-------------------------------------------------------------------------- EQUIP_TYPE_MAX = 5 # Number of equip region #-------------------------------------------------------------------------- # * Object Initialization # actor_index : actor index # equip_index : equipment index #-------------------------------------------------------------------------- def initialize(actor_index = 0, equip_index = 0) @actor_index = actor_index @equip_index = equip_index end #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super create_menu_background @actor = $game_party.members[@actor_index] @help_window = Window_Help.new create_item_windows @equip_window = Window_Equip.new(252, 56, 292, 152, @actor) @equip_window.help_window = @help_window @equip_window.index = @equip_index @status_window = Window_EquipStatus.new(252, 208, 292, 208, @actor) end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super dispose_menu_background @help_window.dispose @equip_window.dispose @status_window.dispose dispose_item_windows end #-------------------------------------------------------------------------- # * Return to Original Screen #-------------------------------------------------------------------------- def return_scene $scene = Scene_Menu.new(2) end #-------------------------------------------------------------------------- # * Switch to Next Actor Screen #-------------------------------------------------------------------------- def next_actor @actor_index += 1 @actor_index %= $game_party.members.size $scene = Scene_Equip.new(@actor_index, @equip_window.index) end #-------------------------------------------------------------------------- # * Switch to Previous Actor Screen #-------------------------------------------------------------------------- def prev_actor @actor_index += $game_party.members.size - 1 @actor_index %= $game_party.members.size $scene = Scene_Equip.new(@actor_index, @equip_window.index) end #-------------------------------------------------------------------------- # * Update Frame #-------------------------------------------------------------------------- def update super update_menu_background @help_window.update update_equip_window update_status_window update_item_windows if @equip_window.active update_equip_selection elsif @item_window.active update_item_selection end end #-------------------------------------------------------------------------- # * Create Item Window #-------------------------------------------------------------------------- def create_item_windows @item_windows = [] for i in 0...EQUIP_TYPE_MAX @item_windows[i] = Window_EquipItem.new(0, 56, 252, 360, @actor, i)#(0, 208, 544, 208, @actor, i) @item_windows[i].help_window = @help_window @item_windows[i].visible = (@equip_index == i) @item_windows[i].y = 56#208 @item_windows[i].height = 360#208 @item_windows[i].active = false @item_windows[i].index = -1 @column_max = 1 @row_max = 8 end end #-------------------------------------------------------------------------- # * Dispose of Item Window #-------------------------------------------------------------------------- def dispose_item_windows for window in @item_windows window.dispose end end #-------------------------------------------------------------------------- # * Update Item Window #-------------------------------------------------------------------------- def update_item_windows for i in 0...EQUIP_TYPE_MAX @item_windows[i].visible = (@equip_window.index == i) @item_windows[i].update end @item_window = @item_windows[@equip_window.index] end #-------------------------------------------------------------------------- # * Update Equipment Window #-------------------------------------------------------------------------- def update_equip_window @equip_window.update end #-------------------------------------------------------------------------- # * Update Status Window #-------------------------------------------------------------------------- def update_status_window if @equip_window.active @status_window.set_new_parameters(nil, nil, nil, nil) elsif @item_window.active temp_actor = @actor.clone temp_actor.change_equip(@equip_window.index, @item_window.item, true) new_atk = temp_actor.atk new_def = temp_actor.def new_spi = temp_actor.spi new_agi = temp_actor.agi @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi) end @status_window.update end #-------------------------------------------------------------------------- # * Update Equip Region Selection #-------------------------------------------------------------------------- def update_equip_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::RIGHT) Sound.play_cursor next_actor elsif Input.trigger?(Input::LEFT) Sound.play_cursor prev_actor elsif Input.trigger?(Input::C) if @actor.fix_equipment Sound.play_buzzer else Sound.play_decision @equip_window.active = false @item_window.active = true @item_window.index = 0 end end end #-------------------------------------------------------------------------- # * Update Item Selection #-------------------------------------------------------------------------- def update_item_selection if Input.trigger?(Input::B) Sound.play_cancel @equip_window.active = true @item_window.active = false @item_window.index = -1 elsif Input.trigger?(Input::C) Sound.play_equip @actor.change_equip(@equip_window.index, @item_window.item) @equip_window.active = true @item_window.active = false @item_window.index = -1 @equip_window.refresh for item_window in @item_windows item_window.refresh end end end end
# Fentre en haut a droite #============================================================================== # ** Window_Equip #------------------------------------------------------------------------------ # This window displays items the actor is currently equipped with on the # equipment screen. #==============================================================================
class Window_Equip < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization # x : window X coordinate # y : window Y corrdinate # actor : actor #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor) super(x, y, width, height)# 336 @actor = actor refresh self.index = 0 end #-------------------------------------------------------------------------- # * Get Item #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear @data = [] for item in @actor.equips do @data.push(item) end @item_max = @data.size self.contents.font.color = system_color if @actor.two_swords_style self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1) self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2) else self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon) self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::armor1) end self.contents.draw_text(4, WLH * 2, 92, WLH, Vocab::armor2) self.contents.draw_text(4, WLH * 3, 92, WLH, Vocab::armor3) self.contents.draw_text(4, WLH * 4, 92, WLH, "Bijoux")#Vocab::armor4) draw_item_name(@data[0], 62, WLH * 0) # 92 draw_item_name(@data[1], 72, WLH * 1) draw_item_name(@data[2], 52, WLH * 2) draw_item_name(@data[3], 62, WLH * 3) draw_item_name(@data[4], 62, WLH * 4) end #-------------------------------------------------------------------------- # * Update Help Text #-------------------------------------------------------------------------- def update_help @help_window.set_text(item == nil ? "" : item.description) end end
#============================================================================== # ** Window_System #------------------------------------------------------------------------------ # This window displays a list of inventory items for the item screen, etc. #==============================================================================
class Window_System < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization # x : window x-coordinate # y : window y-coordinate # width : window width # height : window height #-------------------------------------------------------------------------- def initialize(x, y, width, height) super(x, y, width, height) @column_max = 1 @row_max = 8 self.index = 0 refresh end #-------------------------------------------------------------------------- # * Get Item #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # * Whether or not to include in item list # item : item #-------------------------------------------------------------------------- def include?(item) return false if item == nil if $game_temp.in_battle return false unless item.is_a?(RPG::Item) end return true end #-------------------------------------------------------------------------- # * Whether or not to display in enabled state # item : item #-------------------------------------------------------------------------- def enable?(item) return $game_party.item_can_use?(item) end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh @data = [] for item in $game_party.items next unless include?(item) @data.push(item) if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id self.index = @data.size - 1 end end @data.push(nil) if include?(nil) @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil number = $game_party.item_number(item) enabled = enable?(item) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enabled) self.contents.draw_text(rect, sprintf(":%2d", number), 2) end end #-------------------------------------------------------------------------- # * Update Help Text #-------------------------------------------------------------------------- def update_help @help_window.set_text(item == nil ? "" : item.description) end end
#============================================================================== # ** Window_EquipItem #------------------------------------------------------------------------------ # This window displays choices when opting to change equipment on the # equipment screen. #==============================================================================
class Window_EquipItem < Window_System #-------------------------------------------------------------------------- # * Object Initialization # x : sindow X coordinate # y : sindow Y corrdinate # width : sindow width # height : sindow height # actor : actor # equip_type : equip region (0-4) #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor, equip_type) @actor = actor if equip_type == 1 and actor.two_swords_style equip_type = 0 # Change shield to weapon end @equip_type = equip_type super(x, y, width, height) end #-------------------------------------------------------------------------- # * Whether to include item in list # item : item #-------------------------------------------------------------------------- def include?(item) return true if item == nil if @equip_type == 0 return false unless item.is_a?(RPG::Weapon) else return false unless item.is_a?(RPG::Armor) return false unless item.kind == @equip_type - 1 end return @actor.equippable?(item) end #-------------------------------------------------------------------------- # * Whether to display item in enabled state # item : item #-------------------------------------------------------------------------- def enable?(item) return true end end
#============================================================================== # ** Window_EquipStatus #------------------------------------------------------------------------------ # This window displays actor parameter changes on the equipment screen, etc. #==============================================================================
class Window_EquipStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization # x : window X coordinate # y : window Y corrdinate # actor : actor #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor) super(x, y, width, height) @actor = actor refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.size = 20 draw_actor_name(@actor, 30, 10) draw_parameter(0, WLH * 3, 0) draw_parameter(0, WLH * 4, 1) draw_parameter(0, WLH * 5, 2) draw_parameter(0, WLH * 6, 3) draw_actor_class_loup(@actor, 114, 10) draw_actor_graphic(@actor, 15, 35) self.contents.font.color = normal_color self.contents.draw_text(104, 10, 115, 24, "|") self.contents.font.color = text_color(2) self.contents.font.size = 18 self.contents.draw_text(0, 40, 115, 24, Menu::Prev) self.contents.draw_text(182, 40, 115, 24, Menu::Next) end #-------------------------------------------------------------------------- # * Set Parameters After Equipping # new_atk : attack after equipping # new_def : defense after equipping # new_spi : spirit after equipping # new_agi : agility after equipping #-------------------------------------------------------------------------- def set_new_parameters(new_atk, new_def, new_spi, new_agi) if @new_atk != new_atk or @new_def != new_def or @new_spi != new_spi or @new_agi != new_agi @new_atk = new_atk @new_def = new_def @new_spi = new_spi @new_agi = new_agi refresh end end #-------------------------------------------------------------------------- # * Get Post Equip Parameter Drawing Color # old_value : parameter before equipment change # new_value : parameter after equipment change #-------------------------------------------------------------------------- def new_parameter_color(old_value, new_value) if new_value > old_value # Get stronger return power_up_color elsif new_value == old_value # No change return normal_color else # Get weaker return power_down_color end end #-------------------------------------------------------------------------- # * Draw Parameters # x : draw spot x-coordinate # y : draw spot y-coordinate # type : type of parameter (0 - 3) #-------------------------------------------------------------------------- def draw_parameter(x, y, type) case type when 0 name = Vocab::atk value = @actor.atk new_value = @new_atk when 1 name = Vocab::def value = @actor.def new_value = @new_def when 2 name = Vocab::spi value = @actor.spi new_value = @new_spi when 3 name = Vocab::agi value = @actor.agi new_value = @new_agi end self.contents.font.color = system_color self.contents.draw_text(x + 4, y, 80, WLH, name) self.contents.font.color = normal_color self.contents.draw_text(x + 90, y, 30, WLH, value, 2) self.contents.font.color = system_color self.contents.draw_text(x + 122, y, 20, WLH, ">", 1) if new_value != nil self.contents.font.color = new_parameter_color(value, new_value) self.contents.draw_text(x + 142, y, 30, WLH, new_value, 2) end end end
#============================================================================== # ** Scene_Item #------------------------------------------------------------------------------ # This class performs the item screen processing. #==============================================================================
class Scene_Item < Scene_Base #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super create_menu_background @viewport = Viewport.new(0, 0, 544, 416) @help_window = Window_Information.new(0, 0, 544, 52) @help_window.viewport = @viewport @item_window = Window_Item.new(0, 52, 272, 364) @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.active = false @statut_win = Window_ItemStats.new(272, 52, 272, 364) @target_window = Window_MenuStatus.new(0, 0) hide_target_window end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super dispose_menu_background @viewport.dispose @help_window.dispose @item_window.dispose @target_window.dispose @statut_win.dispose end #-------------------------------------------------------------------------- # * Update Frame #-------------------------------------------------------------------------- def update super update_menu_background @statut_win.update @help_window.update @item_window.update @target_window.update if @item_window.active update_item_selection elsif @target_window.active update_target_selection end end end
#============================================================================== # ** Window_Help #------------------------------------------------------------------------------ # This window shows skill and item explanations along with actor status. #==============================================================================
class Window_Information < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(x, y, width, height) super(x, y, width, height) end #-------------------------------------------------------------------------- # * Set Text # text : character string displayed in window # align : alignment (0..flush left, 1..center, 2..flush right) #-------------------------------------------------------------------------- def set_text(text, align = 0) if text != @text or align != @align self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(4, 0, self.width - 40, WLH, text, align) @text = text @align = align end end end
#============================================================================== # ** Window_Item #------------------------------------------------------------------------------ # This window displays a list of inventory items for the item screen, etc. #==============================================================================
class Window_Item < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization # x : window x-coordinate # y : window y-coordinate # width : window width # height : window height #-------------------------------------------------------------------------- def initialize(x, y, width, height) super(x, y, width, height) @column_max = 1 @row_max = 12 self.index = 0 refresh end #-------------------------------------------------------------------------- # * Get Item #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # * Whether or not to include in item list # item : item #-------------------------------------------------------------------------- def include?(item) return false if item == nil if $game_temp.in_battle return false unless item.is_a?(RPG::Item) end return true end #-------------------------------------------------------------------------- # * Whether or not to display in enabled state # item : item #-------------------------------------------------------------------------- def enable?(item) return $game_party.item_can_use?(item) end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh @data = [] for item in $game_party.items next unless include?(item) @data.push(item) if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id self.index = @data.size - 1 end end @data.push(nil) if include?(nil) @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil number = $game_party.item_number(item) enabled = enable?(item) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enabled) self.contents.draw_text(rect, sprintf(":%2d", number), 2) end end #-------------------------------------------------------------------------- # * Update Help Text #-------------------------------------------------------------------------- def update_help @help_window.set_text(item == nil ? "" : item.description) end end
class Window_ItemStats < Window_Base #-------------------------------------------------------------------------- # * Object Initialization # x : window X coordinate # y : window Y coordinate #-------------------------------------------------------------------------- def initialize(x, y, width, height) super(x, y, width, height) refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.members.size for actor in $game_party.members self.contents.font.size = 20 draw_actor_graphic(actor, 15, actor.index * 90 + 55) x = 35 y = actor.index * 90 draw_actor_name(actor, 0, y) draw_actor_class(actor, x + 120, y) draw_actor_level(actor, 80, y) self.contents.font.size = 16 draw_actor_hp_barre(actor, x + 30, y + 20) draw_actor_mp_barre(actor, x + 30, y + 40) end end end
#============================================ # # Fin du script # #============================================
Merci good bye !!
Dernière édition par Loup-blanc le Lun 31 Oct 2011 - 17:11, édité 10 fois
Matsuo Kaito
Age : 33 Inscrit le : 27/06/2008 Messages : 10881
Sujet: Re: LoupMenu v2 (2) Sam 23 Avr 2011 - 9:00
Bon, je ne suis pas scripteur mais je vais donner mon avis =)
Graphiquement je trouve que c'est pas mal. Mais s'il y a plusieurs persos, qu'est-ce que ça fait ? On peut passer d'un à l'autre ? Comment ?
Seconde question : ton module est dans un script à part ? Ce qui signifie qu'il y a deux scripts à copier/coller ? Parce qu'il me semble qu'habituellement, c'est dans le script lui-même, au début ( et c'est quand même plus pratique ).
Dernière remarque : ce serait peut-être bien de descendre de quelques pixels "vie" ( et donc les autres, magie et exp ) pour ne pas que ce soit trop près de la face. Et peut-être essayer d'aligner "vie" et "équipement", en fait, histoire que ce soit plus organisé.
Sinon, merci du partage ! Je laisse quelqu'un s'y connaissant mieux en script que moi se charger de te donner des points ( sinon au pire, si personne ne passe, je le ferai ).
Loup-blanc
Poulet trizo Lv.3
Age : 28 Inscrit le : 04/02/2011 Messages : 47
Sujet: Re: LoupMenu v2 (2) Sam 23 Avr 2011 - 9:14
Bon alors pour la première question j'ai simplement modifié le menu statut pour que sa change de fenêtre de perso (je mettrais des screens) , pour la deuxième question peu importe on peut les mettre ensemble ou pas (moi je préfère séparé c'est plus claire) et sinon je vais modifié cela tout de suite ! Merci !
Edit : Screens ainsi que le script sont modifiés.
Dernière édition par Loup-blanc le Sam 23 Avr 2011 - 9:33, édité 1 fois
Zangther
Maître des Duels
Age : 32 Inscrit le : 29/07/2009 Messages : 7841
Sujet: Re: LoupMenu v2 (2) Sam 23 Avr 2011 - 9:26
Heh ben j'ai voulu tester, et j'ai eu un epic bug.
Qu'est ce que ça veut dire ça ? C'est simplement que tu prend le membre un, le membre deux, le membre trois et le membre quatre. Mais... Si y'a que le membre un ? PAF, ça bug !
C'est pour cela que je te conseille d'utiliser les boucles dans ce cas là.
party = [] for member in $game_party.members party.push(member, member.name) end @selection_actor = Window_Commandes.new(160, party)
Enfin, j'ai testé en changeant ce morceau de code et finalement ça buggue encore à un autre endroit.
Je te laisse débugger ton script. Si t'as besoin d'aide n'hésite pas à demander ^^ D'ailleurs, petite remarque, mets plutôt le module et le script ensemble. Ca évite aux non initiés de s'y perdre.
Zangther malgré tes conseilles, et malgré mes nombreux essais, je n'arrive pas à corrigé le bug, donc pour cela j'ai décidé de faire 4 versions, un edit sur ce message sera poster quand cela sera fait.
Merci.
Edit : Zanghter : Le problème c'est que je n'y arrive pas ! Donc en attendent voici les scripts :
#============================================ # # Module Menu # #============================================
#---------------------------------------------------------- module Menu #----------------------------------------------------------
# Appellez les images : HP, MP, EXP et fond_barre.
# "norm" = Les fenêtres sont normal, "transpa" = Les fenêtres sont transparentes, "inv" = Il n'y a plus de fenêtre : Transparence = "norm"
# Noms affichés sur la commande principal du menu : Item = "Objets" Skill = "Sorts" Equip = "Equipements" Status = "Statut" Save = "Sauvegarder" Game_end = "Quitter"
# Textes des Fenêtres Help : Text_Help1 = "Selection" Text_Help2 = "Statut"
# Icon qui affiche un sac d'or : Icon_or = 147
# Textes Diverses sur la fenêtre de statut : Class = "Classe" Life = "Vie" Magie = "Magie" Exp = "Experience"
# Image (true = avoir une image, false = ne pas avoir d'image) et son nom ( à mettre à la place de "nil") : IMG = false NOM_IMG = nil # Position x (position horizontal) de l'image : SpriteX = 0 # Position y (position vertical) de l'image : SpriteY = 0
# ~ Fin du module ! ~
end
#============================================ class Scene_Menu < Scene_Base #============================================
def terminate super @stats_help_window.dispose @command_window.dispose @gold_window.dispose @selection_window.dispose @status_window.dispose @selection_actor.dispose if Menu::IMG == true @sprite.dispose else @fond_map.dispose end end
def update super if Menu::IMG == true @sprite.update else @fond_map.update end @command_window.update @gold_window.update @selection_actor.update @selection_window.update @stats_help_window.update @status_window.update if @command_window.active update_command_selection elsif @selection_actor.active update_actor_selection elsif @window_end.active update_shoot_down end end
def create_command_window s1 = Menu::Item s2 = Menu::Skill s3 = Menu::Equip s4 = Menu::Status s5 = Menu::Save s6 = Menu::Game_end @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index @command_window.x = 0 @command_window.y = 48 if Menu::Transparence == "norm" @command_window.opacity = 400 end if Menu::Transparence == "transpa" @command_window.opacity = 100 end if Menu::Transparence == "inv" @command_window.opacity = 0 end if $game_party.members.size == 0 # If number of party members is 0 @command_window.draw_item(0, false) # Disable item @command_window.draw_item(1, false) # Disable skill @command_window.draw_item(2, false) # Disable equipment @command_window.draw_item(3, false) # Disable status end if $game_system.save_disabled # If save is forbidden @command_window.draw_item(4, false) # Disable save end end
def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @command_window.index < 4 Sound.play_buzzer return elsif $game_system.save_disabled and @command_window.index == 4 Sound.play_buzzer return end Sound.play_decision case @command_window.index when 0 # Item $scene = Scene_Item.new when 1,2,3 # Skill, equipment, status start_actor_selection when 4 # Save $scene = Scene_File.new(true, false, false) when 5 $scene = Scene_End.new end end end
def update_actor_selection if Input.trigger?(Input::B) Sound.play_cancel end_actor_selection elsif Input.trigger?(Input::C) @status_window.visible = false @selection_actor.active = false @selection_actor.visible = false $game_party.last_actor_index = @selection_actor.index Sound.play_decision case @command_window.index when 1 # skill $scene = Scene_Skill.new(@selection_actor.index) @command_window.active = true when 2 # equipment $scene = Scene_Equip.new(@selection_actor.index) @command_window.active = true when 3 # status @status_window = Window_Stats.new(@selection_actor.index) @command_window.active = true end end end end
# ~ Fin du script d'origine ! ~
#============================================ class Window_Selection < Window_Base #============================================ def initialize super (0, 0, 160, 48) refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end
#============================================ class Window_Or < Window_Base #============================================
def initialize super(0, 352, 160, 64) refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end
def draw_item_name(actor, x, y) #draw_icon(index, x, y, enabled) draw_character(actor.character_name, actor.character_index, x, y) end
def draw_character(character_name, character_index, x, y) return if character_name == nil bitmap = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign != nil and sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end n = character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) self.contents.blt(x, y, bitmap, src_rect)#(x - cw / 2, y - ch, bitmap, src_rect) end end
#============================================
# ~ Fin de la Fenêtre de Commande ! ~
#============================================ class Window_Help_Stats < Window_Base #============================================
def initialize super (160, 0, 384, 48) refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end
class Window_Stats < Window_Base def initialize(actor_index = 0) super (160, 48, 384, 368) @actor_index = actor_index refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end
def draw_equipments(x, y) self.contents.font.size = 17 self.contents.font.color = system_color self.contents.draw_text(x, y, 120, WLH, Vocab::equip+" "+":") for i in 0..4 draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1)) end end
def draw_actor_hp(actor, x, y, width = 120) self.contents.font.size = 16 self.contents.font.color = red_color self.contents.font.color = hp_color(actor) xr = x + width if width < 120 self.contents.draw_text(xr - 44, y, 44, WLH, actor.hp, 2) else self.contents.draw_text(xr - 110, y, 44, WLH, actor.hp, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 60, y, 11, WLH, "/", 2)#55 self.contents.draw_text(xr - 55, y, 44, WLH, actor.maxhp, 2) end end
def draw_actor_mp(actor, x, y, width = 120) self.contents.font.size = 16 self.contents.font.color = system_color self.contents.font.color = hp_color(actor) xr = x + width if width < 120 self.contents.draw_text(xr - 44, y, 44, WLH, actor.mp, 2) else self.contents.draw_text(xr - 110, y, 44, WLH, actor.mp, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 60, y, 11, WLH, "/", 2) self.contents.draw_text(xr - 55, y, 44, WLH, actor.maxmp, 2) end end
def draw_actor_hp_gauge(actor, x, y, width = 120) fond = Cache.system("Fond_barre") barre = Cache.system("HP") self.contents.blt(x, y, fond, fond.rect) built = Rect.new(0, 0, fond.width * actor.hp / actor.maxhp, fond.height) self.contents.blt(x, y, barre, built) end
def draw_actor_mp_gauge(actor, x, y, width = 120) fond = Cache.system("Fond_barre") barre = Cache.system("MP") self.contents.blt(x, y, fond, fond.rect) built = Rect.new(0, 0, fond.width * actor.mp / actor.maxmp, fond.height) self.contents.blt(x, y, barre, built) end
#============================================ # # Module Menu # #============================================
#---------------------------------------------------------- module Menu #----------------------------------------------------------
# Appellez les images : HP, MP, EXP et fond_barre.
# "norm" = Les fenêtres sont normal, "transpa" = Les fenêtres sont transparentes, "inv" = Il n'y a plus de fenêtre : Transparence = "norm"
# Noms affichés sur la commande principal du menu : Item = "Objets" Skill = "Sorts" Equip = "Equipements" Status = "Statut" Save = "Sauvegarder" Game_end = "Quitter"
# Textes des Fenêtres Help : Text_Help1 = "Selection" Text_Help2 = "Statut"
# Icon qui affiche un sac d'or : Icon_or = 147
# Textes Diverses sur la fenêtre de statut : Class = "Classe" Life = "Vie" Magie = "Magie" Exp = "Experience"
# Image (true = avoir une image, false = ne pas avoir d'image) et son nom ( à mettre à la place de "nil") : IMG = false NOM_IMG = nil # Position x (position horizontal) de l'image : SpriteX = 0 # Position y (position vertical) de l'image : SpriteY = 0
# ~ Fin du module ! ~
end
#============================================ class Scene_Menu < Scene_Base #============================================
def terminate super @stats_help_window.dispose @command_window.dispose @gold_window.dispose @selection_window.dispose @status_window.dispose @selection_actor.dispose if Menu::IMG == true @sprite.dispose else @fond_map.dispose end end
def update super if Menu::IMG == true @sprite.update else @fond_map.update end @command_window.update @gold_window.update @selection_actor.update @selection_window.update @stats_help_window.update @status_window.update if @command_window.active update_command_selection elsif @selection_actor.active update_actor_selection elsif @window_end.active update_shoot_down end end
def create_command_window s1 = Menu::Item s2 = Menu::Skill s3 = Menu::Equip s4 = Menu::Status s5 = Menu::Save s6 = Menu::Game_end @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index @command_window.x = 0 @command_window.y = 48 if Menu::Transparence == "norm" @command_window.opacity = 400 end if Menu::Transparence == "transpa" @command_window.opacity = 100 end if Menu::Transparence == "inv" @command_window.opacity = 0 end if $game_party.members.size == 0 # If number of party members is 0 @command_window.draw_item(0, false) # Disable item @command_window.draw_item(1, false) # Disable skill @command_window.draw_item(2, false) # Disable equipment @command_window.draw_item(3, false) # Disable status end if $game_system.save_disabled # If save is forbidden @command_window.draw_item(4, false) # Disable save end end
def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @command_window.index < 4 Sound.play_buzzer return elsif $game_system.save_disabled and @command_window.index == 4 Sound.play_buzzer return end Sound.play_decision case @command_window.index when 0 # Item $scene = Scene_Item.new when 1,2,3 # Skill, equipment, status start_actor_selection when 4 # Save $scene = Scene_File.new(true, false, false) when 5 $scene = Scene_End.new end end end
def update_actor_selection if Input.trigger?(Input::B) Sound.play_cancel end_actor_selection elsif Input.trigger?(Input::C) @status_window.visible = false @selection_actor.active = false @selection_actor.visible = false $game_party.last_actor_index = @selection_actor.index Sound.play_decision case @command_window.index when 1 # skill $scene = Scene_Skill.new(@selection_actor.index) @command_window.active = true when 2 # equipment $scene = Scene_Equip.new(@selection_actor.index) @command_window.active = true when 3 # status @status_window = Window_Stats.new(@selection_actor.index) @command_window.active = true end end end end
# ~ Fin du script d'origine ! ~
#============================================ class Window_Selection < Window_Base #============================================ def initialize super (0, 0, 160, 48) refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end
#============================================ class Window_Or < Window_Base #============================================
def initialize super(0, 352, 160, 64) refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end
def draw_item_name(actor, x, y) #draw_icon(index, x, y, enabled) draw_character(actor.character_name, actor.character_index, x, y) end
def draw_character(character_name, character_index, x, y) return if character_name == nil bitmap = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign != nil and sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end n = character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) self.contents.blt(x, y, bitmap, src_rect)#(x - cw / 2, y - ch, bitmap, src_rect) end end
#============================================
# ~ Fin de la Fenêtre de Commande ! ~
#============================================ class Window_Help_Stats < Window_Base #============================================
def initialize super (160, 0, 384, 48) refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end
class Window_Stats < Window_Base def initialize(actor_index = 0) super (160, 48, 384, 368) @actor_index = actor_index refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end
def draw_equipments(x, y) self.contents.font.size = 17 self.contents.font.color = system_color self.contents.draw_text(x, y, 120, WLH, Vocab::equip+" "+":") for i in 0..4 draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1)) end end
def draw_actor_hp(actor, x, y, width = 120) self.contents.font.size = 16 self.contents.font.color = red_color self.contents.font.color = hp_color(actor) xr = x + width if width < 120 self.contents.draw_text(xr - 44, y, 44, WLH, actor.hp, 2) else self.contents.draw_text(xr - 110, y, 44, WLH, actor.hp, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 60, y, 11, WLH, "/", 2)#55 self.contents.draw_text(xr - 55, y, 44, WLH, actor.maxhp, 2) end end
def draw_actor_mp(actor, x, y, width = 120) self.contents.font.size = 16 self.contents.font.color = system_color self.contents.font.color = hp_color(actor) xr = x + width if width < 120 self.contents.draw_text(xr - 44, y, 44, WLH, actor.mp, 2) else self.contents.draw_text(xr - 110, y, 44, WLH, actor.mp, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 60, y, 11, WLH, "/", 2) self.contents.draw_text(xr - 55, y, 44, WLH, actor.maxmp, 2) end end
def draw_actor_hp_gauge(actor, x, y, width = 120) fond = Cache.system("Fond_barre") barre = Cache.system("HP") self.contents.blt(x, y, fond, fond.rect) built = Rect.new(0, 0, fond.width * actor.hp / actor.maxhp, fond.height) self.contents.blt(x, y, barre, built) end
def draw_actor_mp_gauge(actor, x, y, width = 120) fond = Cache.system("Fond_barre") barre = Cache.system("MP") self.contents.blt(x, y, fond, fond.rect) built = Rect.new(0, 0, fond.width * actor.mp / actor.maxmp, fond.height) self.contents.blt(x, y, barre, built) end
#============================================ # # Module Menu # #============================================
#---------------------------------------------------------- module Menu #----------------------------------------------------------
# Appellez les images : HP, MP, EXP et fond_barre.
# "norm" = Les fenêtres sont normal, "transpa" = Les fenêtres sont transparentes, "inv" = Il n'y a plus de fenêtre : Transparence = "norm"
# Noms affichés sur la commande principal du menu : Item = "Objets" Skill = "Sorts" Equip = "Equipements" Status = "Statut" Save = "Sauvegarder" Game_end = "Quitter"
# Textes des Fenêtres Help : Text_Help1 = "Selection" Text_Help2 = "Statut"
# Icon qui affiche un sac d'or : Icon_or = 147
# Textes Diverses sur la fenêtre de statut : Class = "Classe" Life = "Vie" Magie = "Magie" Exp = "Experience"
# Image (true = avoir une image, false = ne pas avoir d'image) et son nom ( à mettre à la place de "nil") : IMG = false NOM_IMG = nil # Position x (position horizontal) de l'image : SpriteX = 0 # Position y (position vertical) de l'image : SpriteY = 0
# ~ Fin du module ! ~
end
#============================================ class Scene_Menu < Scene_Base #============================================
def terminate super @stats_help_window.dispose @command_window.dispose @gold_window.dispose @selection_window.dispose @status_window.dispose @selection_actor.dispose if Menu::IMG == true @sprite.dispose else @fond_map.dispose end end
def update super if Menu::IMG == true @sprite.update else @fond_map.update end @command_window.update @gold_window.update @selection_actor.update @selection_window.update @stats_help_window.update @status_window.update if @command_window.active update_command_selection elsif @selection_actor.active update_actor_selection elsif @window_end.active update_shoot_down end end
def create_command_window s1 = Menu::Item s2 = Menu::Skill s3 = Menu::Equip s4 = Menu::Status s5 = Menu::Save s6 = Menu::Game_end @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index @command_window.x = 0 @command_window.y = 48 if Menu::Transparence == "norm" @command_window.opacity = 400 end if Menu::Transparence == "transpa" @command_window.opacity = 100 end if Menu::Transparence == "inv" @command_window.opacity = 0 end if $game_party.members.size == 0 # If number of party members is 0 @command_window.draw_item(0, false) # Disable item @command_window.draw_item(1, false) # Disable skill @command_window.draw_item(2, false) # Disable equipment @command_window.draw_item(3, false) # Disable status end if $game_system.save_disabled # If save is forbidden @command_window.draw_item(4, false) # Disable save end end
def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @command_window.index < 4 Sound.play_buzzer return elsif $game_system.save_disabled and @command_window.index == 4 Sound.play_buzzer return end Sound.play_decision case @command_window.index when 0 # Item $scene = Scene_Item.new when 1,2,3 # Skill, equipment, status start_actor_selection when 4 # Save $scene = Scene_File.new(true, false, false) when 5 $scene = Scene_End.new end end end
def update_actor_selection if Input.trigger?(Input::B) Sound.play_cancel end_actor_selection elsif Input.trigger?(Input::C) @status_window.visible = false @selection_actor.active = false @selection_actor.visible = false $game_party.last_actor_index = @selection_actor.index Sound.play_decision case @command_window.index when 1 # skill $scene = Scene_Skill.new(@selection_actor.index) @command_window.active = true when 2 # equipment $scene = Scene_Equip.new(@selection_actor.index) @command_window.active = true when 3 # status @status_window = Window_Stats.new(@selection_actor.index) @command_window.active = true end end end end
# ~ Fin du script d'origine ! ~
#============================================ class Window_Selection < Window_Base #============================================ def initialize super (0, 0, 160, 48) refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end
#============================================ class Window_Or < Window_Base #============================================
def initialize super(0, 352, 160, 64) refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end
def draw_item_name(actor, x, y) #draw_icon(index, x, y, enabled) draw_character(actor.character_name, actor.character_index, x, y) end
def draw_character(character_name, character_index, x, y) return if character_name == nil bitmap = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign != nil and sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end n = character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) self.contents.blt(x, y, bitmap, src_rect)#(x - cw / 2, y - ch, bitmap, src_rect) end end
#============================================
# ~ Fin de la Fenêtre de Commande ! ~
#============================================ class Window_Help_Stats < Window_Base #============================================
def initialize super (160, 0, 384, 48) refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end
class Window_Stats < Window_Base def initialize(actor_index = 0) super (160, 48, 384, 368) @actor_index = actor_index refresh if Menu::Transparence == "norm" self.opacity = 400 end if Menu::Transparence == "transpa" self.opacity = 100 end if Menu::Transparence == "inv" self.opacity = 0 end end
def draw_equipments(x, y) self.contents.font.size = 17 self.contents.font.color = system_color self.contents.draw_text(x, y, 120, WLH, Vocab::equip+" "+":") for i in 0..4 draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1)) end end
def draw_actor_hp(actor, x, y, width = 120) self.contents.font.size = 16 self.contents.font.color = red_color self.contents.font.color = hp_color(actor) xr = x + width if width < 120 self.contents.draw_text(xr - 44, y, 44, WLH, actor.hp, 2) else self.contents.draw_text(xr - 110, y, 44, WLH, actor.hp, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 60, y, 11, WLH, "/", 2)#55 self.contents.draw_text(xr - 55, y, 44, WLH, actor.maxhp, 2) end end
def draw_actor_mp(actor, x, y, width = 120) self.contents.font.size = 16 self.contents.font.color = system_color self.contents.font.color = hp_color(actor) xr = x + width if width < 120 self.contents.draw_text(xr - 44, y, 44, WLH, actor.mp, 2) else self.contents.draw_text(xr - 110, y, 44, WLH, actor.mp, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 60, y, 11, WLH, "/", 2) self.contents.draw_text(xr - 55, y, 44, WLH, actor.maxmp, 2) end end
def draw_actor_hp_gauge(actor, x, y, width = 120) fond = Cache.system("Fond_barre") barre = Cache.system("HP") self.contents.blt(x, y, fond, fond.rect) built = Rect.new(0, 0, fond.width * actor.hp / actor.maxhp, fond.height) self.contents.blt(x, y, barre, built) end
def draw_actor_mp_gauge(actor, x, y, width = 120) fond = Cache.system("Fond_barre") barre = Cache.system("MP") self.contents.blt(x, y, fond, fond.rect) built = Rect.new(0, 0, fond.width * actor.mp / actor.maxmp, fond.height) self.contents.blt(x, y, barre, built) end
Imagine un jeu ou tu commence avec un seul perso et que tu gagne des membres de ton équipe au fur et à mesure ! Ca rendrait ton script obsolète et inutilisable.
Totalement d'accord avec Zang et c'est en corrigeant ses erreurs qu'on apprend mieux, inutile de faire X scripts de menu un seul menu propre suffit. Bon courage. =)
Cher maker j'ai corriger le bug je posterai le new script demain ou après demain car la je n'est pas le temps a+ Edit : zangther je nest pas encore poster le nouveau script car la mon internet ne marche pas (je suis sur tel) bref je ne sais pas quand je pourrai le poster Ps : jai modifier les scenes (item, skill ...)
Dernière édition par Loup-blanc le Ven 29 Avr 2011 - 18:42, édité 1 fois
Sujet: Re: LoupMenu v2 (2) Dim 12 Juin 2011 - 12:19
Enfete jai tester il faut mettre le script en dessous de tout les scripts et garder les scene d'origine. Sinon sa vien de toi une incompabilité peut etre a pluch !
J'adore ce menu. Je l'ai utilisé pour mon jeu. Chapeau ! Petit défaut : le statut quand on ouvre le menu, il n'y a que le premier personnage. Mais sinon, superbe !
Contenu sponsorisé
Sujet: Re: LoupMenu v2 (2)
LoupMenu v2 (2)
Page 1 sur 1
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum