Solved Help me

  • 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.
Say you select the locations of A Mine, then you can do /addblock A iron ore
And do /addblock A coal ore
It will add all the blocks you add to the mine, no matter how many times you do it
 
Yes, but the function is getting all the blocks in the region.
So once I loop the variable it will set every block in the region that I got with the function to a random variable.
This makes it look random like a mine should.
 
T
Code:
function getBlocks(1: location, 2: location) :: blocks:
    set {_x} to 1
    set {_y} to 1
    set {_z} to 1
    if x coord of {_1} > x coord of {_2}:
        set {_x} to -1
    if y coord of {_1} > y coord of {_2}:
        set {_y} to -1
    if z coord of {_1} > z coord of {_2}:
        set {_z} to -1
    set {_base1} to {_1}
    loop abs(x coord of {_1} - x coord of {_2}) + 1 times:
        loop abs(z coord of {_1} - z coord of {_2}) + 1 times:
            loop abs(y coord of {_1} - y coord of {_2}) + 1 times:
                add 1 to {_current}
                set {_b::%{_current}%} to block at {_1}
                add {_y} to y coord of {_1}
            add {_z} to z coord of {_1}
            set y coord of {_1} to y coord of {_base1}
        add {_x} to x coord of {_1}
        set z coord of {_1} to z coord of {_base1}
    return {_b::*}
command /resetmine <text>: #this is the mine i had, eg. A, B, etc..
    trigger:
        add 1 to y coord of {loc1::%arg-1%} #{loc1} and {loc2... are the locations of the region i set
        set {_x::*} to getBlocks({loc1::%arg-1%}, {loc2::%arg-1%})
        loop {_x::*}:
            set {_block} to a random element out of {blocks::%arg-1%::*}
            set block at location of loop-value to {_block}
command /addblock <text> <text>:
    trigger:
        set {_block} to arg-2 parsed as item
        add {_block} to {blocks::%arg-1%::*} #arg-1 is the mine, A, B, etc, I had something to select the region with sticks but I'm sure you could figure it out
        message "&6&l(!) &6Added &e%arg-2% &6to &e%arg-1% &6mine!"

This is something I threw together a while back, with the help of some on here.
Take what you need from it.
/addblock <mine> <block> is just something to add the blocks you want the mine to consist of, you can add better code.
Thank you very much b ut how can i make for example stone higher than glass
 
Status
Not open for further replies.