Solved How can i set block at location?

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

SniperFox

Member
May 31, 2017
29
0
1
23
Well, I have a variable with the block location, the question is: how do I put the block on this location?
Here are some snippets of code:

Set variable:

code_language.skript:
loop all blocks in radius 5 around {_plotloc}:
    set {_block} to loop-block
    set {_blockloc} to location of loop-block
    ...
    set {tmp::blocks::spawn::%{_num}%::%{_blocknum}%} to {_blockloc}

Set block:

code_language.skript:
loop {tmp::blocks::spawn::%{_num}%::*}:
    set {_block} to {tmp::blocks::spawn::%{_num}%::%loop-value-2%}
    set block {_block} to grass

And error:

code_language.skript:
[15:45:10 ERROR]: There's no world in a periodic event if no world is given in the event (e.g. like 'every hour in "world"') (System.sk, line 282: set block {_block} to grass')
 
As the error states, you have to specify what world those blocks are in.

code_language.skript:
set block {_block} in player’s world to grass


dk if this would work, I’ve never tried stuff like this + I’m on my phone
 
Well, it still does not work .. Here's the whole part of this code:


code_language.skript:
every 1 tick:
     #
     #
     # Удаление Игр
     #
     #
    loop {match::ffa::*}:
        set {_match} to loop-index
        loop all players:
            set {_p} to loop-player
            if {mg::%{_p}%} is set:
                if "%{match::%{_p}%}%" is "%{_match}%":
                    add 1 to {_players}
        if {_players} is not set:
            set {_players} to -1
        if {_players} < 0:
            set {_map} to {match::%{_match}%::map}
            loop {map::%{_map}%::spawn::*}:
                set {_num} to loop-index-2
                delete {tmp::map::%{_map}%::spawn::used::%{_num}%}
            loop {map::%{_map}%::spawn::*}:
                set {_num} to loop-index-2
                set {_plotloc} to {map::%{_map}%::spawn::%{_num}%}
                loop all blocks in radius 5 around {_plotloc}:
                    set {_block} to loop-block
                    set {_blockloc} to location of loop-block
                    add 1 to {_blocks}
                    if {_block} is barrier:
                        set loop-block to grass
                        wait 1 tick
                if {_blocks} < 25:
                    loop {tmp::blocks::spawn::%{_num}%::*}:
                        broadcast "1"
                        set {_block} to {tmp::blocks::spawn::%{_num}%::%loop-value-2%}
                        set block at {_block} in {_p}'s world to grass

                        delete {tmp::blocks::spawn::%{_num}%::%loop-value-2%}

And error:

code_language.skript:
[16:37:09 ERROR]: There's no world in a periodic event if no world is given in the event (e.g. like 'every hour in "world"') (System.sk, line 282: set block at {_block} in player's world to grass')


Or maybe I need to put some addon to make it work? Here are the addons that I have installed:

  1. Skellet
  2. SkQuery-Lime
  3. SkStuff
  4. Skungee
  5. TuSKe
  6. Skript-db
  7. SkRayFall
 
ehm, in your error you used
code_language.skript:
set block at {_block} in PLAYER's world to grass
but in your code you have instead of PLAYER you have {_p} wich should work
 
Well, but do not think that everything will be so simple:

code_language.skript:
[17:07:23 ERROR]: Variables cannot be used here. (System.sk, line 514: set block at {_block} in {_p}'s world to grass')
 
Im not really sure why they are telling you to
code_language.skript:
set block at {_block} in PLAYER's world to grass
Just use
code_language.skript:
set block at {_block} to grass
The block has already been defined in a specific location, no need to re-define the world its in
 
Status
Not open for further replies.