1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Drop to death

Discussion in 'Skript' started by Aralwen, Aug 24, 2018.

Thread Status:
Not open for further replies.
  1. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    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 (Skript):
    1. on death of player:
    2.   set {Death::%victim's uuid%} to victim's location
    3.     set death message to ""
    4.  
    5.     set {_drops::*} to drops
    6.     remove player's helmet from {_drops::*}
    7.     remove player's chestplate from {_drops::*}
    8.     remove player's leggings from {_drops::*}
    9.     remove player's boots from {_drops::*}
    10.     set {_helmet} to player's helmet
    11.     set {_chestplate} to player's chestplate
    12.     set {_leggings} to player's leggings
    13.     set {_boots} to player's boots
    14.  
    15.     clear drops
    16.     wait 5 ticks
    17.     add {_drops::*} to victim's inventory
    18.     set player's helmet to {_helmet}
    19.     set player's chestplate to {_chestplate}
    20.     set player's leggings to {_leggings}
    21.     set player's boots to {_boots}
    22.  
    23.  
    24.     set {_drops::*} to drops
    25.     set {LgUHC.Death::%player's uuid%} to now
    26.     set {LgUHC.Inventory::%player%} to serialized contents of player's inventory
    27.     set {LgUHC.InventoryHelmet::%player%} to victim's helmet
    28.     set {LgUHC.InventoryChestplate::%player%} to victim's chestplate
    29.     set {LgUHC.InventoryLeggings::%player%} to victim's leggings
    30.     set {LgUHC.InventoryBoots::%player%} to victim's boots
    31.     force victim to respawn
    32.  
    33.     wait 15 seconds
    34.  
    35.   Loot(victim) #Here I would like to loot the inventory
    36.     play raw sound "mob.wither.spawn" at all players with pitch 1 volume 100
    37.     broadcast "&c&l%victim% is dead!"
    38.     set the gamemode of victim to spectator
    39.  
    40.  
    41. function Loot(p: player):
    42.   drop 2 obsidian at {LgUHC.Death::%{_p's uuid}%}
    Thank's :emoji_slight_smile:

     
  2. Best Answer:
    Post #6 by jaylawl, Aug 25, 2018
  3. jaylawl

    jaylawl Active Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    Can you please re-explain what you're trying to achieve?
     
  4. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    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:
     
  5. jaylawl

    jaylawl Active Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    after this code the player can be marked as dead and you can do all the code you want with them

    Code (Skript):
    1. on damage:
    2.     damage > victim's health
    3.     cancel event
    4.     set {is-dying::%victim%} to true
    5.     # rest of the code
     
  6. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    Thank you ! I'm going to look at it more closely afterwards, but is it going to work if I do that?

    Code (Skript):
    1. loot {_drops::*} at {Death::%victim's uuid%}
    2. loot {_helmet} at {Death::%victim's uuid%}
    3. loot {_chestplate} at {Death::%victim's uuid%}
    4. loot {_leggings} at {Death::%victim's uuid%}
    5. loot {_boots} at {Death::%victim's uuid%}
     
  7. jaylawl

    jaylawl Active Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    No, but you can just kill the player after 15 seconds and it will drop the inventory normally
    Code (Skript):
    1. on damage:
    2.     damage > victim's health
    3.     cancel event
    4.     set {is-dying::%victim%} to true
    5.     # rest of the code
    6.  
    7.     wait 15 seconds
    8.     (player has not been healed conditon here)
    9.     kill victim
     
    • Agree Agree x 1
  8. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    Thank's :emoji_slight_smile:
     
    #7 Aralwen, Aug 25, 2018
    Last edited: Aug 25, 2018
Thread Status:
Not open for further replies.

Share This Page

Loading...