Arqade Asked by SMILIECHICKEN on June 29, 2021
Is there a way to spawn a usually passive mob (like a cow) hostile?
More specifically, I want to summon an Iron Golem that will automatically lock onto a player and attack them. I’m not a master at this kind of “advanced command block programming”, so I’ll leave it up to you guys… any ideas?
As of 1.9, if a mob is the passenger of another mob, it will control the pathfinding of its host. For example, if you had a zombie riding an iron golem, the iron golem will chase the player due to the zombie targeting the player.
However, the iron golem will still attempt to attack enemy mobs. While normally you can circumvent this by adding both mobs to the same team, which is intended to prevent hostility between the two, this does not work with iron golems while an enemy is its passenger. Even setting the iron golem's generic.followRange
attribute to 0 will not prevent it from trying to attack the enemy mob riding it.
What you can use instead is a mob that the golem will not attack but will still target players, being a creeper. You can give the creeper a Fuse
value of 32767 to make it take roughly 27 minutes before it explodes, which resets if the player moves out of range, just to ensure it does not explode.
An example command that summons an iron golem being controlled by a creeper:
/summon VillagerGolem ~ ~1 ~ {Passengers:[{id:"Creeper",Silent:1b,Invulnerable:1b,Fuse:32767,ActiveEffects:[{Id:14,Duration:2147483647,ShowParticles:0b}]}]}
Unfortunately this type of control does not include attacking, so the golem will simply get as close to the player as possible while its rider attempts to attack (which, in this case, it cannot). You could try to simulate attacking by using the /effect
command around the golem:
/execute @e[type=VillagerGolem] ~ ~ ~ /effect @a[r=1] minecraft:instant_damage
Correct answer by Skylinerw on June 29, 2021
Unfortunately this is impossible without having to dive into minecrafts coding. However with your iron golem problem there is a way, its just a pain to do. According to the wikia iron golems created by the player will not harm the player who built it. Iron golems that have spawned naturally, such as in villages, will go aggro if the player hits villagers or the iron golem itself.
So in theory, you could take the iron golem from a village and hit it, that would make it aggro. Unfortunately that is the only way i can think of that you could possibly do something like that.
In conclusion. No, there isn't a well known way of turning a passive mob into a hostile mob using command blocks. Sorry.
Good luck with whatever your doing though!
Answered by TooLazyToLogIn on June 29, 2021
You need to make a new team via /scoreboard, and then go to this site to create an iron golem summon command that will make the iron golem target you.
Answered by Bluphenyx on June 29, 2021
I think i have a simple command for this in order to set the iron golem to aggro to the nearest player. Put a repeating command block on always active facing straight up that says /execute @a ~~~ testfor @e[type=iron_golem,r=30]. Then add another command block one block away and put a comparitor in between facing out from the repeating command block, and set it to impulse needs redstone, and make it say /execute @a ~~~ /execute @e[type=iron_golem,r=30] ~~~ summon snowball ~~~
Answered by ZANDERTHELEGEND on June 29, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP