if target entity is set:
set {_target} to target entity
set {_v} to vector from player to {_target}
set vector length of {_v} to 0.7
set {_loc} to location of player
loop 200 times:
wait 1 tick
set {_loc} to {_loc} ~ {_v}
draw 1 dust_color_transition using dustTransition(red, orange, 10) at {_loc} with force
if distance between {_loc} and {_target} <= 1:
damage {_target} by 5
stop
if distance between {_loc} and player > distance between player and {_target}:
stop
else:
set {_loc} to eye location of player
set {_dir} to direction of player
set vector length of {_dir} to 0.5
set {_travelled} to 0
loop 1000 times:
wait 1 tick
set {_loc} to {_loc} ~ {_dir}
add 0.5 to {_travelled}
draw 1 dust_color_transition using dustTransition(red, orange, 10) at {_loc} with force
if {_travelled} >= 50:
stop
if block at {_loc} is solid:
stop
loop all living entities:
if loop-entity is not player:
if distance between {_loc} and loop-entity <= 1:
damage loop-entity by 5
stop```
#Wand
1 messages · Page 1 of 1 (latest)
I'm have trouble with the 2nd bit, after else
the line that says set {dir} is direction of player is giving me errors
and I cant figure out why
You probably want: https://docs.skunity.com/syntax/search/id:5120
Alternatively, you can get the player's yaw/pitch via: https://skripthub.net/docs/?id=934
Skript Hub - Documentation
The yaw or pitch of a location or vector.
A yaw of 0 or 360 represents the positive z direction. Adding a positive number to the yaw of a player will rotate it clockwise.
A pitch of 90 represents the negative y direction, or downward facing. A pitch of -90 represents upward facing. Adding a positive number to the pitch will rotate the direction ...
Thanks!