hi, what im trying to do is summon an armor stand at a player, which the armor stand has the same score and the player it summoned at "id" score, how would i give the armor stand this, im doing it on multiplayer and ive done it where each player has a unique id, how would i get the armor stand to have the players id score, and then how would i get the player to tp to the armor stand? thanks, im on 1.21.
#armor stand tp help
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
Someone will come and help soon!
💬 While you wait, take this time to provide more context and details.
🙇 If nobody has answered you by <t:1731071836:t>, feel free to use the Summon Helpers button to ping our helper team.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
Player Id System
>>> ## Give each player a unique ID
Create a scoreboard in a load function that runs on /reload
# namespace:load
scoreboard objectives add playerid dummy
Create a function to assign a unique id to the player
# namespace:assign_id
scoreboard players add .global playerid 1
scoreboard players operation @s playerid = .global playerid
Create a tick advancement to assign an id to a player when they first join
{
"criteria": { "requirement": { "trigger": "minecraft:tick" }},
"rewards": { "function": "namespace:assign_id" }
}
Check if an entity has the same ID as the player
Create a predicate that compares the id
// namespace:match_id
{ "condition": "minecraft:entity_scores", "entity": "this", "scores": {
"playerid": {
"min": { "type": "minecraft:score", "target": { "type": "minecraft:fixed", "name": "#this" }, "score": "playerid" },
"max": { "type": "minecraft:score", "target": { "type": "minecraft:fixed", "name": "#this" }, "score": "playerid" }
}}
}
To use it in a function, you can do that following
scoreboard players operation #this playerid = @s playerid
say @e[predicate=namespace:match_id] HAVE THE SAME PLAYERID
would that still work for multiplayer because there are multiple players who each could have an armor stand spawned for them?
That's the whole point of a player id system
If you don’t need it to work on multiplayer, then you can just execute as the nearest player.
The id system is necessary for the majority of the time when you want a pack to be multiplayer-compatible.
So, to tp the armor stand to the player it belongs to, there are a few things you could do:
- Execute at all players, as all armor stands with a specific tag or whatnot, if the id score of the current entity (@s, which refers to each armor stand individually) matches the id score of the nearest player, tp to the current location (the player)
- Have an entity with an Owner ride the armor stand, and set the owner to the player using the data command, then run functions as the owned entity. In those functions, you can use
execute on vehicleto reference the armor stand andexecute on ownerto reference the player. This method wouldn't actually require an id score system. - You could have a marker riding the armor stand and store data in it, such as the player's uuid, and use macros to flawlessly reference the player that it belongs to. This method is kind of complicated, but doesn't require an id system and can be pretty much flawless if made correctly.
Question Closed
Your question, #1304427016224772116 (armor stand tp help), was resolved!
Original Message
#1304427016224772116 message
Duration open
3d13h30m
Any further messages or reactions will re-open this thread.
Closed for inactivity
This question has been inactive for some time, so it's going to be closed for inactivity. If you still need it, please disregard this message.
Any further messages or reactions will re-open this thread.
Re-opened the channel. Make sure to close it again once you're done.