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 How can i set block at location?

Discussion in 'Skript' started by SniperFox, Jul 17, 2018.

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

    SniperFox Member

    Joined:
    May 31, 2017
    Messages:
    29
    Likes Received:
    0
    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 (Skript):
    1. loop all blocks in radius 5 around {_plotloc}:
    2.     set {_block} to loop-block
    3.     set {_blockloc} to location of loop-block
    4.     ...
    5.     set {tmp::blocks::spawn::%{_num}%::%{_blocknum}%} to {_blockloc}
    Set block:

    Code (Skript):
    1. loop {tmp::blocks::spawn::%{_num}%::*}:
    2.     set {_block} to {tmp::blocks::spawn::%{_num}%::%loop-value-2%}
    3.     set block {_block} to grass
    And error:

    Code (Skript):
    1. [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')


     
  2. Best Answer:
    Post #8 by ShaneBee, Jul 17, 2018
  3. D0XY

    D0XY Member

    Joined:
    May 4, 2018
    Messages:
    35
    Likes Received:
    0
    As the error states, you have to specify what world those blocks are in.

    Code (Skript):
    1. 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
     
  4. SniperFox

    SniperFox Member

    Joined:
    May 31, 2017
    Messages:
    29
    Likes Received:
    0
    Well, thanks for answering, but it does not work: \
     
  5. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    15
    Medals:
    Code (Skript):
    1. set block at {_block} in player's world to grass
     
  6. SniperFox

    SniperFox Member

    Joined:
    May 31, 2017
    Messages:
    29
    Likes Received:
    0
    Well, it still does not work .. Here's the whole part of this code:


    Code (Skript):
    1. every 1 tick:
    2.      #
    3.      #
    4.      # Удаление Игр
    5.      #
    6.      #
    7.     loop {match::ffa::*}:
    8.         set {_match} to loop-index
    9.         loop all players:
    10.             set {_p} to loop-player
    11.             if {mg::%{_p}%} is set:
    12.                 if "%{match::%{_p}%}%" is "%{_match}%":
    13.                     add 1 to {_players}
    14.         if {_players} is not set:
    15.             set {_players} to -1
    16.         if {_players} < 0:
    17.             set {_map} to {match::%{_match}%::map}
    18.             loop {map::%{_map}%::spawn::*}:
    19.                 set {_num} to loop-index-2
    20.                 delete {tmp::map::%{_map}%::spawn::used::%{_num}%}
    21.             loop {map::%{_map}%::spawn::*}:
    22.                 set {_num} to loop-index-2
    23.                 set {_plotloc} to {map::%{_map}%::spawn::%{_num}%}
    24.                 loop all blocks in radius 5 around {_plotloc}:
    25.                     set {_block} to loop-block
    26.                     set {_blockloc} to location of loop-block
    27.                     add 1 to {_blocks}
    28.                     if {_block} is barrier:
    29.                         set loop-block to grass
    30.                         wait 1 tick
    31.                 if {_blocks} < 25:
    32.                     loop {tmp::blocks::spawn::%{_num}%::*}:
    33.                         broadcast "1"
    34.                         set {_block} to {tmp::blocks::spawn::%{_num}%::%loop-value-2%}
    35.                         set block at {_block} in {_p}'s world to grass
    36.  
    37.                         delete {tmp::blocks::spawn::%{_num}%::%loop-value-2%}
    38.  
    And error:

    Code (Skript):
    1. [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
     
  7. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    15
    Medals:
    ehm, in your error you used
    Code (Skript):
    1. 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
     
  8. SniperFox

    SniperFox Member

    Joined:
    May 31, 2017
    Messages:
    29
    Likes Received:
    0
    Well, but do not think that everything will be so simple:

    Code (Skript):
    1. [17:07:23 ERROR]: Variables cannot be used here. (System.sk, line 514: set block at {_block} in {_p}'s world to grass')
     
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    215
    Im not really sure why they are telling you to
    Code (Skript):
    1. set block at {_block} in PLAYER's world to grass
    Just use
    Code (Skript):
    1. 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
     
  10. SniperFox

    SniperFox Member

    Joined:
    May 31, 2017
    Messages:
    29
    Likes Received:
    0
    Thank you!
     
  11. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    215
    You are welcome :emoji_slight_smile:
     
Thread Status:
Not open for further replies.

Share This Page

Loading...