It seems UnitPreDamaged still applies the full impulse to a unit even if you return 0.
I need a hack to make the 0 damage units take no impulse at all but haven't found a solution yet, turning MoveCtrl on and off 5 frames later doesn't work and neither does SetUnitVelocity or applying negative values from GetUnitVelocity to AddUnitImpulse...
Can anyone advise please on the best way to remove a unit's impulse considering the above?
How to remove the Impulse from a unit
Moderator: Moderators
- TheFatController
- Balanced Annihilation Developer
- Posts: 1177
- Joined: 10 Dec 2006, 18:46
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: How to remove the Impulse from a unit
you mean weapon impulse?
impulseBoost = 0,
impulseFactor = 0,
works fine for me.
impulseBoost = 0,
impulseFactor = 0,
works fine for me.
- Evil4Zerggin
- Posts: 557
- Joined: 16 May 2007, 06:34
Re: How to remove the Impulse from a unit
I believe he means via Lua, for example when adding special weapon behaviors using a gadget. Unfortunately, as far as I can tell, there is no way in Lua to read the value of unit->residualImpulse, so it appears you are stuck short of performing ridiculous calculations (e.g. simulating weapon impulse in Lua instead of using the engine).
BTW guess how impulse to ground units is removed:
BTW guess how impulse to ground units is removed:
Code: Select all
void CUnit::SlowUpdate()
{
[...]
residualImpulse *= 0.6f;
- TheFatController
- Balanced Annihilation Developer
- Posts: 1177
- Joined: 10 Dec 2006, 18:46
Re: How to remove the Impulse from a unit
It seems to retain its impulse somehow, in this case the unit is a commander and sometimes MoveCtrl even if you move it onto the ground it'll then perform a wierd slow motion flip on the spot then explode from falling damage.
Other idea from sleeping on it - silently destroy and swap the unit for an untainted one
Other idea from sleeping on it - silently destroy and swap the unit for an untainted one

Last edited by TheFatController on 02 Sep 2009, 13:24, edited 1 time in total.
Re: How to remove the Impulse from a unit
Give it a HUEG mass?