#Health skript
1 messages · Page 1 of 1 (latest)
^
most commonly you'll see people set a variable, but that's a lot of variables if you have one per block, wasting storage space.
You can change to metadata tags, but those will be deleted over a restart. if you care about that, use NBT tags
i dont want it to be deleted over a restart because its going to be a perm thing
nbt tags?
hm
like setting a int for the block when its placed
doing defense bricks so players place them to protect there base with them
no, the way you were going to add health to blocks
metadata but i figured out its going to get deleted after a restart
can u maybe tell me how to get started with it i know how to set a string but idk how to start with it like should i like do this?
on break:
if event-block is a cracked brick:
set {_h} to int tag "custom;Health" of nbt compund of event-block
if {_h} is 0:
set event-block to air
else:
remove 1 from {_h}
pretty much
alright let me try
on break or on mine?
or no difference?
and also i should do
if event-block is a cricked brick:
set int tag "custom;Health" of nbt compound of event-block to 10
set int tag "custom;Tier1D" of nbt compound of event-block to 1
On break is any time a block breaks. Mine requires the preferred tool (ie iron pick for diamond ore)
okay thanks
Its not working
on place:
if event-block is a cracked stone bricks:
set int tag "custom;Health" of nbt compound of event-block to 10
set int tag "custom;Tier1D" of nbt compound of event-block to 1
on break:
if event-block is a cracked stone bricks:
set {_h} to int tag "custom;Health" of nbt compound of event-block
set {_t} to int tag "custom;Tier1D" of nbt compound of event-block
remove 1 from {_h}
if {_h} is 0:
set event-block to air
cancel drops
else:
cancel event
send action bar "%{_h}%"
broadcast "%nbt compound of event-block%"
the removing part is not working
sorry for the ping @ripe lake

hey sorry for late reply
so basically everytime i mine the block it doesnt remove 1 from its health
Because you are only modifying a local variable
You have to remove from the actual tag
Or just set the tag to {_h} at the end
how im going to remove it from the actual tag can u do that in nbt if so how?\