Hello, I'm trying to make a system that when a player dies, he keeps his inventory for 15 seconds, then his inventory is looted at his death position.
The only thing I can not do is loot the inventory after 15 seconds. Indeed, we can not change the drops after the event has taken place.
Code:
Thank's
The only thing I can not do is loot the inventory after 15 seconds. Indeed, we can not change the drops after the event has taken place.
Code:
code_language.skript:
on death of player:
set {Death::%victim's uuid%} to victim's location
set death message to ""
set {_drops::*} to drops
remove player's helmet from {_drops::*}
remove player's chestplate from {_drops::*}
remove player's leggings from {_drops::*}
remove player's boots from {_drops::*}
set {_helmet} to player's helmet
set {_chestplate} to player's chestplate
set {_leggings} to player's leggings
set {_boots} to player's boots
clear drops
wait 5 ticks
add {_drops::*} to victim's inventory
set player's helmet to {_helmet}
set player's chestplate to {_chestplate}
set player's leggings to {_leggings}
set player's boots to {_boots}
set {_drops::*} to drops
set {LgUHC.Death::%player's uuid%} to now
set {LgUHC.Inventory::%player%} to serialized contents of player's inventory
set {LgUHC.InventoryHelmet::%player%} to victim's helmet
set {LgUHC.InventoryChestplate::%player%} to victim's chestplate
set {LgUHC.InventoryLeggings::%player%} to victim's leggings
set {LgUHC.InventoryBoots::%player%} to victim's boots
force victim to respawn
wait 15 seconds
Loot(victim) #Here I would like to loot the inventory
play raw sound "mob.wither.spawn" at all players with pitch 1 volume 100
broadcast "&c&l%victim% is dead!"
set the gamemode of victim to spectator
function Loot(p: player):
drop 2 obsidian at {LgUHC.Death::%{_p's uuid}%}
Thank's