#block detection

1 messages · Page 1 of 1 (latest)

winged saddle
#

I want to make it so whenever the player starts breaking a block it adds a certain number to the variable, and every second he continues breaking the block it adds another. but idk how to do it

void spire
#

there is an event for when player starts breaking block and when they stop

winged saddle
#

ye but I don't want to know how much to add when they stop I want to know every second that the player is doing it. is there a way to do that?

#

variables:
{uuid::%player%oak} = 10
{uuid::%player%strength} = 1
on block damaging:
if block is oak_wood:
add -1 * {uuid::%player%strength} to {uuid::%player%oak}
if {uuid::%player%oak} <= 0:
set {uuid::%player%oak} to 10
send "you broke de oak" to player

#

this is what i have rn but it only works when the player starts hitting it

void spire
#

you have to start while loop when player starts damaging it

#

and end the loop when player stops damaging it

winged saddle
#

so while block damaging?

void spire
#

theres no such thing

#
  set metadata value "damaging" of player to true
  while metadata value "damaging" of player is set:
    do stuff

on block damage abort: (needs skBee i think)
  delete metadata value "damaging" of player (will stop loop you started above)```
winged saddle
#

ok tysm for the help

#

wait so what do i say instead of
on block damage abort:

void spire
#

you install skBee and use on block damge abort
you should have it installed anyways

winged saddle
#
    {uuid::%player%oak} = 10
    {uuid::%player%strength} = 1

on block damaging:
  set metadata value "damaging" of player to true
  while metadata value "damaging" of player is set:
    if block is oak_wood:
      wait 1 second
      add -1 * {uuid::%player%strength} to {uuid::%player%oak}
      if {uuid::%player%oak} <= 0:
        set {uuid::%player%oak} to 10
        send "you broke de oak" to player

on block damage abort:
  delete metadata value "damaging" of player```
this one works but there is a bug that if i stop clicking the resume clicking the whole process resets instead of waiting the 1 second.
iv'e tried a couple ways to stop it but everything makes my game crash
winged saddle
#

can anoyone help plz?

dry dust
# winged saddle ```variables: {uuid::%player%oak} = 10 {uuid::%player%strength} = 1 on ...
variables:
    {uuid::%player%oak} = 10
    {uuid::%player%strength} = 1

on block damaging:
    set metadata value "damaging" of player to true

on break:
    if block is oak_wood:
        wait 1 second
        add -1 * {uuid::%player%strength} to {uuid::%player%oak}
        if {uuid::%player%oak} <= 0:
            set {uuid::%player%oak} to 10
            send "you broke de oak" to player

on block damage abort:
    delete metadata value "damaging" of player
winged saddle
#

tysm <3

dry dust
#

tell me if you encounter any errors

winged saddle
#

k

winged saddle
dry dust
#

I’m not home currently but I will tell you when im back on my pc because there I type faster there

winged saddle
#

Ok thanks

slim knot
#

what are these variables

#

just use metadata tags or nbt tags for the block

winged saddle
# dry dust tell me if you encounter any errors

using on break means when im breaking it and i need the block to not break because i am going to have the players have mining fatigue, ill just want them to reach the amount of score then it'll do stuff

slim knot
#

Okay, the detect it with the variables

slim knot
winged saddle
#

what better version?

slim knot
dry dust
winged saddle
#

im pretty surre when using on break it just means when the player breaks the block