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.

Explosions on specific player blocks

Discussion in 'Skript' started by BryHunter, Aug 13, 2019.

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

    BryHunter Member

    Joined:
    Jan 10, 2018
    Messages:
    33
    Likes Received:
    1
    Code (Text):
    1. on block place:
    2.  
    3.     If lore of player's tool is "&r  ||&8&l> &7Player Block":
    4.  
    5.         set {blockplace::%event-location%} to player
    6.  
    7.         set action bar of player to "&4[PlayerBlocks] &7Block placed successfully"


    Alrighty so i am trying to make it so when players place a block that block is then registered to them, this is working properly. Then i tried to make it so these specific registered blocks take more than 1 tnt to explode. This i got working with the example below:



    Code (Text):
    1. on explosion:
    2.  
    3.     loop exploded blocks:
    4.  
    5.         if loop-block is glass:
    6.  
    7.             if {explosion::%loop-block%} is not set:
    8.  
    9.                 cancel event
    10.  
    11.                 set {explosion::%loop-block%} to 1
    12.  
    13.             else:
    14.  
    15.                 if {explosion::%loop-block%} < 10:
    16.  
    17.                     cancel event
    18.  
    19.                     add 1 to {explosion::%loop-block%}
    20.  
    21.                 else:
    22.  
    23.                     clear {explosion::%loop-block%}
    24.  
    25.                     delete {blockplace::%location of loop-block%}
    But when i tried to add it in so its only the registered blocks take more than 1 tnt to explode it did not work... which is the example below:



    Code (Text):
    1. on explosion:
    2.  
    3.     loop exploded blocks:
    4.  
    5.         if loop-block is glass:
    6.  
    7.             if {blockplace::%event-location%} is set:
    8.  
    9.                 if {explosion::%loop-block%} is not set:
    10.  
    11.                     cancel event
    12.  
    13.                     set {explosion::%loop-block%} to 1
    14.  
    15.                 else:
    16.  
    17.                     if {explosion::%loop-block%} < 10:
    18.  
    19.                         cancel event
    20.  
    21.                         add 1 to {explosion::%loop-block%}
    22.  
    23.                     else:
    24.  
    25.                         clear {explosion::%loop-block%}
    26.  
    27.                         delete {blockplace::%location of loop-block%}
     
    LukynkaCZE likes this.
  2. LukynkaCZE

    LukynkaCZE Member

    Joined:
    May 12, 2019
    Messages:
    26
    Likes Received:
    2
    Hi, I've been thinking about this for about 30 minutes. This should work.

    Code (Text):
    1. on block place:
    2.  
    3.     If lore of player's tool is "&r  ||&8&l> &7Player Block":
    4.  
    5.         set {blockplace::%event-location%} to player
    6.  
    7.         set action bar of player to "&4[PlayerBlocks] &7Block placed successfully"
    8.  
    9.  
    10. on explosion:
    11.  
    12.     loop exploded blocks:
    13.  
    14.         if loop-block is glass:
    15.             set {loc.%loop-block%} to location of loop-block
    16.             if {blockplace::%{loc.%loop-block%}%} is set:
    17.  
    18.                 if {explosion::%loop-block%} is not set:
    19.  
    20.                     cancel event
    21.  
    22.                     set {explosion::%loop-block%} to 1
    23.  
    24.                 else:
    25.  
    26.                     if {explosion::%loop-block%} < 10:
    27.    
    28.                         cancel event
    29.    
    30.                         add 1 to {explosion::%loop-block%}
    31.    
    32.                     else:
    33.    
    34.                         clear {explosion::%loop-block%}
    35.    
    36.                         delete {blockplace::%location of loop-block%}
    37.  
    38.  
    39.  
    40.  
    Tested and its working for me :emoji_slight_smile:
     
Thread Status:
Not open for further replies.

Share This Page

Loading...