Solved Delete dropped item

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

verycoolguy123

Active Member
Jul 31, 2017
70
2
0
54
I know this is fairly simple, but I was wondering how I'd able to clear bowls when dropped. I've tried multiple things, and this seems to be the closest I've gotten to it. I just have no idea how to specify the item. Here is my code:
code_language.skript:
every 2 ticks:
    loop all dropped items:
        delete loop-value
 
I know this is fairly simple, but I was wondering how I'd able to clear bowls when dropped. I've tried multiple things, and this seems to be the closest I've gotten to it. I just have no idea how to specify the item. Here is my code:
code_language.skript:
every 2 ticks:
    loop all dropped items:
        delete loop-value
I couldn't get it to delete just bowls while they're on the ground, but I did figure out a work around you may find handy
code_language.skript:
on drop:
    if event-item is Bowl:
        cancel event
        wait 3 ticks
        remove 1 bowl from player's inventory
 
  • Like
Reactions: iAstora
I couldn't get it to delete just bowls while they're on the ground, but I did figure out a work around you may find handy
code_language.skript:
on drop:
    if event-item is Bowl:
        cancel event
        wait 3 ticks
        remove 1 bowl from player's inventory
Fair enough, that seems to do the job. Thanks. Will mark as solved.
 
  • Like
Reactions: Wynnevir
Ahh I think I get what you mean. I don't see a condition for just if an inventory being open(though I may be missing it), but perhaps you could set a variable to true on the inventory open event, and then delete it on inventory close. In the original code if said variable is true, stop.
code_language.skript:
on drop:
    if {inventory-variable} is true:
        stop
    if event-item is Bowl:
        cancel event
        wait 3 ticks
        remove 1 bowl from player's inventory
 
Ahh I think I get what you mean. I don't see a condition for just if an inventory being open(though I may be missing it), but perhaps you could set a variable to true on the inventory open event, and then delete it on inventory close. In the original code if said variable is true, stop.
code_language.skript:
on drop:
    if {inventory-variable} is true:
        stop
    if event-item is Bowl:
        cancel event
        wait 3 ticks
        remove 1 bowl from player's inventory
I think I described my issue incorrectly. My problem is outside the inventory, rather in the hotbar. I wanted to know if a player was in their inventory to see if i deleted the soup, or if they were outside it I'd set their tool to air. Take this as an example:

code_language.skript:
on inventory open:
    set {inventory-is-open-variable.soup.%player%} to true
on inventory close:
    set {inventory-is-open-variable.soup.%player%} to false
on drop:
    if {inventory-is-open-variable.soup.%player%} is true:
        if event-item is Bowl:
            cancel event
            wait 1 tick
            remove 1 bowl from player's inventory
    else:
        if event-item is Bowl:
            cancel event
            wait 1 tick
            set the player's tool to air
 
Status
Not open for further replies.