Solved Armor stand location

  • 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.

Hyao

Active Member
Apr 1, 2017
73
4
8
code_language.skript:
function spawnEntity(t : text, l : location, v: text):
    if "%{_t}%" is "crook":
        if "%{_v}%" is "1":
            spawn a chicken at {_l}
            set {_e} to last spawned entity
            clear all pathfinder goals of {_e}
            add pathfinder goal wander, speed 1 to {_e}
            add pathfinder goal look around randomly to {_e}
            spawn an armor stand at location of {_e}
            set {_as} to last spawned armor stand
            add "{CustomNameVisible:1,NoGravity:1b,Small:1,Invisible:1,Invulnerable:1,NoBasePlate:1,DisabledSlots:2039583}" to nbt of {_as}
            set name of last spawned armor stand to "&aCrook &6[Lv. 1]"
            while {_e} is alive:
                set {_tl} to location 10 blocks under location of {_e}
                teleport {_as} to location at {_tl}
                wait 3 ticks
            wait 2 ticks
            set {_loc} to location at 0, -50, 0 in world "%{_as}'s world%"
            teleport {_as} to {_loc}

The name of the armor stand is supposed to appear above the chicken/crook, but no matter how far I set it (as you can see it's ten right now) it still appears normally. Any help would be appreciated.
[doublepost=1491963256,1491943645][/doublepost]Update:
Tried putting the TP before the loop. Doesn't work either.

Tried making the ArmorStand a Marker. Doesn't work.

Tried this:
code_language.skript:
set {_ex} to x position of {_e}
            set {_ey} to y position of {_e}
            set {_ey} to {_ey} - 10
            set {_ez} to z position of {_e}
            teleport {_as} to location at {_ex}, {_ey}, {_ez} in world "%{_as}'s world%"

also, surprisingly enough, doesn't work.

Am I missing something?
[doublepost=1491964311][/doublepost]Update 2:
It doesn't work on any entity. It just ignores the Y-coordinate completley and uses the y-coordinate of {_e}(or any other entity).

EDIT:
I'm actually ripping my hair out.
code_language.skript:
function tpTheDamnAS(x : number, y : number, z : number, e : entity):
    teleport {_e} to location at {_x}, {_y}, {_z} in world "%{_e}'s world%"
     
command /spawner [<text>] [<text>] [<text>] [<text>] [<text>] [<text>]:
    trigger:
        if player has permission "rank.gm":
            send "armorstand goes UP!"
            spawn an armor stand at player
            add "{NoGravity:1b}" to nbt of last spawned armor stand
            set {_x} to x coordinate of player
            set {_y} to y coordinate of player
            set {_y} to {_y} + 5
            set {_z} to z coordinate of player
            wait a tick
            tpTheDamnAS({_x}, {_y}, {_z}, last spawned armor stand)

EDIT:

execute console command "tp @e[type=ArmorStand] %{_ex}% %{_eyfix}% %{_ez}%"

doesn't work. It's 5 AM, I've just drank 1l of coffee. It's actually just descided on not working. Not only that, in the chat it outputs it teleported it to Y 55, while the chicken sits at Y 65, but the armor stand doesn't move. Doesn't even flinch!

Ok, probably my last edit for now, I've found the problem.

Adding the "NoGravity" NBT makes the Y just... not work. But it's just so weird, because no matter in what way I set the Y coordinate, it still finds a way to get the chicken's Y. 'Y' does it do this!?

EDIT 6:
relogging fixes it, i'm running minecraft version 1.9.4 and i still have no idea why it doesnt spawn like it should
[doublepost=1492014077][/doublepost]Solved!

If anyone else also stumbles upon this, and oh Notch do I not hope for anyone to recieve the same gruesume fate;

You need to give it time. It sort of plinged when I relogged, basically:
code_language.skript:
set name of last spawned armor stand to "&aCrook &6[Lv. 1]"
            wait 2 ticks
            set {_u} to location 1 blocks under location of {_e}
            teleport {_as} to {_u}
            wait a tick
            while {_e} is alive:
                set {_u} to location 1 blocks under location of {_e}
                teleport {_as} to {_u}
                wait 2 ticks

Works perfectly.
 
Not to sure what you're doing however if you try teleport an armor stand less than 1 block within the same tick it'll not work or bug out, same with trying to teleport an armor stand less than 1 block if the coordinates are relative rather than absloute, i'm guessing it's a bug with spigot or skript, not to sure but something on how they handle there locations, the armor stands don't like.
 
Status
Not open for further replies.