Solved Crate script not working.

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

BrettPlayMC

Supporter
Jan 26, 2017
715
53
28
SkUnity Street
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:
Java:
18.02 17:43:46 [Server] ERROR #!#! End of Error.
18.02 17:43:46 [Server] ERROR #!#!
18.02 17:43:46 [Server] ERROR #!#! Thread: Server thread
18.02 17:43:46 [Server] ERROR #!#!
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%
18.02 17:43:46 [Server] ERROR #!#! Current node: null
18.02 17:43:46 [Server] ERROR #!#!
18.02 17:43:46 [Server] ERROR #!#! Running CraftBukkit: false
18.02 17:43:46 [Server] ERROR #!#!
18.02 17:43:46 [Server] ERROR #!#!   OS: Linux amd64 2.6.18-406.el5
18.02 17:43:46 [Server] ERROR #!#!   Java: 1.8.0_77 (Java HotSpot(TM) 64-Bit Server VM 25.77-b03)
18.02 17:43:46 [Server] ERROR #!#!   Minecraft: 1.8.8
18.02 17:43:46 [Server] ERROR #!#!   Bukkit: 1.8.8-R0.1-SNAPSHOT
18.02 17:43:46 [Server] ERROR #!#!   Skript: 2.2-dev23
18.02 17:43:46 [Server] ERROR #!#! Version Information:
18.02 17:43:46 [Server] ERROR #!#!
18.02 17:43:46 [Server] ERROR #!#!     at java.lang.Thread.run(Unknown Source)
18.02 17:43:46 [Server] ERROR #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557)
18.02 17:43:46 [Server] ERROR #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654)
18.02 17:43:46 [Server] ERROR #!#!     at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374)
18.02 17:43:46 [Server] ERROR #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:723)
18.02 17:43:46 [Server] ERROR #!#!     at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350)
18.02 17:43:46 [Server] ERROR #!#!     at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
18.02 17:43:46 [Server] ERROR #!#!     at ch.njol.skript.effects.Delay$1.run(Delay.java:84)
18.02 17:43:46 [Server] ERROR #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:93)
18.02 17:43:46 [Server] ERROR #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:65)
18.02 17:43:46 [Server] ERROR #!#!     at ch.njol.skript.lang.Effect.run(Effect.java:54)
18.02 17:43:46 [Server] ERROR #!#!     at com.gmail.thelimeglass.Effects.EffPlaySound.execute(EffPlaySound.java:52)
18.02 17:43:46 [Server] ERROR #!#! java.lang.NullPointerException
18.02 17:43:46 [Server] ERROR #!#! Stack trace:
18.02 17:43:46 [Server] ERROR #!#!
18.02 17:43:46 [Server] ERROR #!#! By following this guide fixing the error should be easy and done fast.
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.
18.02 17:43:46 [Server] ERROR #!#! and describe what you did before it happened and/or what you think caused the error.
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),
18.02 17:43:46 [Server] ERROR #!#! and check whether this error has already been reported.
18.02 17:43:46 [Server] ERROR #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
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.
18.02 17:43:46 [Server] ERROR #!#!
18.02 17:43:46 [Server] ERROR #!#! [Skript] Severe Error:
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.
[doublepost=1487526046,1487461750][/doublepost]Post was updated with more information.
 
try using skript oldpas because skript new bug send message : null
tf?
[doublepost=1487894512,1487806076][/doublepost]bump.
I really need some help soon as this would be amazing.
I see other threads being answered around mine which really is saddening.
[doublepost=1488044437][/doublepost]bumpity. <3
 
Try to use SkQuery Play Sound effect instead for Skellett.
Code:
on death:
    player's world is "KitPvP"
    set {_random} to random number between 0 and 100
    if {_random} <= 3:
        add 1 to {KitPvP::AmountKeys::Magma::%uuid of attacker%}
        message "&6&lKitPvP &8» &f&lYou had Luck! A &6&lMagma Key &f&lhas been given to you!" to attacker
        play "EXPLODE" to attacker at volume 0.6
