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 death cancel drops of items

Discussion in 'Skript' started by cvcv789789, Aug 15, 2018.

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

    cvcv789789 New Member

    Joined:
    Aug 15, 2018
    Messages:
    7
    Likes Received:
    0
    on death of player:
    set {_drops::*} to drops
    remove drops from the drops
    wait 5 ticks
    add {_drops::*} to victim's inventory
    BUG-->
    players inventory is full
    on death
    respawn
    Equipment are gone!!!!



    How to repair​


     
  2. Best Answer:
    Post #9 by TPGamesNL, Aug 17, 2018
  3. Aidanete

    Aidanete Active Member

    Joined:
    Apr 11, 2017
    Messages:
    139
    Likes Received:
    10
    If you want to clear the item drops, use this.
    Code (Skript):
    1. on death:
    2. clear drops
    If you want to keep inventory, use the command /gamerule keepInventory true

    EDIT: If you want to add the list variable to the player's inventory to respawn with all the inventory, you may use on respawn event to add the player's inventory to the inventory, if you add when dead, it won't work :emoji_grinning:
     
    #2 Aidanete, Aug 15, 2018
    Last edited: Aug 15, 2018
  4. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    It's probably because when a player's inventory if full, Skript WILL try to give the armor, but since all the items from the 4x9 inventory are back in the player's inventory, it won't give the items because the player's inventory is filled back up again and Skript can't add items to a full inventory. You can try removing the armor from the drops, then setting the armor of the player when it's respawned so that it doesn't add to the 4x9 inventory, but to the actual armor slots
     
  5. jaylawl

    jaylawl Active Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    Won't that "clear drops" effect destroy all drops?
     
  6. Aidanete

    Aidanete Active Member

    Joined:
    Apr 11, 2017
    Messages:
    139
    Likes Received:
    10
    Yes, that was I said. Isn't it?
     
  7. jaylawl

    jaylawl Active Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    No you said it would cancel the drops, in the same way "keepInventory" would. Maybe i misunderstood you. As far as i know, "clear drops" will destroy all drops rather than cancelling the drops.
     
  8. Aidanete

    Aidanete Active Member

    Joined:
    Apr 11, 2017
    Messages:
    139
    Likes Received:
    10
    Oops! Sorry, my head, what a fail! :emoji_smile:
     
  9. cvcv789789

    cvcv789789 New Member

    Joined:
    Aug 15, 2018
    Messages:
    7
    Likes Received:
    0
    How did you do that?
     
  10. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    Maybe something like this:
    Code (Skript):
    1. on death of player:
    2.     set {_drops::*} to drops
    3.     remove player's helmet from {_drops::*}
    4.     remove player's chestplate from {_drops::*}
    5.     remove player's leggings from {_drops::*}
    6.     remove player's boots from {_drops::*}
    7.     set {_helmet} to player's helmet
    8.     set {_chestplate} to player's chestplate
    9.     set {_leggings} to player's leggings
    10.     set {_boots} to player's boots
    11.     clear drops
    12.     wait 5 ticks
    13.     add {_drops::*} to victim's inventory
    14.     set player's helmet to {_helmet}
    15.     set player's chestplate to {_chestplate}
    16.     set player's leggings to {_leggings}
    17.     set player's boots to {_boots}
     
  11. cvcv789789

    cvcv789789 New Member

    Joined:
    Aug 15, 2018
    Messages:
    7
    Likes Received:
    0
    you are right , Thank you
    Please forgive me. My English is weak
    I am from Taiwan.
    --- Double Post Merged, Aug 17, 2018, Original Post Date: Aug 17, 2018 ---
    how to retention level?
    on death
    set {_lv} to player's level
    wait 5 ticks

    set player's level to {_lv}



    I can not
     
  12. Aidanete

    Aidanete Active Member

    Joined:
    Apr 11, 2017
    Messages:
    139
    Likes Received:
    10
    on death:
    set {level::%player%} to player's level

    on respawn:
    set player's level to {level::%player%}
    delete {level::%player%} # This is for saving fewer variables as possible to improve performance

    @cvcv789789
     
Thread Status:
Not open for further replies.

Share This Page

Loading...