赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 3777 |
最后登录 | 2020-2-28 |
在线时间 | 82 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 143
- 在线时间
- 82 小时
- 注册时间
- 2015-5-15
- 帖子
- 40
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
RT,默认的连续技脚本是不能够判断是否学习过该技能的,我想增加这个条件。
例如:玩家释放技能1,如果学习了技能2的话则会通过连续技释放技能2否则不释放。
我看到脚本里面写道可以通过在技能上增加备注的方法,额外增加条件
- <连续技条件>
- 内容
- 内容
- </连续技条件>
- 为高级用户准备的功能,将"内容"替换为代码,设定连续技触发的各种条件.
复制代码
我想通过这个方法来实现但是我不会脚本,不知道该如何在备注里面书写
通过搜索我看到脚本里面有这么一个方法
- #--------------------------------------------------------------------------
- # ● 判定技能是否已经学会
- #--------------------------------------------------------------------------
- def skill_learn?(skill)
- skill.is_a?(RPG::Skill) && @skills.include?(skill.id)
- end
复制代码 但是我应该如何调用这个方法,如何传入参数?这个参数是一个对象还是技能ID还是什么?想问下我应该如何才能实现这个功能?
附YA 连续技脚本
- #==============================================================================
- #
- # ▼ Yanfly Engine Ace - 连续技 v1.01
- # -- 最后更新: 2012.02.12
- # -- 使用难度: 普通
- # -- 需要脚本: 无
- #
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported["YEA-FollowUpSkill"] = true
- #==============================================================================
- # ▼ Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2012.02.12 - Bug Fixed: Follow Up skills do not stack with multi-hits.
- # 2012.02.05 - Started Script and Finished.
- #
- #==============================================================================
- # ▼ 介绍
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 当技能成功命中后可以触发另一个技能,做到连续技的效果.
- #
- #==============================================================================
- # ▼ 安装方式
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
- # 脚本页/槽中.记得保存你的工程以使脚本生效.
- #
- # -----------------------------------------------------------------------------
- # 技能备注 - 在数据库-技能中可以使用的备注.
- # -----------------------------------------------------------------------------
- # <连续技 x>
- # 该技能命中成功后,100%会触发x号技能.
- #
- # <连续技 x: y%>
- # 该技能命中成功后,y%会触发x号技能.
- #
- # <连续技需要状态: x>
- # 如果该技能有连续技,则连续技施放的条件为:角色身上有x号状态.
- #
- # <连续技需要全部状态: a, b...>
- # 如果该技能有连续技,则连续技施放的条件为:角色身上有a、b...号状态.
- # 缺少任何一个状态都不会触发连续技.
- #
- # <连续技需要任意状态: a, b...>
- # 如果该技能有连续技,则连续技施放的条件为:角色身上有a、b...号状态中的任意一个.
- #
- # <连续技需要开关: x>
- # 如果该技能有连续技,则连续技施放的条件为:x号开关为开启状态.
- #
- # <连续技需要全部开关: a, b...>
- # 如果该技能有连续技,则连续技施放的条件为:a、b...号开关全部为开启状态.
- # 任何一个开关为关闭状态都不会触发连续技.
- #
- # <连续技需要任意开关: a, b...>
- # 如果该技能有连续技,则连续技施放的条件为:a、b...号开关中的任意一个为开启状态.
- #
- # <连续技条件>
- # 内容
- # 内容
- # </连续技条件>
- # 为高级用户准备的功能,将"内容"替换为代码,设定连续技触发的各种条件.
- # 缺少任何一个条件都不会触发连续技.
- #
- #==============================================================================
- # ▼ 兼容性
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
- #
- #==============================================================================
- # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
- # 所以编辑了后果自负。
- #==============================================================================
- module YEA
- module REGEXP
- module SKILL
-
- FOLLOWUP = /<(?:FOLLOW_UP|连续技)[ ](\d+)>/i
- FOLLOWUP_CHANCE = /<(?:FOLLOW_UP|连续技)[ ](\d+):[ ](\d+)([%%])>/i
- FOLLOWUP_STATES =
- /<(?:FOLLOW_UP_STATE|连续技需要状态):[ ](\d+(?:\s*,\s*\d+)*)>/i
- FOLLOWUP_ALL_STATES =
- /<(?:FOLLOW_UP_ALL_STATES|连续技需要全部状态):[ ](\d+(?:\s*,\s*\d+)*)>/i
- FOLLOWUP_ANY_STATES =
- /<(?:FOLLOW_UP_ANY_STATES|连续技需要任意状态):[ ](\d+(?:\s*,\s*\d+)*)>/i
- FOLLOWUP_SWITCH =
- /<(?:FOLLOW_UP_SWITCH|连续技需要开关):[ ](\d+(?:\s*,\s*\d+)*)>/i
- FOLLOWUP_ALL_SWITCH =
- /<(?:FOLLOW_UP_ALL_SWITCH|连续技需要全部开关):[ ](\d+(?:\s*,\s*\d+)*)>/i
- FOLLOWUP_ANY_SWITCH =
- /<(?:FOLLOW_UP_ANY_SWITCH|连续技需要任意开关):[ ](\d+(?:\s*,\s*\d+)*)>/i
- FOLLOWUP_EVAL_ON = /<(?:FOLLOW_UP_EVAL|连续技条件)>/i
- FOLLOWUP_EVAL_OFF = /<\/(?:FOLLOW_UP_EVAL|连续技条件)>/i
-
- end # SKILL
- end # REGEXP
- end # YEA
- #==============================================================================
- # ■ DataManager
- #==============================================================================
- module DataManager
-
- #--------------------------------------------------------------------------
- # alias method: load_database
- #--------------------------------------------------------------------------
- class <<self; alias load_database_fus load_database; end
- def self.load_database
- load_database_fus
- load_notetags_fus
- end
-
- #--------------------------------------------------------------------------
- # new method: load_notetags_fus
- #--------------------------------------------------------------------------
- def self.load_notetags_fus
- for obj in $data_skills
- next if obj.nil?
- obj.load_notetags_fus
- end
- end
-
- end # DataManager
- #==============================================================================
- # ■ RPG::BaseItem
- #==============================================================================
- class RPG::Skill < RPG::UsableItem
-
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :follow_up
- attr_accessor :follow_chance
- attr_accessor :follow_states_all
- attr_accessor :follow_states_any
- attr_accessor :follow_switch_all
- attr_accessor :follow_switch_any
- attr_accessor :follow_eval
-
- #--------------------------------------------------------------------------
- # common cache: load_notetags_fus
- #--------------------------------------------------------------------------
- def load_notetags_fus
- @follow_up = 0
- @follow_chance = 1.0
- @follow_states_all = []
- @follow_states_any = []
- @follow_switch_all = []
- @follow_switch_any = []
- @follow_eval = ""
- @follow_eval_on = false
- #---
- self.note.split(/[\r\n]+/).each { |line|
- case line
- #---
- when YEA::REGEXP::SKILL::FOLLOWUP
- @follow_up = $1.to_i
- @follow_chance = 1.0
- when YEA::REGEXP::SKILL::FOLLOWUP_CHANCE
- @follow_up = $1.to_i
- @follow_chance = $2.to_i * 0.01
- #---
- when YEA::REGEXP::SKILL::FOLLOWUP_STATES
- $1.scan(/\d+/).each { |num|
- @follow_states_all.push(num.to_i) if num.to_i > 0 }
- when YEA::REGEXP::SKILL::FOLLOWUP_ALL_STATES
- $1.scan(/\d+/).each { |num|
- @follow_states_all.push(num.to_i) if num.to_i > 0 }
- when YEA::REGEXP::SKILL::FOLLOWUP_ANY_STATES
- $1.scan(/\d+/).each { |num|
- @follow_states_any.push(num.to_i) if num.to_i > 0 }
- #---
- when YEA::REGEXP::SKILL::FOLLOWUP_SWITCH
- $1.scan(/\d+/).each { |num|
- @follow_switch_all.push(num.to_i) if num.to_i > 0 }
- when YEA::REGEXP::SKILL::FOLLOWUP_ALL_SWITCH
- $1.scan(/\d+/).each { |num|
- @follow_switch_all.push(num.to_i) if num.to_i > 0 }
- when YEA::REGEXP::SKILL::FOLLOWUP_ANY_SWITCH
- $1.scan(/\d+/).each { |num|
- @follow_switch_any.push(num.to_i) if num.to_i > 0 }
- #---
- when YEA::REGEXP::SKILL::FOLLOWUP_EVAL_ON
- @follow_eval_on = true
- when YEA::REGEXP::SKILL::FOLLOWUP_EVAL_OFF
- @follow_eval_off = false
- #---
- else
- @follow_eval += line.to_s if @follow_eval_on
- end
- } # self.note.split
- #---
- end
-
- end # RPG::Skill
- #==============================================================================
- # ■ Game_Action
- #==============================================================================
- class Game_Action
-
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :follow_up
-
- end # Game_Action
- #==============================================================================
- # ■ Game_Battler
- #==============================================================================
- class Game_Battler < Game_BattlerBase
-
- #--------------------------------------------------------------------------
- # alias method: item_user_effect
- #--------------------------------------------------------------------------
- alias game_battler_item_user_effect_fus item_user_effect
- def item_user_effect(user, item)
- game_battler_item_user_effect_fus(user, item)
- user.process_follow_up_skill(item)
- end
-
- #--------------------------------------------------------------------------
- # new method: process_follow_up_skill
- #--------------------------------------------------------------------------
- def process_follow_up_skill(item)
- return unless meet_follow_up_requirements?(item)
- action = Game_Action.new(self)
- action.set_skill(item.follow_up)
- if current_action.nil?
- action.decide_random_target
- else
- action.target_index = current_action.target_index
- end
- @actions.insert(1, action)
- @actions[1].follow_up = true
- end
-
- #--------------------------------------------------------------------------
- # new method: meet_follow_up_requirements?
- #--------------------------------------------------------------------------
- def meet_follow_up_requirements?(item)
- return false if item.nil?
- return false unless item.is_a?(RPG::Skill)
- return false if @actions[1] != nil && @actions[1].follow_up
- return false if $data_skills[item.follow_up].nil?
- return false unless follow_up_all_states?(item)
- return false unless follow_up_any_states?(item)
- return false unless follow_up_all_switch?(item)
- return false unless follow_up_any_switch?(item)
- return false unless follow_up_eval?(item)
- return rand < item.follow_chance
- end
-
- #--------------------------------------------------------------------------
- # new method: follow_up_all_states?
- #--------------------------------------------------------------------------
- def follow_up_all_states?(item)
- for state_id in item.follow_states_all
- next if $data_states[state_id].nil?
- return false unless state?(state_id)
- end
- return true
- end
-
- #--------------------------------------------------------------------------
- # new method: follow_up_any_states?
- #--------------------------------------------------------------------------
- def follow_up_any_states?(item)
- return true if item.follow_states_any == []
- for state_id in item.follow_states_any
- next if $data_states[state_id].nil?
- return true if state?(state_id)
- end
- return false
- end
-
- #--------------------------------------------------------------------------
- # new method: follow_up_all_switch?
- #--------------------------------------------------------------------------
- def follow_up_all_switch?(item)
- for switch_id in item.follow_switch_all
- return false unless $game_switches[switch_id]
- end
- return true
- end
-
- #--------------------------------------------------------------------------
- # new method: follow_up_any_switch?
- #--------------------------------------------------------------------------
- def follow_up_any_switch?(item)
- return true if item.follow_switch_all == []
- for switch_id in item.follow_switch_all
- return true if $game_switches[switch_id]
- end
- return false
- end
-
- #--------------------------------------------------------------------------
- # new method: follow_up_eval?
- #--------------------------------------------------------------------------
- def follow_up_eval?(item)
- return true if item.follow_eval == ""
- return eval(item.follow_eval)
- end
-
- end # Game_Battler
- #==============================================================================
- #
- # ▼ End of File
- #
- #==============================================================================
复制代码
|
|