#block detection
1 messages · Page 1 of 1 (latest)
there is an event for when player starts breaking block and when they stop
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
you have to start while loop when player starts damaging it
and end the loop when player stops damaging it
so while block damaging?
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)```
you install skBee and use on block damge abort
you should have it installed anyways
{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
can anoyone help plz?
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
tysm <3
tell me if you encounter any errors
k
Do you mind telling me how you thought about typing it this way?
So I can better myself and maybe do it myself next time
I’m not home currently but I will tell you when im back on my pc because there I type faster there
Ok thanks
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
Okay, the detect it with the variables
Or, the better version that wont clog up storage
what better version?
Metadata tag
I just didn't really think the while metadata value "damaging" of player is set: was useful there and it was better off getting replaced with on break event.
im pretty surre when using on break it just means when the player breaks the block