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!

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

Skript Arrow Effects Tutorial

Discussion in 'Tutorials' started by winterwolf007, Feb 26, 2017.

  1. winterwolf007

    winterwolf007 New Member

    Joined:
    Feb 24, 2017
    Messages:
    8
    Likes Received:
    4
    Hello Everyone, all this tutorial requires is Skript

    Today, I'll be making a tutorial on arrow effects. There are 3 other effects that can be used. They are endersignal, fire, and smoke. Today, I'll be showing you the explode effect.

    Now, we will be coding the event, the permission, and to define what was shot

    Code (Skript):
    1. on shoot:
    2.     shooter has permission "arrow.explode"
    3.     projectile is arrow
    This piece of code doesn't really do much right now. All it does is when someone shoots, and someone has the permission 'arrow.explode', and defining as the item shot as an arrow.

    Now we will be adding looping and checking if a variable is 1.

    Code (Skript):
    1. on shoot:
    2.     shooter has permission "explode.shoot"
    3.     projectile is arrow
    4.         loop 100 times:
    5.             if {es.%shooter%} is 1:
    This code also doesn't do much. All it does is when someone shoots, and someone has the permission 'arrow.explode', and defining as the item shot as an arrow. It also loops 100 times and in the loop, it checks if {es.%shooter%} is 1. We will get to {es.%shooter%} later in this tutorial.

    Now we will be adding the effect. I will be using the exploding effect. I will also make it so the loop doesn't happen all at once by adding a wait time.

    Code (Skript):
    1. on shoot:
    2.     shooter has permission "explode.shoot"
    3.     projectile is arrow
    4.         loop 100 times:
    5.             if {es.%shooter%} is 1:
    6.                wait 0.03 seconds
    7.                create a fake explosion at location of projectile
    This makes it so when someone shoots an arrow and the shooter has the permission 'explode.shoot', it loops 100 times, checking if {es.%shooter%} is 1, waiting 0.03 seconds, and creating a fake explosion at the location of the projectile.

    Now, we wouldn't want the effect to keep going once it hits an entity or block. This is why we have the {es.%shooter%} code in the example. This will make it so when the arrow hits an object, it changes the {es.%shooter%}, making the loop end.

    Code (Skript):
    1. on shoot:
    2.     shooter has permission "explode.shoot"
    3.     projectile is arrow
    4.         loop 100 times:
    5.             if {es.%shooter%} is 1:
    6.                 wait 0.03 seconds
    7.                 create a fake explosion at location of projectile
    8.  
    9. on projectile hit:
    10.     projectile is arrow
    11.     set {es.%shooter%} to 0
    This makes it so when the arrow with the effect (caused by the loop) hits something, it changes the check code, making the loop end. It changes it by when the projectile (arrow) hits something, it changes {es.%shooter%}

    Now, how are we going to get {es.%shooter%} back to 1? We can fix this by inserting code, setting {es.%shooter%} back to 1.

    Code (Skript):
    1. on shoot:
    2.     shooter has permission "explode.shoot"
    3.     projectile is arrow
    4.     set {es.%shooter%} to 1
    5.         loop 100 times:
    6.             if {es.%shooter%} is 1:
    7.                 wait 0.03 seconds
    8.                 create a fake explosion at location of projectile
    9.  
    10. on projectile hit:
    11.     projectile is arrow
    12.     set {es.%shooter%} to 0
    Now, when a player shoots an arrow with permission arrow.explode, checks if the projectile is an arrow, it sets {es.%shooter%} to 1, and checks if {es.%shooter%} is 1, and if it is, it creates a fake explosion at the location of the arrow every 0.03 seconds in the loop. If the arrow hits something, it changes the check in the loop, ending the loop.



     
    • Like Like x 2

Share This Page

Loading...