Solved How can I randomly remove 1 slot for a player's inventory item when the player dies?

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

Status
Not open for further replies.

백형찬

New Member
Jul 29, 2021
8
0
1
Code:
options:
    ID:


on death:
    set {_inv::*} to slots of player's inventory
    set {_inv::*} to shuffled {_inv::*}
    delete {_inv::1} if {_inv::1} is set
    set {{@ID}::storage::*} to {_inv::*}



I've written the syntax so far, but I don't know how
 
I'm not sure how many slots a player's inventory has, but this should work
Code:
on death:
    set {_slot} to a random integer between 0 and 35
    set slot {_slot} of player's inventory to air
 
I'm not sure how many slots a player's inventory has, but this should work
Code:
on death:
    set {_slot} to a random integer between 0 and 35
    set slot {_slot} of player's inventory to air

Wouldn't this code also include empty item slots?
I only want to remove one of the item slots I have from the player slot
 
Code:
on death:
    while {_x} is not set:
        set {_slot} to a random integer between 0 and 35
        if slot {_slot} of player's inventory is not air:
            set slot {_slot} of player's inventory to air
            set {_x} to true
        wait 1 tick
 
Status
Not open for further replies.