2
[SOLVED] Help with teleporting entity to another
Im working on a minecraft map, and in one section there are a lot of zombies walking in a direction, they have no AI so the player cant be hurt by them and the zombies are forced to look in 1 direction. What i need is for each zombie have its own armorstand, and to be teleported to a armor stand (basically the one closest to it), and then i can just have the armor stands motion forward to move the zombie. However im not sure how to give each armorstand a zombie AND have the zombie teleport to its closest armorstand. Ive tried already but it keeps giving armorstands the same amount of zombies that there are armorstands, or just summoning zombies on 1 armorstand repeatidly, and i dont even know where to begin with teleporting them.
Ive tried looking online for answers but i havent been able to find anything that helps my situation.
Could someone please help with this problem?
Ive tried looking online for answers but i havent been able to find anything that helps my situation.
Could someone please help with this problem?
8
I would give the zombies tags and not use armor stands at all.
"/summon zombie ~ ~ ~ {Tags:["walking_zombie"],NoAI:1}"
Then command for teleporting zombies forward is
"/execute as @e[tag=walking_zombie] at @s run tp @s ^ ^ ^.2"
You may need to adjust the speed.
"/summon zombie ~ ~ ~ {Tags:["walking_zombie"],NoAI:1}"
Then command for teleporting zombies forward is
"/execute as @e[tag=walking_zombie] at @s run tp @s ^ ^ ^.2"
You may need to adjust the speed.
Wow i was really overcomplicating this huh. Your response here and ljd's no damage command basically solved this whole issue! thanks for the help.
Name tags?
Im not sure i completely understand what you are trying to do, for the issue with armorstands summoning more than one zombie you can give the armorstand a tag once its summoned one and you can give a zombie some common value as the armorstand youre tping to and use that in a selector
Ill try and heavily simplify it.
say i have 2 armorstands, i want the armorstands to summon a zombie on it (with no AI). but only have 1 zombie appear on each armorstand.
(I have a issue of multiple spawning on a armorstand, or all of the zombies going to 1 armorstand)
Once thats done, and both armor stands have their own zombie. i want each zombie to teleport to their armorstand (maybe use a [sort=nearest] thing? im not sure.) on a repeat command. reason i want them to teleport to the armorstand they have is so that i can move the zombies using said armorstands
Reason i cant just simply give the zombies movement is because the AI on the zombies causes players to be hurt and i dont want them to die, and zombies with no AI cant use the {Motion} tag
THINGS IVE TRIED (Where you can find errors i have made):
I gave the armorstands that require a zombie the tag "test". if they have the tag "test" they go to a scoreboard called "zombie".
IF 0 AND NO ZOMBIE ON ARMORSTAND: set their score to 1
IF 1 AND NO ZOMBIE ON ARMORSTAND: summon a zombie on the armorstand and set score to 2
IF 2: Do nothing
I have done the score check because without it the zombies would all summon on 1 armorstand multiple times, however even with the score check it will put multiple zombies on each armorstand
I have not started the zombie teleportation as i have no idea where to even begin
say i have 2 armorstands, i want the armorstands to summon a zombie on it (with no AI). but only have 1 zombie appear on each armorstand.
(I have a issue of multiple spawning on a armorstand, or all of the zombies going to 1 armorstand)
Once thats done, and both armor stands have their own zombie. i want each zombie to teleport to their armorstand (maybe use a [sort=nearest] thing? im not sure.) on a repeat command. reason i want them to teleport to the armorstand they have is so that i can move the zombies using said armorstands
Reason i cant just simply give the zombies movement is because the AI on the zombies causes players to be hurt and i dont want them to die, and zombies with no AI cant use the {Motion} tag
THINGS IVE TRIED (Where you can find errors i have made):
I gave the armorstands that require a zombie the tag "test". if they have the tag "test" they go to a scoreboard called "zombie".
IF 0 AND NO ZOMBIE ON ARMORSTAND: set their score to 1
IF 1 AND NO ZOMBIE ON ARMORSTAND: summon a zombie on the armorstand and set score to 2
IF 2: Do nothing
I have done the score check because without it the zombies would all summon on 1 armorstand multiple times, however even with the score check it will put multiple zombies on each armorstand
I have not started the zombie teleportation as i have no idea where to even begin
if the NoAI use is just for the no damage, we can modify that and other things from the attributes, you can add this /summon zombie ~ ~ ~ {Attributes:[{Name:generic.attack_damage,Base:0}]} in the NBT to make it not deal any half hearts
I had no idea there was a no damage attribute you could give zombies. that makes everything a lot easier. thank you for the help
The attribute just changes the damage the mob deals, so you can set that to 1000 and the mob will instakill you.
If you dont want to use attributes, or want to periodically make an entity not able to hurt players, apply weakness 10+ to the mob instead
If you dont want to use attributes, or want to periodically make an entity not able to hurt players, apply weakness 10+ to the mob instead
