Project1

标题: MV战斗后自动使用背包的药品回血 [打印本页]

作者: 百花墨印    时间: 2023-10-26 17:21
标题: MV战斗后自动使用背包的药品回血
MV战斗后自动使用背包的药品回血,比如某药品回血500,当战斗后某个人物血量低于上限的500时就会自动使用。
作者: 百花墨印    时间: 2023-10-26 17:22
有类似插件吗?或者是事件怎么做。
作者: shiroin    时间: 2023-10-26 19:47
本帖最后由 shiroin 于 2023-10-26 19:54 编辑

有相关脚本给你用,楼下贴了,先写个战斗结束后触发的公共事件,条件分歧判定血量,判定成功时就通过这个脚本强制使用物品(还得加个物品数量判定)
作者: shiroin    时间: 2023-10-26 19:52
(function(v,i,t,a,c,u) {
  if (i = $dataItems[+v || 0]) {
    u = $gameParty.members()[0];
    a = new Game_Action(u);
    a.setItemObject(i);
    t = i.scope === 7 ? [u] : a.makeTargets();
    for (n of t) c = c || a.testApply(n);
    if (u.canUse(i) && (i.scope === 0 || c)) {
      u.useItem(i);
      for (n of t) for (var m = a.numRepeats(); m--;) a.apply(n);
      a.applyGlobal();
}}})($gameVariables.value(41));

这是我抄的其他人代码做出来的脚本,你可以试试效果,把这段代码作为脚本写进事件里,执行时会依据41号变量的值使用对应ID的道具,你可以把变量ID修改成自己指定的
作者: 百花墨印    时间: 2023-11-1 17:44
shiroin 发表于 2023-10-26 19:52
(function(v,i,t,a,c,u) {
  if (i = $dataItems[+v || 0]) {
    u = $gameParty.members()[0];

谢谢,谢谢,谢谢,谢谢,谢谢,




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