2

Make Zombies Passive

Lutece1979 2/19/22 7:44 am history
133
2/19/2022 1:19 pm
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
Posted by
Lutece1979
Level 9 : Apprentice Miner
0

  Have something to say?

JoinSign in

4

Gamingbarn
02/19/2022 12:05 pm
Level 75 : Legendary Programmer Programmer
Are the zombies also on the team?
2
Lutece1979
02/19/2022 12:25 pm
Level 9 : Apprentice Miner
well, idon't think so...
2
Gamingbarn
02/19/2022 12:57 pm
Level 75 : Legendary Programmer Programmer
That's why it won't work. Both the player and the zombie need to be on the team.
2
Kefaku
02/19/2022 1:19 pm
Level 45 : Master Nerd
history
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).
1

Welcome