Page 1 of 1

Way to detect damaged entities?

Posted: Mon Jul 04, 2016 1:00 am
by credomane
It there anyway to detect when any entity is damaged?

The in-game audio alerts for when your stuff getting damaged is incredibly delayed. I often find myself with a chunk of my factory destroyed before the game decides to even play the alert-damaged sound effect let alone when something gets destroyed. If I'm watching for it the alert icons they appear but the sound effect doesn't always play or plays right as the icon disappears.

I've written a "personal" mod the tells me every time one for my units/structures dies. Now I'd like to know when one of my structured gets under 60% health.

Only way I can think of or find is by abusing on_tick to scan all entities hp values and trigger the alert as needed.

Re: Way to detect damaged entities?

Posted: Mon Jul 04, 2016 7:28 am
by Rseding91
The sound plays when an entity is destroyed. That's just a fact since I'm looking at the code that does it now.

Re: Way to detect damaged entities?

Posted: Mon Jul 04, 2016 7:44 pm
by credomane
Rseding91 wrote:The sound plays when an entity is destroyed. That's just a fact since I'm looking at the code that does it now.
What is that sound? So I can manually play it a few times to "learn" it. Does it play for every biter destroyed structure or with a cool down of some sort? I must not realize what it is to notice it then or think it is a sound for something else. I notice my "C&C Red Alert Structure Destroyed" instantly and check the map for biters.

[edit]
I figured out the sound. I thought it was triggered if I was under attack for a while.