#defense
1 messages · Page 1 of 1 (latest)
you cannot call local variables outside the function they were declared in
in the on place event, you set {_meta} to the metadata but then you remove 1 from {_meta} in your on mine event
right
by default if a variable is undefined (which it is because its a local variable) it'll be 0, and you're removing 1 from it so its always going to be -1
how can i call it tho or something
by my understanding of your code, you simply need to change {_meta} into metadata "DHealth" of event-block in your on mine event
and setting the {_meta} variable inside your on place event is redundant since it will never be used
okay let me try
see more about local variables here (variables prefixed with _)
https://sovdee.gitbook.io/skript-tutorials/core-concepts/variables/global-and-local
weird its not setting the block to air and debugging the meta {none}
on break:
if event-block is a cobblestone:
if metadata "DHealth" of event-block is not set:
set metadata "DHealth" of event-block to 15
else:
set {_meta} to metadata "DHealth" of event-block
remove 1 from {_meta}
set event-block to air
cancel drops
if {_meta} is 0:
delete metadata "DHealth" of event-block
else:
cancel event
set metadata "DHealth" of event-block to {_meta}
when you set {_meta} to the metadata on line 6 and modify it, it will not actually update the metadata since you are just changing the var
so you must use remove 1 from metadata "DHealth" of event-block instead of removing it from the variable
also try using set block at event-block to air instead