- Joined
- Aug 31, 2009
- Messages
- 779
This seems like something that should be simple, and yet I can't find a simple solution.
I want to detect if a building is under construction. That's it.
I looked around online and found a thread on thehelper.net from 2010: Checking if a building is currently under Construction
His method seems really simple, but when I try the method, the "GetUnitAbility(...)" always returns 1 - whether the building is finished or still under construction.
The reason I want to achieve this is because in my map there is a building called a Repair Bay. It automatically searches for nearby damaged buildings, picks one at random, and attempts to heal it at the cost of resources. The problems is that the Repair bay automatically picks buildings which are under construction too (because their health != their max health). It's unnecessary to heal them, as they will get full health the moment their construction is finished anyway.
So - how do I check for if a building has finished construction or not, without having to resort to an annoying workaround (e.g. using custom value when the building enters the map, and changing it on construction finished)?
I want to detect if a building is under construction. That's it.
I looked around online and found a thread on thehelper.net from 2010: Checking if a building is currently under Construction
His method seems really simple, but when I try the method, the "GetUnitAbility(...)" always returns 1 - whether the building is finished or still under construction.
The reason I want to achieve this is because in my map there is a building called a Repair Bay. It automatically searches for nearby damaged buildings, picks one at random, and attempts to heal it at the cost of resources. The problems is that the Repair bay automatically picks buildings which are under construction too (because their health != their max health). It's unnecessary to heal them, as they will get full health the moment their construction is finished anyway.
So - how do I check for if a building has finished construction or not, without having to resort to an annoying workaround (e.g. using custom value when the building enters the map, and changing it on construction finished)?