Project1

标题: 处于特定状态才能使用的技能,脚本求教 [打印本页]

作者: 忧韵谷    时间: 2023-8-14 00:09
标题: 处于特定状态才能使用的技能,脚本求教
之前忘了在哪里看到的脚本,非常好用。但是现在我想要实现“同时处于特定状态A和B才能使用某个技能”这个效果,不知道要怎么办。

脚本如下:

# 处于特定状态才能使用的技能  只能限制友方
# 技能上备注 <state 50> 表明只有在50号状态时才能使用

class RPG::Skill
  def needed_state
    return @needed_state unless @needed_state.nil?
    @needed_state = @note =~ /<state\s*(\d+)>/ ? $1.to_i : false
  end
end

class Game_BattlerBase
  alias no_state_skill_conditions_met? skill_conditions_met?
  def skill_conditions_met?(skill)
    no_state_skill_conditions_met?(skill) &&
      (!skill.needed_state || state?(skill.needed_state))
  end
end

作者: alexncf125    时间: 2023-8-14 00:17
这个只能定义一个状态,非常不好用。

这个好用:https://himeworks.com/2013/11/custom-use-conditions/

<use conditions>
  state: 状态A的ID
  state: 状态B的ID
</use conditions>
作者: 忧韵谷    时间: 2023-8-14 01:42
alexncf125 发表于 2023-8-14 00:17
这个只能定义一个状态,非常不好用。

这个好用:https://himeworks.com/2013/11/custom-use-conditions/

非常感谢!这个确实很好用,帮大忙了




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