じ☆ve冰风 发表于 7 天前

自爆脚本

RUBY 代码
#==============================================================================
# ■ 简单自爆脚本
# 作者:Ruigi
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 使用技能(别名方法)
#--------------------------------------------------------------------------
alias kill_use_item use_item
def use_item
    item = @subject.current_action.item
    is_kill_skill = item.is_a?(RPG::Skill) && item.note.include?("")

    kill_use_item

    if is_kill_skill
      # 在技能效果应用后执行死亡
      @subject.hp = 0
      # 等待一帧确保所有效果都已完成
      call_later(:apply_kill_effect)
    end
end

#--------------------------------------------------------------------------
# ● 应用自爆效果(延迟执行)
#--------------------------------------------------------------------------
def apply_kill_effect
    returnunless@subject && @subject.hp == 0
    @subject.perform_collapse_effectif@subject.dead?
    refresh_status
end

#--------------------------------------------------------------------------
# ● 延迟调用方法
#--------------------------------------------------------------------------
def call_later(method_name)
    send(method_name)
end
end



            本帖来自P1论坛作者Ruigi,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=498229若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页: [1]
查看完整版本: 自爆脚本