Checkmate128 Posted April 13, 2022 Share Posted April 13, 2022 I am attempting to have one entity move towards another one. I have tried using the "push" event and directly modifying its vector but the entity will not move. Even teleporting the entity forwards will not move it. Can anyone explain why it will not move? if {%loop-zombie%.state} is 4: broadcast "Should be moving toward %{%{%loop-zombie%.target}%.checkpointValue}%" set {_vector} to vector from location at loop-zombie and location at {%loop-zombie%.target} set vector length of {_vector} to 5 set loop-zombie's velocity to {_vector} if distance between loop-zombie and {%loop-zombie%.target} is less than 1: set {%loop-zombie%.checkpoint} to {%{%loop-zombie%.target}%.checkpointValue} set {%loop-zombie%.state} to 3 This code runs inside a loop that loops through all zombies and has already checked to ensure that this is the zombie that is supposed to be moving and that the target is alive and exists. The entity has many attributes such as NoAI but none of those would seem to explain why it cannot be pushed or teleported. Thank you in advance! Owner of oldgaffle.minehut.gg. (my paintball server) Owner of karted.minehut.gg. (my mario kart server) Advocate of individual freedom, especially freedom of speech. Cooler than Stalemate128. Link to comment Share on other sites More sharing options...
Checkmate128 Posted April 13, 2022 Author Share Posted April 13, 2022 I found a solution using some math so y'all can close this I guess. if {%loop-zombie%.state} is 4: broadcast "Should be moving toward %{%{%loop-zombie%.target}%.checkpointValue}%" set {_vector} to vector from location at loop-zombie and location at {%loop-zombie%.target} set vector length of {_vector} to 0.5 set {_x} to loop-zombie's x-coordinate set {_y} to loop-zombie's y-coordinate set {_z} to loop-zombie's z-coordinate add x component of {_vector} to {_x} add y component of {_vector} to {_y} add z component of {_vector} to {_z} teleport loop-zombie to position at {_x}, {_y}, {_z} in loop-zombie's world if distance between loop-zombie and {%loop-zombie%.target} is less than 1: set {%loop-zombie%.checkpoint} to {%{%loop-zombie%.target}%.checkpointValue} set {%loop-zombie%.state} to 3 Owner of oldgaffle.minehut.gg. (my paintball server) Owner of karted.minehut.gg. (my mario kart server) Advocate of individual freedom, especially freedom of speech. Cooler than Stalemate128. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now