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.

Crate Inventory / GUI Issues

Discussion in 'Skript' started by Nightmarinya, May 20, 2019.

Thread Status:
Not open for further replies.
  1. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    With the first part I mean something like this:
    Code (Text):
    1. set {_i} to 1
    2. loop {_l::*}:
    3.     # code, use {_i} as the iteration
    4.     add 1 to {_i}
    And for the second part:
    Code (Text):
    1. set {_item} to slot {slot::%player%::%event-slot%} of current inventory of player
    2. # {_item} is the variable with the correct item here
     
  2. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    So would it look more something like this or-?
    I think I understand what you mean by the 2nd part now, the 1st part is still a little cloudy for me
    Trying to follow with you as much as I plausibly can I'm having a bit of troubles though.
    Code (Skript):
    1.  
    2.     set {_item} to slot {slot::%player%::%event-slot%} of current inventory of player
    3.         loop all items in player's current inventory:
    4.         set {_i} to 0
    5.             loop {_l::*}:
    6.                 add 1 to {_i}
    7.                 slot {_i} of player's current inventory is not ender chest named "&6&l???" with lore "&7Click to redeem a random item" and "&7from the Irothai Caverns&7 Lootbox!":
    8.                     name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    9.                        set slot 49 of player's current inventory to glowing chorus flower named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!"
    10.                        stop
    11.  
    Also I read up on this about the different types of variables and I understand them a liiiiiittle better?
    Here's the link if anyone wants it http://en.njol.ch/projects/skript/doc/variables
    --- Double Post Merged, May 26, 2019, Original Post Date: May 26, 2019 ---
    I realize now that the numbers in "slot (numbers) of player's current inventory is ender chest name..." should probably have been changed to {_i}, edited above ^^ correct me if I'm wrong
     
  3. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    I think I understood you wrong, sorry for that. You should use contains (or in your case, does not contain) for the condition if none of the slots is an enderchest.
     
  4. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    Oooh, no problem! Thanks I've give it a shot and let you know if something happens :emoji_slight_smile:
    --- Double Post Merged, May 26, 2019, Original Post Date: May 26, 2019 ---
    Code (Skript):
    1.  
    2. set {_i} to 0
    3.     loop {_l::*}:
    4.        add 1 to {_i}
    5.        slot {_i} of player's current inventory does not contain ender chest named "&6&l???" with lore "&7Click to redeem a random item" and "&7from the Irothai Caverns&7 Lootbox!":
    6.            name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    7.                 set slot 49 of player's current inventory to glowing chorus flower named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!"
    8.                 stop
    9.  
    So like this?
    If so it gives an error:

    Can't understand condition for "slot {_i} of player's current inventory does not contain ender chest..."
    "slot 32, 31, 30, 23, 22, 21, 14, 13 and 12 of player's current inventory does not contain ender chest..." also didn't work with & w/o the {_i} and {_l::*} variables, gives same error

    EDIT: ah wait nevermind I assume you mean
    Code (Skript):
    1.  
    2. loop all items in player's current inventory:
    3.     player's current inventory does not contain ender chest named "&6&l???" with lore "&7Click to redeem a random item" and "&7from the Irothai Caverns&7 Lootbox!":
    4.         name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    5.             set slot 49 of player's current inventory to glowing chorus flower named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!"
    6.             stop
    7.  
    Not the other one I sent
     
    #44 Nightmarinya, May 26, 2019
    Last edited: May 26, 2019
  5. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    Yea that's what I meant
     
  6. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    Right that worked! Awesome! That issues taken care of now the last thing is the stuff I wrote for giving the items to the players isn't actually giving it to them, any issues you see here?
    Code (Skript):
    1.  
    2. set {_item} to slot {slot::%player%::%event-slot%} of current inventory of player
    3.  
    Code (Skript):
    1.  
    2. on inventory close:
    3.     name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    4.         loop all items in player's current inventory:
    5.             slot 32, 31, 30, 23, 22, 21, 14, 13 and 12 of player's current inventory is ender chest named "&6&l???" with lore "&7Click to redeem a random item" and "&7from the Irothai Caverns&7 Lootbox!":
    6.                 wait 1 tick
    7.                 give 1 ender chest named "&4&l-=+> &c&k::&7 Irothai Caverns Lootbox &c&k::&4&l <+=-" with lore "&7A mysterious box found in the depths of", "&7the Irothai Caverns, there may be more", "&7down there, but this is the first of it's", "&7kind to see the light of day...", "&k", "&f&lNORMAL REWARDS:", "&7 - x32 Diamond Blocks", "&7 - x256 Bottles of Enchanting", "&7 - x2 Beacons", "&7 - x1 Irothian Pickaxe", "&7 - x64 Golden Apples", "&k", "&5&lEPIC REWARDS:", "&7 - &5x1 Reward Loot Crate &7(Tier 1 - 3)", "&7 - &5x2 Enchanted Golden Apples", "&7 - &5x1 Shulker Box", "&7 - &5x1 Mending Enchanted Book", "&7 - &5x3 Random Custom Enchants", "&k", "&6&lLEGENDARY REWARDS:", "&7 - &ex3 Random Loot Crates &7(Tier 2 - 4)", "&7 - &ex1 Experience Booster &7(4 Hours)", "&7 - &ex1 Command Access: &7/sethome, /home", "&7 - &ex5 Random Custom Enchants", "&7 - &ex1 Dragon Egg", "&7 - &ex1 Elytra", "&k", "&4&lDIVINE REWARDS:", "&7 - &cx1 &k::&7&l Irothian Knight VKit Access &c&k::", "&7 - &cx1 &k::&7&l Irothai Caverns Key &c&k::", "&7 - &cx1 Potion of Unlimited Buffs &7(3 Uses)", "&7 - &cx2 Totems of Undying", "&7 - &cx1 Random Divine Custom Enchant" and "&7 - &cx1 Admin Item" to player
    8.                 stop
    9.             slot 49 of player's current inventory is red stained glass pane named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!", "&k", "&4You must open your main rewards before" and "&4you can open your &nDIVINE&4 reward!":
    10.                 wait 1 tick
    11.                 open event-inventory to player
    12.                 stop
    13.             slot 49 of player's current inventory is not red stained glass pane named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!", "&k", "&4You must open your main rewards before" and "&4you can open your &nDIVINE&4 reward!":
    14.                 slot 49 of player's current inventory is glowing chorus flower named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!":
    15.                     wait 1 tick
    16.                     open event-inventory to player
    17.                     stop
    18.  
    19.  
    20.             slot 49 of player's current inventory is not red stained glass pane named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!", "&k", "&4You must open your main rewards before" and "&4you can open your &nDIVINE&4 reward!":
    21.                 slot 49 of player's current inventory is not glowing chorus flower named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!":
    22.                     {_item}
    23.                     stop
    24.  
    (I separated the part of the code that I wrote in this 2nd code block that is supposed to give the items to the player.)
    (Gives no items, not even 1. No errors)
     
  7. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    Well I don't see a give effect anywhere or the set item line
     
  8. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    oh my goodness what is wrong with me right now.
    I'm so sorry
     
    #48 Nightmarinya, May 26, 2019
    Last edited: May 26, 2019
  9. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    Don't worry about it, happens to everyone
     
  10. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    I set "{_item}" to
    Code (Skript):
    1.  
    2. give {_item} to player
    3.  
    and that didn't work

    Also the set event is above the thing that checks if all 9 ender chests don't exist, didn't add it to the code block when I sent that, sorry for that
    Code (Skript):
    1.  
    2. set {_item} to slot {slot::%player%::%event-slot%} of current inventory of player
    3.  
    That's what I set it to ^^

    EDIT: Currently working on the code from scratch with TPGamesNL and AsuDev (Revelationage) via Discord and will post the finished result on the thread so people can see how it looks and what I changed to resolve the issues on this thread, might take a little but if possible don't kill the thread until I post that update, thanks~
     
    #50 Nightmarinya, May 26, 2019
    Last edited: May 26, 2019
  11. jonawoning

    jonawoning Member

    Joined:
    May 24, 2019
    Messages:
    29
    Likes Received:
    2
    I think this is the best solution of what you want.
    If it still don't works, tell us maybe we can help again.
    :emoji_wink:
     
Thread Status:
Not open for further replies.

Share This Page

Loading...