#Off Hand
1 messages · Page 1 of 1 (latest)
what remove?
effect
function executeBallCheck(p: player):
if name of {_p}'s offhand item is "&4Iron Ball":
apply infinite potion of strength of tier 2 without particles whilst hiding icon to {_p}
else:
remove potion of strength from {_p}
if name of {_p}'s offhand item is "&9&lOcean Ball":
apply infinite potion of water breathing of tier 1 without particles whilst hiding icon to {_p}
else:
remove potion of water breathing from {_p}
if name of {_p}'s offhand item is "&a&lLucky Ball":
apply infinite potion of luck of tier 2 without particles whilst hiding icon to {_p}
else:
remove potion of luck from {_p}
on swap hand items:
wait 1 tick
executeBallCheck(event-player)
on inventory slot change:
if index of event-slot is 40:
wait 1 tick
executeBallCheck(player)
on join:
wait 1 tick
executeBallCheck(player)
every 2 seconds:
loop players:
executeBallCheck(loop-player)
it does not remove effect
okay, because idk
function executeBallCheck(p: player):
if name of {_p}'s offhand item is "&4Iron Ball":
apply potion of strength of tier 2 without particles whilst hiding icon to {_p} for 3 ticks
if name of {_p}'s offhand item is "&9&lOcean Ball":
apply potion of water breathing of tier 1 without particles whilst hiding icon to {_p} for 3 ticks
if name of {_p}'s offhand item is "&a&lLucky Ball":
apply potion of luck of tier 2 without particles whilst hiding icon to {_p} for 3 ticks
every 1 tick:
loop players:
executeBallCheck(loop-player)
on swap hand items:
wait 1 tick
executeBallCheck(event-player)
on inventory slot change:
if index of event-slot is 40:
wait 1 tick
executeBallCheck(player)
on join:
wait 1 tick
executeBallCheck(player)
this works but can someone optimize this
Uhh
Because it gives the effect to the person forever?
U loop every tick
And give the effect to the person
For 3 ticks
what is the point in doing the periodical + all these other events
please use on hand item swap: and give/remove the infinite duration potion
because ur not doing anything to remove it
it is not in that code
i removed it
it was not removing it
if I used commands, it will spam the thing
i rewrote the code
and now it works
I am sending it here, someone can use it or use for referense
what is all this periodical nonsense?
all you need is on join: / on hand item swap:, and then apply infinite potion effects. And remove the effects on hand item swap: when they un-equip the item
also I really bet you could refactor this to be a lot cleaner. Something like set {_sapling} to type of event-block while type of event-block == {_sapling}: #run while still a sapling not a tree trunk #apply bonemeal
hell, there's even a tree effect you could probably work into this