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.

Skript comes back with no errors but doesn't actually work

Discussion in 'Skript' started by MPGxxYT, Jul 18, 2019.

Tags:
Thread Status:
Not open for further replies.
  1. MPGxxYT

    MPGxxYT Member

    Joined:
    Feb 14, 2018
    Messages:
    10
    Likes Received:
    0
    The skript gives no errors but when the command is run the items aren't in the chest that spawned.

    command /chestspawn [<text>]:
    trigger:
    loop {%arg 1%::chest::*}:
    #the location of chest pos list
    set block at loop-value to chest
    set {_item-count} to random integer from 2 to 5
    clear inventory of block at loop-value
    loop {_item-count} times:
    chance of 100%:
    set {_item} to random element out of {sg.50::%arg 1%::*}
    #<list of items with only chain boots on it
    add {_item} to inventory of block at loop-value #I assume it is something to do with this line ~~
    send "%{_item}%" #debug item just tells me the item
    send "%loop-value%" #debug chest location tells me the chest location
     
  2. LukynkaCZE

    LukynkaCZE Active Member

    Joined:
    May 12, 2019
    Messages:
    26
    Likes Received:
    0
    Hi, I don't know exactly what you're trying to do, but if you're doing something like Chest Refill, try this skript



    Code (Text):
    1. options:
    2.     prefix: &6
    3.     perm: is.admin
    4.     noperm: &cYou don't have the permission to do that!
    5.     minitems: 1
    6.     maxitems: 3
    7.  
    8.  
    9. on load:
    10.     clear {ritem::*}
    11.     add 2 eggs to {ritem::*}
    12.     add 10 eggs to {ritem::*}
    13.     add 8 eggs to {ritem::*}
    14.     add gold sword to {ritem::*}
    15.     add gold helmet to {ritem::*}
    16.     add iron chestplate to {ritem::*}
    17.     add gold leggings to {ritem::*}
    18.     add iron boots to {ritem::*}
    19.     add 12 arrow to {ritem::*}
    20.     add 16 arrow to {ritem::*}
    21.     add 24 arrow to {ritem::*}
    22.     add 32 stone to {ritem::*}
    23.     add 16 stone to {ritem::*}
    24.     add 48 bricks to {ritem::*}
    25.     add 15 bricks to {ritem::*}
    26.     add bow to {ritem::*}
    27.     add leather boots to {ritem::*}
    28.     add leather helmet to {ritem::*}
    29.     add leather chestplate to {ritem::*}
    30.     add leather leggings to {ritem::*}
    31.     add 16 snowballs to {ritem::*}
    32.     add 32 snowballs to {ritem::*}
    33.     add 1 golden apple to {ritem::*}
    34.     add 2 golden apple to {ritem::*}
    35.     add 4 golden apple to {ritem::*}
    36.     add 32 oak planks to {ritem::*}
    37.     add 16 oak planks to {ritem::*}
    38.     add 64 oak planks to {ritem::*}
    39.     add 1 ender pearl to {ritem::*}
    40.     add 2 ender pearl to {ritem::*}
    41.     add 3 experience bottle to {ritem::*}
    42.     add 6 experience bottle to {ritem::*}
    43.     add 4 175 named "&cKredit" to {ritem::*}
    44.     add 7 175 named "&cKredit" to {ritem::*}
    45.     add 12 175 named "&cKredit" to {ritem::*}
    46.     add 4 175 named "&cKredit" to {ritem::*}
    47.     add 7 175 named "&cKredit" to {ritem::*}
    48.     add 12 175 named "&cKredit" to {ritem::*}
    49.     add 4 175 named "&cKredit" to {ritem::*}
    50.     add 7 175 named "&cKredit" to {ritem::*}
    51.     add 12 175 named "&cKredit" to {ritem::*}
    52.     add 4 175 named "&cKredit" to {ritem::*}
    53.     add 7 175 named "&cKredit" to {ritem::*}
    54.     add 12 175 named "&cKredit" to {ritem::*}
    55.  
    56.  
    57.  
    58.  
    59.  
    60.  
    61. command /skchest [<text>]:
    62.     trigger:
    63.         if arg 1 is "add":
    64.             if player has permission "{@perm}":
    65.                 if target block is chest:
    66.                     add location of target block to {cheloc::*}
    67.                     message "{@prefix} Succesfully executed &3AddChest"
    68.                     loop {cheloc::*}:
    69.                         if loop-value is location of target block:
    70.                             message "{@prefix} This chest has already been checked as a SkChest!"
    71.                             stop
    72.                 else:
    73.                     message "&b{@prefix} You need to select a chest!"
    74.             else:
    75.                 message "{@noperm}"
    76.         if arg 1 is "remove":
    77.             if player has permission "{@perm}":
    78.                 if target block is a chest:
    79.                     remove location of target block from {cheloc::*}
    80.                     message "{@prefix} Succesfully removed the selected chest!"
    81.                     clear inventory of target block
    82.                     stop
    83.                 else:
    84.                     message "{@prefix} You need to select a chest!"
    85.             else:
    86.                 message "{@noperm}"
    87.         if arg 1 is "refill":
    88.             if player has permission "{@perm}":
    89.                 loop {cheloc::*}:
    90.                     set {_cheslot::*} to ""
    91.                     loop 27 times:
    92.                         add loop-number to {_slotnum::*}
    93.                     clear inventory of block at loop-value
    94.                     wait 1 tick
    95.                     message "&b{@prefix} Succesfully executed &3ChestRefill"
    96.                     set {_loop} to a random integer between {@minitems} and {@maxitems}
    97.                     loop {_loop} times:
    98.                         set {_cheitem} to a random element out of {ritem::*}
    99.                         set {_cheslot} to a random element out of {_slotnum::*}
    100.                         add {_cheitem} to slot ({_cheslot} - 1) of block at loop-value-1
    101.             else:
    102.                 message "{@noperm}"
    103.         if arg 1 is "about" OR "version":
    104.             message "&3&lSkChests &r&b> Currently running version &3Build 2&b, created by Efnilite"
    105.         if arg 1 is not set:
    106.             if player has permission "{@perm}":
    107.                 message "{@prefix} You need to specify a command! Usage: /skchest <add/remove/refill>"
    108.             else:
    109.                 message "{@noperm}"
    - Commands:
    - /skchest > Main command.
    - /skchest add > Add a chest to the list of chests.
    - /skchest remove > Remove a chest from the list
    - /skchest refill > If you have selected all your chests, or if your minigame is over, you can make the console..
     
Thread Status:
Not open for further replies.
Loading...