#How do I copy the nearest players uuid with DeathTime:1s to the nearest armorstand?

1 messages · Page 1 of 1 (latest)

quasi ginkgo
#

Im trying to be able to compare the player uuid that I have stored in a scoreboard to the armorstand

serene vaultBOT
#

<@&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:1733706936: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

#
⚠️ You already have a question open!

Don't forget to close or resolve your old questions once you're done with them. It makes our lives much easier! :D

Open question: #1315382089851605002

quasi ginkgo
#

I want to copy the UUID of the dead player onto the armorstand that gets summon where the player died. I'm unsure how to get this to work

carmine orbit
#

How are you detecting the player death to summon the armor stand in the first place

quasi ginkgo
#

glowing is just for identification

carmine orbit
#

Well I'd definitely recommend a death scoreboard instead, but either way the solution is the same

quasi ginkgo
#

pros and cons to death scoreboard vs nbt check?

carmine orbit
#

NBT check is way worse on performance, especially if you're doing it twice like this, which you don't need to do

You don't need to do as @a at @a, just to as @a at @s

quasi ginkgo
#

ah ok

#

So a simple scoreboard that goes to 1 when a player died then resets should work?

carmine orbit
#

Yep

#

But yeah, solution: Instead of summoning the armor stand in the same command, have the command run a function that summons the armor stand with a tag, then uses a scoreboard players operation command to set the score of the nearest armor stand with that tag from the UUID of @s.

Also keep in mind that UUID is a list, it can't be saved as a single score. You need to target each entry of UUID individually, otherwise you're just gonna get the length of the list, which is 4

quasi ginkgo
#

may you give an example by chance?

#

I understand the concept just cant visualise it atm

carmine orbit
#

Not without just writing it for you. Try writing it yourself and we'll go from there.

quasi ginkgo
#

kk

#

also instead of uuids of players would it be better to make a id scoreboard?

#

would that be better on performance?

#

and possibly simpler?

carmine orbit
#

Probably a good idea, yes

quasi ginkgo
#

I was trying a few different things while waiting on this ngl so I got an id system made

carmine orbit
#

It can still be based on the UUID, just need to set each player's ID score once when they join

quasi ginkgo
#

I need to still properly test if the ids fully work work in multiplayer lol

#

gonna do that really quick before continuing

#

What's the best way to detect a players death for scoreboards?

hasty plank
#

by using the death statistics

quasi ginkgo
#

how do I detect a change in that?

#

nvm

#

figured it lol

quasi ginkgo
carmine orbit
#

I didn't expect you to be successful, I just expect you to try and then show your work

#

That way we can explore what you're doing wrong and why, so you'll learn what doing it correctly actually means

#

Which wouldn't happen if I just wrote it for you

quasi ginkgo
#

I got a death scoreboard that auto resets to 0 working

carmine orbit
#

Great

quasi ginkgo
#

but thats about it

carmine orbit
#

You didn't write anything else, or what you wrote didn't work?

quasi ginkgo
#

ok i got it to summon the armor stand with the tag deathpoint at the location the player dies

#

Im very confused on how to get the player id to be on the armor stand though

carmine orbit
#

If it's a score, you do a scoreboard players operation command

quasi ginkgo
#

how do those work?

#

ive never used them before

carmine orbit
#

The first entity you specify is whose score will be set, and the second entity will be the score that the operation evaluates from

#

But the operation you'll be using is just =, so it'll set the score of the first entity to that of the second

quasi ginkgo
#

oh ok and so I use the tag to identify the armorstand to give it the correct score

#

and I should only apply it to the closest armorstand to the dead player correct?

#

otherwise it woould cause issues if another player walks past?

carmine orbit
#

Yep

quasi ginkgo
#

so something like this? /scoreboard players operation @e[tag=deathpoint] deadplayer = @s[scores={deadplayer=1}] deadplayer

#

how do I get this to apply properly? Like what would be the best way to trigger this

#

nvm

carmine orbit
#

You don't need to check the score of @s, and you want to do @n instead of @e so that it only targets the single nearest armor stand

carmine orbit
quasi ginkgo
#

ok

carmine orbit
#

Which you should be running from the as @a[...] at @s, as I instructed

quasi ginkgo
quasi ginkgo
#

thankyou

#

just curious but what's the purpose of having it as a seperate function? is it so it only calls it once? or so its not constantly running?

carmine orbit
#

So that the player can still be the executing entity for the scoreboard command

#

As well as the executing position for the summon command and the scoreboard command to be able to find said armor stand

quasi ginkgo
#

ah kk

#

btw is this what you ment for this? run scoreboard players operation @n[tag=deathpoint] deathps = @a[scores={deadplayer=1}] playerid

#

I also made it use its own scoreboard

carmine orbit
#

What's that run at the beginning for?

#

And why are you using @a[...]???

#

I said to just use @s and not check the score, it's already being run as the dead player

quasi ginkgo
#

should I be using @s?

carmine orbit
#

Yes 😭 that's what you were using before

quasi ginkgo
#

ok wasnt sure which you ment that for

#

ignore the run, that was for me to test it worked to some extent

carmine orbit
#

Ok

quasi ginkgo
#

so that scoreboard command goes into its own mcfunction file?

carmine orbit
#

Yes, and also in that mcfunction file will be the summon command

#

Right before this scoreboard command

quasi ginkgo
#

ok

#

how do I trigger that other function how you were saying?

#

im confused on that part

carmine orbit
#

The function is getting run by your as @a[...] at @s command...

quasi ginkgo
#

ok so do I seperate the summon section off of this for the mcfunction then?

#

execute as @a[scores={deadplayer=1}] at @s run summon armor_stand ~ ~ ~ {Glowing:1b,Tags:["deathpoint"],DisabledSlots:4144959}

carmine orbit
#

Yes, like I have said repeatedly, the summon command is being moved into the new, separate function

#

Instead you will run said function, which has the summon command and the scoreboard command

quasi ginkgo
#

ok so how do I trigger the summon in the main file now that the two are seperate? is it still just that score check?

carmine orbit
#

Why would you need to do that?

#

It's in a function, just run the function

#

Foundational knowledge: do you know that the /function command exists?

quasi ginkgo
#

I mean how would the armorstand know to summon at the player initially?

#

thats where im lost sorry

carmine orbit
#

Because you are running the function as and at the player

carmine orbit
#

Just replace the summon ... after the run with function <your function id>

quasi ginkgo
#

oh ok thats what i was lost on thankyou

#

ok I think I got it

carmine orbit
#

Great

quasi ginkgo
#

not sure why but the mcfunction file im trying to call doesnt seem to register ingame with the follow in it.


scoreboard players operation @n[tag=deathpoint] deathps = @s[scores={deadplayer=1}] playerid

scoreboard players set @s deadplayer 0```
#

am I just not seeing whats wrong?

carmine orbit
#

What do the logs say?

quasi ginkgo
#

nvm I figured it

#

@n isnt valid so I did @e[sort=neartest

carmine orbit
#

Ah, you may be on a slightly older version

#

You'll need to do limit=1 as well

quasi ginkgo
#

yeah 1.20.1

carmine orbit
#

Ah

quasi ginkgo
#

good to know about that in the new versions though

#

will make it easier to update

carmine orbit
#

Yeah it's just a nice shorthand

quasi ginkgo
#

i bet

#

this is essentially me completely redoing my ealier project using an armorstand instead btw

#

now I just need to do a compare of scores when in radius

#

then its basically done

#

Sorry for all the confusion btw

#

you've been a massive help

#

how can I give a player an item on respawn?

#

actualy hold that thought

quasi ginkgo
#

ok final question. How can I get this execute if score @s[distance=..3] playerid = @s[type=minecraft:armor_stand,sort=nearest,limit=1] deathps run clear @s minecraft:recovery_compass working in the mcfunction file after the armorstand spawns? or would it be better if I did a similar thing and make another function to call on?

#

trying to check if the player thats within 3 blocks has a matching score and if so to remove compass

carmine orbit
#

I don't understand what you're wanting or why you want it in the same function that spawns the armor stand

quasi ginkgo
#

I dont anymore lol

carmine orbit
carmine orbit
quasi ginkgo
#

im not sure, ive tried both doing an execute if score or player = that of the stand in the tick.mcfunction and in its own seperate function thats called on and it doesnt seem to work

carmine orbit
#

I'm too tired for this

quasi ginkgo
#

I have this as a trigger for a new function atm
execute as @a[scores={deadplayer=..0}] as @s run function coords:deletesc

carmine orbit
#

The second as should be an at

quasi ginkgo
#

and this is what im trying in the function atm
execute if score @e[type=minecraft:armor_stand,limit=1,sort=nearest,distance=..4] deathps = @p playerid as @p run clear @s minecraft:recovery_compass

quasi ginkgo
#

I also have tried doing the player first

carmine orbit
#

The first @p should be @s, and you don't need the as @p

quasi ginkgo
#

kk

carmine orbit
#

Once you make those three changes (and no others!) it looks like it should be good.

quasi ginkgo
#

that fixed it! thankyou

#

Thankyou very much for all of the help!

carmine orbit
#

Sure

quasi ginkgo
#

The rest I should be able to do on my own

serene vaultBOT
# quasi ginkgo Thankyou very much for all of the help!
🎗️ Is your question resolved?

If your question is resolved, that's great to hear! Make sure to run /resolve or click the Resolve Question button. Otherwise, feel free to continue asking for help! :D