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.

Solved Crate script not working.

Discussion in 'Skript' started by BrettPlayMC, Feb 18, 2017.

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

    Supporter

    Joined:
    Jan 26, 2017
    Messages:
    715
    Likes Received:
    53
    Skript Version: Skript 2.2 (dev23)
    Skript Author: Dzikoysk
    Minecraft Version: 1.8.8 (Spigot)

    Full Code:
    https://hastebin.com/leterifipi.sql
    Errors on Reload:
    None

    Console Errors:
    Code (Java):
    1.  
    2. 18.02 17:43:46 [Server] ERROR #!#! End of Error.
    3. 18.02 17:43:46 [Server] ERROR #!#!
    4. 18.02 17:43:46 [Server] ERROR #!#! Thread: Server thread
    5. 18.02 17:43:46 [Server] ERROR #!#!
    6. 18.02 17:43:46 [Server] ERROR #!#! Current item: play [(skellett|better)] [sound] (1¦%-sound%|2¦%-string%) at %locations% (with|at|and) volume %number% (and|with|at) pitch %number%
    7. 18.02 17:43:46 [Server] ERROR #!#! Current node: null
    8. 18.02 17:43:46 [Server] ERROR #!#!
    9. 18.02 17:43:46 [Server] ERROR #!#! Running CraftBukkit: false
    10. 18.02 17:43:46 [Server] ERROR #!#!
    11. 18.02 17:43:46 [Server] ERROR #!#!   OS: Linux amd64 2.6.18-406.el5
    12. 18.02 17:43:46 [Server] ERROR #!#!   Java: 1.8.0_77 (Java HotSpot(TM) 64-Bit Server VM 25.77-b03)
    13. 18.02 17:43:46 [Server] ERROR #!#!   Minecraft: 1.8.8
    14. 18.02 17:43:46 [Server] ERROR #!#!   Bukkit: 1.8.8-R0.1-SNAPSHOT
    15. 18.02 17:43:46 [Server] ERROR #!#!   Skript: 2.2-dev23
    16. 18.02 17:43:46 [Server] ERROR #!#! Version Information:
    17. 18.02 17:43:46 [Server] ERROR #!#!
    18. 18.02 17:43:46 [Server] ERROR #!#!     at java.lang.Thread.run(Unknown Source)
    19. 18.02 17:43:46 [Server] ERROR #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557)
    20. 18.02 17:43:46 [Server] ERROR #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654)
    21. 18.02 17:43:46 [Server] ERROR #!#!     at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374)
    22. 18.02 17:43:46 [Server] ERROR #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:723)
    23. 18.02 17:43:46 [Server] ERROR #!#!     at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350)
    24. 18.02 17:43:46 [Server] ERROR #!#!     at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
    25. 18.02 17:43:46 [Server] ERROR #!#!     at ch.njol.skript.effects.Delay$1.run(Delay.java:84)
    26. 18.02 17:43:46 [Server] ERROR #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:93)
    27. 18.02 17:43:46 [Server] ERROR #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:65)
    28. 18.02 17:43:46 [Server] ERROR #!#!     at ch.njol.skript.lang.Effect.run(Effect.java:54)
    29. 18.02 17:43:46 [Server] ERROR #!#!     at com.gmail.thelimeglass.Effects.EffPlaySound.execute(EffPlaySound.java:52)
    30. 18.02 17:43:46 [Server] ERROR #!#! java.lang.NullPointerException
    31. 18.02 17:43:46 [Server] ERROR #!#! Stack trace:
    32. 18.02 17:43:46 [Server] ERROR #!#!
    33. 18.02 17:43:46 [Server] ERROR #!#! By following this guide fixing the error should be easy and done fast.
    34. 18.02 17:43:46 [Server] ERROR #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
    35. 18.02 17:43:46 [Server] ERROR #!#! and describe what you did before it happened and/or what you think caused the error.
    36. 18.02 17:43:46 [Server] ERROR #!#! If not please create a new ticket with a meaningful title, copy & paste this whole error into it (or use paste service),
    37. 18.02 17:43:46 [Server] ERROR #!#! and check whether this error has already been reported.
    38. 18.02 17:43:46 [Server] ERROR #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
    39. 18.02 17:43:46 [Server] ERROR #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
    40. 18.02 17:43:46 [Server] ERROR #!#!
    41. 18.02 17:43:46 [Server] ERROR #!#! [Skript] Severe Error:
    42. 18.02 17:43:46 [Server] ERROR #!#!
    Addons using (including versions):
    Skellett v1.7.7dskUtilities v0.8.8skRayFall v1.9.5Umbaska v2.0 Beta 5.5.1 for Minecraft 1.10SkQuery v3.21.4TuSKe v1.7SharpSK v1.6.0RandomSK v2.0MundoSK v1.7.4WildSkript v1.8WolvSK v1.5.2SkStuff v1.6.3.6

    Troubleshooting:

    Have you tried searching the docs? No
    Have you tried searching the forums? No
    What other methods have you tried to fix it? I have tried changing the sounds in the script but it seems to have no affect on it. The error still persists.
    --- Double Post Merged, Feb 19, 2017, Original Post Date: Feb 18, 2017 ---
    Post was updated with more information.

     
  2. Best Answer:
    Post #19 by ShaneBee, Mar 12, 2017
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Seems to be something wrong with your play sound effect @LimeGlass
     
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    That is what I thought too... I have tried changing it multiple times but it still gives the error... hmm..
    --- Double Post Merged, Feb 21, 2017, Original Post Date: Feb 20, 2017 ---
    Bump
     
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    try using skript oldpas because skript new bug send message : null
     
  6. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    tf?
    --- Double Post Merged, Feb 24, 2017, Original Post Date: Feb 22, 2017 ---
    bump.
    I really need some help soon as this would be amazing.
    I see other threads being answered around mine which really is saddening.
    --- Double Post Merged, Feb 25, 2017 ---
    bumpity. <3
     
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Try to use SkQuery Play Sound effect instead for Skellett.
    Code (Text):
    1.  
    2. on death:
    3.     player's world is "KitPvP"
    4.     set {_random} to random number between 0 and 100
    5.     if {_random} <= 3:
    6.         add 1 to {KitPvP::AmountKeys::Magma::%uuid of attacker%}
    7.         message "&6&lKitPvP &8» &f&lYou had Luck! A &6&lMagma Key &f&lhas been given to you!" to attacker
    8.         play "EXPLODE" to attacker at volume 0.6
    9. #        play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
    10.         launch "BALL_LARGE" firework at attacker timed 0 coloured yellow
    11.     else if {_random} <= 15:
    12.         add 1 to {KitPvP::AmountKeys::Emthyist::%uuid of attacker%}
    13.         message "&6&lKitPvP &8» &f&lYou had Luck! A &b&lEmthyist Key &f&lhas been given to you!" to attacker
    14.         play "EXPLODE" to attacker at volume 0.6
    15. #        play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
    16.         launch "BALL_LARGE" firework at attacker timed 0 coloured blue
    17.        
    18.        
    19.        
    20. command /crates [<text>] [<text>] [<integer>] [<player>]:
    21.     permission: kitpvp.admin
    22.     trigger:
    23.         if arg-1 is "setcratelocation":
    24.             if targeted block is a chest:
    25.                 set {KitPvP::CrateLocation} to location of targeted block
    26.                 message "&a&lYou've set the Crate location!"
    27.         if arg-1 is "givekey":
    28.             if arg-2 is "emthyist":
    29.                 if arg-3 is set:
    30.                     if arg-4 is set:
    31.                         add arg-3 to {KitPvP::AmountKeys::Emthyist::%uuid of arg-4%}
    32.                     else:
    33.                         message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
    34.                 else:
    35.                     message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
    36.            
    37.             else if arg-2 is "magma":
    38.                 if arg-3 is set:
    39.                     if arg-4 is set:
    40.                         add arg-3 to {KitPvP::AmountKeys::Magma::%uuid of arg-4%}
    41.                     else:
    42.                         message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
    43.                 else:
    44.                     message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
    45.             else:
    46.                 message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
    47.  
    48.         if arg-1 is "set-emthyist-loot":
    49.             if player's gamemode is creative:
    50.                 if targeted block is chest:
    51.                     delete {KitPvP::CrateLoot::Emthyist::*}
    52.                     set {_loc} to location of targeted block
    53.                     loop all items in inventory of block at {_loc}:
    54.                         add loop-value to {KitPvP::CrateLoot::Emthyist::*}
    55.                         wait 0.2 tick
    56.                     wait 1 tick
    57.                     message "&6&lKitPvP &8» &a&lLoot of the &b&lEmthyist Crate &a&lhas been set!"
    58.  
    59.         if arg-1 is "set-magma-loot":
    60.             if player's gamemode is creative:
    61.                 if targeted block is chest:
    62.                     delete {KitPvP::CrateLoot::Magma::*}
    63.                     set {_loc} to location of targeted block
    64.                     loop all items in inventory of block at {_loc}:
    65.                         add loop-value to {KitPvP::CrateLoot::Magma::*}
    66.                         wait 0.2 tick
    67.                     wait 1 tick
    68.                     message "&6&lKitPvP &8» &a&lLoot of the &6&lMagma Crate &a&lhas been set!"
    69. on right click on a chest:
    70.     player's world is "KitPvP"
    71.     {KitPvP::CrateLocation} is location of clicked block
    72.     cancel event
    73.     if player's gamemode is adventure:
    74.         open chest with 3 rows named "&8Select a crate:" to player
    75.         wait 1 tick
    76.         set {_x::*} to 0, 1, 7, 8, 9, 17, 18, 19, 25 and 26
    77.         loop {_x::*}:
    78.             set slot loop-value of player's current inventory to black glass named "&8"
    79.         wait 1 tick
    80.         if {KitPvP::AmountKeys::Emthyist::%uuid of player%} is set:
    81.             set slot 11 of player's current inventory to shiny tripwire hook named "&b&lEmthyist &f&lKey" with lore " ||&aKeys: &f&l%{KitPvP::AmountKeys::Emthyist::%uuid of player%}%|| ||&8&oRight click."
    82.         else:
    83.             set slot 11 of player's current inventory to shiny tripwire hook named "&b&lEmthyist &f&lKey" with lore " ||&aKeys: &f&l0|| ||&8&oRight click."
    84.         set slot 13 of player's current inventory to 166 named "&c&lComing Soon"
    85.         if {KitPvP::AmountKeys::Magma::%uuid of player%} is set:
    86.             set slot 15 of player's current inventory to blaze rod named "&6&lMagma &f&lKey" with lore " ||&aKeys: &f&l%{KitPvP::AmountKeys::Magma::%uuid of player%}%|| ||&8&oRight click."
    87.         else:
    88.             set slot 15 of player's current inventory to blaze rod named "&6&lMagma &f&lKey" with lore " ||&aKeys: &f&l0|| ||&8&oRight click."  
    89.        
    90.     else:
    91.         message "&6&lKitPvP &8» &c&lYou have to be in Adventure for this!"
    92. on inventory click:
    93.     player's world is "KitPvP"
    94.     if inventory name of player's current inventory is "&8Select a crate:":
    95.         cancel event
    96.         if clicked slot is 11:
    97.             if {KitPvP::AmountKeys::Emthyist::%uuid of player%} >= 1:
    98.                 close inventory of player
    99.                 invoke "KitPvP-OpenCrate" from player and "Emthyist"
    100.             else:
    101.                 message "&6&lKitPvP &8» &c&lYou haven't got any &b&lEmthyist &c&lkeys!"
    102.         else if clicked slot is 13:
    103.             message "&6&lKitPvP &8» &c&lComing Soon!"
    104.         else if clicked slot is 15:
    105.             if {KitPvP::AmountKeys::Magma::%uuid of player%} >= 1:
    106.                 close inventory of player
    107.                 invoke "KitPvP-OpenCrate" from player and "Magma"
    108.             else:
    109.                 message "&6&lKitPvP &8» &c&lYou haven't got any &6&lMagma &c&lkeys!"
    110.     else if inventory name of player's current inventory is "Opening Emthyist Crate..":
    111.         cancel event
    112.     else if inventory name of player's current inventory is "Opening Magma Crate..":
    113.         cancel event
    114. sub "KitPvP-OpenCrate":
    115.     set {_p} to "%parameter 1%" parsed as player
    116.     set {_type} to "%parameter 2%"
    117.     set {_uuid} to uuid of {_p}
    118.     wait 1 tick
    119.     remove 1 from {KitPvP::AmountKeys::%{_type}%::%{_uuid}%}
    120.     open chest with 3 rows named "&8Opening %{_type}% Crate.." to {_p}
    121.     wait a tick
    122.     if {_type} is "Emthyist" or "Magma":
    123.         loop {KitPvP::CrateLoot::%{_type}%::*}:
    124.             add loop-value to {_roll::*}
    125.     set {_speedFinal} to 2
    126.     set {_Selector1} to 4
    127.     set {_Selector2} to 22
    128.     loop (random integer between 10 and 40) times:
    129.         set {_sel} to 9
    130.         loop 8 times:
    131.             set {_sel2} to {_sel} - 1
    132.             set {_item::%{_sel}%} to {_item::%{_sel2}%}
    133.             subtract 1 from {_sel}
    134.         set {_item::1} to a random element out of {_roll::*}
    135.         loop integers between 0 and 26:
    136.             if loop-number-2 is {_Selector1} or {_Selector2}:
    137.                 set slot loop-number-2 of {_p}'s current inventory to shiny light green stained glass pane named " "
    138.             else:
    139.                 set slot loop-number-2 of {_p}'s current inventory to black stained glass pane named " "
    140.             loop 9 times:
    141.                 set slot 8 + loop-number-3 of {_p}'s current inventory to {_item::%loop-number-3%}
    142.         add 1 to {_sound}
    143.         if {_sound} > 3:
    144.             set {_sound} to 1
    145.         if {_sound} = 1:
    146.             play "NOTE_PLING" to {_p} at volume 0.8
    147. #            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 2
    148.         if {_sound} = 2:
    149.             play "NOTE_PLING" to {_p} at volume 0.8
    150. #            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 1
    151.         if {_sound} = 3:
    152.             play "NOTE_PLING" to {_p} at volume 0.8
    153. #            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 0.5
    154.         add 1 to {_speed}
    155.         if {_speed} is 5:
    156.             set {_speed} to 0
    157.             add 1 to {_speedFinal}
    158.         loop {_speedFinal} times:
    159.             wait a tick
    160.     set {_wonitem} to "%slot 13 of {_p}'s current inventory%" parsed as item
    161.     message "&6&lKitPvP &8» &a&lYou've won %{_wonitem}%!" to {_p}
    162.     if {_type} is "Emthyist":
    163.         launch "BALL_LARGE" firework at location of {_p} timed 2 coloured blue
    164.         launch "BALL_LARGE" firework at location of {_p} timed 3 coloured blue
    165. #        play sound "EXPLODE" at location of {_p} with volume 0.6 and pitch 3
    166.     else:
    167.         launch "BALL_LARGE" firework at location of {_p} timed 2 coloured yellow
    168.         launch "BALL_LARGE" firework at location of {_p} timed 3 coloured yellow
    169.         play "EXPLODE" to {_p} at volume 0.6
    170. #        play sound "EXPLODE" at location of {_p} with volume 0.6 and pitch 3
    171.     wait 1 tick
    172.     give {_wonitem} to {_p}
    173. command /keys:
    174.     trigger:
    175.         send "&cMagma: %{KitPvP::AmountKeys::Magma::%uuid of player%}%"
    176.         send "&bEmthyist: %{KitPvP::AmountKeys::Emthyist::%uuid of player%}%"
    177.  
     
  8. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    I get this:
    Code (Skript):
    1. 25.02 13:14:06 [Server] ERROR Cannot use 'attacker' outside of a damage/death/destroy event (crates.sk, line 149: play "EXPLODE" to attacker at volume 0.8')
    2. 25.02 13:14:06 [Server] ERROR Cannot use 'attacker' outside of a damage/death/destroy event (crates.sk, line 146: play "EXPLODE" to attacker at volume 0.8')
     
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    You have to specify, who's is getting this sound. In this case, you have chosen "attacker", to receive the sound effect, but that isn't possible because "attacker" can only be used in a death, destroy or damage event (on death - on damage - on destroy). That's why you received an error.

    You can easily fix this, by finding line number 149 & 146, and change "attacker" to "{_p}" in that line.
     
  10. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Here is my script:

    Code (Skript):
    1. on death:
    2.     player's world is "KitPvP"
    3.     set {_random} to random number between 0 and 100
    4.     if {_random} <= 3:
    5.         add 1 to {KitPvP::AmountKeys::Magma::%uuid of attacker%}
    6.         message "&6&lKitPvP &8» &f&lYou had Luck! A &6&lMagma Key &f&lhas been given to you!" to attacker
    7.         play "EXPLODE" to attacker at volume 0.6
    8.         launch "BALL_LARGE" firework at attacker timed 0 coloured yellow
    9.     else if {_random} <= 15:
    10.         add 1 to {KitPvP::AmountKeys::Emthyist::%uuid of attacker%}
    11.         message "&6&lKitPvP &8» &f&lYou had Luck! A &b&lEmthyist Key &f&lhas been given to you!" to attacker
    12.         #play sound "EXPLODE" at attacker with volume 0.6 and pitch 2
    13.         play "EXPLODE" to attacker at volume 0.6
    14.         #play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
    15.         launch "BALL_LARGE" firework at attacker timed 0 coloured blue
     
  11. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    There aren't any errors in that code. Your errors are in line 146 and 149 as stated before.
     
  12. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    omg i'm an idiot, I fixed it.
    But in the crate menu, when spinning a crate, I can take the items out of it. How can I fix this?
    Also is there any way I can save the crate rewards to a variable?
    --- Double Post Merged, Feb 26, 2017, Original Post Date: Feb 25, 2017 ---
    bump. :emoji_slight_smile:
     
  13. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Removing items from the GUI *NOT Crates rewards to a variable*

    Line 109-112

    Code (Skript):
    1.     else if inventory name of player's current inventory is "Opening Emthyist Crate..":
    2.         cancel event
    3.     else if inventory name of player's current inventory is "Opening Magma Crate..":
    4.         cancel event

    Code (Skript):
    1.     if inventory name of player's current inventory contains "Opening Emthyist Crate..":
    2.         cancel event
    3.     if inventory name of player's current inventory contains "Opening Magma Crate..":
    4.         cancel event
     
  14. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    I have fixed the code, so it uses TuSKe's GUI manager instead of SkQueries(only where there is a need for it).
    GUI's made out of SkQueries set slot and inventory click, can easily be glitched in some cases. I would not recommend you to use SkQuery to GUI's anymore.
    Code (Skript):
    1.  
    2. on death:
    3.     player's world is "world"
    4.     set {_random} to random number between 0 and 100
    5.     if {_random} <= 3:
    6.         add 1 to {KitPvP::AmountKeys::Magma::%uuid of attacker%}
    7.         message "&6&lKitPvP &8» &f&lYou had Luck! A &6&lMagma Key &f&lhas been given to you!" to attacker
    8.         play "EXPLODE" to attacker at volume 0.6
    9. #        play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
    10.         launch "BALL_LARGE" firework at attacker timed 0 coloured yellow
    11.     else if {_random} <= 15:
    12.         add 1 to {KitPvP::AmountKeys::Emthyist::%uuid of attacker%}
    13.         message "&6&lKitPvP &8» &f&lYou had Luck! A &b&lEmthyist Key &f&lhas been given to you!" to attacker
    14.         play "EXPLODE" to attacker at volume 0.6
    15. #        play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
    16.         launch "BALL_LARGE" firework at attacker timed 0 coloured blue
    17.        
    18.        
    19.        
    20. command /crates [<text>] [<text>] [<integer>] [<player>]:
    21.     permission: kitpvp.admin
    22.     trigger:
    23.         if arg-1 is "setcratelocation":
    24.             if targeted block is a chest:
    25.                 set {KitPvP::CrateLocation} to location of targeted block
    26.                 message "&a&lYou've set the Crate location!"
    27.         if arg-1 is "givekey":
    28.             if arg-2 is "emthyist":
    29.                 if arg-3 is set:
    30.                     if arg-4 is set:
    31.                         add arg-3 to {KitPvP::AmountKeys::Emthyist::%uuid of arg-4%}
    32.                     else:
    33.                         message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
    34.                 else:
    35.                     message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
    36.            
    37.             else if arg-2 is "magma":
    38.                 if arg-3 is set:
    39.                     if arg-4 is set:
    40.                         add arg-3 to {KitPvP::AmountKeys::Magma::%uuid of arg-4%}
    41.                     else:
    42.                         message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
    43.                 else:
    44.                     message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
    45.             else:
    46.                 message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
    47.  
    48.         if arg-1 is "set-emthyist-loot":
    49.             if player's gamemode is creative:
    50.                 if targeted block is chest:
    51.                     delete {KitPvP::CrateLoot::Emthyist::*}
    52.                     set {_loc} to location of targeted block
    53.                     loop all items in inventory of block at {_loc}:
    54.                         add loop-value to {KitPvP::CrateLoot::Emthyist::*}
    55.                         wait 0.2 tick
    56.                     wait 1 tick
    57.                     message "&6&lKitPvP &8» &a&lLoot of the &b&lEmthyist Crate &a&lhas been set!"
    58.  
    59.         if arg-1 is "set-magma-loot":
    60.             if player's gamemode is creative:
    61.                 if targeted block is chest:
    62.                     delete {KitPvP::CrateLoot::Magma::*}
    63.                     set {_loc} to location of targeted block
    64.                     loop all items in inventory of block at {_loc}:
    65.                         add loop-value to {KitPvP::CrateLoot::Magma::*}
    66.                         wait 0.2 tick
    67.                     wait 1 tick
    68.                     message "&6&lKitPvP &8» &a&lLoot of the &6&lMagma Crate &a&lhas been set!"
    69. on right click on a chest:
    70.     player's world is "world"
    71.     {KitPvP::CrateLocation} is location of clicked block
    72.     cancel event
    73.     if player's gamemode is adventure:
    74.         open chest with 3 rows named "&8Select a crate:" to player
    75.         wait 1 tick
    76.         set {_x::*} to 0, 1, 7, 8, 9, 17, 18, 19, 25 and 26
    77.         loop {_x::*}:
    78.             format gui slot loop-value of player with black glass named "&8" to do nothing
    79. #            set slot loop-value of player's current inventory to black glass named "&8"
    80.         wait 1 tick
    81.         if {KitPvP::AmountKeys::Emthyist::%uuid of player%} is set:
    82.             set slot 11 of player's current inventory to shiny tripwire hook named "&b&lEmthyist &f&lKey" with lore " ||&aKeys: &f&l%{KitPvP::AmountKeys::Emthyist::%uuid of player%}%|| ||&8&oRight click."
    83.         else:
    84.             set slot 11 of player's current inventory to shiny tripwire hook named "&b&lEmthyist &f&lKey" with lore " ||&aKeys: &f&l0|| ||&8&oRight click."
    85.         set slot 13 of player's current inventory to 166 named "&c&lComing Soon"
    86.         if {KitPvP::AmountKeys::Magma::%uuid of player%} is set:
    87.             set slot 15 of player's current inventory to blaze rod named "&6&lMagma &f&lKey" with lore " ||&aKeys: &f&l%{KitPvP::AmountKeys::Magma::%uuid of player%}%|| ||&8&oRight click."
    88.         else:
    89.             set slot 15 of player's current inventory to blaze rod named "&6&lMagma &f&lKey" with lore " ||&aKeys: &f&l0|| ||&8&oRight click."  
    90.        
    91.     else:
    92.         message "&6&lKitPvP &8» &c&lYou have to be in Adventure for this!"
    93. on inventory click:
    94.     player's world is "world"
    95.     if inventory name of player's current inventory is "&8Select a crate:":
    96.         cancel event
    97.         if clicked slot is 11:
    98.             if {KitPvP::AmountKeys::Emthyist::%uuid of player%} >= 1:
    99.                 close inventory of player
    100.                 invoke "KitPvP-OpenCrate" from player and "Emthyist"
    101.             else:
    102.                 message "&6&lKitPvP &8» &c&lYou haven't got any &b&lEmthyist &c&lkeys!"
    103.         else if clicked slot is 13:
    104.             message "&6&lKitPvP &8» &c&lComing Soon!"
    105.         else if clicked slot is 15:
    106.             if {KitPvP::AmountKeys::Magma::%uuid of player%} >= 1:
    107.                 close inventory of player
    108.                 invoke "KitPvP-OpenCrate" from player and "Magma"
    109.             else:
    110.                 message "&6&lKitPvP &8» &c&lYou haven't got any &6&lMagma &c&lkeys!"
    111.     else if inventory name of player's current inventory is "Opening Emthyist Crate..":
    112.         cancel event
    113.     else if inventory name of player's current inventory is "Opening Magma Crate..":
    114.         cancel event
    115. sub "KitPvP-OpenCrate":
    116.     set {_p} to "%parameter 1%" parsed as player
    117.     set {_type} to "%parameter 2%"
    118.     set {_uuid} to uuid of {_p}
    119.     wait 1 tick
    120.     remove 1 from {KitPvP::AmountKeys::%{_type}%::%{_uuid}%}
    121.     open chest with 3 rows named "&8Opening %{_type}% Crate.." to {_p}
    122.     wait a tick
    123.     if {_type} is "Emthyist" or "Magma":
    124.         loop {KitPvP::CrateLoot::%{_type}%::*}:
    125.             add loop-value to {_roll::*}
    126.     set {_speedFinal} to 2
    127.     set {_Selector1} to 4
    128.     set {_Selector2} to 22
    129.     loop (random integer between 10 and 40) times:
    130.         set {_sel} to 9
    131.         loop 8 times:
    132.             set {_sel2} to {_sel} - 1
    133.             set {_item::%{_sel}%} to {_item::%{_sel2}%}
    134.             subtract 1 from {_sel}
    135.         set {_item::1} to a random element out of {_roll::*}
    136.         loop integers between 0 and 26:
    137.             if loop-number-2 is {_Selector1} or {_Selector2}:
    138. #               set slot loop-number-2 of {_p}'s current inventory to shiny light green stained glass pane named " "
    139.                 format gui slot loop-number-2 of {_p} with shiny light green stained glass pane named " " to do nothing
    140.             else:
    141. #               set slot loop-number-2 of {_p}'s current inventory to black stained glass pane named " "
    142.                 format gui slot loop-number-2 of {_p} with shiny black stained glass pane named " " to do nothing
    143.             loop 9 times:
    144. #               set slot 8 + loop-number-3 of {_p}'s current inventory to {_item::%loop-number-3%}
    145.                 format gui slot 8+loop-number-3 of {_p} with {_item::%loop-number-3%} named " " to do nothing
    146.         add 1 to {_sound}
    147.         if {_sound} > 3:
    148.             set {_sound} to 1
    149.         if {_sound} = 1:
    150.             play "NOTE_PLING" to {_p} at volume 0.8
    151. #            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 2
    152.         if {_sound} = 2:
    153.             play "NOTE_PLING" to {_p} at volume 0.8
    154. #            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 1
    155.         if {_sound} = 3:
    156.             play "NOTE_PLING" to {_p} at volume 0.8
    157. #            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 0.5
    158.         add 1 to {_speed}
    159.         if {_speed} is 5:
    160.             set {_speed} to 0
    161.             add 1 to {_speedFinal}
    162.         loop {_speedFinal} times:
    163.             wait a tick
    164.     set {_wonitem} to "%slot 13 of {_p}'s current inventory%" parsed as item
    165.     message "&6&lKitPvP &8» &a&lYou've won %{_wonitem}%!" to {_p}
    166.     if {_type} is "Emthyist":
    167.         launch "BALL_LARGE" firework at location of {_p} timed 2 coloured blue
    168.         launch "BALL_LARGE" firework at location of {_p} timed 3 coloured blue
    169. #        play sound "EXPLODE" at location of {_p} with volume 0.6 and pitch 3
    170.     else:
    171.         launch "BALL_LARGE" firework at location of {_p} timed 2 coloured yellow
    172.         launch "BALL_LARGE" firework at location of {_p} timed 3 coloured yellow
    173.         play "EXPLODE" to {_p} at volume 0.6
    174. #        play sound "EXPLODE" at location of {_p} with volume 0.6 and pitch 3
    175.     wait 1 tick
    176.     give {_wonitem} to {_p}
    177. command /keys:
    178.     trigger:
    179.         send "&cMagma: %{KitPvP::AmountKeys::Magma::%uuid of player%}%"
    180.         send "&bEmthyist: %{KitPvP::AmountKeys::Emthyist::%uuid of player%}%"
    181.  
    They are already saved to these two variables "{KitPvP::CrateLoot::Emthyist::*}" and "{KitPvP::CrateLoot::Magma::*}"
     
  15. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    But how can I set those variables to items in the script?
     
  16. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    The script itself have a built-in way to set the items you can win.

    Use the commands: "/crates set-magma-loot" and "/crates set-emthyist-loot", while being in creative and targeting a chest with the items, you want people to be able to win.
     
  17. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    So I am running /crates set-magma-loot with items in my inventory but when I go into adventure mode and spin a magma crate, none of the items I added are in there.
     
  18. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Your suppose to put them in a chest, then do /crates set-magma-loot.
    Code (Skript):
    1.         if arg-1 is "set-magma-loot":
    2.             if player's gamemode is creative:
    3.                 if targeted block is chest:
    Code (Skript):
    1. if targeted block is  chest:
     
  19. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    That is what I am doing.
    I put items in my inventory, point at the chest and run the command, it doesn't do shit.
     
  20. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    @BrettPlayMC I never got notified of this tag in this whole thread .-.

    Basically the error happens when the server can't understand what Sound you have. Looks like you're using a 1.9 sound on a 1.8 server or vice versa

    If you're using a 1.8 server here is a list of all 1.8 sounds.https://github.com/Attano/Spigot-1.8/blob/master/org/bukkit/Sound.java

    If you're using 1.9+ here is a list of all possible sounds https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html

    I leave this error in so I can tell if the user is using the wrong sound name or not.
     
    • Informative Informative x 2
  21. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Read my above post. :emoji_stuck_out_tongue:
    I figured this was the problem out a while ago and I actually just got a friend to help me with the rewards. :emoji_stuck_out_tongue:
    Thread solved! :emoji_grinning:
     
    • Like Like x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...