#Health skript

1 messages · Page 1 of 1 (latest)

nocturne estuary
#

if you can think of a way try it

ripe lake
#

^

#

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

hazy gust
#

nbt tags?

#

hm

#

like setting a int for the block when its placed

ripe lake
#

yup.

#

curious, what was your original idea?

hazy gust
ripe lake
#

no, the way you were going to add health to blocks

hazy gust
#

metadata but i figured out its going to get deleted after a restart

hazy gust
# ripe lake no, the way you were going to add health to blocks

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}
ripe lake
#

pretty much

hazy gust
#

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
ripe lake
hazy gust
#

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

ripe lake
hazy gust
#

hey sorry for late reply

#

so basically everytime i mine the block it doesnt remove 1 from its health

ripe lake
#

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

hazy gust