Shoot an arrow towards a player starting from location

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

Hosom

Member
Jul 10, 2017
22
0
1
27
I am trying to make a skript that transforms Dispensers into automatic turrets, using arrows contained inside, when powered by redstone, they automatically shoot arrows towards players.

I can't manage to create a proper vector, i made the arrow go from the player to the dispenser but not vice versa and i can't manage to fix.

Code:
on place of dispenser:
    add event-block's location to {turrets::*}

on break of dispenser:
    remove event-block's location from {turrets::*}

command /removeturrets:
    trigger:
        delete {turrets::*}

every 1 seconds in world "world":
    loop {turrets::*}:
        loop all players in radius 20 around loop-value:
            set {_loc1} to loop-value-1
            set {_loc2} to loop-player's location
            set {_dir} to vector between {_loc1} and {_loc2}
            broadcast "%{_loc2}%"
            shoot a creeper from {_loc1} at speed 3 {_dir}

Edit: tried also this but it's not working..

Code:
every 1 seconds in world "world":
    loop {turrets::*}:
        set {_loc1} to location above loop-value
        loop all players in radius 20 around loop-value:
            set {_loc2} to loop-player's location
            broadcast "Test"
            shoot an arrow from {_loc1} at speed 1 direction from {_loc1} to {_loc2}
 
Last edited:
Status
Not open for further replies.