Um so why? or am I doin it rong?
I cannot use the attackerid param to detect it, because if the attacker dies before the projectile hits from what I understand the attackerid will be nil
so is there a call that is ONLY called when a unit dies? or is there a way I can better use this command?
UnitDestroyed is called when construction is canceled?
Moderator: Moderators
Re: UnitDestroyed is called when construction is canceled?
Have you tried using Spring.GetUnitHealth to get the buildprogress? I'm not sure whether it will work or not but it's worth a try.
Re: UnitDestroyed is called when construction is canceled?
for my logging thing i use UnitDamaged
didnt notice it getting called for decaying nano frames.
Code: Select all
function widget:UnitDamaged (unitID, unitDefID, unitTeam, damage, paralyzer, weaponID, attackerID, attackerDefID, attackerTeam)
if (Spring.GetGameSeconds() < 1) then
return --for some reason units "die" in the first moments of gameplay when startunits spawn in some mods
end
if (Spring.GetUnitHealth (unitID) > 0 ) then
return
end
--unit actually died here--
...
...
Re: UnitDestroyed is called when construction is canceled?
I will try it out..
for now I have to sleep, thanks guys.
for now I have to sleep, thanks guys.
Re: UnitDestroyed is called when construction is canceled?
that seems to have worked. thanks guys