I am currently making a gravestone system in minecraft with command blocks, and that means I need to run a command at the location of a player before they die.
I have tried the obvious answer, executing on a player when their deaths score increases: (deaths
is a scoreboard tracking deathCount
)
execute @e[score_deaths_min=1] ~ ~ ~ summon minecraft:armor_stand
however this summons the armor stand after the player respawns because it can't find the player when they are dead
I also tried teleporting a mob to a player when they die, however the mob can't be teleported to a dead player either:
summon minecraft:armor_stand 0 1000 0 {CustomName:"deadplayer",NoAI:1b,NoGravity:1b,Invisible:0b,Invulnerable:1b}
tp @e[name=deadplayer] @e[score_deaths=1]
function graves:playerdied unless @e[name=deadplayer,x=0,y=1000,z=0,r=5]
kill @e[name=deadplayer]
function graves:playerdied:
execute @e[name=deadplayer] ~ ~ ~ summon minecraft:armor_stand
This does the exact same thing, spawning the armorstand in the player when they click respawn, but not at their death point.
How can I spawn an armorstand or execute commands at the death point of a player, not where they respawn?