創作內容

2 GP

[RMXP RGSS] 簡易的橫向動態戰鬥製作教學 part1 (190725更新)

作者:未来ずら│新 RPG 製作大師 XP 中文版│2019-07-13 17:56:00│巴幣:502│人氣:713
最近收到來信問咱要不要在巴哈小屋把在天空部落的橫向戰鬥教學文重發
想想或許還有人需要就來做吧,從這教學入門RM腳本也不錯


先感謝養樂多這位仁兄備份了失去的教學文
還有已故的ooxx工作室和6R的橫向戰鬥製作教學,本教學的基礎是來自這個

不過雖說有備份,不過到現在回頭看有挺多彆扭的地方
這次會用更乾淨的寫法,或許和以前相比會難一點


※注意※
1.這是RMXP的教學
2.改腳本請養成複製原本的到空白欄位修改的習慣
※因為解說方式的關係,會有同個方法被修改多次的情況,請直接使用最後一次的修改
3.善用Ctrl+F、Ctrl+Shift+F
4.請開個新專案用內建腳本來改,有使用其他腳本產生衝突這裡不負責
5.因為齒輪之城的網站炸了,RTAB的改法就沒了,抱歉

橫向化準備工作

輔助素材
把裡面的資料夾解壓到Graphics
內有一個戰鬥動畫、一個編輯畫面用的戰鬥圖、一個實際遊戲用的戰鬥分割圖



調整我方角色位置
既然是橫向戰鬥當然要先把配置改成橫的,敵人只要在"敵群"畫面調位置就好
我方角色就必須去改Game_Actorscreen_x、screen_y、screen_z三個方法,簡單列個範例:
  #--------------------------------------------------------------------------
  # ● 取得戰鬥畫面的 X 座標
  #--------------------------------------------------------------------------
  def screen_x
    if self.index != nil
      return self.index * 30 + 450
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # ● 取得戰鬥畫面的 Y 座標
  #--------------------------------------------------------------------------
  def screen_y
    return self.index * 30 + 230
  end
  #---------------------------------------------------------------------
  # ● 取得戰鬥畫面的 Z 座標
  #--------------------------------------------------------------------------
  def screen_z   
    if self.index != nil
      return self.index
    else
      return 0
    end
  end
self.index 表示我方隊伍的順序,0~3的數字


變更優先度、不透明度、Viewport
改完後發現打開技能窗變成這樣了,這是因為角色戰鬥圖優先度比其他視窗還大


原本教學會叫你去改各種視窗的z軸,不過現在發現有個更快(懶)的做法,等下說明
如果還是打算改z軸的話,大致上是Scene_Battle內的:
@skill_window (技能視窗)
@item_window (道具視窗)
@help_window (說明視窗)
@actor_command_window (角色命令窗)
@status_window  (狀態視窗)
@message_window (對話視窗)
@result_window (戰果結算視窗)

優先度改z、不透明度改opacity,像是:
# 把狀態窗的z改為9999、不透明度為0(即看不到視窗)
@status_window.z = 9999
@status_window.opacity = 0
記得這些修改都要在物件生成後(@xxx = XXX.new)才可以,不然會因為操作不存在的物件報錯




只是如果你改了狀態窗的不透明度接下來會發現變成了這樣:
狀態欄是漆黑一片的,原因有兩個:
1.背景本身就沒這麼大
2.腳本限制了背景的viewport(顯示範圍)大小

因為2的關係,就算換了張640x480的背景狀態欄那邊還是黑黑一塊
所以要先處理這問題

Spriteset_Battleinitialize中找到:
@viewport1 = Viewport.new(0, 0, 640, 320)
改成這樣:
@viewport1 = Viewport.new(0, 0, 640, 480)

然後還沒完,因為在update又有一段,這又會把背景圖顯示範圍改成640x320:
      @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
      @battleback_sprite.src_rect.set(0, 0, 640, 320)
我真的不太懂為什麼XP很堅持背景圖要鎖在640x320...
總之改成:
      @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
      @battleback_sprite.src_rect.set(0, 0, 640, 480)

(Sprite對象).src_rect.set 這個方法記下來,
這是設定對象圖片的顯示範圍,之後做動態會用到


接下來剛剛說不用改視窗優先度就能蓋過角色,怎麼做呢?
在上面那張圖有沒有注意到敵人被視窗蓋住了?回到Spriteset_Battleinitialize繼續往下看會發現:
    for enemy in $game_troop.enemies.reverse
      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
    end
這是在生成敵人的Sprite_Battler(即戰鬥圖Sprite,總之就是用來顯示戰鬥圖的物件),
然後對照角色的部分:
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))

知道接下來要幹嘛了嗎?沒錯,改那個viewport,變成:
    @actor_sprites.push(Sprite_Battler.new(@viewport1))
    @actor_sprites.push(Sprite_Battler.new(@viewport1))
    @actor_sprites.push(Sprite_Battler.new(@viewport1))
    @actor_sprites.push(Sprite_Battler.new(@viewport1))
這樣就不用特地去改視窗優先度了,
而且畫面震動等效果也會因此應用在我方角色上面(放在@viewport2就沒了),真是太好了



修正全畫面動畫位置
照上面修改之後會發現不論敵我方使用全畫面動畫一律是原本敵方對我方一樣顯示在狀態欄那邊
因為剛剛調整了@viewport1的大小,配合RPG::Spriteanimation_set_sprites產生這種結果

然後RPG::Sprite定義很特別,腳本編輯器是找不到的,但電子說明書有定義,就把我們要改的挖過來吧
module RPG
  class Sprite < ::Sprite
    def animation_set_sprites(sprites, cell_data, position)
      for i in 0..15
        sprite = sprites[i]
        pattern = cell_data[i, 0]
        if sprite == nil or pattern == nil or pattern == -1
          sprite.visible = false if sprite != nil
          next
        end
        sprite.visible = true
        sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
        if position == 3
          if self.viewport != nil
            sprite.x = self.viewport.rect.width / 2
            sprite.y = self.viewport.rect.height - 160
          else
            sprite.x = 320
            sprite.y = 240
          end
        else
          sprite.x = self.x - self.ox + self.src_rect.width / 2
          sprite.y = self.y - self.oy + self.src_rect.height / 2
          sprite.y -= self.src_rect.height / 4 if position == 0
          sprite.y += self.src_rect.height / 4 if position == 2
        end
        sprite.x += cell_data[i, 1]
        sprite.y += cell_data[i, 2]
        sprite.z = 2000
        sprite.ox = 96
        sprite.oy = 96
        sprite.zoom_x = cell_data[i, 3] / 100.0
        sprite.zoom_y = cell_data[i, 3] / 100.0
        sprite.angle = cell_data[i, 4]
        sprite.mirror = (cell_data[i, 5] == 1)
        sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
        sprite.blend_type = cell_data[i, 7]
      end
    end
  end
end

改成
module RPG
  class Sprite < ::Sprite
    def animation_set_sprites(sprites, cell_data, position)
      for i in 0..15
        sprite = sprites[i]
        pattern = cell_data[i, 0]
        if sprite == nil or pattern == nil or pattern == -1
          sprite.visible = false if sprite != nil
          next
        end
        sprite.visible = true
        sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
        # 全螢幕動畫的情況
        if position == 3
          if self.viewport != nil
            sprite.x = self.viewport.rect.width / 2
            sprite.y = self.viewport.rect.height - 320
          else
            sprite.x = 320
            sprite.y = 240
          end
        else
          sprite.x = self.x - self.ox + self.src_rect.width / 2
          sprite.y = self.y - self.oy + self.src_rect.height / 2
          sprite.y -= self.src_rect.height / 4 if position == 0
          sprite.y += self.src_rect.height / 4 if position == 2
        end
        sprite.x += cell_data[i, 1]
        sprite.y += cell_data[i, 2]
        sprite.z = 2000
        sprite.ox = 96
        sprite.oy = 96
        sprite.zoom_x = cell_data[i, 3] / 100.0
        sprite.zoom_y = cell_data[i, 3] / 100.0
        sprite.angle = cell_data[i, 4]
        sprite.mirror = (cell_data[i, 5] == 1)
        sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
        sprite.blend_type = cell_data[i, 7]
      end
    end
  end
end
其實就是把320>480的差值補上


反轉戰鬥動畫
這邊步驟多了點,
首先在Game_Temp增加一個變數來判斷要不要反轉動畫,例如animation_turn
class Game_Temp
  #--------------------------------------------------------------------------
  # ● 公開變數
  #--------------------------------------------------------------------------
  attr_accessor :animation_turn          #動畫反轉判定
  #--------------------------------------------------------------------------
  # ● 初始化物件
  #--------------------------------------------------------------------------
  alias :svb_animeturn :initialize
  def initialize
    svb_animeturn
   @animation_turn = false
  end
