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.
Edit: tried also this but it's not working..
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: