Project1

标题: 怎么根据武器的不同 做不一样的技能 [打印本页]

作者: link756367658    时间: 2018-2-8 16:12
标题: 怎么根据武器的不同 做不一样的技能
例如我装备了手枪 只有手枪的技能   装备了散弹枪 只有散弹枪的技能
作者: 芯☆淡茹水    时间: 2018-2-8 16:38
学会习惯运用搜索:武器限制技能
作者: porlutia    时间: 2018-2-8 16:40
Sailcat的装备增强系统中有个 装备附带技能的模块
https://rpg.blue/thread-404129-1-2.html ←链接
https://rpg.blue/thread-403415-1-1.html ←上面脚本的依赖

作者: link756367658    时间: 2018-2-8 23:52
芯☆淡茹水 发表于 2018-2-8 16:38
学会习惯运用搜索:武器限制技能

里面的链接失效
作者: link756367658    时间: 2018-2-9 00:00
porlutia 发表于 2018-2-8 16:40
Sailcat的装备增强系统中有个 装备附带技能的模块
https://rpg.blue/thread-404129-1-2.html ←链接
https ...

没看太懂 有范例就好了
作者: 芯☆淡茹水    时间: 2018-2-9 06:55
本帖最后由 芯☆淡茹水 于 2018-2-9 07:35 编辑
link756367658 发表于 2018-2-8 23:52
里面的链接失效


你就不会变着法的自己搜么?! 武器技能,武器决定技能,,,,
坐等别人帮你搜?
作者: i_khaos    时间: 2018-2-9 13:52
本帖最后由 i_khaos 于 2018-2-10 01:44 编辑

如果你只是要弄個簡易版, VXAce 的默認功能就能做到。

1)
  角色同時有學手槍和散彈槍的技能,但分別歸在手槍類技能和散彈槍類技能,然後你設定武器時,把手槍類武器都放一個特徵下去,那特徵可以解鎖手槍類技能,而散彈槍類武器則能解鎖散彈槍類技能。

2)
  角色沒辦法直接學到手槍和散彈槍的技能,但你在設定武器時,手槍類武器附帶一個特徵,讓裝備者能學會手槍類技能,而散彈槍類武器則能讓角色學會散彈槍類技能。

  如果你要更複雜的設定,那可能就要用腳本了;如果你只需要比較簡易版的做法,那上頭那兩招或許能滿足你的需求。

  最後,如果默認功能就能達到你的目的,納建議你看一些基本教程;如果你要的功能需要外插腳本才能做到,那你得多善用搜尋功能。



────────────────────────────────────────────────

  我犯傻了,沒注意到這裏是 XP 區,真的很抱歉 orz
作者: porlutia    时间: 2018-2-9 15:57
link756367658 发表于 2018-2-9 00:00
没看太懂 有范例就好了

如果是你学会了手枪和散弹枪的技能,然后技能要依赖对应的武器(比如“子弹发射”技能只有装备了手枪才能使用;“散弹发射”技能只有装备了散弹枪才能使用)
那么 https://rpg.blue/thread-403718-1-1.html ←这个技能依赖脚本可以实现
假设 散弹枪武器的id是1 手枪的id是2  
那么 你就要在手枪技能的名字后面加上 #cq=[-2] 散弹枪技能名字后面加上 #cq=[-1]

如果是武器自带技能的话  
假设散弹发射技能的id是1  手枪子弹发射技能id是2
那么 你就在散弹枪名字后面加上 #qs=[1] 手枪名字后面加上#qs=[2]

没有测试过 不知道有没有用 是不是这么写  具体的 还是看看脚本里面怎么说比较好
作者: 文雅夕露    时间: 2018-2-10 19:34
RUBY 代码复制
  1. module RB
  2.   # 设置区域,设置的格式为:技能ID => [所需武器ID数组]
  3.   # 例如限制37号技能只有装备了1~4号武器才能发动,就写37 => [1, 2, 3, 4]
  4.   # 不同的设置项之间用','隔开,具体写法参照Hash写法
  5.   Skill_Weapon = {
  6.     57 => [1, 2, 3, 4],
  7.     58 => [5, 6, 7 ,8]
  8.   }
  9. end
  10. class Game_Battler
  11.   unless method_defined? :rb_skill_can_use_20150407
  12.     alias rb_skill_can_use_20150407 skill_can_use?
  13.     def skill_can_use?(skill_id)
  14.       if self.is_a?(Game_Actor) && RB::Skill_Weapon[skill_id] != nil && !RB::Skill_Weapon[skill_id].include?(self.weapon_id)
  15.         return false
  16.       end
  17.       return rb_skill_can_use_20150407(skill_id)
  18.     end
  19.   end
  20. end

简单实用的功能,别说楼主还看不懂备注哦。
作者: link756367658    时间: 2018-2-11 08:15
芯☆淡茹水 发表于 2018-2-9 06:55
你就不会变着法的自己搜么?! 武器技能,武器决定技能,,,,
坐等别人帮你搜? ...

想到了 还用问你?
作者: link756367658    时间: 2018-2-11 14:32
porlutia 发表于 2018-2-9 15:57
如果是你学会了手枪和散弹枪的技能,然后技能要依赖对应的武器(比如“子弹发射”技能只有装备了手枪才能 ...

# ▼▲▼ XRXS_BP 1. CP制導入 ver.1.12 ▼▲▼
# by 桜雅 在土, 和希, Jack-R

#==============================================================================
# ■ Scene_Battle_CP
#==============================================================================
class Scene_Battle_CP
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor   :stop                   # CP加算ストップ
  #----------------------------------------------------------------------------
  # ● オブジェクトの初期化
  #----------------------------------------------------------------------------
  def initialize
    @battlers = []
    @cancel = false
    @agi_total = 0
    # 配列 @count_battlers を初期化
    @count_battlers = []
    # エネミーを配列 @count_battlers に追加
    for enemy in $game_troop.enemies
      @count_battlers.push(enemy)
    end
    # アクターを配列 @count_battlers に追加
    for actor in $game_party.actors
      @count_battlers.push(actor)
    end
    for battler in @count_battlers
      @agi_total += battler.agi
    end
    for battler in @count_battlers
      battler.cp = [[65535 * (rand(15) + 85) / 100 * battler.agi / @agi_total * 4, 0].max, 65535].min
    end
  end
  #----------------------------------------------------------------------------
  # ● CPカウントの開始
  #----------------------------------------------------------------------------
  def start
    if @cp_thread != nil then
      return
    end
    @cancel = false
    @stop = false
    # ここからスレッド
    @cp_thread = Thread.new do
      while @cancel != true
        if @stop != true
          self.update # 更新
          sleep(0.05)
        end
      end
    end
    # ここまでスレッド
  end
  #----------------------------------------------------------------------------
  # ● CPカウントアップ
  #----------------------------------------------------------------------------
  def update
    if @count_battlers != nil then
      for battler in @count_battlers
        # 行動出来なければ無視
        if battler.dead? == true #or battler.movable? == false then
          battler.cp = 0
          next
        end
        # ここの 1.3を変えることで↓スピードを変更可能。ただし小数点は使用すること。
        battler.cp = [[battler.cp + 1.3 * 4096 * battler.agi / @agi_total, 0].max, 65535].min
      end
    end
  end
  #----------------------------------------------------------------------------
  # ● CPカウントの開始
  #----------------------------------------------------------------------------
  def stop
    @cancel = true
    if @cp_thread != nil then
      @cp_thread.join
      @cp_thread = nil
    end
  end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
  attr_accessor :now_guarding             # 現在防御中フラグ
  attr_accessor :cp                       # 現在CP
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化 initialize objects
  #--------------------------------------------------------------------------
  alias xrxs_bp1_initialize initialize
  def initialize
    @hate = 100  # init-value is 100
    @cp = 0
    @now_guarding = false
    xrxs_bp1_initialize
  end
  #--------------------------------------------------------------------------
  # ● コマンド入力可能判定
  #--------------------------------------------------------------------------
  def inputable?
    return (not @Hidden and restriction <= 1 and @cp >=65535)
  end
end
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor   :update_cp_only                   # CPメーターのみの更新
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias xrxs_bp1_initialize initialize
  def initialize
    @update_cp_only = false
    xrxs_bp1_initialize
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  alias xrxs_bp1_refresh refresh
  def refresh
    if @update_cp_only == false
      xrxs_bp1_refresh
    end
    for i in 0...$game_party.actors.size
      actor = $game_party.actors
      actor_x = i * 160
      draw_actor_cp_meter(actor, actor_x + 86, 73, 77, 0)
    end
  end
  #--------------------------------------------------------------------------
  # ● CPメーター の描画
  #--------------------------------------------------------------------------
  def draw_actor_cp_meter(actor, x, y, width = 156, type = 0)
    self.contents.font.color = system_color
    self.contents.fill_rect(x-8, y+27, width+2,6, Color.new(0, 0, 0, 255))
    if actor.cp == nil
      actor.cp = 0
    end
    w = width * [actor.cp,65535].min / 65535
    self.contents.fill_rect(x-7, y+28, w,1, Color.new(146, 245, 0, 255))
    self.contents.fill_rect(x-7, y+29, w,1, Color.new(186, 285, 0, 255))
    self.contents.fill_rect(x-7, y+30, w,1, Color.new(27, 99, 0, 255))
    self.contents.fill_rect(x-7, y+31, w,1, Color.new(27, 99, 0, 255))
  end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● バトル終了
  #     result : 結果 (0:勝利 1:敗北 2:逃走)
  #--------------------------------------------------------------------------
  alias xrxs_bp1_battle_end battle_end
  def battle_end(result)
    # CPカウント停止
    @cp_thread.stop
    xrxs_bp1_battle_end(result)
  end
  #--------------------------------------------------------------------------
  # ● プレバトルフェーズ開始
  #--------------------------------------------------------------------------
  alias xrxs_bp1_start_phase1 start_phase1
  def start_phase1
    @agi_total = 0
    @cp_thread = Scene_Battle_CP.new
    # アクターコマンドウィンドウを再作成
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, "逃跑"])
    @actor_command_window.y = 128
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    @actor_command_window.draw_item(4, $game_temp.battle_can_escape ? @actor_command_window.normal_color : @actor_command_window.disabled_color)
    xrxs_bp1_start_phase1
  end
  #--------------------------------------------------------------------------
  # ● パーティコマンドフェーズ開始
  #--------------------------------------------------------------------------
  alias xrxs_bp1_start_phase2 start_phase2
  def start_phase2
    xrxs_bp1_start_phase2
    @party_command_window.active = false
    @party_command_window.visible = false
    # 次へ
    start_phase3
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (パーティコマンドフェーズ)
  #--------------------------------------------------------------------------
  alias xrxs_bp1_update_phase2 update_phase2
  def update_phase2
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
      # パーティコマンドウィンドウのカーソル位置で分岐
      case @party_command_window.index
      when 0  # 戦う
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        @cp_thread.start
        # アクターコマンドフェーズ開始
        start_phase3
      end
      return
    end
    xrxs_bp1_update_phase2
  end
  #--------------------------------------------------------------------------
  # ● 次のアクターのコマンド入力へ
  #--------------------------------------------------------------------------
  def phase3_next_actor
    # ループ
    begin
      # アクターの明滅エフェクト OFF
      if @active_battler != nil
        @active_battler.blink = false
      end
      # 最後のアクターの場合
      if @actor_index == $game_party.actors.size-1
        # メインフェーズ開始
        @cp_thread.start
        start_phase4
        return
      end
      # アクターのインデックスを進める
      @actor_index += 1
      @active_battler = $game_party.actors[@actor_index]
      @active_battler.blink = true
      if @active_battler.inputable? == false
        @active_battler.current_action.kind = -1
      end
      # アクターがコマンド入力を受け付けない状態ならもう一度
    end until @active_battler.inputable?
    @cp_thread.stop
    # アクターコマンドウィンドウをセットアップ
    @active_battler.now_guarding = false
    phase3_setup_command_window
  end
  #--------------------------------------------------------------------------
  # ● 前のアクターのコマンド入力へ
  #--------------------------------------------------------------------------
  def phase3_prior_actor
    # ループ
    begin
      # アクターの明滅エフェクト OFF
      if @active_battler != nil
        @active_battler.blink = false
      end
      # 最初のアクターの場合
      if @actor_index == 0
        # 最初へ戻る
        start_phase3
        return
      end
      # アクターのインデックスを戻す
      @actor_index -= 1
      @active_battler = $game_party.actors[@actor_index]
      @active_battler.blink = true
      # アクターがコマンド入力を受け付けない状態ならもう一度
    end until @active_battler.inputable?
    @cp_thread.stop
    # アクターコマンドウィンドウをセットアップ
    @active_battler.now_guarding = false
    phase3_setup_command_window
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  #--------------------------------------------------------------------------
  alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  def update_phase3_basic_command
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
      # アクターコマンドウィンドウのカーソル位置で分岐
      case @actor_command_window.index
      when 4  # 逃げる
        if $game_temp.battle_can_escape
          # 決定 SE を演奏
          $game_system.se_play($data_system.decision_se)
          # アクションを設定
          @active_battler.current_action.kind = 0
          @active_battler.current_action.basic = 4
          # 次のアクターのコマンド入力へ
          phase3_next_actor
        else
          # ブザー SE を演奏
          $game_system.se_play($data_system.buzzer_se)
        end
        return
      end
    end
    xrxs_bsp1_update_phase3_basic_command
  end
  #--------------------------------------------------------------------------
  # ● メインフェーズ開始
  #--------------------------------------------------------------------------
  alias xrxs_bp1_start_phase4 start_phase4
  def start_phase4
    xrxs_bp1_start_phase4
    # エネミーアクション作成
    for enemy in $game_troop.enemies
      if enemy.cp < 65535
        enemy.current_action.clear
        enemy.current_action.kind = -1 # ターン飛ばし。
        next
      end
      enemy.make_action
    end
    # 行動順序作成
    make_action_orders
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  #--------------------------------------------------------------------------
  def update_phase4_step1
    # ヘルプウィンドウを隠す
    @help_window.visible = false
    # 勝敗判定
    if judge
      @cp_thread.stop
      # 勝利または敗北の場合 : メソッド終了
      return
    end
    # アクションを強制されているバトラーが存在しない場合
    if $game_temp.forcing_battler == nil
      # バトルイベントをセットアップ
      setup_battle_event
      # バトルイベント実行中の場合
      if $game_system.battle_interpreter.running?
        return
      end
    end
    # アクションを強制されているバトラーが存在する場合
    if $game_temp.forcing_battler != nil
      # 先頭に追加または移動
      @action_battlers.delete($game_temp.forcing_battler)
      @action_battlers.unshift($game_temp.forcing_battler)
    end
    # 未行動バトラーが存在しない場合 (全員行動した)
    if @action_battlers.size == 0
      # パーティコマンドフェーズ開始
      start_phase2
      return
    end
    # アニメーション ID およびコモンイベント ID を初期化
    @animation1_id = 0
    @animation2_id = 0
    @common_event_id = 0
    # 未行動バトラー配列の先頭からシフト
    @active_battler = @action_battlers.shift
    # すでに戦闘から外されている場合
    if @active_battler.index == nil
      return
    end
    # ステータスウィンドウをリフレッシュ
    # CPメーターの更新もここで行われる。
    @status_window.update_cp_only = true
    @status_window.refresh
    @status_window.update_cp_only = false
    # ステップ 2 に移行
    @phase4_step = 2
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  #--------------------------------------------------------------------------
  alias xrxs_bp1_update_phase4_step2 update_phase4_step2
  def update_phase4_step2
    # 強制アクションでなければ
    unless @active_battler.current_action.forcing
      # CPが足りていない場合
      if @active_battler.cp < 65535
        @phase4_step = 6
        return
      end
      # 制約が [行動できない] の場合
      if @active_battler.restriction == 4
        # アクション強制対象のバトラーをクリア
        $game_temp.forcing_battler = nil
        if @active_battler.cp >= 65535
          # ステート自然解除
          @active_battler.remove_states_auto
          # CP消費
          @active_battler.cp = [(@active_battler.cp - 65535),0].max
          # ステータスウィンドウをリフレッシュ
          @status_window.refresh
        end
        # ステップ 1 に移行
        @phase4_step = 1
        return
      end
    end
    # アクションの種別で分岐
    case @active_battler.current_action.kind
    when 0  # 基本
      @active_battler.cp -= 0 # 攻撃・防御・逃げる・何もしない時の共通消費CP
    when 1  # スキル
      @active_battler.cp -= 65535 # スキル使用時の消費CP
    when 2  # アイテム
      @active_battler.cp -= 65535 # アイテム使用時の消費CP
    when -1 # CPが溜まっていない
      @phase4_step = 6
      return
    end
    # CP加算を一時停止する
    @cp_thread.stop = true
    # ステート自然解除
    @active_battler.remove_states_auto
    xrxs_bp1_update_phase4_step2
  end
  #--------------------------------------------------------------------------
  # ● 基本アクション 結果作成
  #--------------------------------------------------------------------------
  alias xrxs_bp1_make_basic_action_result make_basic_action_result
  def make_basic_action_result
    # 攻撃の場合
    if @active_battler.current_action.basic == 0
      @active_battler.cp -= 65535 # 攻撃時のCP消費
    end
    # 防御の場合
    if @active_battler.current_action.basic == 1
      @active_battler.cp -= 32767 # 防御時のCP消費
    end
    # 敵の逃げるの場合
    if @active_battler.is_a?(Game_Enemy) and
       @active_battler.current_action.basic == 2
      @active_battler.cp -= 65535 # 逃走時のCP消費
    end
    # 何もしないの場合
    if @active_battler.current_action.basic == 3
      @active_battler.cp -= 32767 # 何もしない時のCP消費
    end
    # 逃げるの場合
    if @active_battler.current_action.basic == 4
      @active_battler.cp -= 65535 # 逃走時のCP消費
      # 逃走可能ではない場合
      if $game_temp.battle_can_escape == false
        # ブザー SE を演奏
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 決定 SE を演奏
      $game_system.se_play($data_system.decision_se)
      # 逃走処理
      update_phase2_escape
      return
    end
    xrxs_bp1_make_basic_action_result
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  #--------------------------------------------------------------------------
  alias xrxs_bp1_update_phase4_step5 update_phase4_step5
  def update_phase4_step5
    # スリップダメージ
    if @active_battler.hp > 0 and @active_battler.slip_damage?
      @active_battler.slip_damage_effect
      @active_battler.damage_pop = true
    end
    xrxs_bp1_update_phase4_step5
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  #--------------------------------------------------------------------------
  alias xrxs_bp1_update_phase4_step6 update_phase4_step6
  def update_phase4_step6
    # CP加算を再開する
    @cp_thread.stop = false
    xrxs_bp1_update_phase4_step6
  end
end





感觉和我的CP代码有冲突 我把这个删了 有些功能就好使了




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1