#        play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
        launch "BALL_LARGE" firework at attacker timed 0 coloured yellow
    else if {_random} <= 15:
        add 1 to {KitPvP::AmountKeys::Emthyist::%uuid of attacker%}
        message "&6&lKitPvP &8» &f&lYou had Luck! A &b&lEmthyist Key &f&lhas been given to you!" to attacker
        play "EXPLODE" to attacker at volume 0.6
#        play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
        launch "BALL_LARGE" firework at attacker timed 0 coloured blue
       
       
       
command /crates [<text>] [<text>] [<integer>] [<player>]:
    permission: kitpvp.admin
    trigger:
        if arg-1 is "setcratelocation":
            if targeted block is a chest:
                set {KitPvP::CrateLocation} to location of targeted block
                message "&a&lYou've set the Crate location!"
        if arg-1 is "givekey":
            if arg-2 is "emthyist":
                if arg-3 is set:
                    if arg-4 is set:
                        add arg-3 to {KitPvP::AmountKeys::Emthyist::%uuid of arg-4%}
                    else:
                        message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
                else:
                    message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
           
            else if arg-2 is "magma":
                if arg-3 is set:
                    if arg-4 is set:
                        add arg-3 to {KitPvP::AmountKeys::Magma::%uuid of arg-4%}
                    else:
                        message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
                else:
                    message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
            else:
                message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"

        if arg-1 is "set-emthyist-loot":
            if player's gamemode is creative:
                if targeted block is chest:
                    delete {KitPvP::CrateLoot::Emthyist::*}
                    set {_loc} to location of targeted block
                    loop all items in inventory of block at {_loc}:
                        add loop-value to {KitPvP::CrateLoot::Emthyist::*}
                        wait 0.2 tick
                    wait 1 tick
                    message "&6&lKitPvP &8» &a&lLoot of the &b&lEmthyist Crate &a&lhas been set!"

        if arg-1 is "set-magma-loot":
            if player's gamemode is creative:
                if targeted block is chest:
                    delete {KitPvP::CrateLoot::Magma::*}
                    set {_loc} to location of targeted block
                    loop all items in inventory of block at {_loc}:
                        add loop-value to {KitPvP::CrateLoot::Magma::*}
                        wait 0.2 tick
                    wait 1 tick
                    message "&6&lKitPvP &8» &a&lLoot of the &6&lMagma Crate &a&lhas been set!"
on right click on a chest:
    player's world is "KitPvP"
    {KitPvP::CrateLocation} is location of clicked block
    cancel event
    if player's gamemode is adventure:
        open chest with 3 rows named "&8Select a crate:" to player
        wait 1 tick
        set {_x::*} to 0, 1, 7, 8, 9, 17, 18, 19, 25 and 26
        loop {_x::*}:
            set slot loop-value of player's current inventory to black glass named "&8"
        wait 1 tick
        if {KitPvP::AmountKeys::Emthyist::%uuid of player%} is set:
            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."
        else:
            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."
        set slot 13 of player's current inventory to 166 named "&c&lComing Soon"
        if {KitPvP::AmountKeys::Magma::%uuid of player%} is set:
            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."
        else:
            set slot 15 of player's current inventory to blaze rod named "&6&lMagma &f&lKey" with lore " ||&aKeys: &f&l0|| ||&8&oRight click."   
       
    else:
        message "&6&lKitPvP &8» &c&lYou have to be in Adventure for this!"
on inventory click:
    player's world is "KitPvP"
    if inventory name of player's current inventory is "&8Select a crate:":
        cancel event
        if clicked slot is 11:
            if {KitPvP::AmountKeys::Emthyist::%uuid of player%} >= 1:
                close inventory of player
                invoke "KitPvP-OpenCrate" from player and "Emthyist"
            else:
                message "&6&lKitPvP &8» &c&lYou haven't got any &b&lEmthyist &c&lkeys!"
        else if clicked slot is 13:
            message "&6&lKitPvP &8» &c&lComing Soon!"
        else if clicked slot is 15:
            if {KitPvP::AmountKeys::Magma::%uuid of player%} >= 1:
                close inventory of player
                invoke "KitPvP-OpenCrate" from player and "Magma"
            else:
                message "&6&lKitPvP &8» &c&lYou haven't got any &6&lMagma &c&lkeys!"
    else if inventory name of player's current inventory is "Opening Emthyist Crate..":
        cancel event
    else if inventory name of player's current inventory is "Opening Magma Crate..":
        cancel event
