• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Hero-defense with 2 switchable heroes - Focus bug

Status
Not open for further replies.
Hello,

I have a map of type Hero Defense. Each player can have 2 heroes, but control only once at a time. So when he uses F1 or F2, he switchs between his 2 heroes.

The unused hero is moved to a storage place, paused, made invulnerable.

My issue is the following:
- During boss fights, if the player attacked by the boss switches of hero, then the boss focus remains stuck. As a consequence, the boss moves away, ignoring all attackers, just trying to reach the unused hero (even if it is invulnerable, paused and out-of-range...).

Do you have an idea of how I can solve this focus-bug ?
 
Level 39
Joined
Feb 27, 2007
Messages
5,010
Store the current target of the boss in a variable. When a player switches, if the switched-out unit is the same as the boss target then also switch the boss target and re-issue its current order to the new target.
 
Status
Not open for further replies.
Top