Hey there, I tried to make throwing axe. But the armor stand (which is carrying the axe) cannot be teleported.
Is there something wrong? Because I tried another code that worked.
Here is the code that doesn't work:
And the one that works
Thank you. (Sorry for the bad English)
Is there something wrong? Because I tried another code that worked.
Here is the code that doesn't work:
code_language.skript:
command /axe2:
trigger:
if player is {pp::1}:
set {_y} to 0
set {_z} to location 0.375 meter left of player
set {_x} to location of {_z}
set {_a} to location of {_x}
set {_b} to 0
loop 60 times:
wait 0.05 second
increase {_y} by 0.3
increase {_b} by 22.5
add "{Pose:{RightArm:[%{_b} - 11 + 270%f,0f,0f]}}" to nbt tag of {_c}
set {_a} to location {_y} meter in front of {_x}
set {_d} to (90-{_b}) * 22 * 7 / 180
set {_e} to (90-{_b}) * 22 * 7 / 180
set {_d} to sine {_d}
set {_e} to cosine {_e}
set {_a} to location 0.45*{_d} meter below {_a}
set {_a} to location 0.45*{_e} meter horizontally behind {_a}
set {_d} to (0-{_b}) * 22 * 7 / 180
set {_e} to (0-{_b}) * 22 * 7 / 180
set {_d} to sine {_d}
set {_e} to cosine {_e}
set {_a} to location 0.45*{_d} meter below {_a}
set {_a} to location 0.45*{_e} meter horizontally behind {_a}
spawn armor stand at {_x}
set {_c} to last spawned entity
add "{NoGravity:1b,Invulnerable:1,Invisible:1,NoBasePlate:1,DisabledSlots:2039583,Pose:{RightArm:[%{_b} - 11 + 270%f,0f,0f]}}" to nbt tag of {_c}
teleport {_c} to {_a}
set tool of {_c} to diamond axe
stop
And the one that works
code_language.skript:
command /throw:
trigger:
if player is {pp:1}:
set {_a} to location 0.825 meter left of player
spawn armor stand at {_a}
set {_c} to last spawned entity
set tool of {_c} to diamond sword named "&bAAAA"
add "{NoGravity:1b,Invulnerable:1,Invisible:1,NoBasePlate:1,DisabledSlots:2039583,Pose:{RightArm:[-11f,%player's pitch*-1%f,90f]}}" to nbt tag of {_c}
set {_b} to 0
if targeted block is not air:
set {_d} to distance between targeted block and {_a}
set {_x} to now
loop 15 times:
wait 0.05 second
set {_x} to now
increase {_b} by 1
teleport {_c} to location {_b} meter in front of {_a}
kill {_c}
stop
Thank you. (Sorry for the bad English)
Last edited: