# When a player dies there is a corpse created in their place. In order for this to work # Gamerule KeepInventory must be set to true. Also armour is not put into the inventory of # the corpse. clean: type: world events: on player quit: - if .inventory.stacks> == 0 remove n@ death: type: world events: on player dies: # If there is an old body it will drop everything. - foreach .inventory.list_contents> { - drop %value% .location> } # Removes an old body if there is one - remove n@ # Create body at the players death location - create player # Flag dead player to the created npc for latter/earlier reference - flag player body:.id> # give script to body to retrieve items - assignment set script:corpse npc: # Move inventory from dead player, to new body - inventory move d:in@npc[n@] o:.inventory> # Does not work as expected. # - animate n@ a:sleep corpse: type: assignment interact scripts: - 10 body body: type: interact Steps: 'retrive': click trigger: script: - inventory open d: damage trigger: script: - ^inventory add o:in@npc[n@] d:.inventory> - ^remove n@