Page 1 of 1
How to remove the Impulse from a unit
Posted: 01 Sep 2009, 02:20
by TheFatController
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?
Re: How to remove the Impulse from a unit
Posted: 01 Sep 2009, 04:47
by Forboding Angel
you mean weapon impulse?
impulseBoost = 0,
impulseFactor = 0,
works fine for me.
Re: How to remove the Impulse from a unit
Posted: 01 Sep 2009, 06:23
by Evil4Zerggin
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:
Code: Select all
void CUnit::SlowUpdate()
{
[...]
residualImpulse *= 0.6f;
Re: How to remove the Impulse from a unit
Posted: 01 Sep 2009, 09:44
by imbaczek
movectrl?
Re: How to remove the Impulse from a unit
Posted: 01 Sep 2009, 10:00
by TheFatController
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

Re: How to remove the Impulse from a unit
Posted: 02 Sep 2009, 12:58
by KDR_11k
Give it a HUEG mass?