#Have Loop constantly check for a score, but then execute a function only once.

1 messages · Page 1 of 1 (latest)

solar surge
#

currently polishing my custom weapons datapack, there's this hammer that when it hits a player, it adds units to a score that acts as a timer, as long as that score isn't 0, their armor is replaced by a "troll" variant and once it reaches 0, that armor disappears and they can go on as normal.

My problem is that my Loop function constantly checks for said score reaching 0, once it does, it permanently runs the "remove armor" function so no players can actually put on any armor at any time. How would I make it so that the check is constant, but the command is only ran once?

simple raptor
#

if the score is usualy above 0 then once you complete the function set the score to -1 (and if score is usualy negative then set it to 1)

if you need both sides of score then you could use advancement to check the score and trigger it once instaed of ticking function
then if you want to reset the checking score just revoke the advancement

solar surge
solar surge
#

a different question, but i don't want to open another thread while this one's open, why isn't minecraft finding this custom enchantment? are my folders mixed up? Is the code so wrong it fails to load? I made it with misode, but i might have set it up wrong. Idea is that it gives you slowness, 2 at mininum and 6 at maximum

loud crow
#

Have you checked the logs?

#

Also there's no harm in making a new thread for a different question, in fact it's preferred

simple raptor
#

the player would (if the starting score is 0) trigger advancement by default at the start so you need something to detect if its the first time and bypass or return the function first time

solar surge
#

i'll see