sub "KitPvP-OpenCrate":
    set {_p} to "%parameter 1%" parsed as player
    set {_type} to "%parameter 2%"
    set {_uuid} to uuid of {_p}
    wait 1 tick
    remove 1 from {KitPvP::AmountKeys::%{_type}%::%{_uuid}%}
    open chest with 3 rows named "&8Opening %{_type}% Crate.." to {_p}
    wait a tick
    if {_type} is "Emthyist" or "Magma":
        loop {KitPvP::CrateLoot::%{_type}%::*}:
            add loop-value to {_roll::*}
    set {_speedFinal} to 2
    set {_Selector1} to 4
    set {_Selector2} to 22
    loop (random integer between 10 and 40) times:
        set {_sel} to 9
        loop 8 times:
            set {_sel2} to {_sel} - 1
            set {_item::%{_sel}%} to {_item::%{_sel2}%}
            subtract 1 from {_sel}
        set {_item::1} to a random element out of {_roll::*}
        loop integers between 0 and 26:
            if loop-number-2 is {_Selector1} or {_Selector2}:
                set slot loop-number-2 of {_p}'s current inventory to shiny light green stained glass pane named " "
            else:
                set slot loop-number-2 of {_p}'s current inventory to black stained glass pane named " "
            loop 9 times:
                set slot 8 + loop-number-3 of {_p}'s current inventory to {_item::%loop-number-3%}
        add 1 to {_sound}
        if {_sound} > 3:
            set {_sound} to 1
        if {_sound} = 1:
            play "NOTE_PLING" to {_p} at volume 0.8
#            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 2
        if {_sound} = 2:
            play "NOTE_PLING" to {_p} at volume 0.8
#            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 1
        if {_sound} = 3:
            play "NOTE_PLING" to {_p} at volume 0.8
#            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 0.5
        add 1 to {_speed}
        if {_speed} is 5:
            set {_speed} to 0
            add 1 to {_speedFinal}
        loop {_speedFinal} times:
            wait a tick
    set {_wonitem} to "%slot 13 of {_p}'s current inventory%" parsed as item
    message "&6&lKitPvP &8» &a&lYou've won %{_wonitem}%!" to {_p}
    if {_type} is "Emthyist":
        launch "BALL_LARGE" firework at location of {_p} timed 2 coloured blue
        launch "BALL_LARGE" firework at location of {_p} timed 3 coloured blue
#        play sound "EXPLODE" at location of {_p} with volume 0.6 and pitch 3
    else:
        launch "BALL_LARGE" firework at location of {_p} timed 2 coloured yellow
        launch "BALL_LARGE" firework at location of {_p} timed 3 coloured yellow
        play "EXPLODE" to {_p} at volume 0.6
#        play sound "EXPLODE" at location of {_p} with volume 0.6 and pitch 3
    wait 1 tick
    give {_wonitem} to {_p}
command /keys:
    trigger:
        send "&cMagma: %{KitPvP::AmountKeys::Magma::%uuid of player%}%"
        send "&bEmthyist: %{KitPvP::AmountKeys::Emthyist::%uuid of player%}%"
 
Try to use SkQuery Play Sound effect instead for Skellett.
Code:
on death:
    player's world is "KitPvP"
    set {_random} to random number between 0 and 100
    if {_random} <= 3:
        add 1 to {KitPvP::AmountKeys::Magma::%uuid of attacker%}
        message "&6&lKitPvP &8» &f&lYou had Luck! A &6&lMagma Key &f&lhas been given to you!" to attacker
        play "EXPLODE" to attacker at volume 0.6