end

接著修改Scene_Battleupdate_phase4_step3update_phase4_step5
分別是使用方動畫以及顯示傷害的處理,
我們要讓敵方使用時反轉動畫、並在顯示傷害時關閉反轉功能
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 更新畫面 (主回合步驟 3 : 行動方動畫)
  #--------------------------------------------------------------------------
  alias :svb_update_phase4_step3 :update_phase4_step3
  def update_phase4_step3
    $game_temp.animation_turn = @active_battler.is_a?(Game_Enemy)
    svb_update_phase4_step3
  end
  #--------------------------------------------------------------------------
  # ● 更新畫面 (主回合步驟 5 : 顯示傷害)
  #--------------------------------------------------------------------------
  alias :svb_update_phase4_step5 :update_phase4_step5
  def update_phase4_step5
    svb_update_phase4_step5
    $game_temp.animation_turn = false
  end
end

最後再度修改RPG::Spriteanimation_set_sprites
module RPG
  class Sprite < ::Sprite
  #--------------------------------------------------------------------------
  # ● 處理動畫分割
  #--------------------------------------------------------------------------
    def animation_set_sprites(sprites, cell_data, position)
      for i in 0..15
        sprite = sprites[i]
        pattern = cell_data[i, 0]
        if sprite == nil or pattern == nil or pattern == -1
          sprite.visible = false if sprite != nil
          next
        end
        sprite.visible = true
        sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
        if position == 3
          if self.viewport != nil
            sprite.x = self.viewport.rect.width / 2
            sprite.y = self.viewport.rect.height - 320
          else
            sprite.x = 320
            sprite.y = 240
          end
        else
          sprite.x = self.x - self.ox + self.src_rect.width / 2
          sprite.y = self.y - self.oy + self.src_rect.height / 2
          sprite.y -= self.src_rect.height / 4 if position == 0
          sprite.y += self.src_rect.height / 4 if position == 2
        end
        # 反轉處理(x軸)
         if $game_temp.animation_turn
            sprite.x -= cell_data[i, 1]
         else
            sprite.x += cell_data[i, 1]
         end
        sprite.y += cell_data[i, 2]
        # 戰鬥中、而且非全畫面動畫時,動畫的Z軸等於作用對象的Z軸
        if position == 3  or !$game_temp.in_battle
          sprite.z = 2000
        else        
          sprite.z = self.battler.screen_z
        end
        sprite.ox = 96
        sprite.oy = 96
        sprite.zoom_x = cell_data[i, 3] / 100.0
        sprite.zoom_y = cell_data[i, 3] / 100.0
        # 反轉處理(角度、動畫本身的左右反轉)
        if $game_temp.animation_turn
          sprite.angle = (360 - cell_data[i, 4])
          sprite.mirror = (cell_data[i, 5] == 0)
        else
          sprite.angle = cell_data[i, 4]
          sprite.mirror = (cell_data[i, 5] == 1)
        end    
        # 如果旋轉角度在360度以上就減少360度避免多花處理時間      
        sprite.angle -= 360 if sprite.angle >= 360
        sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
        sprite.blend_type = cell_data[i, 7]
      end
    end
  end
end
這裡注意一下
狀態動畫也會透過animation_set_sprites處理,所以敵方攻擊時狀態動畫也會跟著反轉

