- Joined
- Jul 5, 2014
- Messages
- 551
Is there a way to make boss-like neutral hostiles regenerate faster while they're out of combat? (enemy runs away or defeated).
On map Initialization, mark all units with a flag that indicates that they are not in combat. They would have their own individual timers.
On an is unit attacked event or a spell cast event, you would start that timer instance, letting it expire after n seconds, where n is the attack cool down of the unit. Of course, that timer is refreshed on subsequent attacked events or spell events. This affects both the attacker and the target.
When the timer expires, if ever, enumerate nearby enemies within n units from the unit in question. If there are any, restart the timer. Otherwise, mark it as idle. (Not in combat)
You can check out Combat Systems in HIVE to see which one suits you best.