#        play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
        launch "BALL_LARGE" firework at attacker timed 0 coloured yellow
    else if {_random} <= 15:
        add 1 to {KitPvP::AmountKeys::Emthyist::%uuid of attacker%}
        message "&6&lKitPvP &8» &f&lYou had Luck! A &b&lEmthyist Key &f&lhas been given to you!" to attacker
        play "EXPLODE" to attacker at volume 0.6
#        play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
        launch "BALL_LARGE" firework at attacker timed 0 coloured blue
      
      
      
command /crates [<text>] [<text>] [<integer>] [<player>]:
    permission: kitpvp.admin
    trigger:
        if arg-1 is "setcratelocation":
            if targeted block is a chest:
                set {KitPvP::CrateLocation} to location of targeted block
                message "&a&lYou've set the Crate location!"
        if arg-1 is "givekey":
            if arg-2 is "emthyist":
                if arg-3 is set:
                    if arg-4 is set:
                        add arg-3 to {KitPvP::AmountKeys::Emthyist::%uuid of arg-4%}
                    else:
                        message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
                else:
                    message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
          
            else if arg-2 is "magma":
                if arg-3 is set:
                    if arg-4 is set:
                        add arg-3 to {KitPvP::AmountKeys::Magma::%uuid of arg-4%}
                    else:
                        message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
                else:
                    message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
            else:
                message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"

        if arg-1 is "set-emthyist-loot":
            if player's gamemode is creative:
                if targeted block is chest:
                    delete {KitPvP::CrateLoot::Emthyist::*}
                    set {_loc} to location of targeted block
                    loop all items in inventory of block at {_loc}:
                        add loop-value to {KitPvP::CrateLoot::Emthyist::*}
                        wait 0.2 tick
                    wait 1 tick
                    message "&6&lKitPvP &8» &a&lLoot of the &b&lEmthyist Crate &a&lhas been set!"

        if arg-1 is "set-magma-loot":
            if player's gamemode is creative:
                if targeted block is chest:
                    delete {KitPvP::CrateLoot::Magma::*}
                    set {_loc} to location of targeted block
                    loop all items in inventory of block at {_loc}:
                        add loop-value to {KitPvP::CrateLoot::Magma::*}
                        wait 0.2 tick
                    wait 1 tick
                    message "&6&lKitPvP &8» &a&lLoot of the &6&lMagma Crate &a&lhas been set!"
on right click on a chest:
    player's world is "KitPvP"
    {KitPvP::CrateLocation} is location of clicked block
    cancel event
    if player's gamemode is adventure:
        open chest with 3 rows named "&8Select a crate:" to player
        wait 1 tick
        set {_x::*} to 0, 1, 7, 8, 9, 17, 18, 19, 25 and 26
        loop {_x::*}:
            set slot loop-value of player's current inventory to black glass named "&8"
        wait 1 tick
        if {KitPvP::AmountKeys::Emthyist::%uuid of player%} is set:
            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."
        else:
            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."
        set slot 13 of player's current inventory to 166 named "&c&lComing Soon"
        if {KitPvP::AmountKeys::Magma::%uuid of player%} is set:
            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."
        else:
            set slot 15 of player's current inventory to blaze rod named "&6&lMagma &f&lKey" with lore " ||&aKeys: &f&l0|| ||&8&oRight click."  
      
    else:
        message "&6&lKitPvP &8» &c&lYou have to be in Adventure for this!"
on inventory click:
    player's world is "KitPvP"
    if inventory name of player's current inventory is "&8Select a crate:":
        cancel event
        if clicked slot is 11:
            if {KitPvP::AmountKeys::Emthyist::%uuid of player%} >= 1:
                close inventory of player
                invoke "KitPvP-OpenCrate" from player and "Emthyist"
            else:
                message "&6&lKitPvP &8» &c&lYou haven't got any &b&lEmthyist &c&lkeys!"
        else if clicked slot is 13:
            message "&6&lKitPvP &8» &c&lComing Soon!"
        else if clicked slot is 15:
            if {KitPvP::AmountKeys::Magma::%uuid of player%} >= 1:
                close inventory of player
                invoke "KitPvP-OpenCrate" from player and "Magma"
            else:
                message "&6&lKitPvP &8» &c&lYou haven't got any &6&lMagma &c&lkeys!"
    else if inventory name of player's current inventory is "Opening Emthyist Crate..":
        cancel event
    else if inventory name of player's current inventory is "Opening Magma Crate..":
        cancel event
