How can I do this? I want to use a command in a single command block to execute from a player with a specific potion effect. I think maybe /execute at @a as @s if data could work, but I don't know how to use it...
How can I do this? I want to use a command in a single command block to execute from a player with a specific potion effect. I think maybe /execute at @a as @s if data could work, but I don't know how to use it...
/execute as @a[nbt={ActiveEffects:[{Id:8b}]}] run say hi
This will make all players with the Jump boost effect say hi
you can mess around with the Id, 8b is the ID for Jump boost
not typing any ID:
/execute as @a[nbt={ActiveEffects:[{}]}] run say hi
How can I do this? I want to use a command in a single command block to execute from a player with a specific potion effect. I think maybe /execute at @a as @s if data could work, but I don't know how to use it...
/execute as @a[nbt={ActiveEffects:[{Id:8b}]}] run say hi
This will make all players with the Jump boost effect say hi
you can mess around with the Id, 8b is the ID for Jump boost
not typing any ID:
/execute as @a[nbt={ActiveEffects:[{}]}] run say hi
will make everyone with any potion effect say hi
Visit my website to see/download my datapacks!
https://qualthorn.wixsite.com/datapacks
Yea, that would work. I didn't know about the [nbt={}] and was trying to just do {}, so I thought they removed it. I figured it out tho, thanks!
What if I want to know if the player has no potion effects?
in the context of this you would use /execute unless @a[nbt={ActiveEffects:[{}]}] (which we said before is for when they have any effect)[/b]