UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

cancel out moveto();

broken avatar :(
Created 10 years ago
by death_reaper0
0 Members and 1 Guest are viewing this topic.
2,186 views
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
respect the dead

donates greatly appreciated :) paypal.me/F3ARxReaper666
discord server:
https://discord.gg/tsGHW99
×
death_reaper0's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
basically i have a script that moves something toward something else using moveto();
what i need is a way to stop it before reaching its destination BEFORE reaching it after a variable is changed
or if theres another way to do this that could also work, thanks
Marked as best answer by death_reaper0 10 years ago
broken avatar :(
×
broken avatar :(
RadihaX
Location: caCanada
Date Registered: 2 September 2012
Last active: 5 years ago
Posts
978
Respect
Forum Rank
The Decider
Primary Group
Mapper Elite
My Groups
More
My Contact & Social Links
More
Signature
Overrun
Lockdown
Overrun (Black Ops Mod)
Snowglobe
Leviathan
Abandoned School
Ski Resort
Leviathan Redux
×
JBird632's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Mapper Elite Has shown excellence and experience in the area of custom mapping in the UGX-Mods community.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
JBird632's Contact & Social LinksJBird632JBird632JBird632JBird632JBird632Mapper
I don't believe there is a way to stop an entity from moving after calling MoveTo() on it; however, an alternative would be to have the entity move in increments and just stop telling it to move when you want it to stop.

This is a bit lenghthy of an explaination but the way I might approach this would be:
Spoiler: click to open...
Get the distance between the entity and location you want it to move to, then divide that by the amount of increments you think is appropriate. Once you have the length of each increment, then you can get a vector in the direction of travel by subtracting the origin of the location its moving to by the origin of the entity, then normalize the vector by dividing each component of the vector by the distance (ie: x/dist, y/dist, z/dist). With this vector you can multiply each component of it by the length of the increment to get a vector in the direction of travel with the length of the increment. So, finally you just have a loop (which loops through the amount of times as there are increments - or breaks when you want it to stop) and have the entity move to its origin plus the vector we just calculated. The wait that you would put in the loop would be the time to move to the next increment, so you can just think of it as the total time divided by the amount of increments.

I hope this helps.

Double Post Merge: June 02, 2016, 06:58:35 am
I don't believe there is a way to stop an entity from moving after calling MoveTo() on it; however, an alternative would be to have the entity move in increments and just stop telling it to move when you want it to stop.

This is a bit lenghthy of an explaination but the way I might approach this would be:
Spoiler: click to open...
Get the distance between the entity and location you want it to move to, then divide that by the amount of increments you think is appropriate. Once you have the length of each increment, then you can get a vector in the direction of travel by subtracting the origin of the location its moving to by the origin of the entity, then normalize the vector by dividing each component of the vector by the distance (ie: x/dist, y/dist, z/dist). With this vector you can multiply each component of it by the length of the increment to get a vector in the direction of travel with the length of the increment. So, finally you just have a loop (which loops through the amount of times as there are increments - or breaks when you want it to stop) and have the entity move to its origin plus the vector we just calculated. The wait that you would put in the loop would be the time to move to the next increment, so you can just think of it as the total time divided by the amount of increments.

I hope this helps.

Edit: Well... after consulting with Pieman, we've come to the conclusion that my method was way too complicated and you can stop the movement by telling the entity to move to its own location. Awesome Pieman did a test seeing that MoveTo's actually cancel each other out.
Last Edit: June 02, 2016, 06:58:35 am by JBird632
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Edit: Well... after consulting with Pieman, we've come to the conclusion that my method was way too complicated and you can stop the movement by telling the entity to move to its own location. Awesome Pieman did a test seeing that MoveTo's actually cancel each other out.
so basically i can just make it moveto(self.origin) when i want it to stop?
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
Yes

Another helpful function also

Code Snippet
Plaintext
waittill_not_moving()
{
    origin = self.origin;
    while( 1 )
    {
        wait .05;
        if ( self.origin == origin )
            break;

        origin = self.origin;
    }
}
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
basically i have a script that moves something toward something else using moveto();
what i need is a way to stop it before reaching its destination BEFORE reaching it after a variable is changed
or if theres another way to do this that could also work, thanks
Try doing self notify("movedone");

 
Loading ...