Elekami Fondateur
Messages postés : 19071 Date d'inscription : 19/07/2008 Jauge LPC :
| Sujet: [XP] Nouveau Menu Mar 21 Avr 2009 - 15:40 | |
| Voici un type de menu. Testé, il marche à merveille. Auteur: Squall Source: Rpg Créative Voici les 3 scripts à placer au-dessus de Main. Le premier, que vous devez nommer "Scene_Menu ": - Code:
-
#==============================================================================# # ? Scene_Menu # #------------------------------------------------------------------------------# # Replaces the DMS. Made by Squall webmaster@loeher.zzn.com # #==============================================================================#
class Scene_Menu #----------------------------------------------------------------------------# # ? initialize the Scene_Test # #----------------------------------------------------------------------------# def initialize(menu_index = 0, actor_index = 0, equip_index = 0) @menu_index = menu_index @actor_index = actor_index @equip_index = equip_index @from_skill = false @from_item = false @from_command = false end #----------------------------------------------------------------------------# # ? setup all the windows # #----------------------------------------------------------------------------# def main @actor = $game_party.actors[@actor_index]
s0 = $data_system.words.item s1 = $data_system.words.skill s2 = $data_system.words.equip s3 = "Equipe" s4 = "Sauvegarder" s5 = "Quitter" @command_window = Window_Command.new(160, [s0, s1, s2, s3, s4, s5]) @command_window.index = @menu_index @command_window.x = 480
@status_window = Window_MenuStatusMenu.new(@actor)
@equip_window = Window_EquipRightMenu.new(@actor) @equip_window.index = @equip_index
@skill_window = Window_SkillMenu.new(@actor)
@items_window = Window_ItemMenu.new
@item_window1 = Window_EquipItemMenu.new(@actor, 0) @item_window2 = Window_EquipItemMenu.new(@actor, 1) @item_window3 = Window_EquipItemMenu.new(@actor, 2) @item_window4 = Window_EquipItemMenu.new(@actor, 3) @item_window5 = Window_EquipItemMenu.new(@actor, 4)
@playtime_window = Window_PlayTime.new @playtime_window.x = 480 @playtime_window.y = 224
@steps_window = Window_Steps.new @steps_window.x = 480 @steps_window.y = 320
@gold_window = Window_Gold.new @gold_window.x = 480 @gold_window.y = 416
@target_window = Window_TargetMenu.new
refresh Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @command_window.dispose @status_window.dispose @equip_window.dispose @skill_window.dispose @items_window.dispose @item_window1.dispose @item_window2.dispose @item_window3.dispose @item_window4.dispose @item_window5.dispose @playtime_window.dispose @steps_window.dispose @gold_window.dispose @target_window.dispose end #----------------------------------------------------------------------------# # ? refresh windows when equipping items # #----------------------------------------------------------------------------# def refresh @item_window1.visible = (@equip_window.index == 0) @item_window2.visible = (@equip_window.index == 1) @item_window3.visible = (@equip_window.index == 2) @item_window4.visible = (@equip_window.index == 3) @item_window5.visible = (@equip_window.index == 4) item1 = @equip_window.item case @equip_window.index when 0 @item_window = @item_window1 when 1 @item_window = @item_window2 when 2 @item_window = @item_window3 when 3 @item_window = @item_window4 when 4 @item_window = @item_window5 end
if @equip_window.active @status_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil) end if @item_window.active item2 = @item_window.item last_hp = @actor.hp last_sp = @actor.sp @actor.equip(@equip_window.index, item2 == nil ? 0 : item2.id) new_atk = @actor.atk new_pdef = @actor.pdef new_mdef = @actor.mdef new_str = @actor.str new_dex = @actor.dex new_agi = @actor.agi new_int = @actor.int new_eva = @actor.eva @actor.equip(@equip_window.index, item1 == nil ? 0 : item1.id) @actor.hp = last_hp @actor.sp = last_sp @status_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int, new_eva) else unless @equip_window.active @item_window.visible = false end end end #----------------------------------------------------------------------------# # ? update Scene_Test # #----------------------------------------------------------------------------# def update @command_window.update @status_window.update @equip_window.update @skill_window.update @items_window.update @item_window1.update @item_window2.update @item_window3.update @item_window4.update @item_window5.update @playtime_window.update @steps_window.update @gold_window.update @target_window.update
refresh
if @command_window.active @equip_window.index = -1 update_command return end if @items_window.active update_items return end if @skill_window.active update_skill return end if @equip_window.active update_equip return end if @from_skill == true if @target_window.active update_target_skill return end elsif @from_item == true if @target_window.active update_target_item return end elsif @from_command == true if @target_window.active update_target_party return end end if @item_window != nil and @item_window.active update_itemequip return end end #----------------------------------------------------------------------------# # ? update the command window # #----------------------------------------------------------------------------# def update_command if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new return end
if Input.trigger?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) @actor_index += 1 @actor_index %= $game_party.actors.size $scene = Scene_Menu.new(0, @actor_index) return end
if Input.trigger?(Input::LEFT) $game_system.se_play($data_system.cursor_se) @actor_index += $game_party.actors.size - 1 @actor_index %= $game_party.actors.size $scene = Scene_Menu.new(0, @actor_index) return end
if Input.trigger?(Input::R) @skill_window.page_up @skill_window.index = -1 return end
if Input.trigger?(Input::L) @skill_window.page_down @skill_window.index = -1 return end
if Input.trigger?(Input::C) case @command_window.index when 0 $game_system.se_play($data_system.decision_se) @command_window.active = false @items_window.visible = true @items_window.active = true @items_window.index = 0 when 1 $game_system.se_play($data_system.decision_se) @command_window.active = false @skill_window.active = true @skill_window.index = 0 when 2 $game_system.se_play($data_system.decision_se) @command_window.active = false @equip_window.active = true @equip_window.index = 0 when 3 $game_system.se_play($data_system.decision_se) @target_window.active = true @target_window.visible = true @target_window.index = 0 @command_window.active = false @from_command = true when 4 if $game_system.save_disabled $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) $scene = Scene_Save.new when 5 $game_system.se_play($data_system.decision_se) $scene = Scene_End.new end return end end #----------------------------------------------------------------------------# # ? update the item window # #----------------------------------------------------------------------------# def update_items if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @items_window.visible = false @items_window.active = false @items_window.index = -1 return end
if Input.trigger?(Input::C) @item = @items_window.item unless @item.is_a?(RPG::Item) $game_system.se_play($data_system.buzzer_se) return end unless $game_party.item_can_use?(@item.id) $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) if @item.scope >= 3 @items_window.active = false @target_window.visible = true @target_window.active = true @from_item = true if @item.scope == 4 || @item.scope == 6 @target_window.index = -1 else @target_window.index = 0 end else if @item.common_event_id > 0 $game_temp.common_event_id = @item.common_event_id $game_system.se_play(@item.menu_se) if @item.consumable $game_party.lose_item(@item.id, 1) @items_window.draw_item(@item_window.index) end $scene = Scene_Map.new return end end return end end #----------------------------------------------------------------------------# # ? update the skill window # #----------------------------------------------------------------------------# def update_skill if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @skill_window.active = false @skill_window.index = -1 return end
if Input.trigger?(Input::C) @skill = @skill_window.skill if @skill == nil or not @actor.skill_can_use?(@skill.id) $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) if @skill.scope >= 3 @skill_window.active = false @target_window.visible = true @target_window.active = true @from_skill = true if @skill.scope == 4 || @skill.scope == 6 @target_window.index = -1 elsif @skill.scope == 7 @target_window.index = @actor_index - 10 else @target_window.index = 0 end else if @skill.common_event_id > 0 $game_temp.common_event_id = @skill.common_event_id $game_system.se_play(@skill.menu_se) @actor.sp -= @skill.sp_cost @status_window.refresh @skill_window.refresh @target_window.refresh $scene = Scene_Map.new return end end return end end #----------------------------------------------------------------------------# # ? update the equip window # #----------------------------------------------------------------------------# def update_equip if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @item_window.visible = false @equip_window.active = false @equip_window.index = -1 return end
if Input.trigger?(Input::C) if @actor.equip_fix?(@equip_window.index) $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) @equip_window.active = false @item_window.active = true @item_window.index = 0 return end end #----------------------------------------------------------------------------# # ? update the skill target window # #----------------------------------------------------------------------------# def update_target_skill if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @skill_window.active = true @target_window.active = false @target_window.visible = false @from_skill = false return end
if Input.trigger?(Input::C) unless @actor.skill_can_use?(@skill.id) $game_system.se_play($data_system.buzzer_se) return end if @target_window.index == -1 used = false for i in $game_party.actors used |= i.skill_effect(@actor, @skill) end end if @target_window.index <= -2 target = $game_party.actors[@target_window.index + 10] used = target.skill_effect(@actor, @skill) end if @target_window.index >= 0 target = $game_party.actors[@target_window.index] used = target.skill_effect(@actor, @skill) end if used $game_system.se_play(@skill.menu_se) @actor.sp -= @skill.sp_cost @status_window.refresh @skill_window.refresh @target_window.refresh if $game_party.all_dead? $scene = Scene_Gameover.new return end if @skill.common_event_id > 0 $game_temp.common_event_id = @skill.common_event_id $scene = Scene_Map.new return end end unless used $game_system.se_play($data_system.buzzer_se) end return end end #----------------------------------------------------------------------------# # ? update the item target window # #----------------------------------------------------------------------------# def update_target_item if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @items_window.active = true @target_window.active = false @target_window.visible = false @from_item = false return end
if Input.trigger?(Input::C) if $game_party.item_number(@item.id) == 0 $game_system.se_play($data_system.buzzer_se) return end if @target_window.index == -1 used = false for i in $game_party.actors used |= i.item_effect(@item) end end if @target_window.index >= 0 target = $game_party.actors[@target_window.index] used = target.item_effect(@item) end if used $game_system.se_play(@item.menu_se) if @item.consumable $game_party.lose_item(@item.id, 1) @items_window.draw_item(@items_window.index) end @target_window.refresh if $game_party.all_dead? $scene = Scene_Gameover.new return end if @item.common_event_id > 0 $game_temp.common_event_id = @item.common_event_id $scene = Scene_Map.new return end end unless used $game_system.se_play($data_system.buzzer_se) end return end end #----------------------------------------------------------------------------# # ? update the party target window # #----------------------------------------------------------------------------# def update_target_party if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @target_window.active = false @target_window.visible = false @from_command = false return end
if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $scene = Scene_Menu.new(3, @target_window.index) return end end #----------------------------------------------------------------------------# # ? update the item equip window # #----------------------------------------------------------------------------# def update_itemequip if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @equip_window.active = true @item_window.active = false @item_window.visible = false @item_window.index = -1 return end if Input.trigger?(Input::C) $game_system.se_play($data_system.equip_se) item = @item_window.item @actor.equip(@equip_window.index, item == nil ? 0 : item.id) @equip_window.active = true @item_window.active = false @item_window.visible = false @item_window.index = -1 @equip_window.refresh @item_window.refresh return end end end |
|
Elekami Fondateur
Messages postés : 19071 Date d'inscription : 19/07/2008 Jauge LPC :
| Sujet: Re: [XP] Nouveau Menu Mar 21 Avr 2009 - 16:09 | |
| Le second, à nommer " Window_ItemMenu ". Et le troisième, " Widow_EquipItem ". Je n'ai pas assez de place, donc je vous passe le lien Les deux autres scripts sur RPG Creative. |
|