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 Projectile Trails

Discussion in 'Skript' started by Selvati, Dec 25, 2017.

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

    Selvati Active Member

    Joined:
    Jun 26, 2017
    Messages:
    190
    Likes Received:
    10
    I know that it is possible to give arrows a custom particle trail using the code below, how can I do this same effect for fishing rods, snowballs, and eggs?

    Code (Skript):
    1. on shoot:
    2.     projectile is arrow:
    3.         while ground state of projectile is false:
    4.             play heart at projectile
    5.             wait 1 tick
    Thanks!
    --- Double Post Merged, Dec 25, 2017, Original Post Date: Dec 25, 2017 ---
    Update I successfully got projectile trails working for arrows, snowballs, and eggs, I just need one for a fishing rod hook!

     
  2. Best Answer:
    Post #3 by Selvati, Dec 25, 2017
  3. FishRekt

    FishRekt Active Member

    Joined:
    Jan 26, 2017
    Messages:
    87
    Likes Received:
    0
    I don't even know if Fishing Rod is a projectile.. BTW you can do the same thing with it, just think about the name in the code:
    Code (Skript):
    1. on shoot:
    2.     projectile is a fishing rod:
    3.         while ground state of projectile is false:
    4.             play heart at projectile
    5.             wait 1 tick
     
    • Creative Creative x 1
  4. Selvati

    Selvati Active Member

    Joined:
    Jun 26, 2017
    Messages:
    190
    Likes Received:
    10
    As it does not give any errors, it still doesn't work, I even tried using "hook" but nope!
    --- Double Post Merged, Dec 25, 2017, Original Post Date: Dec 25, 2017 ---
    All projectile types according to docs "A projectile, e.g. an arrow, snowball or thrown potion." I was once able to almost perfectly have the same effect on a hook from a fishing rod but I lost that code and am still trying to figure it out again.
    --- Double Post Merged, Dec 25, 2017 ---
    Alright for any future thread viewers, since the "trail projectile with %particle%" no longer works as of posting this I present a way to trail arrows, snowballs, eggs, and fishing rod hooks with a particle, there are endless possibilities, such as adding permissions or multiple effects. Merry Christmas everyone! ♥
    Code (Skript):
    1. # Arrow Trail
    2. #-Heart
    3. on shoot:
    4.     projectile is an arrow
    5.     while ground state of projectile is false:
    6.         play heart at projectile
    7.         wait 1 tick
    8.        
    9. #Rod Trail
    10. #-Heart
    11. on fishing:
    12.     fishing state is fishing:
    13.         set {p-r-heart.%player%} to 1
    14.         loop 1000 times:
    15.             if {p-r-heart.%player%} is 1:
    16.                 wait 0.03 seconds
    17.                 play heart at location of hook
    18.            
    19. # Snowball Trail
    20. #-Heart
    21. #--Snowball
    22. on shoot:
    23.     projectile is a snowball
    24.     set {p-s-heart.%shooter%} to 1
    25.     loop 1000 times:
    26.         if {p-s-heart.%shooter%} is 1:
    27.             wait 0.03 seconds
    28.             play heart at location of projectile
    29. #--Egg
    30. on shoot:
    31.     projectile is a egg
    32.     set {p-e-heart.%shooter%} to 1
    33.     loop 1000 times:
    34.         if {p-e-heart.%shooter%} is 1:
    35.             wait 0.03 seconds
    36.             play heart at location of projectile
    37.  
    38. # Trail Stop
    39. #-Heart
    40. #--Snowball
    41. on projectile hit:
    42.     projectile is snowball
    43.     set {p-s-heart.%shooter%} to 0
    44. #--Egg
    45. on projectile hit:
    46.     projectile is egg
    47.     set {p-e-heart.%shooter%} to 0
    48. #--Rod
    49. on fishing:
    50.     fishing state is failed_attempt or in_ground or caught_fish or caught_entity:
    51.         set {p-r-heart.%player%} to 0
    52.  
    53. # Debug Method :: Fishing Rod
    54. #on fishing:
    55. #    broadcast "%fishing state%"
    56. #    if "%fishing state%" is "CAUGHT_FISH" or "CAUGHT_ENTITY":
    57. #        if caught entity is set:
    58. #            broadcast "%caught fish%"
     
  5. Pikachu

    Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    139
    Medals:
    Take a look at this code i made for somebody else the other day
    Code (Skript):
    1. function setMetadata(n: string, t: object, o: object):
    2.   set {_args::*} to {_n} and new {FixedMetadataValue}({metadata::Skript} and {_o})
    3.   if {_o} is not null ref:
    4.     {_t}.setMetadata({_args::*});
    5.   else:
    6.     set {_args::*} to {_n} and {metadata::Skript}
    7.     {_t}.removeMetadata({_args::*});
    8. function getMetadata(n: string, t: object) :: object:
    9.   return (first element out of ...{_t}.getMetadata({_n}).toArray()).value()
    10. function deleteMetadata(n: string, t: object):
    11.   setMetadata({_n}, {_t}, null ref)
    12. on shoot:
    13.   {cosmetics::%shooter's uuid%::trail} is set
    14.    while getMetadata("hit", projectile) is not true:
    15.      play {cosmetics::%shooter's uuid%::trail} parsed as a particletype at projectile
    16.      wait 0.03 seconds
    17. on projectile hit:
    18.   setMetadata("hit", projectile, true)
     
    • Informative Informative x 1
  6. Selvati

    Selvati Active Member

    Joined:
    Jun 26, 2017
    Messages:
    190
    Likes Received:
    10
    This is amazing but I barely understand any of it, but thank you, I can pick pieces of this to help me better understand your complex yet efficient way of doing things.
     
  7. ImOfflinezzz

    Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    73
    Likes Received:
    10
    I don't know if my way to do it is good but get it newbs:
    Code (Skript):
    1.  
    2. on shoot:
    3.  set {_l} to location of projectile
    4.  set {_a} to 0
    5.  while projectile doesn't exists:
    6.   wait 0.03 seconds
    7.   if location of projectile is equal to {_l}:
    8.    stop
    9.   else:
    10.    set {_l} to location of projectile
    11.  
    Code need to be corrected and be made gud but im lazy mineman so shut up and get it
     
Thread Status:
Not open for further replies.

Share This Page

Loading...