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