Dont drop specific items from inventory on 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 community!

    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!

xDalager05

New Member
Apr 9, 2024
7
0
1
Hello
I am right now making a boxpvp minecraft server. I want to make people drop loot but not armor, swords and tools. Is there a script for that pls? I found this BUT it didnt work and made me keep everything with and without keepinventory

"
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}"
 
This is because of the line add {_drops::*} to victim's inventory. You should instead use drop {_drops::*} at event-location
You should also use a different variable for saving the helmet and then give it back on respawn rather than death. You also need to use victim and not player.
All in all, the code should look like this
AppleScript:
on death of player:
    set {_drops::*} to drops
    remove victim's helmet from {_drops::*}
    remove victim's chestplate from {_drops::*}
    remove victim's leggings from {_drops::*}
    remove victim's boots from {_drops::*}
    set {armor::%victim's uuid%::helm} to victim's helmet
    set {armor::%victim's uuid%::chest} to victim's chestplate
    set {armor::%victim's uuid%::legs} to victim's leggings
    set {armor::%victim's uuid%::boots} to victim's boots
    clear drops
    drop {_drops::*} at event-location

on respawn:
    set player's helmet to {armor::%player's uuid%::helm} if {armor::%player's uuid%::helm} is set
    set player's chestplate to {armor::%player's uuid%::chest} if {armor::%player's uuid%::chest} is set
    set player's leggings to {armor::%player's uuid%::legs} if {armor::%player's uuid%::legs} is set
    set player's boots to {armor::%player's uuid%::boots} if {armor::%player's uuid%::boots} is set
    delete {armor::%player's uuid%::*}
  
on unload:
    delete {armor::*}
 
Last edited:
Thank you so much! When I paste your code in my script it doesnt work. I use "skript" Sorry. I am very new. What to do so it works in my skript
 
Last edited:
Are you on the latest skript version (2.8.3 I believe)? Also did you indent the code correctly? This skript worked when I tested it.
 
Are you on the latest skript version (2.8.3 I believe)? Also did you indent the code correctly? This skript worked when I tested it.
I have now downloaded the new version but when I type "/sk reload (my script) it doesnt say anything. Why. My server is on 1.8.8
 
Last edited:
Uhh that is probably the issue, Minecraft 1.8.8 is VERY outdated and recent versions of skript and its addons have absolutely 0 support for anything below 1.12, I recommend updating your server.

Why exactly is your server on 1.8.8?
 
Uhh that is probably the issue, Minecraft 1.8.8 is VERY outdated and recent versions of skript and its addons have absolutely 0 support for anything below 1.12, I recommend updating your server.

Why exactly is your server on 1.8.8?
Because the server host cant be above 1.8.8...