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

Project1

 找回密码
 注册会员
搜索
查看: 315|回复: 7
打印 上一主题 下一主题

[有事请教] 求教一下战斗怎么做“抛硬币式“技能

[复制链接]

Lv2.观梦者

梦石
0
星屑
350
在线时间
119 小时
注册时间
2023-1-19
帖子
59
跳转到指定楼层
1
发表于 2024-5-14 16:06:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
50星屑
就是使用A技能之后随机触发两种效果的其中一种,例如技能成功对面受伤,技能失败己方受伤。

开始想用事件做,想法是这样A技能触发公共事件,公共事件变量操作随机数1~2,判断变量=1强制战斗行动技能B,判断变量=2强制战斗行动技能C。但是这么做的话,强制战斗行动的行动主体只能指定一个角色,无法做到所有角色通用。

有没有办法可以做到这种类似抛硬币的技能?

最佳答案

查看完整内容

用YEP战斗序列即可用一个技能做出来 对象为使用者 要有伤害公式 剩下自己搞 motion item: user action animation: user common event: x //x填入随机变数的公共事件ID wait for animation if ($gameVariables.value(x) > 1)x为变数ID animation x: friends //x为给伤害用的动画 action effect: friends add state x: user //x为状态A else animation x: opponents //x为给伤害用的动画 action effect: opponents end ...

Lv2.观梦者

梦石
0
星屑
294
在线时间
21 小时
注册时间
2022-12-28
帖子
9
2
发表于 2024-5-14 16:06:45 | 只看该作者
本帖最后由 Z8K 于 2024-5-19 04:45 编辑

用YEP战斗序列即可用一个技能做出来

对象为使用者 要有伤害公式 剩下自己搞

<target action>
motion item: user
action animation: user
common event: x //x填入随机变数的公共事件ID
wait for animation
if ($gameVariables.value(x) > 1)x为变数ID
  animation x: friends //x为给伤害用的动画
  action effect: friends
  add state x: user //x为状态A
else
  animation x: opponents //x为给伤害用的动画
  action effect: opponents
end
wait for animation
</target action>

實例:https://imgur.com/SUsiKwn
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
387
在线时间
121 小时
注册时间
2021-6-20
帖子
1
3
发表于 2024-5-18 18:23:35 | 只看该作者
强制敌人来放技能呗。
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
350
在线时间
119 小时
注册时间
2023-1-19
帖子
59
4
 楼主| 发表于 2024-5-19 18:39:29 | 只看该作者
Z8K 发表于 2024-5-19 04:24
用YEP战斗序列即可用一个技能做出来

对象为使用者 要有伤害公式 剩下自己搞

感谢大佬,实测可行。

但是我这样写战斗序列的话就报错,这是什么原因呢?


<target action>
common event: 5
wait for animation
if ($gameVariables.value(1) > 1)
if user.attackMotion() == 'thrust'
motion thrust: user
else
if user.attackMotion() == 'swing'
motion swing: user
else
motion missile: user
end
attack animation: target
wait for animation
action effect: target
else
if target.attackMotion() == 'thrust'
motion thrust: target
else
if target.attackMotion() == 'swing'
motion swing: target
else
motion missile: target
end
attack animation: user
wait for animation
action effect: user
end
</target action>
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
294
在线时间
21 小时
注册时间
2022-12-28
帖子
9
5
发表于 2024-5-19 20:32:02 | 只看该作者
本帖最后由 Z8K 于 2024-5-19 22:13 编辑
haohaoniu 发表于 2024-5-19 18:39
感谢大佬,实测可行。

但是我这样写战斗序列的话就报错,这是什么原因呢?


If else中的公式内容都是需要空两格让它可以判断出来的

尤其我看你的代码还在If else中套If else,就需要空格分的更清楚

此外 使用else且要用两种以上的else状况时除了最后一个使用else外其他要使用else if

所以你的notetag应该改成

<target action>
common event: 5
wait for animation //没动画干嘛塞这个?
if ($gameVariables.value(1) > 1)
  if user.attackMotion() == 'thrust'
    motion thrust: user
  else if user.attackMotion() == 'swing'
    motion swing: user
  else
    motion missile: user
  end
  attack animation: target
  wait for animation
  action effect: target
else
  if target.attackMotion() == 'thrust'
    motion thrust: target
  else if target.attackMotion() == 'swing'
    motion swing: target
  else
    motion missile: target
  end
  attack animation: user
  wait for animation
  action effect: user
end
</target action>
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
350
在线时间
119 小时
注册时间
2023-1-19
帖子
59
6
 楼主| 发表于 2024-5-19 21:44:28 | 只看该作者
Z8K 发表于 2024-5-19 20:32
If else中的公式内容都是需要空两格让它可以判断出来的

尤其我看你的代码还在If else中套If else,就需要 ...

可是这样之后就变成不管随到1还是2都是双方一起受伤害,是我哪里写错了吗?
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
294
在线时间
21 小时
注册时间
2022-12-28
帖子
9
7
发表于 2024-5-20 08:35:09 | 只看该作者
本帖最后由 Z8K 于 2024-5-20 08:37 编辑
haohaoniu 发表于 2024-5-19 21:44
可是这样之后就变成不管随到1还是2都是双方一起受伤害,是我哪里写错了吗? ...


应该是因为太多if else导致判定错误了

毕竟你原notetag太杂了

我帮你把
if user.attackMotion() == 'thrust'
    motion thrust: user
  else if user.attackMotion() == 'swing'
    motion swing: user
  else
    motion missile: user
  end
这部分直接去掉
改成用motion attack: user或是motion attack: target
这样其实就会读取该角色本身的普攻攻击行动

<target action> //想打敌方全体就把target改成whole
common event: 5
if ($gameVariables.value(1) > 1)
  motion attack: user
  attack animation: target
  wait for animation
  action effect: target
else
  motion attack: target
  attack animation: user
  wait for animation
  action effect: user
end
</target action> //想打敌方全体就把target改成whole

评分

参与人数 1+1 收起 理由
haohaoniu + 1 塞糖

查看全部评分

回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
350
在线时间
119 小时
注册时间
2023-1-19
帖子
59
8
 楼主| 发表于 2024-5-20 15:12:31 | 只看该作者
Z8K 发表于 2024-5-20 08:35
应该是因为太多if else导致判定错误了

毕竟你原notetag太杂了

哇,非常感谢大神。以前学的时候都是教不同武器动画攻击这么写的。从来没见过有人教写motion attack。害我还以为motion attack也是不分武器动画。难怪以前写技能那么多BUG,这次受益良多。
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-6-9 21:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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