#My custom mining skript has multiple bugs.

1 messages · Page 1 of 1 (latest)

celest ice
#

`on join:
set {_potion} to infinite potion effect of mining fatigue of tier -1 without particles
apply {_potion} to player

on block damaging:
set {Mining::%player's name%} to 1
set {MiningStage::%player's name%} to 0
send "STARTING" to player
loop 10 times:
while {MiningStage::%player's name%} is smaller than 10:
if {Mining::%player's name%} is equal to 1:
add 1 to {MiningStage::%player's name%}
send action bar "%({MiningStage::%player's name%} / 10)% / 1" to player
make player see damage of target block as ({MiningStage::%player's name%} / 10)
wait 20 ticks
set player's target block to air

on block damage abort:
make player see damage of target block as 0
set {Mining::%player's name%} to 0
set {MiningStage::%player's name%} to 0
send "ABORTED" to player`

First bug: the mining stage flickers
Second bug: sometimes it breaks two blocks at the same time
Third bug the mining breaks when you look at another block with the mouse held

vast trout
#

you could try (wait 1 second) or something

celest ice
#

where

#

wait 20 ticks is the time between a new mining stage

#

@vivid pendant help me out on this one

vivid pendant
vivid pendant
celest ice
vivid pendant
celest ice
#

That will probably fix the insta break bug too ( I hope)

vivid pendant
#

wow you are having the same issues i was having xd

celest ice
#

Yeah, I'm happy cuz that makes my life easier xD ( I literally sent my keys flying cuz I hit my keyboard of of rage)

celest ice
#

Also I'll tell you tmrw if I fixed my issues cuz for me it's 23 o clock

#

got baguette man problems

severe wharf
#

What is this

#

Why are you putting %player’s name% in variables??

#

I understand not realizing about the uuid, but to specifically put the inferior one?

celest ice
#

I'll change it

#

Idk why I put player's name anyway

celest ice
celest ice
#

`on join:
set {_potion} to infinite potion effect of mining fatigue of tier -1 without particles
apply {_potion} to player

on block damaging:
set {Mining::%player%} to true
set {MiningStage::%player%} to 0
send "STARTING" to player

set {_loop} to 0
while {Mining::%player%} is equal to true:
    if {MiningStage::%player%} is equal to 9:
        breakAnimation(exact target block, 10, player)
        set exact target block of player to air
        
    if {_loop} is smaller than 10:
        add 1 to {_loop}
        set {MiningStage::%player%} to {_loop} - 1
        send action bar "M: %{Mining::%player%}% // %{MiningStage::%player%}% / 10 // LV: %{_loop}%" to player
        send {_loop} to player

        set {_blockStrength} to 2300

        if player is on ground:
            set {_digSpeed} to {MiningSpeed::%player%}
        if player is not on ground:
            set {_digSpeed} to ({MiningSpeed::%player%}/5)
        if player is in water:
            set {_digSpeed} to ({MiningSpeed::%player%}/5)
        set {_ticks} to round((30*{_blockStrength})/{_digSpeed})
        if {_ticks} is smaller than 4:
            set {_ticks} to 4
        if {_digSpeed} is equal to (60*{_blockStrength})+1:
            set {MiningStage::%player%} to 10
        
        breakAnimation(exact target block, {MiningStage::%player%}, player)
        wait "%{_ticks}/10% ticks" parsed as timespan
    else:
        stop

on block damage abort:
breakAnimation(exact target block, 10, player)
set {Mining::%player%} to false
set {MiningStage::%player%} to 0
send "ABORTED" to player

function breakAnimation(block: block, stage: number, receivers: players):
set {_packet} to new play_server_block_break_animation packet
set field 0 of {_packet} to random integer between 0 and 999999
set field 1 of {_packet} to {_block}
set field 2 of {_packet} to {_stage}
send {_receivers::*} packet {_packet} without calling event

command mspeed <integer>:
trigger:
set {MiningSpeed::%player%} to arg-1`

#

here are the bugs

vivid pendant
celest ice
#

changing the "health" of the block ? i dont understand

#

my bug here is i don't know how to remove the block stage animation if you abort the mining or when its finished + when i look at a block while mining it completely breaks

vivid pendant
#

ohh

#

i set the break stage to -1 not 10, try that

celest ice
#

oke

#

and for the other bug

vivid pendant
#

how are you detecting how long a block should take to break? which part of the code does that

#

i think you took a dif route then i did when making this, im just tryna figure out which way you did it

celest ice
#

it loops it 10 times, one for each block animation stage

#

` set {_loop} to 0
while {Mining::%player%} is equal to true:
if {MiningStage::%player%} is equal to 9:
breakAnimation(exact target block, 10, player)
set exact target block of player to air

    if {_loop} is smaller than 10:
        add 1 to {_loop}
        set {MiningStage::%player%} to {_loop} - 1
        send action bar "M: %{Mining::%player%}% // %{MiningStage::%player%}% / 10 // LV: %{_loop}%" to player
        send {_loop} to player`
#

this part does it

#

breakAnimation(exact target block, {MiningStage::%player%}, player) wait "%{_ticks}/10% ticks" parsed as timespan else: stop

and this

vivid pendant
#

ohhh, ok i see how you did it now,

celest ice
#

my method is probably not the best

vivid pendant
#

your method is fine, there are multiples way to do it, its just a dif way then i did it, so im tryan think of a way to fix it

#

ill send you my code, so you cna see how i did it, maybe you can think of a way to fix at after you see it, i cant think of a way

celest ice
#

okay

vivid pendant
#

ima remove the useless parts so its easier to read the important parts rq, gimme a min

celest ice
#

Got everything fixed. Took me more than 10 hours of work
Thanks to papa5p for his amazing help.