sub "KitPvP-OpenCrate":
    set {_p} to "%parameter 1%" parsed as player
    set {_type} to "%parameter 2%"
    set {_uuid} to uuid of {_p}
    wait 1 tick
    remove 1 from {KitPvP::AmountKeys::%{_type}%::%{_uuid}%}
    open chest with 3 rows named "&8Opening %{_type}% Crate.." to {_p}
    wait a tick
    if {_type} is "Emthyist" or "Magma":
        loop {KitPvP::CrateLoot::%{_type}%::*}:
            add loop-value to {_roll::*}
    set {_speedFinal} to 2
    set {_Selector1} to 4
    set {_Selector2} to 22
    loop (random integer between 10 and 40) times:
        set {_sel} to 9
        loop 8 times:
            set {_sel2} to {_sel} - 1
            set {_item::%{_sel}%} to {_item::%{_sel2}%}
            subtract 1 from {_sel}
        set {_item::1} to a random element out of {_roll::*}
        loop integers between 0 and 26:
            if loop-number-2 is {_Selector1} or {_Selector2}:
                set slot loop-number-2 of {_p}'s current inventory to shiny light green stained glass pane named " "
            else:
                set slot loop-number-2 of {_p}'s current inventory to black stained glass pane named " "
            loop 9 times:
                set slot 8 + loop-number-3 of {_p}'s current inventory to {_item::%loop-number-3%}
        add 1 to {_sound}
        if {_sound} > 3:
            set {_sound} to 1
        if {_sound} = 1:
            play "NOTE_PLING" to {_p} at volume 0.8
#            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 2
        if {_sound} = 2:
            play "NOTE_PLING" to {_p} at volume 0.8
#            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 1
        if {_sound} = 3:
            play "NOTE_PLING" to {_p} at volume 0.8
#            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 0.5
        add 1 to {_speed}
        if {_speed} is 5:
            set {_speed} to 0
            add 1 to {_speedFinal}
        loop {_speedFinal} times:
            wait a tick
    set {_wonitem} to "%slot 13 of {_p}'s current inventory%" parsed as item
    message "&6&lKitPvP &8» &a&lYou've won %{_wonitem}%!" to {_p}
    if {_type} is "Emthyist":
        launch "BALL_LARGE" firework at location of {_p} timed 2 coloured blue
        launch "BALL_LARGE" firework at location of {_p} timed 3 coloured blue
#        play sound "EXPLODE" at location of {_p} with volume 0.6 and pitch 3
    else:
        launch "BALL_LARGE" firework at location of {_p} timed 2 coloured yellow
        launch "BALL_LARGE" firework at location of {_p} timed 3 coloured yellow
        play "EXPLODE" to {_p} at volume 0.6
#        play sound "EXPLODE" at location of {_p} with volume 0.6 and pitch 3
    wait 1 tick
    give {_wonitem} to {_p}
command /keys:
    trigger:
        send "&cMagma: %{KitPvP::AmountKeys::Magma::%uuid of player%}%"
        send "&bEmthyist: %{KitPvP::AmountKeys::Emthyist::%uuid of player%}%"
I get this:
code_language.skript:
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')
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')
 
I get this:
code_language.skript:
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')
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')
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.
 
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.
Here is my script:

