# Solved Block has problems

Discussion in 'Skript' started by Dxn, Nov 22, 2021.

Not open for further replies.
1. ### Dxn New Member

Joined:
Nov 8, 2021
Messages:
8
0
Code (Text):
1. on projectile hit:
2.   projectile is an snowball:
3.     play sound "expl.bazooka" with volume 100 with pitch 1 at shooter for shooter
4.   create an explosion of force 1
5.   loop blocks in radius 6 around event-location:
6.     add 1 to {explosiondurability::%loop-block%}
7.     if loop-block is oak wooden plank:
8.       {explosiondurability::%loop-block%} is more than or equal to 4
9.       set loop-block to air
10.     if loop-block is cobblestone:
11.       {explosiondurability::%loop-block%} is more than or equal to 5
12.       set loop-block to air
13.     if loop-block is spruce wooden plank:
14.       {explosiondurability::%loop-block%} is more than or equal to 6
15.       set loop-block to air
16.     if loop-block is obsidian:
17.       {explosiondurability::%loop-block%} is more than or equal to 7
18.       set loop-block to air
I have a problem. If you build as example some cobblestone somewhere and the blocks get destroyed by the snowball, if you place the blocks again they will instantly blow instead of getting destroyed by using the snowball 5 times. Like "{explosiondurability::%loop-block%} is more than or equal to 5" you gotta use the snowball 5 times to destroy the blocks, but they get destroyed instantly. Please someone help me!

#1
Post #2 by Nikd0, Nov 23, 2021
3. ### Nikd0 Active Member

Joined:
May 30, 2020
Messages:
204
19
I believe you have to delete this value=variable when the blocks are removed.
Code (Text):
1. set loop-block to air
2. clear {explosiondurability::%loop-block%}
Also, it should be probably cleared when you remove it by yourself too:
Code (Text):
1. on break:
2.   {explosiondurability::%event-block%} is set
3.   clear {explosiondurability::%event-block%}

#2
Not open for further replies.