Minecraft – How to spawn an entity that can be linked to the player that spawned it in Minecraft 1.13

minecraft-commandsminecraft-java-edition

I'm working on a minigame in 1.13 and am trying to make a command that executes at a players position and spawns an area effect cloud there. I have managed that but I also need that area effect cloud to be spawned with a tag or something (or a score etc.) that can link it to the player that was used to spawn it. I tried one command that is supposed to give the area effect cloud the players name as a tag but it doesn't seem to work:

/execute as @a[team=Alive,scores={ReadyToPlant=3,Sneak=1..,PlantedPotato=0},nbt={SelectedItem:{id:"minecraft:stripped_birch_wood"}}] at @s run summon area_effect_cloud ~ ~ ~ {Duration:2147483647,CustomName:"{\"text\":\"SpawningPotato\"}",Tags:["{\"text\":\"@s\"}"]}

Best Answer

You could try to make a command chain where after the area effect cloud is spawned it summons a perminate, imobile, indistructable, invisible entity such as a armor stand next to or under or above the area effect cloud that has a tag which can then activate a command block with the sequence:

execute if entity @e[type=armor_stand,tag=...] run ...

Idk if this will work or helps at all but I hope it does.

Related Topic