2

(Solved) Effect detection problem

Lord_Ser 9/21/22 8:01 pm
232
9/23/2022 7:23 am
So, in my data pack i wanted to add a way for it to detect the players active effects. The detection function won't work if I let it run through the data pack as a scheduled function but however it DOES work when ran in a world on a repeating command block. If anyone could help me out I'd apprechiate it a thousand times.

here's the code:

schedule function player_scan:jump_boost 10t replace
execute if entity @a[​nbt={ActiveEffects:[{Id:8, Amplifier: 1b}]}] run tellraw @a " Effect detected"
Posted by
Lord_Ser
Level 1 : New Miner
0

  Have something to say?

JoinSign in

3

Lord_Ser
09/23/2022 7:23 am
Level 1 : New Miner
(solve):

calling the active effect from @a was the problem, since it's calling from too many entities, idk how I didn't notice that.
execute if entity @r[​nbt={ActiveEffects:[{Id:8, Amplifier: 1b}]}] run tellraw @a "Effect detected" works totally fine...
1
Spuduking
09/22/2022 4:10 pm
Level 34 : Artisan Procrastinator
Try replacing the 8 under ID with '8b'. It seems to work.
2
Lord_Ser
09/23/2022 7:16 am
Level 1 : New Miner
replacing the id 8 with 8b doesn't work for me, it just tells me it expects an int tag not a byte tag. That's why I'm so confused, but thank you for your input.
1

Welcome