Solved Projectile Trails

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Selvati

Active Member
Jun 26, 2017
190
10
18
22
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_language.skript:
on shoot:
    projectile is arrow:
        while ground state of projectile is false:
            play heart at projectile
            wait 1 tick
Thanks!
[doublepost=1514233425,1514230209][/doublepost]Update I successfully got projectile trails working for arrows, snowballs, and eggs, I just need one for a fishing rod hook!
 
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_language.skript:
on shoot:
    projectile is a fishing rod:
        while ground state of projectile is false:
            play heart at projectile
            wait 1 tick
 
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_language.skript:
on shoot:
    projectile is a fishing rod:
        while ground state of projectile is false:
            play heart at projectile
            wait 1 tick
As it does not give any errors, it still doesn't work, I even tried using "hook" but nope!
[doublepost=1514236845,1514236757][/doublepost]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.
[doublepost=1514237645][/doublepost]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_language.skript:
# Arrow Trail
#-Heart
on shoot:
    projectile is an arrow
    while ground state of projectile is false:
        play heart at projectile
        wait 1 tick
        
#Rod Trail
#-Heart
on fishing:
    fishing state is fishing:
        set {p-r-heart.%player%} to 1
        loop 1000 times:
            if {p-r-heart.%player%} is 1:
                wait 0.03 seconds
                play heart at location of hook
            
# Snowball Trail
#-Heart
#--Snowball
on shoot:
    projectile is a snowball
    set {p-s-heart.%shooter%} to 1
    loop 1000 times:
        if {p-s-heart.%shooter%} is 1:
            wait 0.03 seconds
            play heart at location of projectile
#--Egg
on shoot:
    projectile is a egg
    set {p-e-heart.%shooter%} to 1
    loop 1000 times:
        if {p-e-heart.%shooter%} is 1:
            wait 0.03 seconds
            play heart at location of projectile

# Trail Stop
#-Heart
#--Snowball
on projectile hit:
    projectile is snowball
    set {p-s-heart.%shooter%} to 0
#--Egg
on projectile hit:
    projectile is egg
    set {p-e-heart.%shooter%} to 0
#--Rod
on fishing:
    fishing state is failed_attempt or in_ground or caught_fish or caught_entity:
        set {p-r-heart.%player%} to 0

# Debug Method :: Fishing Rod
#on fishing:
#    broadcast "%fishing state%"
#    if "%fishing state%" is "CAUGHT_FISH" or "CAUGHT_ENTITY":
#        if caught entity is set:
#            broadcast "%caught fish%"
 
Take a look at this code i made for somebody else the other day
code_language.skript:
function setMetadata(n: string, t: object, o: object):
  set {_args::*} to {_n} and new {FixedMetadataValue}({metadata::Skript} and {_o})
  if {_o} is not null ref:
    {_t}.setMetadata({_args::*});
  else:
    set {_args::*} to {_n} and {metadata::Skript}
    {_t}.removeMetadata({_args::*});
function getMetadata(n: string, t: object) :: object:
  return (first element out of ...{_t}.getMetadata({_n}).toArray()).value()
function deleteMetadata(n: string, t: object):
  setMetadata({_n}, {_t}, null ref)
on shoot:
  {cosmetics::%shooter's uuid%::trail} is set
   while getMetadata("hit", projectile) is not true:
     play {cosmetics::%shooter's uuid%::trail} parsed as a particletype at projectile
     wait 0.03 seconds
on projectile hit:
  setMetadata("hit", projectile, true)
 
Take a look at this code i made for somebody else the other day
code_language.skript:
function setMetadata(n: string, t: object, o: object):
  set {_args::*} to {_n} and new {FixedMetadataValue}({metadata::Skript} and {_o})
  if {_o} is not null ref:
    {_t}.setMetadata({_args::*});
  else:
    set {_args::*} to {_n} and {metadata::Skript}
    {_t}.removeMetadata({_args::*});
function getMetadata(n: string, t: object) :: object:
  return (first element out of ...{_t}.getMetadata({_n}).toArray()).value()
function deleteMetadata(n: string, t: object):
  setMetadata({_n}, {_t}, null ref)
on shoot:
  {cosmetics::%shooter's uuid%::trail} is set
   while getMetadata("hit", projectile) is not true:
     play {cosmetics::%shooter's uuid%::trail} parsed as a particletype at projectile
     wait 0.03 seconds
on projectile hit:
  setMetadata("hit", projectile, true)
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.
 
I don't know if my way to do it is good but get it newbs:
code_language.skript:
on shoot:
 set {_l} to location of projectile
 set {_a} to 0
 while projectile doesn't exists:
  wait 0.03 seconds
  if location of projectile is equal to {_l}:
   stop
  else:
   set {_l} to location of projectile
Code need to be corrected and be made gud but im lazy mineman so shut up and get it
 
Status
Not open for further replies.