Date: 2014/04/30 17:31:07 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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 <n@<player.flag[body]>.inventory.stacks> == 0 remove n@<player.flag[body]>
death:
type: world
events:
on player dies:
# If there is an old body it will drop everything.
- foreach <n@<player.flag[body]>.inventory.list_contents> { - drop %value% <n@<player.flag[body]>.location> }
# Removes an old body if there is one
- remove n@<player.flag[body]>
# Create body at the players death location
- create player <player.name> <player.location>
# Flag dead player to the created npc for latter/earlier reference
- flag player body:<n@<player.name>.id>
# give script to body to retrieve items
- assignment set script:corpse npc:<player.name>
# Move inventory from dead player, to new body
- inventory move d:in@npc[n@<player.flag[body]>] o:<p@<player.name>.inventory>
# Does not work as expected.
# - animate n@<player.flag[body]> a:sleep
corpse:
type: assignment
interact scripts:
- 10 body
body:
type: interact
Steps:
'retrive':
click trigger:
script:
- inventory open d:<npc.inventory>
damage trigger:
script:
- ^inventory add o:in@npc[n@<player.flag[body]>] d:<p@<player.name>.inventory>
- ^remove n@<npc.id>