I found out that this is not possible since ressurected units get their full health assigned in CUnit* CUnitLoader::LoadUnit(...) (which calls BuildingFinished(..) which calls GlobalAI::UnitFinished(..) ) first and the lower health (5% of max health) is assigned afterwards.
I need to detect resurrected units (and maybe other AIs are suffering from this problem as well) so I would suggest to modify
Code: Select all
CUnit* CUnitLoader::LoadUnit(const string& name, float3 pos, int team, bool build, int facing, const CUnit* builder)
Code: Select all
CUnit* CUnitLoader::LoadUnit(const string& name, float3 pos, int team, bool build, int facing, const CUnit* builder, float health = 1.0f)
Code: Select all
unit->maxHealth = ud->health;
unit->health = ud->health * health;