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 our 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 to set blocks from position 1 to position 2?

Discussion in 'Skript' started by pepper82, Mar 13, 2019.

  1. pepper82

    pepper82 Member

    Joined:
    Jan 26, 2017
    Messages:
    226
    Likes Received:
    1
    I want to set all blocks within two locations to a specific block but only using Skript (no addons). Is it possible? If so, what is the correct syntax?
     
  2. Best Answer:
    Post #2 by ShaneBee, Mar 13, 2019
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,688
    Likes Received:
    119
    This is probably the easiest way to do it. This is a function utilizing MC's built-in fill command
    Code (Skript):
    1. function fill(l1: location, l2: location, b: itemtype, t: text):
    2.     if {_t} = "destroy", "hollow", "keep", "outline" or "replace":
    3.         set {_type} to {_t}
    4.     else:
    5.         set {_type} to "replace"
    6.     set {_x1} to rounded x coord of {_l1}
    7.     set {_y1} to rounded y coord of {_l1}
    8.     set {_z1} to rounded z coord of {_l1}
    9.     set {_x2} to rounded x coord of {_l2}
    10.     set {_y2} to rounded y coord of {_l2}
    11.     set {_z2} to rounded z coord of {_l2}
    12.  
    13.     execute console command "/fill %{_x1}% %{_y1}% %{_z1}% %{_x2}% %{_y2}% %{_z2}% %minecraft name of {_b}% %{_type}%"
    14.  
    15. # used like:
    16. # these are obviously just examples
    17. command /test:
    18.     trigger:
    19.         fill({loc1}, {loc2}, water, "replace")
    20.         fill({loc1}, {loc2}, stone, "hollow")
     
    • Like Like x 1
  4. pepper82

    pepper82 Member

    Joined:
    Jan 26, 2017
    Messages:
    226
    Likes Received:
    1
    Thanks, looks nice, didn't know minecraft itself can do this. Will test it out.
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,688
    Likes Received:
    119
    I didn't know either until like a month or 2 ago, but apparently, this command has been in the game for years. Along with some other weird ones.
     
  6. pepper82

    pepper82 Member

    Joined:
    Jan 26, 2017
    Messages:
    226
    Likes Received:
    1
    It actually works @ShaneBee . Only downside of this is that every server admin receives a message like "[Server: 180 blocks set ... ]". Or is there a way to disable these messages?

    Another problem is that you can not enter a world name, so it only works on the main world.
     
    #5 pepper82, Mar 15, 2019
    Last edited: Mar 15, 2019
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,688
    Likes Received:
    119
    I'm guessing your admins are OPd? de-op them! No one on your server should be OP'd, just give them the correct permissions they need.
    If they are not OPd then I'm not sure why they are receiving console messages. They shouldn't!

    Yes, that part sucks. I'm not entirely sure why MC did it that way.

    This is the only way I know how to do it via Skript, especially with no addons.
     
Loading...