#How do I copy the nearest players uuid with DeathTime:1s to the nearest armorstand?
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
💬 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
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
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
How are you detecting the player death to summon the armor stand in the first place
execute at @a[nbt={DeathTime:1s}] as @a[nbt={DeathTime:1s}] run summon minecraft:armor_stand ~ ~ ~ {Glowing:1b,DisabledSlots:4144959,CustomName:'{"text":"DeathPoint"}'}
glowing is just for identification
Well I'd definitely recommend a death scoreboard instead, but either way the solution is the same
pros and cons to death scoreboard vs nbt check?
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
ah ok
So a simple scoreboard that goes to 1 when a player died then resets should work?
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
may you give an example by chance?
I understand the concept just cant visualise it atm
Not without just writing it for you. Try writing it yourself and we'll go from there.
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?
Probably a good idea, yes
I was trying a few different things while waiting on this ngl so I got an id system made
It can still be based on the UUID, just need to set each player's ID score once when they join
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?
by using the death statistics
im not sure how to do this ngl. I have tried with no success
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
I got a death scoreboard that auto resets to 0 working
Great
but thats about it
You didn't write anything else, or what you wrote didn't work?
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
If it's a score, you do a scoreboard players operation command
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
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?
Yep
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
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
It goes in the same function as the armor stand summon command, right after it
ok
Which you should be running from the as @a[...] at @s, as I instructed
mind showing me where you said that earlier again?
Here
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?
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
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
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
should I be using @s?
Yes 😭 that's what you were using before
ok wasnt sure which you ment that for
ignore the run, that was for me to test it worked to some extent
Ok
so that scoreboard command goes into its own mcfunction file?
Yes, and also in that mcfunction file will be the summon command
Right before this scoreboard command
ok
how do I trigger that other function how you were saying?
im confused on that part
The function is getting run by your as @a[...] at @s command...
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}
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
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?
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?
I mean how would the armorstand know to summon at the player initially?
thats where im lost sorry
Because you are running the function as and at the player
Thanks to this command
Just replace the summon ... after the run with function <your function id>
Great
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?
What do the logs say?
yeah 1.20.1
Ah
Yeah it's just a nice shorthand
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
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
I don't understand what you're wanting or why you want it in the same function that spawns the armor stand
I dont anymore lol
Like I get this, don't repeat this
Ok so what's the problem?
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
Besides the fact that this doesn't do anything because @s means "the thing executing this command" so you're just checking if the score of the thing executing this is the same as the score of the armor stand executing this
I'm too tired for this
I have this as a trigger for a new function atm
execute as @a[scores={deadplayer=..0}] as @s run function coords:deletesc
The second as should be an at
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
alright ill try that
I also have tried doing the player first
The first @p should be @s, and you don't need the as @p
kk
In this command
Once you make those three changes (and no others!) it looks like it should be good.
Sure
The rest I should be able to do on my own
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