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

MoveTo_speed()

broken avatar :(
Created 8 years ago
by alaurenc9
0 Members and 1 Guest are viewing this topic.
4,110 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 9 months ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
My preferred name is "xSanchez78".
Check me out here: www.steamcommunity.com/id/xSanchez78
×
alaurenc9's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
This allows you to enter a unit of speed rather than a unit of time.
its pretty much the same as MoveTo except instead of putting the amount of seconds you want it to move, you put the units-per-second speed you want it to move.

Code Snippet
Plaintext
MoveTo_speed( pos, speed )
{
self MoveTo( pos, ( Distance( self.origin, pos ) / speed ) );
}
Last Edit: November 05, 2015, 10:59:23 pm by alaurenc9
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 16 June 2013
Last active: 1 year ago
Posts
1,005
Respect
Forum Rank
Zombie Colossus
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Signature
Hey if you had tons of fun on playing my maps please DONATE :)

play ESTATE now, and claim your mansion back from the undead!
×
jei9363's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
jei9363's Contact & Social Linksjei9363jei9363jayingardia
maybe also return

Code Snippet
Plaintext
Distance( self.origin, pos ) / speed

as time incase you have a

Code Snippet
Plaintext
wait time;

after
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
maybe also return

Code Snippet
Plaintext
Distance( self.origin, pos ) / speed

as time incase you have a

Code Snippet
Plaintext
wait time;

after

couldnt you just waittill movedone or did i misread and not understand what you said correctly?

Code Snippet
Plaintext
self MoveTo_speed(pos, speed);
self waittill("movedone"); //notified from MoveTo to say when we have finished moving
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
couldnt you just waittill movedone or did i miss read and not understand what you said correctly?

Code Snippet
Plaintext
self MoveTo_speed(pos, speed);
self waittill("movedone"); //notified from MoveTo to say when we have finished moving

lol, nvm. i misread what you said..  :D
Last Edit: November 06, 2015, 12:19:44 am by BluntStuffy
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
This allows you to enter a unit of speed rather than a unit of time.
its pretty much the same as MoveTo except instead of putting the amount of seconds you want it to move, you put the units-per-second speed you want it to move.

Code Snippet
Plaintext
MoveTo_speed( pos, speed )
{
self MoveTo( pos, ( Distance( self.origin, pos ) / speed ) );
}

Seems a waste to me. I can just write the one line you have in the function...? Why would one create a function? If you really want to make a function, then add more to it, or add multiple functions. Some thing more like (could be split into movetostruct_speed or movetoent_speed:

Code Snippet
Plaintext
MoveTo_speed( targetname, speed, struct, kvp )
{
/*targetname = value of kvp
speed = constant rate of travel
struct = 1 for this is a struct or 0 or undefined for ent <optional>
kvp = kvp key to get, if undefined then targetname <optional>
*/
if(isDefined(struct) && struct){
if(isDefined(kvp)) pos = getstructarray(targetname, kvp)[0];
else pos = getstructarray(targetname, "targetname")[0];
}else{
if(isDefined(kvp)) pos = getentarray(targetname, kvp)[0];
else pos = getentarray(targetname, "targetname")[0];
}
self MoveTo( pos, ( Distance( self.origin, pos ) / speed ) );
wait(Distance( self.origin, pos ) / speed )-.1);
}

Or maybe it is just me...  :-\  Not tested, just theory.
Last Edit: November 06, 2015, 04:22:58 am by MakeCents
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 4 years ago
Posts
6,877
Respect
1,004Add +1
Forum Rank
Immortal
Primary Group
Community 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.
Community 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 Links[email protected]HarryBo21HarryBo000
Seems a waste to me. I can just write the one line you have in the function...? Why would one create a function? If you really want to make a function, then add more to it, or add multiple functions. Some thing more like (could be split into movetostruct_speed or movetoent_speed:

Code Snippet
Plaintext
MoveTo_speed( targetname, speed, struct, kvp )
{
/*targetname = value of kvp
speed = constant rate of travel
struct = 1 for this is a struct or 0 or undefined for ent <optional>
kvp = kvp key to get, if undefined then targetname <optional>
*/
if(isDefined(struct) && struct){
if(isDefined(kvp)) pos = getstructarray(targetname, kvp)[0];
else pos = getstructarray(targetname, "targetname")[0];
}else{
if(isDefined(kvp)) pos = getentarray(targetname, kvp)[0];
else pos = getentarray(targetname, "targetname")[0];
}
self MoveTo( pos, ( Distance( self.origin, pos ) / speed ) );
wait(Distance( self.origin, pos ) / speed )-.1);
}

Or maybe it is just me...  :-\  Not tested, just theory.
I agree, but i also noticed treyarch did this an awful lot too

