查看: 3171|回复: 14

[有事请教] 【已经解决】关于Yanfly插件的Custom Target Eval

[复制链接]
梦石
0
星屑
2281
在线时间
403 小时
注册时间
2018-11-9
回帖
224
发表于 2019-6-9 21:34:23 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 Niko_ 于 2019-6-10 22:43 编辑

在目标核心插件看到这一栏,似乎可以自定义插件。不过这一栏没有翻译,也不知道在哪里自定义这个插件。
原文
============================================================================
Lunatic Mode - Custom Target Help Text
============================================================================

For users that are proficient with JavaScript, these notetags can be used to
provide custom help window text if you are also the Battle Engine Core.

Skill and Item Notetags:

  <Custom Target Text>
   text = $gameActors.actor(1).name();
   text += ' and ' + $gameActors.actor(2).name();
  </Custom Target Text>
  The 'text' variable is the text that will appear in the help window. Any
  changes made to it will be what is visibly displayed.
(PS:这一段应该是自定义描述文本)
============================================================================
Lunatic Mode - Custom Target Eval
============================================================================

For users that are proficient with JavaScript, these notetags can be used to
make custom target selections. For the targeting aspect, this will refer to
the skill/item's current scope and the targets made here will be made
independent of the scope with the exception of the target, where if a target
is selected, it will become the 'target' value.

  <Custom Target Eval>
  for (var i = 0; i < foes.aliveMembers().length; ++i) {
    var member = foes.aliveMembers();
    if (member.level % 3 === 0) targets.push(member);
  }
  </Custom Target Eval>
(PS:这一段应该是自定义目标了,看起来像是。。。3的倍数?)
  The 'targets' variable is an array that determines which are the targets
  to be used during the selection process. Push the desired targets into
  the 'targets' array.
莫把湖面倒影,当作夜空繁星。所以大角鼠yesyes,kaka的力量无人能及!
梦石
0
星屑
2281
在线时间
403 小时
注册时间
2018-11-9
回帖
224
 楼主| 发表于 2019-6-10 00:23:42 | 显示全部楼层
回复

使用道具 举报

梦石
0
星屑
2281
在线时间
403 小时
注册时间
2018-11-9
回帖
224
 楼主| 发表于 2019-6-10 11:08:14 | 显示全部楼层
回复

使用道具 举报

梦石
0
星屑
9867
在线时间
581 小时
注册时间
2017-9-28
回帖
203
发表于 2019-6-10 11:08:56 | 显示全部楼层
本帖最后由 hyrious 于 2019-6-10 22:32 编辑

在技能/物品的注释里写:
  1. <Custom Target Text>
  2.   text = "喵喵喵";
  3. </Custom Target Text>
复制代码
就会在查看该物品时显示 text 到帮助窗口,根据源代码 925 行的信息,这里你可以使用的变量有:
[pre lang="javascript"]var text = ''; // text = 最终显示的文本
var s = $gameSwitches._data; // s[1] = 开关1
var v = $gameVariables._data; // v[1] = 变量1
var user = BattleManager._subject; // a = b = subject = user = 当前使用者(这人搞这么多别名干啥……
var a = user;
var subject = user;
var b = user;
var target = user;[/pre]
在技能/物品的注释里写:
  1. <Custom Target Eval>
  2.   targets.push(opponents.aliveMembers()[0]);
  3. </Custom Target Eval>
复制代码
就会在使用该物品时选中对面第一个单位作为目标,根据源代码 747 行的信息,这里你可以使用的变量有:
[pre lang="javascript"]var targets = []; // targets = 最终选中的目标列表(数组)
var a = this.subject(); // a = user = subject = 使用者(搞一堆别名……
var user = this.subject();
var subject = this.subject();
if (this.isForOpponent()) { // 如果是对敌道具,则 b = target = 敌方单位,否则 b = target = 己方单位
  var targetUnit = this.opponentsUnit();
} else {
  var targetUnit = this.friendsUnit();
}
var b = targetUnit.smoothTarget(this._targetIndex);
var target = targetUnit.smoothTarget(this._targetIndex);
var s = $gameSwitches._data; // s = 开关
var v = $gameVariables._data; // v = 变量
var allies = this.friendsUnit(); // alies = friends = 所有己方单位
var friends = allies;
var foes = this.opponentsUnit(); // foes = opponents = 所有敌方单位
var opponents = foes;[/pre]

点评

感谢,我先回去研究了!  发表于 2019-6-10 12:35
喵喵喵
回复

使用道具 举报

梦石
0
星屑
2281
在线时间
403 小时
注册时间
2018-11-9
回帖
224
 楼主| 发表于 2019-6-10 13:49:51 | 显示全部楼层
hyrious 发表于 2019-6-10 11:08
在技能/物品的注释里写:
就会在查看该物品时显示 text 到帮助窗口,根据源代码 925 行的信息,这里你可以 ...

G4.png g6.png
我按照格式编(fu)写(zhi)了一遍,但似乎并没有起作用。(应该不是插件冲突,附上我已加入插件的图)


莫把湖面倒影,当作夜空繁星。所以大角鼠yesyes,kaka的力量无人能及!
回复

使用道具 举报

梦石
0
星屑
2281
在线时间
403 小时
注册时间
2018-11-9
回帖
224
 楼主| 发表于 2019-6-10 21:22:20 | 显示全部楼层

顶一顶,问题依旧没有解决。。。
莫把湖面倒影,当作夜空繁星。所以大角鼠yesyes,kaka的力量无人能及!
回复

使用道具 举报

梦石
0
星屑
9867
在线时间
581 小时
注册时间
2017-9-28
回帖
203
发表于 2019-6-10 21:50:55 | 显示全部楼层
我测了一下好像没什么问题
Snipaste_2019-06-10_21-50-11.png
Snipaste_2019-06-10_21-50-37.png
Snipaste_2019-06-10_21-50-19.png
我直接去 http://yanfly.moe/plugins/en/ 下的原版(

点评

非常感谢!!!  发表于 2019-6-10 22:43
一旦使用了 Eval 标签,即使是单体效果也会显示一个选择全体的步骤,执行时按标签内的代码选择目标  发表于 2019-6-10 22:36
Eval 那个标签我例子用错了,上去改了一下(具体怎么写还是得翻脚本源码  发表于 2019-6-10 22:33
嗯,就是选择目标这个步骤。用预设的标签,即使是目标为全体角色,都会有一个选择目标这个步骤。  发表于 2019-6-10 22:21
目标选择界面意思是战斗中使用时选择目标这个步骤  发表于 2019-6-10 22:17
喵喵喵
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部