I'm not talking about maximum movement speed. I'm looking for a way to cut a unit's current movement speed in half, even if it was only halfway through accelerating to it's maximum speed. At this point, I'll take a trigger or data solution, so long as it lets me solve the problem. (I also posted this thread in Data because of that)
Ideally, there'd be a way to get a unit's current velocity (since you KNOW that the SC2 engine is saving that value in between cycles), so that you could just cut that in half, but pausing a unit's movement half of the time (with very short intervals) could also work...if there were a way to do that while still preserving the unit's current velocity.
Any help that you could give me would be wonderful! Thanks! (=
Sorry for disappearing for 5 days! =x No, really, I am.
Unfortunately, this solution doesn't work, as the Movement Speed value that you're modifying through triggers here just changes the unit's current MAXIMUM movement speed to a set value regardless of effects that would normally modify this. I want to be able to change a unit's CURRENT movement speed (while it is still in the process of accelerating to or from its max value).
I've already tried the data editor solution that you recommended. It doesn't work for reasons explained in my first post. I appreciate the help, though! (=
To be honest, the only solution that I can think of is to emulate acceleration by having my 'accelerating' units actually change their base movement speed at very short intervals (probably through the addition and removal of stacking buffs), rather than lowering the premade "acceleration" field in Blizzard's data editor. It'll probably work, but I'm not to keen on the idea. It seems horribly wasteful. =\
I imagine it is possible but the problem is the result might not be immediate.
Your trigger needs 3 basic parts.
Get the unit's current velocity.
Limit the unit's maximum speed to half the current velocity.
Restore the unit's maximum speed to original value.
For part 1 you get the unit's current position then wait 0.0625 game seconds (an internal frame) and then get the unit's current position again. Based on the two positions you can get the distance travelled. Since you have the time it took and the distance travelled you can compute the current velocity. For accurate results this might need several formula tests since it might factor in acceleration to displacement travelled (since displacement is the double integral of acceleration) or it might simply move velocity multiplied by time and then add acceleration to velocity.
For part 2 you can set the maximum movement speed as appropriate. If using triggers you need to make sure it can be restored accurately at a later time (no loss or gain in speed due to buffs).
For part 3 you need to wait 0.0625 second so the unit decelerates to its current maximum movement speed and then restore its maximum movement speed.
This assumes that when a unit is at maximum movement speed and maximum movement speed changes positively then it must accelerate to the new maximum movement speed. If maximum movement speed is "locked" at maximum then it might instantly accelerate to the new maximum. I do not know the exact workings of the game engine so this is a rather rough guess at how to do it.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm not talking about maximum movement speed. I'm looking for a way to cut a unit's current movement speed in half, even if it was only halfway through accelerating to it's maximum speed. At this point, I'll take a trigger or data solution, so long as it lets me solve the problem. (I also posted this thread in Data because of that)
Ideally, there'd be a way to get a unit's current velocity (since you KNOW that the SC2 engine is saving that value in between cycles), so that you could just cut that in half, but pausing a unit's movement half of the time (with very short intervals) could also work...if there were a way to do that while still preserving the unit's current velocity.
Any help that you could give me would be wonderful! Thanks! (=
Is this what you're looking for?
Also, here is the solution in data, there's a behavior that increase movement speed in multiplier (2x), just negative it.
@Laiev: Go
Sorry for disappearing for 5 days! =x No, really, I am.
Unfortunately, this solution doesn't work, as the Movement Speed value that you're modifying through triggers here just changes the unit's current MAXIMUM movement speed to a set value regardless of effects that would normally modify this. I want to be able to change a unit's CURRENT movement speed (while it is still in the process of accelerating to or from its max value).
I've already tried the data editor solution that you recommended. It doesn't work for reasons explained in my first post. I appreciate the help, though! (=
To be honest, the only solution that I can think of is to emulate acceleration by having my 'accelerating' units actually change their base movement speed at very short intervals (probably through the addition and removal of stacking buffs), rather than lowering the premade "acceleration" field in Blizzard's data editor. It'll probably work, but I'm not to keen on the idea. It seems horribly wasteful. =\
I imagine it is possible but the problem is the result might not be immediate.
Your trigger needs 3 basic parts.
For part 1 you get the unit's current position then wait 0.0625 game seconds (an internal frame) and then get the unit's current position again. Based on the two positions you can get the distance travelled. Since you have the time it took and the distance travelled you can compute the current velocity. For accurate results this might need several formula tests since it might factor in acceleration to displacement travelled (since displacement is the double integral of acceleration) or it might simply move velocity multiplied by time and then add acceleration to velocity.
For part 2 you can set the maximum movement speed as appropriate. If using triggers you need to make sure it can be restored accurately at a later time (no loss or gain in speed due to buffs).
For part 3 you need to wait 0.0625 second so the unit decelerates to its current maximum movement speed and then restore its maximum movement speed.
This assumes that when a unit is at maximum movement speed and maximum movement speed changes positively then it must accelerate to the new maximum movement speed. If maximum movement speed is "locked" at maximum then it might instantly accelerate to the new maximum. I do not know the exact workings of the game engine so this is a rather rough guess at how to do it.