code_language.skript:
on death:
    player's world is "KitPvP"
    set {_random} to random number between 0 and 100
    if {_random} <= 3:
        add 1 to {KitPvP::AmountKeys::Magma::%uuid of attacker%}
        message "&6&lKitPvP &8» &f&lYou had Luck! A &6&lMagma Key &f&lhas been given to you!" to attacker
        play "EXPLODE" to attacker at volume 0.6
        launch "BALL_LARGE" firework at attacker timed 0 coloured yellow
    else if {_random} <= 15:
        add 1 to {KitPvP::AmountKeys::Emthyist::%uuid of attacker%}
        message "&6&lKitPvP &8» &f&lYou had Luck! A &b&lEmthyist Key &f&lhas been given to you!" to attacker
        #play sound "EXPLODE" at attacker with volume 0.6 and pitch 2
        play "EXPLODE" to attacker at volume 0.6
        #play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
        launch "BALL_LARGE" firework at attacker timed 0 coloured blue
 
Here is my script:

code_language.skript:
on death:
    player's world is "KitPvP"
    set {_random} to random number between 0 and 100
    if {_random} <= 3:
        add 1 to {KitPvP::AmountKeys::Magma::%uuid of attacker%}
        message "&6&lKitPvP &8» &f&lYou had Luck! A &6&lMagma Key &f&lhas been given to you!" to attacker
        play "EXPLODE" to attacker at volume 0.6
        launch "BALL_LARGE" firework at attacker timed 0 coloured yellow
    else if {_random} <= 15:
        add 1 to {KitPvP::AmountKeys::Emthyist::%uuid of attacker%}
        message "&6&lKitPvP &8» &f&lYou had Luck! A &b&lEmthyist Key &f&lhas been given to you!" to attacker
        #play sound "EXPLODE" at attacker with volume 0.6 and pitch 2
        play "EXPLODE" to attacker at volume 0.6
        #play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
        launch "BALL_LARGE" firework at attacker timed 0 coloured blue
There aren't any errors in that code. Your errors are in line 146 and 149 as stated before.
 
There aren't any errors in that code. Your errors are in line 146 and 149 as stated before.
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?
[doublepost=1488147932,1488056234][/doublepost]bump. :emoji_slight_smile:
 
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?
[doublepost=1488147932,1488056234][/doublepost]bump. :emoji_slight_smile:
Removing items from the GUI *NOT Crates rewards to a variable*

Line 109-112

code_language.skript:
    else if inventory name of player's current inventory is "Opening Emthyist Crate..":
        cancel event
    else if inventory name of player's current inventory is "Opening Magma Crate..":
        cancel event

code_language.skript:
    if inventory name of player's current inventory contains "Opening Emthyist Crate..":
        cancel event
    if inventory name of player's current inventory contains "Opening Magma Crate..":
        cancel event
 
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?
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_language.skript:
on death:
    player's world is "world"
    set {_random} to random number between 0 and 100
    if {_random} <= 3:
        add 1 to {KitPvP::AmountKeys::Magma::%uuid of attacker%}
        message "&6&lKitPvP &8» &f&lYou had Luck! A &6&lMagma Key &f&lhas been given to you!" to attacker
        play "EXPLODE" to attacker at volume 0.6
#        play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
        launch "BALL_LARGE" firework at attacker timed 0 coloured yellow
    else if {_random} <= 15:
        add 1 to {KitPvP::AmountKeys::Emthyist::%uuid of attacker%}
        message "&6&lKitPvP &8» &f&lYou had Luck! A &b&lEmthyist Key &f&lhas been given to you!" to attacker
        play "EXPLODE" to attacker at volume 0.6
#        play sound "EXPLODE" at location of attacker with volume 0.6 and pitch 2
        launch "BALL_LARGE" firework at attacker timed 0 coloured blue
       
       
       
