1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Block has problems

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

Thread Status:
Not open for further replies.
  1. Dxn

    Dxn New Member

    Joined:
    Nov 8, 2021
    Messages:
    8
    Likes Received:
    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!
     
  2. Best Answer:
    Post #2 by Nikd0, Nov 23, 2021
  3. Nikd0

    Nikd0 Active Member

    Joined:
    May 30, 2020
    Messages:
    204
    Likes Received:
    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%}
     
Thread Status:
Not open for further replies.

Share This Page

Loading...