#Spinning Armor Stand that moves into the direction where player is looking.
1 messages · Page 1 of 1 (latest)
on right click:
player is holding a iron hoe
if name of player's held item is "%{goofy.staff}%":
cancel event
play sound "entity.ghast.ambient" with volume 1000 to all players in radius 3 around player
spawn 1 armor stand at location of player
add nbt compound from "{Invisible:1b}" to nbt of last spawned armor stand
add nbt compound from "{NoGravity:1b}" to nbt of last spawned armor stand
set helmet of last spawned armor stand to player head
set {astand::%last spawned armor stand%} to "goofy"
set {_v} to vector from player to target block
set vector length of {_v} to 0.1
set {_loc} to location of player
loop (distance between {_loc} and target block) / 0.1 times:
loop all armor stands:
if {astand::%loop-entity%} is "goofy":
teleport loop-entity to {_loc}
set {_loc} to {_loc} ~ {_v}
if block below loop-entity is not air:
delete loop-entity
stop```
please don't mind the last few lines lol i am just out of ideas
why you looping all armor stands
While armor stand is alive.
yes i know i removed that like 5 minutes after posting the code
set the rotation tag to yaw and pitch of player
anyways with the moving of the armor stand towards where player is looking
whats the most efficient way of doing it
by rotation tag do you mean like the nbt? or
yes
Vectors
so
set {_v} to vector from player to target block
set vector length of {_v} to 0.1
set {_loc} to location of player
loop (distance between {_loc} and target block) / 0.1 times:```
Yes
set {_v} to vector from player to target block
set vector length of {_v} to 0.1
set {_loc} to location of player
loop (distance between {_loc} and target block) / 0.1 times:
set {_loc} to {_loc} ~ {_v}
teleport last spawned armor stand to {_loc}``` so i did this but when i click again while one armor stand is currently moving it just stops
it may be because of the last spawned armor stand but
Correct
cant think of another way of doing this
Now what do you think you could replace last spawned armor stand with?
i dont know my first thought was to create a variable but that sounds bad
{_}?
Yes
got it
so i did this so the bullet (the head) isnt that fast but now its just too slow and you cant go below 1 tick afaik
Increase the length
oh yeah that makes sense
wait why is it clipping through blocks now
okay nevermind fixed it
changed the value from 0.1 to 0.5
just like the length
okay now the rotation
ok finally got it fully working