如何在玩家所面向的方向处一段长度内生成一列等间距尖牙
可以的话,尽量满足以下条件
1.让这些尖牙的Owner就是召唤尖牙的玩家(从而如果这些尖牙招惹了怪物/击杀了怪物,那么仇恨会吸引到玩家头上/视作被玩家击杀)
2.这些尖牙不是同时召唤出的,而是生成一个尖牙后间隔一段时间才生成下一个(用schedule?)
可以的话,尽量满足以下条件
1.让这些尖牙的Owner就是召唤尖牙的玩家(从而如果这些尖牙招惹了怪物/击杀了怪物,那么仇恨会吸引到玩家头上/视作被玩家击杀)
2.这些尖牙不是同时召唤出的,而是生成一个尖牙后间隔一段时间才生成下一个(用schedule?)
schedule 在这个情景下不太好用,因为无法传递函数的执行坐标和执行者等。
所以,不如高频增加一个分数(例如 @s time),然后这么写:
execute as @a if score @s time matches 1 at @s rotated ~ 0 positioned ^ ^ ^1 run function foo:summon_fangs
execute as @a if score @s time matches 10 at @s rotated ~ 0 positioned ^ ^ ^2 run function foo:summon_fangs
execute as @a if score @s time matches 20 at @s rotated ~ 0 positioned ^ ^ ^3 run function foo:summon_fangs
...
# 函数 foo:summon_fangs
summon minecraft:evoker_fangs ~ ~ ~ {Tags:["new"]}
data modify entity @e[limit=1,tag=new,type=minecraft:evoker_fangs] Owner.OwnerUUIDMost set from entity @s UUIDMost
data modify entity @e[limit=1,tag=new,type=minecraft:evoker_fangs] Owner.OwnerUUIDLeast set from entity @s UUIDLeast
tag @e remove new
所以,不如高频增加一个分数(例如 @s time),然后这么写:
execute as @a if score @s time matches 1 at @s rotated ~ 0 positioned ^ ^ ^1 run function foo:summon_fangs
execute as @a if score @s time matches 10 at @s rotated ~ 0 positioned ^ ^ ^2 run function foo:summon_fangs
execute as @a if score @s time matches 20 at @s rotated ~ 0 positioned ^ ^ ^3 run function foo:summon_fangs
...
# 函数 foo:summon_fangs
summon minecraft:evoker_fangs ~ ~ ~ {Tags:["new"]}
data modify entity @e[limit=1,tag=new,type=minecraft:evoker_fangs] Owner.OwnerUUIDMost set from entity @s UUIDMost
data modify entity @e[limit=1,tag=new,type=minecraft:evoker_fangs] Owner.OwnerUUIDLeast set from entity @s UUIDLeast
tag @e remove new
你可以考虑生成一排体积极小的药水云,并且这些药水云的Duration值为等差数列(差值为间隔时间)且RadiusPerTick为0,当药水云的Duration为某一固定值时令玩家在药水云的位置召唤带有某一标签尖牙,然后处理owner
execute as <target> at @s run summon minecraft:area_effect_cloud ^ ^ ^1 {Duration:1,RadiusPerTick:0f,Radius:0.00001f,Tags:["A"]}
execute as <target> at @s run summon minecraft:area_effect_cloud ^ ^ ^2 {Duration:6,RadiusPerTick:0f,Radius:0.00001f,Tags:["A"]}
execute as <target> at @s run summon minecraft:area_effect_cloud ^ ^ ^3 {Duration:11,RadiusPerTick:0f,Radius:0.00001f,Tags:["A"]}
……
(高频)execute as <target> at @e[tag=A,nbt={Duration:1}] run summon minecraft:evoker_fangs ~ ~ ~ {Tags:["B"]}
(高频)data modify entity @e[limit=1,tag=B] Owner.OwnerUUIDMost set from entity <target> UUIDMost
(高频)data modify entity @e[limit=1,tag=B] Owner.OwnerUUIDLeast set from entity <target> UUIDLeast
其中<target>为目标玩家,我们可以通过给每个玩家及其生成的药水云与尖牙加不同的tag来进行区分
execute as <target> at @s run summon minecraft:area_effect_cloud ^ ^ ^1 {Duration:1,RadiusPerTick:0f,Radius:0.00001f,Tags:["A"]}
execute as <target> at @s run summon minecraft:area_effect_cloud ^ ^ ^2 {Duration:6,RadiusPerTick:0f,Radius:0.00001f,Tags:["A"]}
execute as <target> at @s run summon minecraft:area_effect_cloud ^ ^ ^3 {Duration:11,RadiusPerTick:0f,Radius:0.00001f,Tags:["A"]}
……
(高频)execute as <target> at @e[tag=A,nbt={Duration:1}] run summon minecraft:evoker_fangs ~ ~ ~ {Tags:["B"]}
(高频)data modify entity @e[limit=1,tag=B] Owner.OwnerUUIDMost set from entity <target> UUIDMost
(高频)data modify entity @e[limit=1,tag=B] Owner.OwnerUUIDLeast set from entity <target> UUIDLeast
其中<target>为目标玩家,我们可以通过给每个玩家及其生成的药水云与尖牙加不同的tag来进行区分
SPGoding 发表于 2019-8-16 18:31
schedule 在这个情景下不太好用,因为无法传递函数的执行坐标和执行者等。
schedule不能传递执行者与执行坐标……?execute as...at...run schedule是不行的吗?
data modify entity @e[limit=1,tag=new,type=minecraft:evoker_fangs] Owner.OwnerUUIDMost set from entity @s UUIDMost
那个limit=1是随机选择一个还是选择距离指令执行者最近的一个还是选择距离指令执行位置最近的一个?
多个玩家同时放技能(虽然概率不高……吧),会不会有尖牙Owner出错的风险?
另外rotated ~ 0是为了防止尖牙竖直方向上倾斜??
execute as @a if score @s time matches 1 at @s rotated ~ 0 positioned ^ ^ ^1 run function foo:summon_fangs
还有一个execute指令怎么让局部坐标与绝对坐标搭配……比如想更加模仿唤魔者的效果:尖牙与召唤者y坐标相同,在召唤者水平方向前方1、2、3米处生成尖牙
对于:data modify entity @e[limit=1,tag=new,type=minecraft:evoker_fangs] Owner.OwnerUUIDMost set from entity @s UUIDMost
发现到你没有用execute store result... run data get,是因为这个只能得到数值?
MinecraftPeace 发表于 2019-8-18 18:54
你可以考虑生成一排体积极小的药水云,并且这些药水云的Duration值为等差数列(差值为间隔时间)且RadiusPe ...
没想到可以用药水云实现延迟……不过“通过给每个玩家及其生成的药水云与尖牙加不同的tag来进行区分”那应该就要穷举了(?)
本帖最后由 aa0307bb 于 2019-8-20 00:44 编辑
追问: 为什么不可以给最佳
先rotate再用局部坐标666,太强了学到了
这几天都只能是空谈指令,开不了MC……
可以这样理解吗:如果玩家A、B同时使用技能
那么A、B身上会分别运行相同的函数
虽然这两个函数同处于一个游戏刻内执行,但存在微观上的先后顺序,
不妨设在这一个游戏刻内,A玩家比B玩家先执行函数
那么A玩家的函数执行完后才会轮到B玩家
……
……
?? 可是A玩家执行完函数后,A玩家对应的尖牙不会被删除呀
……
??
……
……
……
噢……原来移除tag的指令别有用心
A玩家所召唤的那个有new标签的尖牙虽然并不会在函数执行完后被删除(尖牙存在一定时间后才会自动消失),但是会在A玩家执行完函数后把A玩家召唤出来的尖牙移除标签,这样轮到B玩家执行函数的时候就不会选中A玩家召唤出的尖牙了
这么显然成立的东西我居然想了半天
正常情况下世界中同时最多只能存在一个 tag=new 的尖牙
论语言的简练性与定语的重要性……
SPGoding 发表于 2019-8-19 12:30
schedule不能传递执行者与执行坐标……?execute as...at...run schedule是不行的吗?
不行。
追问:
先rotate再用局部坐标666,太强了学到了
这几天都只能是空谈指令,开不了MC……
多个玩家同时放技能(虽然概率不高……吧),会不会有尖牙Owner出错的风险?
不可能。是以每个玩家的身份单独执行的函数,因此就算多个玩家同时放技能,该函数也是被分开执行两次的,正常情况下世界中同时最多只能存在一个 tag=new 的尖牙。
可以这样理解吗:如果玩家A、B同时使用技能
那么A、B身上会分别运行相同的函数
虽然这两个函数同处于一个游戏刻内执行,但存在微观上的先后顺序,
不妨设在这一个游戏刻内,A玩家比B玩家先执行函数
那么A玩家的函数执行完后才会轮到B玩家
……
……
??
……
??
……
……
……
噢……原来移除tag的指令别有用心
A玩家所召唤的那个有new标签的尖牙虽然并不会在函数执行完后被删除(尖牙存在一定时间后才会自动消失),但是会在A玩家执行完函数后把A玩家召唤出来的尖牙移除标签,这样轮到B玩家执行函数的时候就不会选中A玩家召唤出的尖牙了
正常情况下世界中同时最多只能存在一个 tag=new 的尖牙
SPGoding 发表于 2019-8-20 00:39
理解正确√
(不想要最佳,因为再拿到爱心的话我的爱心数就不是 500 了。我也没法再攒到 512,因为太菜了 ...
data get 命令的返回值必须在 Int32 范围内,而 UUIDMost 和 UUIDLeast 都是 Long 类型,很容易溢出
又发现一个小问题……uuid是一堆字母+数字,能够与数字类型相互转化???(莫非uuid不是字符串,而是数字类型的非十进制形式?)