為了避免這情形,我們要另外複製一份內建的方法,當然再從說明書copy一份過來也可以,
不過有更快的做法,就是別名
module RPG
  class Sprite < ::Sprite
    # 設定別名給原本的狀態動畫用
    alias :old_animation_set_sprites :animation_set_sprites unless method_defined?(:old_animation_set_sprites)
    #--------------------------------------------------------------------------
    # ● 處理動畫分割
    #--------------------------------------------------------------------------
    def animation_set_sprites(sprites, cell_data, position)
      for i in 0..15
        sprite = sprites[i]
        pattern = cell_data[i, 0]
        if sprite == nil or pattern == nil or pattern == -1
          sprite.visible = false if sprite != nil
          next
        end
        sprite.visible = true
        sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
        if position == 3
          if self.viewport != nil
            sprite.x = self.viewport.rect.width / 2
            sprite.y = self.viewport.rect.height - 320
          else
            sprite.x = 320
            sprite.y = 240
          end
        else
          sprite.x = self.x - self.ox + self.src_rect.width / 2
          sprite.y = self.y - self.oy + self.src_rect.height / 2
          sprite.y -= self.src_rect.height / 4 if position == 0
          sprite.y += self.src_rect.height / 4 if position == 2
        end
        # 反轉處理(x軸)
         if $game_temp.animation_turn
            sprite.x -= cell_data[i, 1]
         else
            sprite.x += cell_data[i, 1]
         end
        sprite.y += cell_data[i, 2]
        # 戰鬥中、而且非全畫面動畫時,動畫的Z軸等於作用對象的Z軸
        if position == 3  or !$game_temp.in_battle
          sprite.z = 2000
        else        
          sprite.z = self.battler.screen_z
        end
        sprite.ox = 96
        sprite.oy = 96
        sprite.zoom_x = cell_data[i, 3] / 100.0
        sprite.zoom_y = cell_data[i, 3] / 100.0
        # 反轉處理(角度、動畫本身的左右反轉)
        if $game_temp.animation_turn
          sprite.angle = (360 - cell_data[i, 4])
          sprite.mirror = (cell_data[i, 5] == 0)
        else
          sprite.angle = cell_data[i, 4]
          sprite.mirror = (cell_data[i, 5] == 1)
        end    
        # 如果旋轉角度在360度以上就減少360度避免多花處理時間      
        sprite.angle -= 360 if sprite.angle >= 360
        sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
        sprite.blend_type = cell_data[i, 7]
      end
    end
  end
end
注意使用別名的時機,要在修改內建定義前,不然就沒意義了
method_defined? 是用來迴避F12不會重新載入RPG::Sprite內建定義用的
嗯...有點難解釋,總之如果是給Sprite、Bitmap等不會顯示在腳本編輯器內(沒存在Scripts.rxdata)的方法設定別名,就要做這件事

設定好別名後,修改同個Classupdate_loop_animation,這個一樣要從說明書挖
    #--------------------------------------------------------------------------
    # ● 更新狀態動畫
    #--------------------------------------------------------------------------
    def update_loop_animation
      frame_index = @_loop_animation_index
      cell_data = @_loop_animation.frames[frame_index].cell_data
      position = @_loop_animation.position
      old_animation_set_sprites(@_loop_animation_sprites, cell_data, position) ########
      for timing in @_loop_animation.timings
        if timing.frame == frame_index
          animation_process_timing(timing, true)
        end
      end
    end


反轉敵人戰鬥圖
修改Sprite_Battlerinitialize
class Sprite_Battler < RPG::Sprite
  #--------------------------------------------------------------------------
  # ● 初始化物件
  #--------------------------------------------------------------------------
  alias :svb_initialize :initialize
  def initialize(viewport, battler = nil)
    svb_initialize(viewport, battler)
    self.mirror = battler.is_a?(Game_Enemy)
  end
end



給Game_Battler對象加上phase
Game_Battler就是敵我方角色,可以進行戰鬥的對象
為了能在適當的時機切換動作,需要加上個變數,這邊就命名成phase
class Game_Battler
  #--------------------------------------------------------------------------
  # ● 定義實例變數
  #--------------------------------------------------------------------------
  attr_accessor :phase                           # 戰鬥者回合
  #--------------------------------------------------------------------------
  # ● 初始化物件
  #--------------------------------------------------------------------------
  alias :svb_initialize :initialize
  def initialize
    svb_initialize
    @phase = 1                                     
  end
end

然後修改Scene_Battleupdate_phase4相關的方法
這是一個大型的處理,負責決定目前角色能不能行動、顯示使用方動畫、對象方動畫、顯示傷害、輪到下個角色行動等等

