Aventurier Lv.16
Age : 40 Inscrit le : 03/09/2009 Messages : 1503
| Sujet: [Résolu] Problème avec la fenêtre de combat Jeu 24 Mai 2012 - 17:35 | |
| Bonjour. Le script marche très bien, mais si je fais un event avec par exemple Personnage n°1 Forcer action: Attaque double sur cible aléatoire Le jeu plante, j'ai eu le droit à ce message d'erreur: - Spoiler:
La ligne qui pose problème: - Code:
-
@help_window.set_text(obj.name, 1) Dans cette partie: - Code:
-
#-------------------------------------------------------------------------- def pop_help(obj) return if obj.extension.include?("ヘルプ非表示") # @help_window.set_text(obj.name, 1) @help_window.visible = true update_back_sprite_help # end #-------------------------------------------------------------------------- Le script est un patch pour le SBS mais il marche très bien sur le système de base, le script: - Code:
-
#============================================================================== # ■ Scene_Battle Ver2.6 #------------------------------------------------------------------------------ # バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base
#-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- alias back_start start def start create_back_sprite_help create_back_sprite_item back_start end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super dispose_info_viewport @message_window.dispose @spriteset.dispose dispose_back_sprite_help dispose_back_sprite_item unless $scene.is_a?(Scene_Gameover) $scene = nil if $BTEST end end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- alias back_update update def update update_back_sprite_item update_back_sprite_help back_update end #-------------------------------------------------------------------------- # ● 戦闘行動の実行 : スキル ※再定義 #-------------------------------------------------------------------------- def execute_action_skill skill = @active_battler.action.skill # ATTACK_FAIL付与のスキルで不死身設定を分岐 if skill.plus_state_set.include?(1) for member in $game_party.members + $game_troop.members next if member.immortal next if member.dead? member.dying = true end else # 行動中に死なないようメンバー全員を不死身化 immortaling end # スキルコスト消費 return if @active_battler.consum_skill_cost(skill) == false # ターゲット決定 target_decision(skill) # アクション開始 @spriteset.set_action(@active_battler.actor?, @active_battler.index, skill.base_action) # ヘルプウインドウにスキル名表示 pop_help(skill) # アクション中 playing_action(skill) # コモンイベント取得 $game_temp.common_event_id = skill.common_event_id end #-------------------------------------------------------------------------- # ● アクション実行中 #-------------------------------------------------------------------------- def playing_action(skill = 0) loop do update_basic # アクティブバトラーに格納されているアクション情報を見る action = @active_battler.play next if action == 0 @active_battler.play = 0 if action[0] == "個別処理" individual elsif action == "Can Collapse" unimmortaling elsif action == "Cancel Action" break action_end elsif action == "End" break action_end elsif action[0] == "OBJ_ANIM" damage_action(action[1]) end end end #-------------------------------------------------------------------------- # ● ターゲット選択の開始 #-------------------------------------------------------------------------- def start_target_selection(actor = false) members = $game_party.members if actor members = $game_troop.members unless actor # カーソルスプライトの作成 @cursor = Sprite.new @cursor.bitmap = Cache.character("cursor") @cursor.src_rect.set(0, 0, 32, 32) @cursor_flame = 0 @cursor.x = -200 @cursor.y = -200 @cursor.ox = @cursor.width @cursor.oy = @cursor.height # ターゲット名を表示するヘルプウインドウを作成 @help_window.visible = false if @help_window != nil @help_window2 = Window_Help.new if @help_window2 == nil # 不要なウインドウを消す @actor_command_window.active = false @skill_window.visible = false if @skill_window != nil @item_window.visible = false if @item_window != nil # @skill_window.update if @skill_window != nil @item_window.update if @item_window != nil update_back_sprite_help update_back_sprite_item # # 存在しているターゲットで最も番号の低い対象を最初に指すように @index = 0 @max_index = members.size - 1 # アクターはATTACK_FAIL者でもターゲットできるようにエネミーと区別 unless actor members.size.times do break if members[@index].exist? @index += 1 end end @help_window2.set_text(members[@index].name, 1) select_member(actor) end #-------------------------------------------------------------------------- # ● 戦闘行動の実行 : GUARD_ATTACK ※再定義 #-------------------------------------------------------------------------- def execute_action_guard @help_window.set_text("Endurance", 1) @help_window.visible = true update_back_sprite_help # バトラーのアクティブ化を解除 @active_battler.active = false wait(45) @help_window.visible = false end #-------------------------------------------------------------------------- # ● ターゲット選択のEnd #-------------------------------------------------------------------------- def end_target_selection @actor_command_window.active = true if @actor_command_window.index == 0 and @limit_window == nil @skill_window.visible = true if @skill_window != nil @item_window.visible = true if @item_window != nil update_back_sprite_item update_back_sprite_help @cursor.dispose @cursor = nil if @help_window2 != nil @help_window2.dispose @help_window2 = nil end @help_window.visible = true if @help_window != nil end #-------------------------------------------------------------------------- # ● ヘルプウインドウの表示 #-------------------------------------------------------------------------- def pop_help(obj) return if obj.extension.include?("ヘルプ非表示") # @help_window.set_text(obj.name, 1) @help_window.visible = true update_back_sprite_help # end #-------------------------------------------------------------------------- # * Start Item Selection #-------------------------------------------------------------------------- def start_item_selection @help_window = Window_Help.new @item_window = Window_Item.new(136, 56, 272, 232) @item_window.help_window = @help_window @item_window.opacity = 255 @actor_command_window.active = false update_back_sprite_item end #-------------------------------------------------------------------------- # * Update Item Selection #-------------------------------------------------------------------------- def update_item_selection @item_window.active = true @item_window.update @help_window.update if Input.trigger?(Input::B) Sound.play_cancel end_item_selection elsif Input.trigger?(Input::C) @item = @item_window.item if @item != nil $game_party.last_item_id = @item.id end if $game_party.item_can_use?(@item) determine_item else Sound.play_buzzer end end end #-------------------------------------------------------------------------- # * Confirm Item #-------------------------------------------------------------------------- def determine_item @active_battler.action.set_item(@item.id) @item_window.active = false if @item.need_selection? Sound.play_cursor if @item.for_opponent? start_target_enemy_selection else start_target_actor_selection end else Sound.play_decision end_item_selection next_actor end end #-------------------------------------------------------------------------- # * Start Skill Selection #-------------------------------------------------------------------------- def start_skill_selection @help_window = Window_Help.new @skill_window = Window_Skill.new(136, 56, 272, 232, @active_battler)# @skill_window = Window_Skill.new(136, 56, 272, 232, @active_battler) @skill_window.help_window = @help_window @skill_window.opacity = 255 #### @actor_command_window.active = false #update_back_sprite_item end #-------------------------------------------------------------------------- # * Update Skill Selection #-------------------------------------------------------------------------- def update_skill_selection @skill_window.active = true @skill_window.update @help_window.update if Input.trigger?(Input::B) Sound.play_cancel end_skill_selection elsif Input.trigger?(Input::C) @skill = @skill_window.skill if @skill != nil @active_battler.last_skill_id = @skill.id end if @active_battler.skill_can_use?(@skill) determine_skill else Sound.play_buzzer end end end #-------------------------------------------------------------------------- # * Create Background Sprite Help #-------------------------------------------------------------------------- def create_back_sprite_help @back_sprite2 = Sprite.new @back_sprite2.bitmap = Cache.system("MessageBack") @back_sprite2.zoom_y = 0.3 @back_sprite2.y = 5 @back_sprite2.z = 40 @back_sprite2.opacity = 180 @back_sprite2.visible = false end #-------------------------------------------------------------------------- # * Dispose of Background Sprite Help #-------------------------------------------------------------------------- def dispose_back_sprite_help @back_sprite2.dispose end #-------------------------------------------------------------------------- # * Update Background Sprite Help #-------------------------------------------------------------------------- def update_back_sprite_help back_ok_1 = back_ok_2 = false if @help_window != nil if @help_window.visible back_ok_1 = true end end if @help_window2 != nil if @help_window2.visible back_ok_2 = true end end if back_ok_1 @help_window.opacity = 0 @back_sprite2.visible = true elsif back_ok_2 @help_window2.opacity = 0 @back_sprite2.visible = true else @back_sprite2.visible = false end @back_sprite2.update end #-------------------------------------------------------------------------- # * Create Background Sprite Item #-------------------------------------------------------------------------- def create_back_sprite_item @back_sprite_item = Sprite.new @back_sprite_item.bitmap = Cache.system("") @back_sprite_item.zoom_x = 0.5 @back_sprite_item.zoom_y = 1.5 @back_sprite_item.x = 134 @back_sprite_item.y = 55 @back_sprite_item.z = 40 @back_sprite_item.opacity = 180 @back_sprite_item.visible = false end #-------------------------------------------------------------------------- # * Dispose of Background Sprite Item #-------------------------------------------------------------------------- def dispose_back_sprite_item @back_sprite_item.dispose end #-------------------------------------------------------------------------- # * Update Background Sprite Item #-------------------------------------------------------------------------- def update_back_sprite_item back_ok_1 = back_ok_2 = false if @item_window != nil if @item_window.visible and @item_window.active back_ok_1 = true end end if @skill_window != nil if @skill_window.visible and @skill_window.active back_ok_2 = true end end if back_ok_1 or back_ok_2 @back_sprite_item.visible = true else @back_sprite_item.visible = false end @back_sprite_item.update end end Merci d'avance. ^^ EDIT: Bon bah finalement c'est bon. ^^ |
|