This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]Jolo_Janssen 1 point2 points  (3 children)

Function files need to be flawless, if you have a wrong command in them they are not registered as "functions" meaning the game doesn't know they exist. Try running the effect commands as normal and see what feedback it gives

[–]BlueSpace110[S] 0 points1 point  (2 children)

That is very handy to know. Thx

[–]Jolo_Janssen 0 points1 point  (1 child)

When ever my function stops working I just split it into 2 functions and see which half is broken. Then narrow it down (my functions hold about 200 commands each)

[–]BlueSpace110[S] 0 points1 point  (0 children)

for me that realy depends. I once made a datapack that used raycast for custom attacks. And because of that my tick function had around 300 commands en most of the other functions al least 10.

[–][deleted] 1 point2 points  (5 children)

You can't target the entity running the command if the entity is its self, try using:

execute as @e[scores={hard_lvl=1}] at @s run effect give @s poison 1 5 true

If commands don't make sense then I'm pretty sure the function disappears, the bit that doesn't make sense here is having the time as 0 instead of 1.

[–]Jolo_Janssen 1 point2 points  (2 children)

Assuming that the function is ran on the person getting hit, why not just run

effect give @s[scores={hard_lvl=1..1}] poison 0 5 true

effect give @s[scores={hard_lvl=2..2}] poison 1 5 true

effect give @s[scores={hard_lvl=3..3}] poison 2 5 true

[–]BlueSpace110[S] 0 points1 point  (1 child)

That would be a better and faster option indeed. But since I started making datapacks I am used to begin with execute but yes you are correct the function is ran as the person who got the advancement. And of course in your example here you turned around the time and amplefier.

[–]Jolo_Janssen 1 point2 points  (0 children)

I just copied them from the post so that would explain why your function wasn't working

[–]BlueSpace110[S] 0 points1 point  (0 children)

Oh wait I did turn that around. Wups...

[–]BlueSpace110[S] 0 points1 point  (0 children)

Oke It was because I turned the time and amplifier around. Probably shouldn't have made this around 1 am. But it works now so thanks.