Can't teleport entity

  • 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 community!

    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.

Enkinor

Member
Feb 12, 2017
4
0
0
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:
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:
You could just use the summon item command with a motion tag
 
Does line 18 give you an error? I think you need to do something like this:
code_language.skript:
set {_block} to the block {_b} meters in front of {_a}
set {_loc} to {_block}'s location
teleport {_c} to {_loc}
 
Does line 18 give you an error? I think you need to do something like this:
code_language.skript:
set {_block} to the block {_b} meters in front of {_a}
set {_loc} to {_block}'s location
teleport {_c} to {_loc}

Which line 18?
Top script or the bottom?
 
Oh wait you said the top one doesn't work and the bottom does. I was looking at the bottom when I wrote that my bad
 
Status
Not open for further replies.