Solved Drop to death

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Aralwen

Active Member
May 26, 2017
164
14
18
25
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:

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 :emoji_slight_smile:
 
Can you please re-explain what you're trying to achieve?

A player dies, a other player has 15 seconds to save it or not. During this time the player can not move, he just has to wait
  • If the player is saved, he is teleported randomly elsewhere with his equipment
  • If he is not saved, his equipment is left where he was dead and he passes as a spectator
I have already done everything, but I can not find a way to keep the equipment and throw it away some time later x:
 
after this code the player can be marked as dead and you can do all the code you want with them

code_language.skript:
on damage:
    damage > victim's health
    cancel event
    set {is-dying::%victim%} to true
    # rest of the code
 
after this code the player can be marked as dead and you can do all the code you want with them

code_language.skript:
on damage:
    damage > victim's health
    cancel event
    set {is-dying::%victim%} to true
    # rest of the code
Thank you ! I'm going to look at it more closely afterwards, but is it going to work if I do that?

code_language.skript:
loot {_drops::*} at {Death::%victim's uuid%}
loot {_helmet} at {Death::%victim's uuid%}
loot {_chestplate} at {Death::%victim's uuid%}
loot {_leggings} at {Death::%victim's uuid%}
loot {_boots} at {Death::%victim's uuid%}
 
No, but you can just kill the player after 15 seconds and it will drop the inventory normally
code_language.skript:
on damage:
    damage > victim's health
    cancel event
    set {is-dying::%victim%} to true
    # rest of the code

    wait 15 seconds
    (player has not been healed conditon here)
    kill victim
 
No, but you can just kill the player after 15 seconds and it will drop the inventory normally
code_language.skript:
on damage:
    damage > victim's health
    cancel event
    set {is-dying::%victim%} to true
    # rest of the code

    wait 15 seconds
    (player has not been healed conditon here)
    kill victim

Thank's :emoji_slight_smile:
 
Last edited:
Status
Not open for further replies.