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.

Detect if particle reaches targeted block

Discussion in 'Skript' started by Hackusater, Nov 24, 2018.

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

    Hackusater Active Member

    Joined:
    Aug 5, 2017
    Messages:
    74
    Likes Received:
    2
    Wondering if there is a way to detect when a particle created from DrawLine (sk dragon) reaches targeted-block:
    Code (Skript):
    1. command /test:
    2.     trigger:
    3.         make the player shoot an arrow at speed 1000
    4.         loop 100 times:
    5.             wait 1 tick
    6.             #if particle hasn't reached targeted block/arrow:
    7.                 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
    8.             else:
    9.                 exit 1 loop
    10.  
    If not is there a way to check if it reaches the arrow?
     
  2. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    this should work

    Code (Skript):
    1. command /test:
    2.     trigger:
    3.         make the player shoot an arrow at speed 1000
    4.         set {_loc} to location of target block
    5.         if {_loc} is set:
    6.             set {_density} to 10 #amount of particles at 1 block distance
    7.             set {_time} to 1 tick #time between every particle getting spawned this is difficult to get correctly
    8.             set {_dis} to distance between {_loc} and player
    9.             set {_calc} to rounded ({_dis} * {_density})
    10.             set {_incx} to (x-coord of {_loc} - x-coord of location of player) / {_calc}
    11.             set {_incy} to (y-coord of {_loc} - y-coord of location of player) / {_calc}
    12.             set {_incz} to (z-coord of {_loc} - z-coord of location of player) / {_calc}
    13.             set {_loc2} to location of player
    14.             loop {_calc} times:
    15.                 add {_incx} to x-coord of {_loc2}
    16.                 add {_incy} to y-coord of {_loc2}
    17.                 add {_incz} to z-coord of {_loc2}
    18.                 drawDot particle smoke, XYZ 0, 0, 0, center {_loc2}, rainbowMode false, visibleRange 100
    19.                 wait {_time}
    20.             broadcast "HIT!"
     
  3. Hackusater

    Hackusater Active Member

    Joined:
    Aug 5, 2017
    Messages:
    74
    Likes Received:
    2
    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
    --- Double Post Merged, Dec 15, 2018, Original Post Date: Dec 2, 2018 ---
    Can anyone help me out with this?
     
Thread Status:
Not open for further replies.

Share This Page

Loading...