设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1697|回复: 2

[有事请教] 战斗中如何获取所选敌人ID?(已解决)

[复制链接]

Lv2.观梦者

梦石
0
星屑
358
在线时间
43 小时
注册时间
2021-8-1
帖子
2
发表于 2021-8-14 11:58:04 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 lty184 于 2021-8-15 13:49 编辑

最终需求是,在对敌人使用物品的时候,获取所选敌人的ID...

求指教~

Lv3.寻梦者

梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
帖子
101
发表于 2021-8-15 00:57:06 | 显示全部楼层
JS 代码复制
  1. Game_Action.prototype.apply = function(target) {
  2.     const result = target.result();
  3.     this.subject().clearResult();
  4.     result.clear();
  5.     result.used = this.testApply(target);
  6.     result.missed = result.used && Math.random() >= this.itemHit(target);
  7.     result.evaded = !result.missed && Math.random() < this.itemEva(target);
  8.     result.physical = this.isPhysical();
  9.     result.drain = this.isDrain();
  10.     if (result.isHit()) {
  11.         if (this.item().damage.type > 0) {
  12.             result.critical = Math.random() < this.itemCri(target);
  13.             const value = this.makeDamageValue(target, result.critical);
  14.             this.executeDamage(target, value);
  15.         }
  16.         for (const effect of this.item().effects) {
  17.             this.applyItemEffect(target, effect);
  18.         }
  19.         this.applyItemUserEffect(target);
  20.     }
  21.     this.updateLastTarget(target);
  22. };


里面的target就是敌人的基本数据 target._enemyId 就能看到他的ID了, 你想测试的话可以在 const result = target.result();上面 加上console.log(target._enemyId)
但是敌人跟角色的ID是不一样的 相同的敌人公用相同的ID 所以你会看到敌人名字出会出现A,B,C..
你可以在rmmz_objects 里面找到
回复 支持 1 反对 0

使用道具 举报

Lv2.观梦者

梦石
0
星屑
358
在线时间
43 小时
注册时间
2021-8-1
帖子
2
 楼主| 发表于 2021-8-15 13:49:04 | 显示全部楼层
MH-Pride 发表于 2021-8-15 00:57
Game_Action.prototype.apply = function(target) {
    const result = target.result();
    this.subjec ...

多谢指教
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-17 00:30

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表