Hi, Im trying to make that when /point <player> command is executed there will be an send title action to tell player how to reach the arg-1 player the fastest example Right, Left, Down, Up, Forward, Backward
I'm very confused about this and my math is not enough
Here is what i have right now (Does not even load crashes when loading):
[doublepost=1682424812,1682404530][/doublepost]Ok fixed it here is the code:
This will return the arrow emoji of which location is the fastest way to go to the goal
Thanks to
{members::2002Spiele}
for helping at skUnity discord!
I'm very confused about this and my math is not enough
Here is what i have right now (Does not even load crashes when loading):
Code:
import:
java.lang.Math
command /point [<player>]:
trigger:
if arg-1 is not set:
send "&cUsage: /point <player>" to player
else:
set {_x} to (((Math).sin({_yaw}) * -1) * (z component of (location of arg-1) - z component of (location of player)) + ((Math).cos({_yaw}) * -1) * (component of (location of arg-1) - x component of (location of player)))
set {_z} to (((Math).cos({_yaw}) * -1) * (z component of (location of arg-1) - z component of (location of player))) - (((Math).sin({_yaw}) * -1) * (x component of (location of arg-1) - x component of (location of player)))
if {_z} > 0:
send title "&aMove forwards to reach &f%arg-1%&a fastest" to player for 10 ticks
else if {_z} < 0:
send title "&aMove backwards to reach &f%arg-1%&a fastest" to player for 10 ticks
else:
if {_x} > 0:
send title "&aMove to the right to reach &f%arg-1%&a fastest" to player for 10 ticks
else if {_x} < 0:
send title "&aMove to the left to reach &f%arg-1%&a fastest" to player for 10 ticks
else:
send title "&aYou are already at &f%arg-1%'s&a location" to player for 10 ticks
Code:
function waytogo(p: player, goal: location) :: text:
set {_vec} to vector from {_p} to {_goal}
set {_yaw} to yaw of {_vec}
subtract (yaw of {_p}) from {_yaw}
while {_yaw} is less than -180:
add 360 to {_yaw}
while {_yaw} is more than 180:
subtract 360 from {_yaw}
set {_last2} to "→"
if {_yaw} is less than 0:
set {_last2} to "←"
if (abs({_yaw})) < 6:
set {_last2} to "↑"
return {_last2}
This will return the arrow emoji of which location is the fastest way to go to the goal
Thanks to
{members::2002Spiele}
for helping at skUnity discord!