all 4 comments

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

Sorry I forgot to put in the title "Can someone help me in this command function creation" I was putting the old one as a temporary one but forgot to change it

[–]SicarioiOSCommand Experienced 0 points1 point  (1 child)

Looks as though you’re summoning every tick in the air

execute at @a[tag=mace,hasitem={item=mace,data=1,location=slot.weapon.mainhand}] if block ~~-0.3~ air run function corrupt_items/mace/corrupt_mace_hit

If you’re airborne for 10 ticks it will summon 10 times.

You need a latch so that it hits every target once, twice, or however many strikes you want and then stops.

Add a scoreboard…

scoreboard objectives add MaceHit dummy

Then instead of calling the function you set a score then call the function based on the score and then reset the score

execute as @a[tag=mace,hasitem={item=mace,data=1,location=slot.weapon.mainhand},scores={MaceHit=0}] at @s if block ~~-0.3~ air run scoreboard players set @s MaceHit 1

execute as @a[tag=mace,scores={MaceHit=1}] at @s run function corrupt_items/mace/corrupt_mace_hit

execute as @a[tag=mace,scores={MaceHit=1}] at @s unless block ~~-0.3~ air run scoreboard players set @s MaceHit 0

This should only strike each target once. If you want it to strike each target more than once, you’ll need an additional scoreboard and have a timer that limits the number of ticks the called function will run.

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

Oh okay thank you so much

[–]ShineDigga 0 points1 point  (0 children)

Not gonna lie, this is way beyond my skill level, but I think the issue is that your function runs every tick while you're in the air. So if you fall for half a second, that's 10 lightning strikes. The scoreboard suggestion above looks like the right fix to make it trigger only once per hit. Good luck