這裡要做的即是在對應的時機修改目前行動者phase變數
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 更新畫面 (主回合步驟 1 : 準備行動)
  #--------------------------------------------------------------------------
  alias :svb_update_phase4_step1 :update_phase4_step1
  def update_phase4_step1
    svb_update_phase4_step1
    @active_battler.phase = 2 if @active_battler  ########
  end
  #--------------------------------------------------------------------------
  # ● 更新畫面 (主回合步驟 2 : 開始行動)
  #--------------------------------------------------------------------------
  def update_phase4_step2
    # 如果不是強制行動
    unless @active_battler.current_action.forcing
      # 限制為 [敵人為普通攻擊] 或 [我方為普通攻擊] 的情況下
      if @active_battler.restriction == 2 or @active_battler.restriction == 3
        # 設定行動為攻擊
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 0
      end
      # 限制為 [不能行動] 的情況下
      if @active_battler.restriction == 4
        # 清除行動強制目標的戰鬥者
        $game_temp.forcing_battler = nil
        # 移至步驟 1
        @phase4_step = 1
        @active_battler.phase = 1 ########
        return
      end
    end
    # 清除目標戰鬥者
    @target_battlers = []
    # 行動種類分歧
    case @active_battler.current_action.kind
    when 0  # 基本
      make_basic_action_result
    when 1  # 技能
      make_skill_action_result
    when 2  # 物品
      make_item_action_result
    end
    # 移至步驟 3
    if @phase4_step == 2
      @phase4_step = 3
      @active_battler.phase = 3 ########
    end
  end
  #--------------------------------------------------------------------------
  # ● 產生基本行動結果
  #--------------------------------------------------------------------------
  def make_basic_action_result
    # 攻擊的情況下
    if @active_battler.current_action.basic == 0
      # 設定攻擊 ID
      @animation1_id = @active_battler.animation1_id
      @animation2_id = @active_battler.animation2_id
      # 行動方的戰鬥者是敵人的情況下
      if @active_battler.is_a?(Game_Enemy)
        if @active_battler.restriction == 3
          target = $game_troop.random_target_enemy
        elsif @active_battler.restriction == 2
          target = $game_party.random_target_actor
        else
          index = @active_battler.current_action.target_index
          target = $game_party.smooth_target_actor(index)
        end
      end
      # 行動方的戰鬥者是角色的情況下
      if @active_battler.is_a?(Game_Actor)
        if @active_battler.restriction == 3
          target = $game_party.random_target_actor
        elsif @active_battler.restriction == 2
          target = $game_troop.random_target_enemy
        else
          index = @active_battler.current_action.target_index
          target = $game_troop.smooth_target_enemy(index)
        end
      end
      # 設定對像方的戰鬥者序列
      @target_battlers = [target]
      # 套用通常攻擊效果 (移至phase5)
    #  for target in @target_battlers
      #  target.attack_effect(@active_battler)
    #  end
      return
    end
    # 防禦的情況下
    if @active_battler.current_action.basic == 1
      # 說明視窗顯示"防禦"
      @help_window.set_text($data_system.words.guard, 1)
      return
    end
    # 逃跑的情況下
    if @active_battler.is_a?(Game_Enemy) and
       @active_battler.current_action.basic == 2
      #  說明視窗顯示"逃跑"
      @help_window.set_text("逃跑", 1)
      # 逃跑
      @active_battler.escape
      return
    end
    # 什麼也不做的情況下
    if @active_battler.current_action.basic == 3
      # 清除強制行動目標的戰鬥者
      $game_temp.forcing_battler = nil
      # 移至步驟 1
      @phase4_step = 1
      @active_battler.phase = 1 ########
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 產生技能行動結果
  #--------------------------------------------------------------------------
  def make_skill_action_result
    # 獲取技能
    @skill = $data_skills[@active_battler.current_action.skill_id]
    # 如果不是強制行動
    unless @active_battler.current_action.forcing
      # 因為 SP 耗盡而無法使用的情況下
      unless @active_battler.skill_can_use?(@skill.id)
        # 清除強制行動對像的戰鬥者
        $game_temp.forcing_battler = nil
        # 移至步驟 1
        @phase4_step = 1
        @active_battler.phase = 1  #########
        return
      end
    end
    # 消耗 SP
    @active_battler.sp -= @skill.sp_cost
    # 更新狀態視窗
    @status_window.refresh
    # 在說明視窗顯示技能名稱
    @help_window.set_text(@skill.name, 1)
    # 設定動畫 ID
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # 設定公共事件 ID
    @common_event_id = @skill.common_event_id
    # 設定對像方戰鬥者
    set_target_battlers(@skill.scope)
    # 套用技能效果 (移至phase5)
  #  for target in @target_battlers
  #    target.skill_effect(@active_battler, @skill)
  #  end
  end
  #--------------------------------------------------------------------------
  # ● 產生物品行動結果
  #--------------------------------------------------------------------------
  def make_item_action_result
    # 獲取物品
    @item = $data_items[@active_battler.current_action.item_id]
    # 因為物品耗盡而無法使用的情況下
    unless $game_party.item_can_use?(@item.id)
      # 移至步驟 1
      @phase4_step = 1
      @active_battler.phase = 1  #########
      return
    end
    # 消耗品的情況下
    if @item.consumable
      # 使用的物品減 1
      $game_party.lose_item(@item.id, 1)
    end
    # 在說明視窗顯示物品名稱
    @help_window.set_text(@item.name, 1)
    # 設定動畫 ID
    @animation1_id = @item.animation1_id
    @animation2_id = @item.animation2_id
    # 設定公共事件 ID
    @common_event_id = @item.common_event_id
    # 確定對像
    index = @active_battler.current_action.target_index
    target = $game_party.smooth_target_actor(index)
    # 設定對像方戰鬥者
    set_target_battlers(@item.scope)
    # 套用物品效果(移至phase5)
