Solved Loop blocks 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.

Aidanete

Active Member
Apr 11, 2017
139
10
0
I'm trying to save blocks as an arena, but it doesn't works
code_language.skript:
command /save [<text>]:
    trigger:
        loop blocks from {hpos1::%player%} to {hpos2::%player%}:
            wait 1 tick
            set {arenastorage::%arg 1%::%loop-block%} to location of loop-block
            add 1 to {_savedblocks}
        message "{@Prefix} <gray>Arena saved with a total of %{_savedblocks}% blocks saved"
The command will show the message below as it don't saved any block.
The Hpos are setted here:
code_language.skript:
on rightclick:
    player's tool is a golden axe:
        set {hpos2::%player%} to location of targeted block
on leftclick:
    player's tool is a golden axe:
        cancel event
        set {hpos1::%player%} to location of targeted block
HELP!
 
SkQuery has a CUBOID SYNTAX. you could try:
code_language.skript:
loop blocks within {hpos1::%player%} to {hpos2::%player%}:
Okay, but how I load it?
code_language.skript:
command /load [<text>]:
    trigger:
        loop {arenastorage::%arg 1%::*}:
            wait 1 tick
            set the block at loop-value to loop-index parsed as a block
        message "{@Prefix} <gray>Arena reloaded [Debug]"
 
Okay, but how I load it?
code_language.skript:
command /load [<text>]:
    trigger:
        loop {arenastorage::%arg 1%::*}:
            wait 1 tick
            set the block at loop-value to loop-index parsed as a block
        message "{@Prefix} <gray>Arena reloaded [Debug]"
I guess you could try that. Ive never done it this way, i have only every used world guard/world edit
 
@ShaneBee No, that code shows up an error:
code_language.skript:
A block can't be set to loop-index because the latter is not an item type
How do I fix that?

The parsed as a block don't work, and without it the error log is the above one
 
I actually have no idea. I have never used the cuboids, but IM going to fire up a test server and see if i can figure it out!
[doublepost=1534369614,1534367760][/doublepost]Okay, I did a little re-write and made this work:
code_language.skript:
command /save [<text>]:
    trigger:
        loop blocks within {hpos1::%player%} to {hpos2::%player%}:
            set {arenastorage::block::%arg 1%::%loop-block%} to type of loop-block
            set {arenastorage::loc::%arg 1%::%loop-block%} to location of loop-block
            add 1 to {_savedblocks}
        message "{@prefix} <gray>Arena saved with a total of %{_savedblocks}% blocks saved"

command /load [<text>]:
    trigger:
        loop {arenastorage::loc::%arg 1%::*}:
            if block at {arenastorage::loc::%arg 1%::%loop-index%} is not {arenastorage::block::%arg 1%::%loop-index%}:
                set block at {arenastorage::loc::%arg 1%::%loop-index%} to {arenastorage::block::%arg 1%::%loop-index%}
                wait 1 tick
        message "{@prefix} <gray>Arena reloaded [Debug]"
 
Status
Not open for further replies.