command /crates [<text>] [<text>] [<integer>] [<player>]:
    permission: kitpvp.admin
    trigger:
        if arg-1 is "setcratelocation":
            if targeted block is a chest:
                set {KitPvP::CrateLocation} to location of targeted block
                message "&a&lYou've set the Crate location!"
        if arg-1 is "givekey":
            if arg-2 is "emthyist":
                if arg-3 is set:
                    if arg-4 is set:
                        add arg-3 to {KitPvP::AmountKeys::Emthyist::%uuid of arg-4%}
                    else:
                        message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
                else:
                    message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
           
            else if arg-2 is "magma":
                if arg-3 is set:
                    if arg-4 is set:
                        add arg-3 to {KitPvP::AmountKeys::Magma::%uuid of arg-4%}
                    else:
                        message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
                else:
                    message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"
            else:
                message "&6&lKitPvP &8» &c&lSyntax: &7&o/kitpvp givekey (crate) (number) (player)"

        if arg-1 is "set-emthyist-loot":
            if player's gamemode is creative:
                if targeted block is chest:
                    delete {KitPvP::CrateLoot::Emthyist::*}
                    set {_loc} to location of targeted block
                    loop all items in inventory of block at {_loc}:
                        add loop-value to {KitPvP::CrateLoot::Emthyist::*}
                        wait 0.2 tick
                    wait 1 tick
                    message "&6&lKitPvP &8» &a&lLoot of the &b&lEmthyist Crate &a&lhas been set!"

        if arg-1 is "set-magma-loot":
            if player's gamemode is creative:
                if targeted block is chest:
                    delete {KitPvP::CrateLoot::Magma::*}
                    set {_loc} to location of targeted block
                    loop all items in inventory of block at {_loc}:
                        add loop-value to {KitPvP::CrateLoot::Magma::*}
                        wait 0.2 tick
                    wait 1 tick
                    message "&6&lKitPvP &8» &a&lLoot of the &6&lMagma Crate &a&lhas been set!"
on right click on a chest:
    player's world is "world"
    {KitPvP::CrateLocation} is location of clicked block
    cancel event
    if player's gamemode is adventure:
        open chest with 3 rows named "&8Select a crate:" to player
        wait 1 tick
        set {_x::*} to 0, 1, 7, 8, 9, 17, 18, 19, 25 and 26
        loop {_x::*}:
            format gui slot loop-value of player with black glass named "&8" to do nothing
#            set slot loop-value of player's current inventory to black glass named "&8"
        wait 1 tick
        if {KitPvP::AmountKeys::Emthyist::%uuid of player%} is set:
            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."
        else:
            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."
        set slot 13 of player's current inventory to 166 named "&c&lComing Soon"
        if {KitPvP::AmountKeys::Magma::%uuid of player%} is set:
            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."
        else:
            set slot 15 of player's current inventory to blaze rod named "&6&lMagma &f&lKey" with lore " ||&aKeys: &f&l0|| ||&8&oRight click."  
       
    else:
        message "&6&lKitPvP &8» &c&lYou have to be in Adventure for this!"
on inventory click:
    player's world is "world"
    if inventory name of player's current inventory is "&8Select a crate:":
        cancel event
        if clicked slot is 11:
            if {KitPvP::AmountKeys::Emthyist::%uuid of player%} >= 1:
                close inventory of player
                invoke "KitPvP-OpenCrate" from player and "Emthyist"
            else:
                message "&6&lKitPvP &8» &c&lYou haven't got any &b&lEmthyist &c&lkeys!"
        else if clicked slot is 13:
            message "&6&lKitPvP &8» &c&lComing Soon!"
        else if clicked slot is 15:
            if {KitPvP::AmountKeys::Magma::%uuid of player%} >= 1:
                close inventory of player
                invoke "KitPvP-OpenCrate" from player and "Magma"
            else:
                message "&6&lKitPvP &8» &c&lYou haven't got any &6&lMagma &c&lkeys!"
    else if inventory name of player's current inventory is "Opening Emthyist Crate..":
        cancel event
    else if inventory name of player's current inventory is "Opening Magma Crate..":
        cancel event
