I have a phoenix that can attack while moving. I can give him the move command and he will attack whatever units he wants along the path.
However, suppose I want him to attack a specific unit among many in his path. If I issue an order to attack that unit, he stops moving along the path he was order and follow/attacks the target. If I re issue the order to continue moving to his original destination, he resumes attacking whatever target suits him.
It appears I cannot have him move to point A and attack a particular unit as well IF it's in his path.
This is partly a data problem. You need to set up validators so that the Phoenix's attack can only target units with a certain behavior. Give this behavior a duration of, say, 2 seconds. On the trigger side, when the Phoenix is issued any order besides an attack targeting a unit, periodically pick all units within a certain range of the Phoenix and add the targeting behavior to them. You will also need to store the point of the triggering order in a global variable. When the Phoenix is issued a command to attack one specific unit, remove the targeting behavior from all nearby units and add it only to the targeted unit (create a loop so it continuously applies it until the unit either dies or the Phoenix is issued a different order), turn the trigger off, order the Phoenix to move to the stored point, and turn the trigger back on.
It's a bit complicated so it may need a little work to get it operating correctly. Good luck.
That works for a single unit, but what if I have 40 units flying in an air battle? 20 red and 20 blue? Applying that behavior 20 times would cause other pheonixes to often attack the wrong target again.
You would have to make 40 different behaviors and validators combined with custom values on the Phoenixes. It would probably be less work than you think - mostly a lot of duplicating.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I have a phoenix that can attack while moving. I can give him the move command and he will attack whatever units he wants along the path.
However, suppose I want him to attack a specific unit among many in his path. If I issue an order to attack that unit, he stops moving along the path he was order and follow/attacks the target. If I re issue the order to continue moving to his original destination, he resumes attacking whatever target suits him.
It appears I cannot have him move to point A and attack a particular unit as well IF it's in his path.
This is partly a data problem. You need to set up validators so that the Phoenix's attack can only target units with a certain behavior. Give this behavior a duration of, say, 2 seconds. On the trigger side, when the Phoenix is issued any order besides an attack targeting a unit, periodically pick all units within a certain range of the Phoenix and add the targeting behavior to them. You will also need to store the point of the triggering order in a global variable. When the Phoenix is issued a command to attack one specific unit, remove the targeting behavior from all nearby units and add it only to the targeted unit (create a loop so it continuously applies it until the unit either dies or the Phoenix is issued a different order), turn the trigger off, order the Phoenix to move to the stored point, and turn the trigger back on.
It's a bit complicated so it may need a little work to get it operating correctly. Good luck.
@BasharTeg: Go
That works for a single unit, but what if I have 40 units flying in an air battle? 20 red and 20 blue? Applying that behavior 20 times would cause other pheonixes to often attack the wrong target again.
@EdwardSolomon: Go
You would have to make 40 different behaviors and validators combined with custom values on the Phoenixes. It would probably be less work than you think - mostly a lot of duplicating.