So, upon losing yet another game in ZK, and finding myself with some spare time, i got to thinking that a widget that counted my own and confirmed enemy casualties and displayed their cost in metal would be a nice and useful idea.
However, i can't seem to get enemy losses - even those within my los - detected by the widget. Does widget::UnitDestroyed fire only on owned units in unsynced context?
If so - can anyone point me to how i could detect any confirmed kills from unsynced?
What if I made a game where there were no corpses, units disappear when they die, and they can cloak. If widget:unitdestroyed worked on enemy units, a widget could help you cheat in my game.
I would gladly accept the limitation to confirmed kills only. So in that theoretical game, the widget would have been somewhat useless anyway, and even the player themselves wouldn't be able to determine, was unit killed or just cloaked and ran away.
Similarly, i'm completely ok if units killed outside LOS (such as glaives set on fire by a pyro) are not counted.
Going to try the left-los thing, see if it gives anything useful...
function widget:UnitEnteredLos(uID) inLos[uID] = true end
function widget:UnitLeftLos(uID) inLos[uID] = nil end
function widget:GameFrame(n) for uID, _ in pairs(inLos) do if not Spring.GetUnitDefID(uID) then Spring.Echo(uID .. ' has died !') inLos[uID] = nil end end end
function widget:GameFrame(n) for uID, _ in pairs(inLos) do if not Spring.GetUnitDefID(uID) then Spring.Echo(uID .. ' has died or morphed !') inLos[uID] = nil end end end[/code]
Corrected that. Unit has either died or morphed. Morphed units receive new uID:s.
Corrected that. Unit has either died or morphed. Morphed units receive new uID:s.
Morph == Destroyed and at the same time a completely new unit is spawned at the same position with the old commands, giving the appearance of just one unit changing types.
Users browsing this forum: Bing [Bot] and 0 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum