Detect if particle reaches targeted block

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

Hackusater

Active Member
Aug 5, 2017
74
2
8
34
Wondering if there is a way to detect when a particle created from DrawLine (sk dragon) reaches targeted-block:
code_language.skript:
command /test:
    trigger:
        make the player shoot an arrow at speed 1000
        loop 100 times:
            wait 1 tick
            #if particle hasn't reached targeted block/arrow:
                drawLine particle smoke, XYZ 0, 0, 0, center player, target location of target block, id "%player%-%loop-number%", rainbowMode false, solid false, density 2, length 0, zigZag count 0, height 0, visibleRange 100, displacementXYZ 0, 0, 0, pulseDelay 1
            else:
                exit 1 loop
If not is there a way to check if it reaches the arrow?
 
this should work

code_language.skript:
command /test:
    trigger:
        make the player shoot an arrow at speed 1000
        set {_loc} to location of target block
        if {_loc} is set:
            set {_density} to 10 #amount of particles at 1 block distance
            set {_time} to 1 tick #time between every particle getting spawned this is difficult to get correctly
            set {_dis} to distance between {_loc} and player
            set {_calc} to rounded ({_dis} * {_density})
            set {_incx} to (x-coord of {_loc} - x-coord of location of player) / {_calc}
            set {_incy} to (y-coord of {_loc} - y-coord of location of player) / {_calc}
            set {_incz} to (z-coord of {_loc} - z-coord of location of player) / {_calc}
            set {_loc2} to location of player
            loop {_calc} times:
                add {_incx} to x-coord of {_loc2}
                add {_incy} to y-coord of {_loc2}
                add {_incz} to z-coord of {_loc2}
                drawDot particle smoke, XYZ 0, 0, 0, center {_loc2}, rainbowMode false, visibleRange 100
                wait {_time}
            broadcast "HIT!"
 
this should work

code_language.skript:
command /test:
    trigger:
        make the player shoot an arrow at speed 1000
        set {_loc} to location of target block
        if {_loc} is set:
            set {_density} to 10 #amount of particles at 1 block distance
            set {_time} to 1 tick #time between every particle getting spawned this is difficult to get correctly
            set {_dis} to distance between {_loc} and player
            set {_calc} to rounded ({_dis} * {_density})
            set {_incx} to (x-coord of {_loc} - x-coord of location of player) / {_calc}
            set {_incy} to (y-coord of {_loc} - y-coord of location of player) / {_calc}
            set {_incz} to (z-coord of {_loc} - z-coord of location of player) / {_calc}
            set {_loc2} to location of player
            loop {_calc} times:
                add {_incx} to x-coord of {_loc2}
                add {_incy} to y-coord of {_loc2}
                add {_incz} to z-coord of {_loc2}
                drawDot particle smoke, XYZ 0, 0, 0, center {_loc2}, rainbowMode false, visibleRange 100
                wait {_time}
            broadcast "HIT!"
It works but how do i make it move fasted and how do i make it more than 1 particle so it creates a full line from me to the targeted block
[doublepost=1544838020,1543792155][/doublepost]Can anyone help me out with this?
 
Status
Not open for further replies.