i have a function with some command inside it
execute as @s at @s run tp @s ^ ^ ^0.05
scoreboard players add @s tmp 1
tag @e[type=!area_effect_cloud,distance=..10] add hit
execute if score @s tmp < @s gun run function gunmech:move
scoreboard players set @s tmp 0
the "tag @e[type=!area_effect_cloud,distance=..10] add hit" command didn't do his thing even when there's so much mob around him
this function run 107 times every tick
maybe anyone could help?
execute as @s at @s run tp @s ^ ^ ^0.05
scoreboard players add @s tmp 1
tag @e[type=!area_effect_cloud,distance=..10] add hit
execute if score @s tmp < @s gun run function gunmech:move
scoreboard players set @s tmp 0
the "tag @e[type=!area_effect_cloud,distance=..10] add hit" command didn't do his thing even when there's so much mob around him
this function run 107 times every tick
maybe anyone could help?
4
First of all keep well in mind that snapshots are just that. When something doesn't work it could just as well be caused by a bug or something. Speaking of which: I think you should have mentioned that you're using a snapshot. Players who'd try this command on the currently recent version would get some pretty specific errors ;)
Anyway... How do you execute the function? If you want a specific entity to run a command inside your function then it's best to use the execute @s command.
So: execute as @s run tag @e[type... etc.
Anyway... How do you execute the function? If you want a specific entity to run a command inside your function then it's best to use the execute @s command.
So: execute as @s run tag @e[type... etc.
actually, the entity that i want to give tag is the different entity with the one that executing the function
I'm aware. Which is also what that execute command would do; the command would run as the entity, but it will tag others.
Also, I just realized the obvious (sorry, I'm slow sometimes) didn't you mean:
scoreboard players tag @e[stuff...] add hit?
Even so.. it would probably still be better to use execute as @s.
Hope this can help!
Also, I just realized the obvious (sorry, I'm slow sometimes) didn't you mean:
scoreboard players tag @e[stuff...] add hit?
Even so.. it would probably still be better to use execute as @s.
Hope this can help!
thanks, i will try and it stilll can't get what i want, i'll try other things