sub "KitPvP-OpenCrate":
    set {_p} to "%parameter 1%" parsed as player
    set {_type} to "%parameter 2%"
    set {_uuid} to uuid of {_p}
    wait 1 tick
    remove 1 from {KitPvP::AmountKeys::%{_type}%::%{_uuid}%}
    open chest with 3 rows named "&8Opening %{_type}% Crate.." to {_p}
    wait a tick
    if {_type} is "Emthyist" or "Magma":
        loop {KitPvP::CrateLoot::%{_type}%::*}:
            add loop-value to {_roll::*}
    set {_speedFinal} to 2
    set {_Selector1} to 4
    set {_Selector2} to 22
    loop (random integer between 10 and 40) times:
        set {_sel} to 9
        loop 8 times:
            set {_sel2} to {_sel} - 1
            set {_item::%{_sel}%} to {_item::%{_sel2}%}
            subtract 1 from {_sel}
        set {_item::1} to a random element out of {_roll::*}
        loop integers between 0 and 26:
            if loop-number-2 is {_Selector1} or {_Selector2}:
#               set slot loop-number-2 of {_p}'s current inventory to shiny light green stained glass pane named " "
                format gui slot loop-number-2 of {_p} with shiny light green stained glass pane named " " to do nothing
            else:
#               set slot loop-number-2 of {_p}'s current inventory to black stained glass pane named " "
                format gui slot loop-number-2 of {_p} with shiny black stained glass pane named " " to do nothing
            loop 9 times:
#               set slot 8 + loop-number-3 of {_p}'s current inventory to {_item::%loop-number-3%}
                format gui slot 8+loop-number-3 of {_p} with {_item::%loop-number-3%} named " " to do nothing
        add 1 to {_sound}
        if {_sound} > 3:
            set {_sound} to 1
        if {_sound} = 1:
            play "NOTE_PLING" to {_p} at volume 0.8
#            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 2
        if {_sound} = 2:
            play "NOTE_PLING" to {_p} at volume 0.8
#            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 1
        if {_sound} = 3:
            play "NOTE_PLING" to {_p} at volume 0.8
#            play sound "NOTE_PLING" at location of {_p} with volume 0.8 and pitch 0.5
        add 1 to {_speed}
        if {_speed} is 5:
            set {_speed} to 0
            add 1 to {_speedFinal}
        loop {_speedFinal} times:
            wait a tick
    set {_wonitem} to "%slot 13 of {_p}'s current inventory%" parsed as item
    message "&6&lKitPvP &8» &a&lYou've won %{_wonitem}%!" to {_p}
    if {_type} is "Emthyist":
        launch "BALL_LARGE" firework at location of {_p} timed 2 coloured blue
        launch "BALL_LARGE" firework at location of {_p} timed 3 coloured blue
#        play sound "EXPLODE" at location of {_p} with volume 0.6 and pitch 3
    else:
        launch "BALL_LARGE" firework at location of {_p} timed 2 coloured yellow
        launch "BALL_LARGE" firework at location of {_p} timed 3 coloured yellow
        play "EXPLODE" to {_p} at volume 0.6
#        play sound "EXPLODE" at location of {_p} with volume 0.6 and pitch 3
    wait 1 tick
    give {_wonitem} to {_p}
command /keys:
    trigger:
        send "&cMagma: %{KitPvP::AmountKeys::Magma::%uuid of player%}%"
        send "&bEmthyist: %{KitPvP::AmountKeys::Emthyist::%uuid of player%}%"

Also is there any way I can save the crate rewards to a variable?
They are already saved to these two variables "{KitPvP::CrateLoot::Emthyist::*}" and "{KitPvP::CrateLoot::Magma::*}"
 
But how can I set those variables to items in the script?
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.
 
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.
 
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.
Your suppose to put them in a chest, then do /crates set-magma-loot.
code_language.skript:
        if arg-1 is "set-magma-loot":
            if player's gamemode is creative:
                if targeted block is chest:

code_language.skript:
if targeted block is  chest:
 
Your suppose to put them in a chest, then do /crates set-magma-loot.
code_language.skript:
        if arg-1 is "set-magma-loot":
            if player's gamemode is creative:
                if targeted block is chest:

code_language.skript:
if targeted block is  chest:
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.
 
@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.
 
@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.
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
Reactions: LimeGlass
Status
Not open for further replies.