2
Make Zombies Passive
Hi guys,
I'm creating a custom armor and I would like leggings to be able to make zombies passive when equipped.
I tried this but without success
data>minecraft>tags>function>tick.json
{"values": ["zombie:tick"]}
data>zombie>function>give_zleg.mcfunction
give @s iron_leggings{tag:{zleg:1b},display:{Name:'{"text":"Zombie Leggings",}'} 1
data>zombie>function>tick.mcfunction
execute as @a[nbt={Inventory:[{Slot:101b,tag:{zleg:1b}}]}] run team join zombie
execute at @a[team=zombie] run team join zombie @e[type=minecraft:zombie,distance=..25]
execute as @a[team=zombie] unless data entity @s Inventory[{Slot:101b,tag:{zleg:1b}}] run team leave @s
any idea ?
Thx
I'm creating a custom armor and I would like leggings to be able to make zombies passive when equipped.
I tried this but without success
data>minecraft>tags>function>tick.json
{"values": ["zombie:tick"]}
data>zombie>function>give_zleg.mcfunction
give @s iron_leggings{tag:{zleg:1b},display:{Name:'{"text":"Zombie Leggings",}'} 1
data>zombie>function>tick.mcfunction
execute as @a[nbt={Inventory:[{Slot:101b,tag:{zleg:1b}}]}] run team join zombie
execute at @a[team=zombie] run team join zombie @e[type=minecraft:zombie,distance=..25]
execute as @a[team=zombie] unless data entity @s Inventory[{Slot:101b,tag:{zleg:1b}}] run team leave @s
any idea ?
Thx
4
Are the zombies also on the team?
well, idon't think so...
That's why it won't work. Both the player and the zombie need to be on the team.
I think the zombies should already be on the same team. Isn't that what that command is for:
execute at @a[team=zombie] run team join zombie @e[type=minecraft:zombie,distance=..25]
I didn't find any commands that make the zombie leave the team again in the tick.mcfunction (in case the player takes off the armor), but that shouldn't cause any problems. I think the problem might be, that according to the minecraft wiki the inability to damage other entities in the same team "Does not affect some non-player entities in a team.", but I'm not sure.
Make sure that friendlyFire is set to false (should be by default, manually: /team modify zombie friendlyFire false).
execute at @a[team=zombie] run team join zombie @e[type=minecraft:zombie,distance=..25]
I didn't find any commands that make the zombie leave the team again in the tick.mcfunction (in case the player takes off the armor), but that shouldn't cause any problems. I think the problem might be, that according to the minecraft wiki the inability to damage other entities in the same team "Does not affect some non-player entities in a team.", but I'm not sure.
Make sure that friendlyFire is set to false (should be by default, manually: /team modify zombie friendlyFire false).
