Solved death cancel drops of items

  • 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.

cvcv789789

New Member
Aug 15, 2018
7
0
0
24
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​
 
If you want to clear the item drops, use this.
code_language.skript:
on death:
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:
 
Last edited:
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​
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
 
If you want to cancel the item drops, use this.
code_language.skript:
on death:
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:
Won't that "clear drops" effect destroy all drops?
 
Yes, that was I said. Isn't it?
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.
 
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.
Oops! Sorry, my head, what a fail! :emoji_smile:
 
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
How did you do that?
 
How did you do that?
Maybe something like this:
code_language.skript:
on death of player:
    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}
 
Maybe something like this:
code_language.skript:
on death of player:
    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}

you are right , Thank you
Please forgive me. My English is weak
I am from Taiwan.
[doublepost=1534499040,1534496362][/doublepost]how to retention level?
on death
set {_lv} to player's level
wait 5 ticks

set player's level to {_lv}



I can not
 
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
 
Status
Not open for further replies.