I'm making an army of vindicators mounted on wolves, and want them to only follow the player while the player is holding an item. The commands I'm using are:
tag @a[nbt={SelectedItem:{id:"minecraft:red_banner"}}] add RedBanner
tag @a[nbt=!{SelectedItem:{id:"minecraft:red_banner"}}] remove RedBanner
execute as @a[type=wolf,team=Red] run data modify entity @s Owner set from entity @ a[tag=RedBanner,limit=1] UUID
execute unless entity @a[tag=RedBanner] run execute as @a[type=wolf,team=Red] run data merge entity @s {Owner:"dummy"}
The aim is to make wolves follow the player when the item is held, and stay on 'stand by mode' when it isn't so the vindicators can guard but still roam around. For this reason I don't want the wolf to sit down, which would be a simple solution. The only way I can think to do this is make the wolf un-tamed, but can't find a command other than giving the ownership to a non-existant player. However, this will bug out the wolf's AI and it can't walk around freely like I would want from it while guarding. Thanks
Your final command is an @a selector which searches for players only. Also it would be better if you removed the Owner tag completely as it does not naturally exist without an owner.
Hence the final command would be:
execute unless entity @a[tag=RedBanner] as @e[type=wolf,team=Red] run data remove entity @s Owner
I'm making an army of vindicators mounted on wolves, and want them to only follow the player while the player is holding an item. The commands I'm using are:
tag @a[nbt={SelectedItem:{id:"minecraft:red_banner"}}] add RedBanner
tag @a[nbt=!{SelectedItem:{id:"minecraft:red_banner"}}] remove RedBanner
execute as @a[type=wolf,team=Red] run data modify entity @s Owner set from entity @ a[tag=RedBanner,limit=1] UUID
execute unless entity @a[tag=RedBanner] run execute as @a[type=wolf,team=Red] run data merge entity @s {Owner:"dummy"}
The aim is to make wolves follow the player when the item is held, and stay on 'stand by mode' when it isn't so the vindicators can guard but still roam around. For this reason I don't want the wolf to sit down, which would be a simple solution. The only way I can think to do this is make the wolf un-tamed, but can't find a command other than giving the ownership to a non-existant player. However, this will bug out the wolf's AI and it can't walk around freely like I would want from it while guarding. Thanks
Your final command is an @a selector which searches for players only. Also it would be better if you removed the Owner tag completely as it does not naturally exist without an owner.
Hence the final command would be: