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.

Help removing Items

Discussion in 'Skript' started by GlaxFusion, Jan 14, 2022 at 11:00 PM.

  1. GlaxFusion

    GlaxFusion Member

    Joined:
    Feb 9, 2021
    Messages:
    3
    Likes Received:
    0
    Hello, So Im trying to do something like a compressor of items.

    The problem is that when It removes the cobblestone it also removes the given item, the Compressed Stone, I want to keep it and only remove the cobblestone.

    (Srry for bad english)

    Code (Text):
    1. on block break:
    2.  if items in player's inventory contains 1 of beacon named "&a&lT1 Mineral Compressor":
    3.   if player has 32 of cobblestone:    
    4.    remove 32 of cobblestone from player's inventory
    5.    give player 1 of glowing cobblestone named "&7&lCompressed Stone"
     
  2. WoolBoy

    WoolBoy New Member

    Joined:
    Sep 16, 2021
    Messages:
    5
    Likes Received:
    0
    When removing cobblestone from the inventory of the player, Skript is not picky about whether or not the cobblestone it deletes is named "Compressed Stone" or if it is just normal cobblestone, it will simply delete the first 32 cobblestone in the player's inventory. To fix this problem, you must check whether or not the cobblestone is named "Compressed Stone" or just "Cobblestone".

    To do this you will just have to remove 32 cobblestone named "cobblestone"

    You can accomplish this with this skript:

    Code (Text):
    1. on block break:
    2.     event-block is cobblestone
    3.     items in player's inventory contains 1 of beacon named "&a&lT1 Mineral Compressor":
    4.     player has 32 cobblestone
    5.     give player 1 of glowing cobblestone named "&7&lCompressed Stone"
    6.     remove 32 of cobblestone named "Cobblestone" from player's inventory
    EDIT:
    This solution has an issue. The system counts compressed cobblestone towards the 32 cobblestone blocks to compress, but does not remove it. A check must be introduced when it counts the number of cobblestone in the player's inventory.
     
    #2 WoolBoy, Jan 17, 2022 at 4:06 PM
    Last edited: Jan 17, 2022 at 4:13 PM
  3. GlaxFusion

    GlaxFusion Member

    Joined:
    Feb 9, 2021
    Messages:
    3
    Likes Received:
    0
    I figure out how to do it, thank you :emoji_slight_smile:
     

Share This Page

Loading...