2

[SOLVED] Help with teleporting entity to another

Azbrin Surro 10/20/21 5:22 pm
165
10/20/2021 7:50 pm
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?
Posted by
Azbrin Surro
Level 1 : New Miner
3

  Have something to say?

JoinSign in

8

Endernice61
10/20/2021 6:32 pm
Level 74 : Legendary System
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.
1
Azbrin Surro
10/20/2021 6:44 pm
Level 1 : New Miner
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.
1
fatcat109_
10/20/2021 6:02 pm
Level 44 : Master Lad
Name tags?
2
Ijd
10/20/2021 5:41 pm
Level 41 : Master Engineer
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
2
Azbrin Surro
10/20/2021 6:27 pm
Level 1 : New Miner
history
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
1
Ijd
10/20/2021 6:32 pm
Level 41 : Master Engineer
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
1
Azbrin Surro
10/20/2021 6:45 pm
Level 1 : New Miner
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
1
HoboMaggot
10/20/2021 7:50 pm
Level 55 : Grandmaster Blob
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
1

Welcome