Solved Automatic Miner

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

BryHunter

Member
Jan 10, 2018
35
2
8
27
Okay so I am trying to make a dispenser that when you place it loops the 100 blocks in front of event-block placed and mines them, then adds them to players inventory. But if possible each block takes 1 second to mine and there is also a delay

code_language.skript:
on place of dispenser:
    if name of player's held item contains "&e&lStraight Line Miner"
        loop blocks in front of player where [block input is not bedrock]:
            set loop-blocks to air

something like this but nicer and more efficient
 
Okay so I am trying to make a dispenser that when you place it loops the 100 blocks in front of event-block placed and mines them, then adds them to players inventory. But if possible each block takes 1 second to mine and there is also a delay

code_language.skript:
on place of dispenser:
    if name of player's held item contains "&e&lStraight Line Miner"
        loop blocks in front of player where [block input is not bedrock]:
            set loop-blocks to air

something like this but nicer and more efficient
okay this might not be the prettiest code, but it works
code_language.skript:
on place of dispenser:
    if name of player's tool is "&e&lStraight Line Miner":
        set {miner::%player%} to location of event-block
        wait 1 second
        loop blocks 100 in front of event-block:
            if {miner::%player%} is set:
                if loop-block is not a dispenser or bedrock or air:
                    play sound "BLOCK_STONE_BREAK" at location of event-block for player
                    give player 1 of loop-block
                    set loop-block to air
                    wait 1 second
            else:
                stop
on break of dispenser:
    if {miner::%player%} is location of event-block:
        cancel event
        set event-block to air
        drop 1 dispenser named "&e&lStraight Line Miner" at event-location without velocity
        delete {miner::%player%}
 
  • Like
Reactions: BryHunter
Status
Not open for further replies.