查看: 3131|回复: 1

[已经解决] 帮助文档制作逃脱物品的问题

[复制链接]
梦石
0
星屑
4627
在线时间
818 小时
注册时间
2017-7-14
回帖
116

开拓者

发表于 2018-3-27 17:20:10 | 显示全部楼层 |阅读模式

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

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

×
class Scene_ItemBase
  alias xxx001_use_item use_item
  def use_item
    xxx001_use_item
    use_escape_item if item.note.include?("<ESCAPE>")
  end
  def use_escape_item
    print "脱出!\n"
  end
end
这是帮助文档的教程实例,请问,这个在菜单物品使用能P出来,请问,战斗中使用物品怎么才能P出来?
梦石
0
星屑
8498
在线时间
775 小时
注册时间
2017-11-10
回帖
1074
发表于 2018-3-27 20:33:19 | 显示全部楼层
很简单,直接在class Scene_Battle里再重定义一段相同的方法即可。
但方法的参数要修改一下。
以下是自己完成的效果脚本:
可作为参考?
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Scene_Battle
  4. #------------------------------------------------------------------------------
  5. #  战斗画面
  6. #==============================================================================

  7. class Scene_Battle
  8.   #--------------------------------------------------------------------------
  9.   # ● 使用技能/物品
  10.   #--------------------------------------------------------------------------
  11.   def use_item
  12.     if @item.note.include?("<逃脱>")
  13.     use_escape_item
  14.     else
  15.     item = @subject.current_action.item
  16.     @log_window.display_use_item(@subject, item)
  17.     @subject.use_item(item)
  18.     refresh_status
  19.     targets = @subject.current_action.make_targets.compact
  20.     show_animation(targets, item.animation_id)
  21.     targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  22.   end
  23. end

  24. def use_escape_item
  25.     BattleManager.process_abort
  26.   end
  27. end
复制代码

评分

参与人数 1星屑 +20 收起 理由
VIPArcher + 20 认可答案

查看全部评分

一个只会简单事件的Rm新人,脚本完全不懂。只求做个简单的游戏完成自己的游戏之梦而已。
第一个游戏已经完成,等待各素材的完成和测试。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部