Solved Replacing Blocks in radius?

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

Skzen

Member
Jun 15, 2017
15
1
0
44
Hi,
I'm trying to replace x ore with another random ore completely. I've tried making it work but it seems to replace a vein with different types of ores instead of a vein of one type of ore. How can I make this work?
code_language.skript:
on mine of iron ore:
    player is in "Warzone"
    cancel event
    set event-block to bedrock
    add 1 iron ingot named "&e&lWarzone Iron" to the player
    play sound "ENTITY_EXPERIENCE_ORB_PICKUP " to player at volume 1 and pitch 5
    send action bar from "&f&lMined &e&lWarzone Iron&f&l!" to player
    loop blocks in radius 4 around event-block:
        loop-block is equal to bedrock or coal ore or iron ore or gold ore or redstone ore or lapis ore or diamond ore or emerald ore
        wait 2 seconds
        set {ores} to a random integer between 1 and 14
        if {ores} is 1:
            set all stone blocks in radius 5 to coal ore
        if {ores} is 2:
            set loop-blocks to coal ore
        if {ores} is 3:
            set loop-blocks to coal ore
        if {ores} is 4:
            set loop-blocks to iron ore
        if {ores} is 5:
            set loop-blocks to iron ore
        if {ores} is 6:
            set loop-blocks to iron ore
        if {ores} is 7:
            set loop-blocks to lapis ore
        if {ores} is 8:
            set loop-blocks to lapis ore
        if {ores} is 9:
            set loop-blocks to redstone ore
        if {ores} is 10:
            set loop-blocks to redstone ore
        if {ores} is 11:
            set loop-blocks to gold ore
        if {ores} is 12:
            set loop-blocks to gold ore
        if {ores} is 13:
            set loop-blocks to diamond ore
        if {ores} is 14:
            set loop-blocks to emerald ore
 
Because each loop iteration you're choosing a new random ore.

"set loop-blocks to whatever" doesn't set all the blocks you loop to that ore, just the current block being looped.

You should set {ores} to a random ore before the loop, then loop blocks in radius 4 and check if the loop block is an ore, and if so, set it to {ores}
 
Status
Not open for further replies.