查看: 3136|回复: 12

[已经解决] 即時的戰鬥腳本如何加入狀態變換頭像的指令?(已解決)

[复制链接]
梦石
0
星屑
399
在线时间
36 小时
注册时间
2017-11-9
回帖
16
发表于 2017-12-1 13:07:57 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 cht94512 于 2018-1-15 15:26 编辑

但沒有支緩把角色不同狀態以不同戰鬥圖顯示,例如攻擊時用生氣表情、受傷所以想請教一下如何在腳本加入這指令 (作為不懂RGSS的人試了多天也沒成功) ,感激不盡!!!!更新:
感謝下面的大大建議,在這裡上載了測試工程,希望有大神幫幫忙><
十分感謝!!!!

Project1.rar

438.19 KB, 下载次数: 83

梦石
0
星屑
399
在线时间
36 小时
注册时间
2017-11-9
回帖
16
 楼主| 发表于 2017-12-2 10:27:01 | 显示全部楼层
本帖最后由 cht94512 于 2017-12-5 11:50 编辑

補充,之前看到有專用作頭像變換的RGSS,但多番嘗試都接駁不能,在update更新開始就不懂得接駁回上面的腳本了。詳情在工程中可見。
回复

使用道具 举报

梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2017-12-4 09:50:00 | 显示全部楼层
没有大神理LZ呢..
建议传个测试用的工程方便大家研究..

点评

謝謝大大的建議。  发表于 2017-12-5 11:50
回复

使用道具 举报

梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2017-12-5 14:52:46 | 显示全部楼层
这工程就算没了头像变化..也会报错啊喂..

点评

所以他把两个战斗系统放在一起是想,玩什么..  发表于 2017-12-6 13:37
不,因為CIB戰鬥系統跟頭象變換是一起的,而即時戰鬥與以上兩個的作者是不同的,所以是CIB兩個戰鬥 VS 即時戰鬥這兩方有衝突。  发表于 2017-12-6 12:43
回复

使用道具 举报

梦石
0
星屑
399
在线时间
36 小时
注册时间
2017-11-9
回帖
16
 楼主| 发表于 2017-12-7 13:15:52 | 显示全部楼层
是這樣的,一個作者做了即時戰鬥的腳本,但沒有相應的頭像變換腳本,
而另一位作者做了一個改良非即時戰鬥的腳本(CIB戰鬥那個)而同時他做了頭像變換腳本可以連著戰鬥一起用,
我是想用即時戰鬥再加入頭像變換,但不知如何把現在的頭像變換腳本改成即時戰鬥可用。

点评

上传了脚本..勉强是能够变换头像..  发表于 2017-12-7 17:40
回复

使用道具 举报

梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2017-12-7 14:11:12 | 显示全部楼层
本帖最后由 soulsaga 于 2017-12-7 17:40 编辑
cht94512 发表于 2017-12-7 13:15
是這樣的,一個作者做了即時戰鬥的腳本,但沒有相應的頭像變換腳本,
而另一位作者做了一個改良非即時戰鬥 ...

CIB?不是CTB吗..
头像变换是依靠CTB脚本的....
我尽了努力..只能搞成这样..没法完全还原原来的效果..

即时战斗整合头像变换.zip

169.33 KB, 下载次数: 67

点评

是CTB,一直打錯了XDD  发表于 2017-12-7 22:05

评分

参与人数 2星屑 +80 赞 +2 收起 理由
RyanBern + 80 + 1 认可答案
cht94512 + 1 认可答案

查看全部评分

回复 2 0

使用道具 举报

梦石
0
星屑
399
在线时间
36 小时
注册时间
2017-11-9
回帖
16
 楼主| 发表于 2017-12-7 22:03:42 | 显示全部楼层
好強大!!!辛苦了,太感謝大大了!!!
現在攻擊時會轉頭象,但攻擊完直到下回合前都沒有變回正常,
我看看能不能自己修改一下做成原有效果@@
回复

使用道具 举报

梦石
0
星屑
399
在线时间
36 小时
注册时间
2017-11-9
回帖
16
 楼主| 发表于 2018-1-15 15:25:52 | 显示全部楼层
本帖最后由 cht94512 于 2018-1-15 15:34 编辑

在網上找到一個是可以做到這效果,而且與ACB不衝突的腳本。放在下方供有需要人士使用
----------------------------------------------------------------------------------------------------

[pre lang="ruby"]# ▼▲▼ No111. バトラーモーションXC. ver.3β ▼▲▼
#
# update 2006/10/22
#
#==============================================================================
# □ カスタマイズポイント
#==============================================================================
module NO111
  #
  # 「自動アニメ」頻度(低いほうが頻繁)
  #
  AUTO_FREQUENCY = 4
  #
  # 「自動アニメ」:自動的に下一桁を加算するモーションの配列
  #
  AUTO_UPDATES = [1,31,41,51,101,221,231,801,811,951]
  #
  # アニメを繰り返すモーションの配列
  #  (下一桁は1、1,2,3,4...8 の次に1, と繰り返します)
  #
  AUTO_LOOP = [1,41,51,101,221,231,801,811]
  #
  # 自動的に10加算して続行するモーション配列
  #  (951,952,953...と続き、958の次に961に移ります。)
  #
  AUTO_NEXT = [951]
  #
  # 初期モーションランダム
  #  ( 下一桁の1~8ランダム復帰を有効にします )
  #
  RANDOM_STARTUP = false
  #--------------------------------------------------------------------------
  # 基本フォーム
  #--------------------------------------------------------------------------
  #BASIC       =   1              # (固定)待機:基本
  #DOWN        =  91              # (固定)戦闘不能
  STEP3_ATTACK = 111              # 通常攻撃  :行動側アニメ時
  STEP4_ATTACK = 121              # 通常攻撃  :対象側アニメ時
  STEP3_GUARD  =  61              # 防御選択  :行動側アニメ時
  STEP4_GUARD  =  61              # 防御選択  :対象側アニメ時
  STEP3_ITEM   = 241              # アイテム使用:行動側アニメ時
  STEP4_ITEM   = 251              # アイテム使用:対象側アニメ時
  STEP4_DAMAGE =  71              # ダメージ受け
  STEP4_GUARD  =  61              # 攻撃を防御時
  STEP4_AVOID  =  51              # 回避時
  STEP4_HEALED = 151              # 回復受け時
  STEPS_ESCAPE = 901              # 逃げる
  WIN_ACTION   = 951              # 戦闘勝利時
  #--------------------------------------------------------------------------
  # スキル
  #--------------------------------------------------------------------------
  # スキル個別フォーム ハッシュ(優先)
  STEP3_SKILL_FORMS  = {56=>221}
  STEP4_SKILL_FORMS  = {56=>231}
  #
  STEP3_SKILL  = 201              # スキル(非魔法):行動側アニメ時
  STEP4_SKILL  = 211              # スキル(非魔法):対象側アニメ時
  STEP3_MAGIC  = 221              # スキル( 魔法 ):行動側アニメ時
  STEP4_MAGIC  = 231              # スキル( 魔法 ):対象側アニメ時
  STEP3_HEAL   = 261              # スキル( 回復 ):行動側アニメ時
  STEP4_HEAL   = 271              # スキル( 回復 ):対象側アニメ時
  #
  # 「回避」だと判断するダメージ表示文字列配列
  #
  AVOID_TEXT = ["Miss", "Guard!"]
  #
  # "回復スキル"であると判断するスキルのID 配列
  #
  HEAL_SKILL_IDS = [102,103]
  #--------------------------------------------------------------------------
  # ステート
  #--------------------------------------------------------------------------
  # マイナスステート 基本フォームID値
  MINUS_STATE_DEFAULT_FORM_ID = 81
  # 指定ステート個別フォームID ハッシュ(優先)
  STATE_FORMS = {2=>82, 3=>83, 4=>84, 5=>85, 6=>86, 7=>87, 8=>88}
  # マイナスステートであると判断するステートID配列
  MINUS_STATE_IDS = [1, 2, 3, 4, 5, 6, 7, 8]
  # モーション変更禁止ステート (石化など)
  FORM_FIX_STATES = [2, 7]
end
#==============================================================================
# RPG::Skill # 魔法スキルがどうか?
#==============================================================================
module RPG
  class Skill
    def is_a_magic?
      return (self.str_f < self.int_f)
    end
  end
end
#==============================================================================
# □ RPG_FileTest # バトラーグラフィックの有無
#==============================================================================
module RPG_FileTest
  def RPG_FileTest.battler_exist?(filename)
    return RPG::Cache.battler(filename, 0) rescue return false
  end
end
#==============================================================================
# --- フォーム 機構 ---
#==============================================================================
module XRXS_Forms
  def battler_name
    return @battler_motion_name == nil ? super : @battler_motion_name
  end
  attr_reader   :form_id
  def form_id=(id)
    @form_id = id
    # フォーム ID の変化に対応
    case @form_id
    when nil, 0, 1
      filename = nil
      exist    = true
    else
      filename = @battler_name + "_" + sprintf("%03d", self.form_id)
      exist    = RPG_FileTest.battler_exist?(filename)
    end
    @battler_motion_name = filename if exist
  end
end
class Game_Actor < Game_Battler
  include XRXS_Forms
end
class Game_Enemy < Game_Battler
  include XRXS_Forms
end
#==============================================================================
# --- 0番 非表示化 ---
#==============================================================================
class Game_Battler
  def visible
    return (self.form_id != 0)
  end
end
module XRXS_ZeroForm_Enhide
  def update
    super
    if @battler != nil
      self.visible = @battler.visible
    end
  end
end
class Sprite_Battler < RPG::Sprite
  include XRXS_ZeroForm_Enhide
end
#==============================================================================
# --- ランダムスタートアップ機能 ---
#==============================================================================
class Game_Temp
  def shift_random_start_id
    if @no111_randoms.nil? or @no111_randoms.empty?
      @no111_randoms = [1,2,3,4,5,6,7,8]
    end
    index = rand(@no111_randoms.size)
    return @no111_randoms.delete_at(index)
  end
end
#==============================================================================
# --- 基本待機フォームへのバトラーグラフィックの変更 ---
#==============================================================================
module XRXS_Forms
  attr_accessor :form_id_basic
end
class Game_Battler
  def transgraphic_basic_form
    # 基本を取得
    id = self.form_id_basic
    id = 1 if id == nil
    # 「自動アニメ」ならばランタムスタートアップ
    if NO111::RANDOM_STARTUP and NO111::AUTO_UPDATES.include?(form_id)
      id += $game_temp.shift_random_start_id - 1
    end
    # 戦闘不能時強制フォーム
    id = 91 if self.dead?
    # 設定
    self.form_id = id
  end
end
#==============================================================================
# --- マイナスステートによる基本フォームの変化 ---
#==============================================================================
module XRXS_Forms_MinusStates
  def add_state(state_id, force = false)
    super
    form_id_basic_refresh
  end
  def remove_state(state_id, force = false)
    super
    form_id_basic_refresh
  end
  def form_id_basic_refresh
    form_id = 1
    # ステート検索
    now_rate = 0
    for state_id in @states
      state_form_id = nil
      # レーティングを比較
      next if now_rate >= $data_states[state_id].rating
      # 優先指定フォーム
      id = NO111::STATE_FORMS[state_id]
      if id != nil
        state_form_id = id
      end
      # マイナスステート基本フォーム
      if id == nil and NO111::MINUS_STATE_IDS.include?(state_id)
        state_form_id = NO111::MINUS_STATE_DEFAULT_FORM_ID
      end
      # マイナスステートフォーム用ファイルが存在するかどうか判別
      if state_form_id != nil
        filename = @battler_name + "_" + sprintf("%03d", state_form_id)
        exist    = RPG_FileTest.battler_exist?(filename)
        if exist
          # ファイルが存在する場合のみ基本フォームに設定
          form_id  = state_form_id
          now_rate = $data_states[state_id].rating
        end
      end
    end
    self.form_id_basic = form_id
  end
end
class Game_Actor < Game_Battler
  include XRXS_Forms_MinusStates
end
class Game_Enemy < Game_Battler
  include XRXS_Forms_MinusStates
end
#==============================================================================
# --- ステート自然解除 にモーション連動 ---
#==============================================================================
class Game_Battler
  alias no111_remove_states_auto remove_states_auto
  def remove_states_auto
    no111_remove_states_auto
    self.transgraphic_basic_form
  end
end
#==============================================================================
# --- フォーム ID のフレーム更新 ---
#==============================================================================
module XRXS_TransForms
  def update_transform
    # 例外補正
    self.form_id = 1 if self.form_id == nil
    # ステップ更新
    if self.form_id != 0 and
       NO111::AUTO_UPDATES.include?(self.form_id/10 * 10 + 1)
      if self.form_id%10 == 8
        if NO111::AUTO_NEXT.include?(self.form_id - 7)
          self.form_id += 3
        elsif NO111::AUTO_LOOP.include?(self.form_id - 7)
          self.form_id -= 7
        end
      else
        self.form_id += 1
      end
    end
  end