Functions that just return variables and stuff lol, never really understood why
broken avatar :(
×
broken avatar :(
RadihaX
Location: caCanada
Date Registered: 2 September 2012
Last active: 3 years ago
Posts
978
Respect
Forum Rank
The Decider
Primary Group
Community 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.
Community Mapper Elite Has shown excellence and experience in the area of custom mapping in the UGX-Mods community.
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 agree, but i also noticed treyarch did this an awful lot too

Functions that just return variables and stuff lol, never really understood why
Usually you only use function returning a single variable in object oriented programming, so it makes no sense with a normal function.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 4 years ago
Posts
6,877
Respect
1,004Add +1
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community 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 Links[email protected]HarryBo21HarryBo000
Usually you only use function returning a single variable in object oriented programming, so it makes no sense with a normal function.
for some particualr things i do find that i just prefer it that way to be fair

like my perks ( which prob are OOP ), I prefer to use get_perk_machines(); to get the array, despite the fact i could just use

perks = getEntArray( "machines", "targetname" );

or whatever. I always assumed then if i needed to change that aspect, and reflect these changes on everything i used it for, this would be more ideal than searching through all my scripts again. Which worked out actualy when i did a check to see if they had actually spawned, i just stuck it in there, applied across the board

leaves room to add / accept certain arguments too then, but also leads to fleshing out that function too, like you guys said

its prob not the right term but i always call these "points of interaction"

Quite a interesting subject we have stumbled on
Last Edit: November 06, 2015, 05:42:29 am by Harry Bo21
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 9 months ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
alaurenc9's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
couldnt you just waittill movedone or did i misread and not understand what you said correctly?

Code Snippet
Plaintext
self MoveTo_speed(pos, speed);
self waittill("movedone"); //notified from MoveTo to say when we have finished moving

yea just do that instead of waiting the time....

Seems a waste to me. I can just write the one line you have in the function...? Why would one create a function?

well how many people realized you could do distance / speed in script in the first place? and so i would rather make it easier for people and write the function rather than teaching how to do this wherever you need it. besides, this is neater with less opportunity for mistakes.

If you really want to make a function, then add more to it, or add multiple functions. Some thing more like (could be split into movetostruct_speed or movetoent_speed:

Code Snippet
Plaintext
MoveTo_speed( targetname, speed, struct, kvp )
{
/*targetname = value of kvp
speed = constant rate of travel
struct = 1 for this is a struct or 0 or undefined for ent <optional>
kvp = kvp key to get, if undefined then targetname <optional>
*/
if(isDefined(struct) && struct){
if(isDefined(kvp)) pos = getstructarray(targetname, kvp)[0];
else pos = getstructarray(targetname, "targetname")[0];
}else{
if(isDefined(kvp)) pos = getentarray(targetname, kvp)[0];
else pos = getentarray(targetname, "targetname")[0];
}
self MoveTo( pos, ( Distance( self.origin, pos ) / speed ) );
wait(Distance( self.origin, pos ) / speed )-.1);
}

Or maybe it is just me...  :-\  Not tested, just theory.

nah thats too much and too specific and off topic for this anyways.

for some particualr things i do find that i just prefer it that way to be fair

like my perks ( which prob are OOP ), I prefer to use get_perk_machines(); to get the array, despite the fact i could just use

perks = getEntArray( "machines", "targetname" );

or whatever. I always assumed then if i needed to change that aspect, and reflect these changes on everything i used it for, this would be more ideal than searching through all my scripts again. Which worked out actualy when i did a check to see if they had actually spawned, i just stuck it in there, applied across the board

leaves room to add / accept certain arguments too then, but also leads to fleshing out that function too, like you guys said

its prob not the right term but i always call these "points of interaction"

Quite a interesting subject we have stumbled on

Yea making separate functions like that always make things neater. You can change it easily without looking through the script for every instance of error, and the script just ends up looking more professional anyways.
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 3 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
Signature
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
I think it would be nice if you added acceleration and deceleration too. ::)

Also, I think it's hard to know which is the speed you need because WaW uses units instead of meters or yards.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
nah thats too much and too specific and off topic for this anyways.


Lol, what? It's exactly the same as what you posted with more "options" lol, off topic and too specific.

The difference is you don't have to get the ent or struct before you thread "your" new "function". This isolates redundancies, that are always present in either function, mine or yours, the object. The wait is only effective if you call the function vs threading them.

Edit, and I only mean, if you make a function, it should be more than the same thing, or less than really, cause you actually lose functionality of the moveto function with this, as soy sort of mentioned. You can do anything, just not replace one line for another, that's silly. I'm trying to help you, not correct you. Technically each version could also do with an if isdefined else for pos as well, maybe with a println for troubleshooting.
Last Edit: November 06, 2015, 11:40:29 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 9 months ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
alaurenc9's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
Lol, what? It's exactly the same as what you posted with more "options" lol, off topic and too specific.

The difference is you don't have to get the ent or struct before you thread "your" new "function". This isolates redundancies, that are always present in either function, mine or yours, the object. The wait is only effective if you call the function vs threading them.

Edit, and I only mean, if you make a function, it should be more than the same thing, or less than really, cause you actually lose functionality of the moveto function with this, as soy sort of mentioned. You can do anything, just not replace one line for another, that's silly. I'm trying to help you, not correct you. Technically each version could also do with an if isdefined else for pos as well, maybe with a println for troubleshooting.

I understand your trying to help me, im not trying to be mean or mad at you or anything. im just saying if someone really needs all that extra, it really should be up to them to make it. and again, I know it is a small function. if people don't need a whole function, they atleast might want the line itself. either way I was just trying to release this speed moveto rather than a time moveto and making a util func seemed like the best way to release it.

 
Loading ...