#   for target in @target_battlers
   #   target.item_effect(@item)
  #  end
  end
  #--------------------------------------------------------------------------
  # ● 更新畫面 (主回合步驟 3 : 行動方動畫)
  #--------------------------------------------------------------------------
  alias :svb_update_phase4_step3 :update_phase4_step3
  def update_phase4_step3
    $game_temp.animation_turn = @active_battler.is_a?(Game_Enemy)
    svb_update_phase4_step3
    @active_battler.phase = 4
  end
  #--------------------------------------------------------------------------
  # ● 更新畫面 (主回合步驟 4 : 對像方動畫)
  #--------------------------------------------------------------------------
  alias :svb_update_phase4_step4 :update_phase4_step4
  def update_phase4_step4
     svb_update_phase4_step4
     @active_battler.phase = 5
  end
  #--------------------------------------------------------------------------
  # ● 更新畫面 (主回合步驟 5 : 顯示傷害)
  #--------------------------------------------------------------------------
  alias :svb_update_phase4_step5 :update_phase4_step5
  def update_phase4_step5
    case @active_battler.current_action.kind
    when 0  # 套用基本攻擊效果  
      if @active_battler.current_action.basic == 0
        for target in @target_battlers
          target.attack_effect(@active_battler)
        end
      end
    when 1 # 套用技能效果
      for target in @target_battlers
        target.skill_effect(@active_battler, @skill)
      end
    when 2 # 套用物品效果
       for target in @target_battlers
         target.item_effect(@item)
       end
    end  
    svb_update_phase4_step5
    @active_battler.phase = 6
    $game_temp.animation_turn = false
  end
  #--------------------------------------------------------------------------
  # ● 更新畫面 (主回合步驟 6 : 更新)
  #--------------------------------------------------------------------------
  alias :svb_update_phase4_step6 :update_phase4_step6
  def update_phase4_step6
    #這兩個內容設為無
    @skill = nil
    @item = nil
    @active_battler.phase = 1
    svb_update_phase4_step6
  end
end
注意update_phase4_step3update_phase4_step5這裡又改了一次,
要嘛把之前的剪到這裡改,要嘛刪掉前面改的

然後注意到原本在update_phase4_step2就進行的套用行動效果被移到update_phase4_step5
不這樣做到時會變成角色出手前就被附上/解除狀態


橫向化的準備工作差不多就到這邊,下一篇教怎麼製作角色動態部分



引用網址:https://home.gamer.com.tw/TrackBack.php?sn=4458940
All rights reserved. 版權所有,保留一切權利

相關創作

同標籤作品搜尋:RM|RGSS

留言共 1 篇留言

養樂多
來推一個(?)[e19]

07-21 18:15

未来ずら
謝大哥支援07-22 14:00
我要留言提醒:您尚未登入,請先登入再留言

2喜歡★qootm2 可決定是否刪除您的留言,請勿發表違反站規文字。

前一篇:[腳本進度] 按鍵設定... 後一篇:[RMXP RGSS] ...

追蹤私訊切換新版閱覽

作品資料夾

ilove487  
【讀墨】2023年台灣大眾小說人氣票選ーー《致一百光年外的你》名列候補!!看更多我要大聲說昨天16:00


face基於日前微軟官方表示 Internet Explorer 不再支援新的網路標準,可能無法使用新的應用程式來呈現網站內容,在瀏覽器支援度及網站安全性的雙重考量下,為了讓巴友們有更好的使用體驗,巴哈姆特即將於 2019年9月2日 停止支援 Internet Explorer 瀏覽器的頁面呈現和功能。
屆時建議您使用下述瀏覽器來瀏覽巴哈姆特:
。Google Chrome(推薦)
。Mozilla Firefox
。Microsoft Edge(Windows10以上的作業系統版本才可使用)

face我們了解您不想看到廣告的心情⋯ 若您願意支持巴哈姆特永續經營,請將 gamer.com.tw 加入廣告阻擋工具的白名單中,謝謝 !【教學】