end
class Game_Battler
  include XRXS_TransForms
end
#==============================================================================
# --- 91番 コラプス制御 ---
#==============================================================================
class Game_Battler
  def down_battler_graphic?
    # ファイル名の作成
    filename = @battler_name + "_" + sprintf("%03d", 91)
    # 有無チェック
    return RPG_FileTest.battler_exist?(filename)
  end
end
module NO111_CollapseBan
  def collapse
    super unless @battler.down_battler_graphic?
  end
end
class Sprite_Battler < RPG::Sprite
  include NO111_CollapseBan
  alias no111_update update
  def update
    no111_update
    return if @battler == nil
    if @battler.dead? and @battler.down_battler_graphic?
      self.opacity = 255
    end
  end
end
#==============================================================================
# --- ステート変化保持機構 ---
#==============================================================================
class Game_Battler
  attr_accessor :damage_states
  #--------------------------------------------------------------------------
  # ● 通常攻撃の効果適用
  #--------------------------------------------------------------------------
  alias attack_effect_damage_state attack_effect
  def attack_effect(attacker)
    last_states = self.states.dup
    attack_effect_damage_state(attacker)
    self.damage_states = self.states - last_states
  end
  #--------------------------------------------------------------------------
  # ● スキルの効果適用
  #--------------------------------------------------------------------------
  alias skill_effect_damage_state skill_effect
  def skill_effect(user, skill)
    last_states = self.states.dup
    skill_effect_damage_state(user, skill)
    self.damage_states = self.states - last_states
  end
  #--------------------------------------------------------------------------
  # ● アイテムの効果適用
  #--------------------------------------------------------------------------
  alias item_effect_damage_state item_effect
  def item_effect(item)
    last_states = self.states.dup
    item_effect_damage_state(item)
    self.damage_states = self.states - last_states
  end
end
#==============================================================================
# --- フォーム固定 ---
#==============================================================================
class Game_Battler
  def form_fixed?
    fixed = false
    for state_id in self.states
      fixed |= NO111::FORM_FIX_STATES.include?(state_id)
    end
    return fixed
  end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● メイン処理
  #--------------------------------------------------------------------------
  alias no111_main main
  def main
    # カウント初期化
    @wait_count_motion = 0
    # 呼び戻す
    no111_main
    # モーションを基本に戻す
    $game_party.actors.each{|actor| actor.form_id = nil }
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias no111_update update
  def update
    # 呼び戻す
    no111_update
    # ウェイトカウント待機
    if @wait_count_motion > 0
      @wait_count_motion -= 1
      return
    end
    # バトラーグラフィック表示更新
    for battler in $game_party.actors + $game_troop.enemies
      battler.update_transform
    end
    @wait_count_motion = NO111::AUTO_FREQUENCY
  end
  #--------------------------------------------------------------------------
  # ● プレバトルフェーズ開始
  #--------------------------------------------------------------------------
  alias no111_start_phase1 start_phase1
  def start_phase1
    no111_start_phase1
    # モーションをリセット
    actors_motion_reset
  end
  #--------------------------------------------------------------------------
  # ○ アクター達のモーションをリセット
  #--------------------------------------------------------------------------
  def actors_motion_reset
    for actor in $game_party.actors
      actor.transgraphic_basic_form
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
  #--------------------------------------------------------------------------
  alias no111_update_phase2_escape update_phase2_escape
  def update_phase2_escape
    # 呼び戻す
    no111_update_phase2_escape
    # 逃走成功
    unless $scene.is_a?(Scene_Battle)
      # 逃走モーション
      for actor in $game_party.actors
        if actor.movable?
          actor.form_id = NO111::STEPS_ESCAPE
        end
      end
      # 強制更新
      @spriteset.update
      Graphics.update
    end
  end
  #--------------------------------------------------------------------------
  # ● 勝敗判定
  #--------------------------------------------------------------------------
  alias no111_judge judge
  def judge
    bool = no111_judge
    if bool
      for battler in $game_party.actors
        if battler.dead? == false
          battler.form_id = NO111::WIN_ACTION
        end
      end
    end
    return bool
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  #--------------------------------------------------------------------------
  alias no111_update_phase4_step3 update_phase4_step3
  def update_phase4_step3
    # モーション:行動側のモーション
    # アクションの種別で分岐
    case @active_battler.current_action.kind
    when 0  # 基本
      # 攻撃の場合
      if @active_battler.current_action.basic == 0
        @active_battler.form_id = NO111::STEP3_ATTACK
      end
      # 防御の場合
      if @active_battler.current_action.basic == 1
        @active_battler.form_id = NO111::STEP3_GUARD
      end
      # 逃げるの場合
      if @active_battler.is_a?(Game_Enemy) and @active_battler.current_action.basic == 2
        @active_battler.form_id = NO111::STEPS_ESCAPE
      end
    when 1  # スキル時、魔法判別
      form_id = NO111::STEP3_SKILL_FORMS[@skill.id]
      if form_id != nil
        @active_battler.form_id = form_id
      elsif NO111::HEAL_SKILL_IDS.include?(@skill.id)
        @active_battler.form_id = NO111::STEP3_HEAL
      elsif @skill != nil and @skill.is_a_magic?
        @active_battler.form_id = NO111::STEP3_MAGIC
      else
        @active_battler.form_id = NO111::STEP3_SKILL
      end
    when 2  # アイテム
      @active_battler.form_id = NO111::STEP3_ITEM
    end
    # 戻す
    no111_update_phase4_step3
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  #--------------------------------------------------------------------------
  alias no111_update_phase4_step4 update_phase4_step4
  def update_phase4_step4
    # モーション:対象側のダメージ
    for target in @target_battlers
      # フォーム固定ステート
      next if target.form_fixed?
      #
      # 対象の反応
      #
      if NO111::AVOID_TEXT.include?(target.damage)
        # 回避表示がなされる場合
        target.form_id = NO111::STEP4_AVOID
      elsif (target.damage.is_a?(Numeric) and target.damage >= 0)
        #
        if target.guarding? or target.damage == 0
          # ガード
          target.form_id = NO111::STEP4_GUARD
        else
          # 通常ダメージ
          target.form_id = NO111::STEP4_DAMAGE
        end
      else
        # マイナスステートを検索
        minus_state = false
        if target.damage_states != nil
          for state_id in target.damage_states
            minus_state |= NO111::MINUS_STATE_IDS.include?(state_id)
          end
          target.damage_states.clear
        end
        if minus_state
          # マイナスステート
          target.form_id = NO111::STEP4_DAMAGE
        else
          # 回復受け
          target.form_id = NO111::STEP4_HEALED
        end
      end
    end
    # 自分自身のダメージ時は強制離脱
    if @active_battler.form_id == NO111::STEP4_DAMAGE
      return no111_update_phase4_step4
    end
    # モーション:行動側のモーション
    # アクションの種別で分岐
    case @active_battler.current_action.kind
    when 0  # 基本
      # 攻撃の場合
      if @active_battler.current_action.basic == 0
        @active_battler.form_id = NO111::STEP4_ATTACK
      end
      # 防御の場合
      if @active_battler.current_action.basic == 1
        @active_battler.form_id = NO111::STEP4_GUARD
      end
      # 逃げるの場合
      if @active_battler.is_a?(Game_Enemy) and @active_battler.current_action.basic == 2
        @active_battler.form_id = NO111::STEPS_ESCAPE
      end
    when 1  # スキル時、魔法判別
      form_id = NO111::STEP4_SKILL_FORMS[@skill.id]
      if form_id != nil
        @active_battler.form_id = form_id
      elsif NO111::HEAL_SKILL_IDS.include?(@skill.id)
        @active_battler.form_id = NO111::STEP4_HEAL
      elsif @skill != nil and @skill.is_a_magic?
        @active_battler.form_id = NO111::STEP4_MAGIC
      else
        @active_battler.form_id = NO111::STEP4_SKILL
      end
    when 2  # アイテム
      @active_battler.form_id = NO111::STEP4_ITEM
    end
    # 戻す
    no111_update_phase4_step4
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  #--------------------------------------------------------------------------
  alias no111_update_phase4_step6 update_phase4_step6
  def update_phase4_step6
    # 行動者のモーションのリセット
    @active_battler.transgraphic_basic_form
    # 対象のモーションリセット
    if @target_battlers != nil
      for target in @target_battlers
        target.transgraphic_basic_form
      end
    end
    # 呼び戻す
    no111_update_phase4_step6
  end
end[/pre]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部