Warzone "Mining"

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

iParis

Member
Jan 28, 2017
48
2
0
25
Hey,

I'm creating a warzone mining skript for my server and I'm struggling a little bit with it. The bit I'm struggling with is when it comes to mining the stuff in the war zone, I'll show you my current skript and it is the on mine section of it. The event-block turns to bedrock, however, after the time period it doesn't turn into a block from the list.

code_language.skript:
on right click on purple wool:
    cancel event
    add location of event-block to {warzoneores::*}
    send " &8(&6&l!&8)  &7&oAdded &f%location of event-block% &7&oto the list  &8(&6&l!&8)   "
    add coal ore named "&6&lCOAL ORE" to {_warzoneores::*}
    add iron ore named "&6&lIRON ORE" to {_warzoneores::*}
    add lapis ore named "&6&lLAPIS ORE" to {_warzoneores::*}
    add redstone ore named "&6&lREDSTONE ORE" to {_warzoneores::*}
    add gold ore named "&6&lGOLD ORE" to {_warzoneores::*}
    add diamond ore named "&6&lDIAMOND ORE" to {_warzoneores::*}
    add emerald ore named "&6&lEMERALD ORE" to {_warzoneores::*}
    set {_warzone} to random element of {_warzoneores::*}
    wait 5 tick
    set event-block to {_warzone}

on mine:
    if "%{warzoneores::*}%" contains "%location of event-block%":   
        cancel event
        set event-block to bedrock
        wait 5 seconds
        set {_warzone} to random element of {_warzoneores::*}
        set event-block to {_warzone}

Thanks, Jack
 
{_var} are local variables, meaning that creating one of these will only work in one place, so you can only operate with these in 1 part, in your case, in the right click one. Use {var::*} instead
 
{_var} are local variables, meaning that creating one of these will only work in one place, so you can only operate with these in 1 part, in your case, in the right click one. Use {var::*} instead
Explain more?
 
Local variables, like {_var}, disappears when the event that it's in completely passes. On the other hand, global variables, like {var}, is stored into the variable file and can be used in every event. The rules apply to list variables too.
 
Well, I did what @dudle said
code_language.skript:
on right click on purple wool:
    cancel event
    add location of event-block to {warzoneores::*}
    send " &8(&6&l!&8)  &7&oAdded &f%location of event-block% &7&oto the list  &8(&6&l!&8)   "
    add coal ore named "&6&lCOAL ORE" to {_warzoneores::*}
    add iron ore named "&6&lIRON ORE" to {_warzoneores::*}
    add lapis ore named "&6&lLAPIS ORE" to {_warzoneores::*}
    add redstone ore named "&6&lREDSTONE ORE" to {_warzoneores::*}
    add gold ore named "&6&lGOLD ORE" to {_warzoneores::*}
    add diamond ore named "&6&lDIAMOND ORE" to {_warzoneores::*}
    add emerald ore named "&6&lEMERALD ORE" to {_warzoneores::*}
    set {warzone::*} to random element of {_warzoneores::*}
    wait 5 tick
    set event-block to {warzone::*}

on mine:
    if "%{warzoneores::*}%" contains "%location of event-block%":   
        cancel event
        set event-block to bedrock
        wait 5 seconds
        set {_warzone} to random element of {_warzoneores::*}
        set event-block to {_warzone}

https://i.gyazo.com/ad1890d9ef582bb1a3c395dc9e8c1b34.png
 
You cannot set a value to a list with ::*. ::* in the variable is used for looping and getting out indexes/values. You can only set a value to a variable such as {var::example}, not {var::*}.

If you're only wanting to get one value out of a random element, don't add ::*, use a variable such as {var::example}.
 
So how would I do it, are you able to just change the skript?
I gave you a short overview of how list variables work. I am not going to spoon feed you so you'll have to figure it out or let someone else spoon feed you. Learning to solve problems yourself will help you improve.
 
I gave you a short overview of how list variables work. I am not going to spoon feed you so you'll have to figure it out or let someone else spoon feed you. Learning to solve problems yourself will help you improve.
I wouldn't call it spoon feeding. I've tried my own ideas and it hasn't worked, I've tried your ideas / what you've told me and it still hasn't worked / made sense to me. I can't help not understanding something, but if you don't want to "Spoon feed" then that's your own choice but I appreciate the help you gave.
 
If you want a bit help, change {warzone::*} to {warzone} on both, the reason It doesn't set is because you most likely didn't do both of them, also I recommend enabling effect-commands in your config.sk so you can see the variables and what they are.
 
Status
Not open for further replies.