I am looking for a way to limit the possible attack areas of a unit. I'm not interested in simply reducing the range, as the idea is to have a big range up and down a lane, but not be able to shoot units in the parallel lane right next to it. I've not found any built-in functions to allow for this, and what I've come up with of workarounds myself have yet to prove sufficient.
I've played around with the idea of disabling attack ability if the unit targets something outside it's assigned region, waiting a short while, and enabling the attack ability again, but that has the unfortunate side-effect (of course) that it won't be able to target any units in it's own line either during that downtime. It even disables the possibility to micromanage the units since with the attack ability gone you can't order the unit to attack, and thus it will keep targeting the unit in the parallel lane until it is out of range or dead (killed by other player).
I also tried to switch the wait command for a command that after disabling would activate attack cooldown period before enabling it again, so that the unit would still have the attack ability (and thus at least be able to be micromanaged to attack units in it's own lane) but upon enabling the ability again the cooldown is reset. Even if I try to activate cooldown at that time the unit is able to attack out of it's lane again, as if the units is attacking so quickly that it hits before the activation of the cooldown is even triggered, or the trigger itself even has time to run again.
Events
Unit - Any Unit starts attacking
Local Variables
Conditions
(Owner of (Attacking Unit)) == 3
((Acquired Target) is in Player3) != true
Actions
Unit - Disable the Attack ability for (Triggering unit)
General - Wait 0.5 Game Time seconds
Unit - Enable the Attack ability for (Triggering unit)
I am looking for a way to limit the possible attack areas of a unit. I'm not interested in simply reducing the range, as the idea is to have a big range up and down a lane, but not be able to shoot units in the parallel lane right next to it. I've not found any built-in functions to allow for this, and what I've come up with of workarounds myself have yet to prove sufficient.
I've played around with the idea of disabling attack ability if the unit targets something outside it's assigned region, waiting a short while, and enabling the attack ability again, but that has the unfortunate side-effect (of course) that it won't be able to target any units in it's own line either during that downtime. It even disables the possibility to micromanage the units since with the attack ability gone you can't order the unit to attack, and thus it will keep targeting the unit in the parallel lane until it is out of range or dead (killed by other player).
I also tried to switch the wait command for a command that after disabling would activate attack cooldown period before enabling it again, so that the unit would still have the attack ability (and thus at least be able to be micromanaged to attack units in it's own lane) but upon enabling the ability again the cooldown is reset. Even if I try to activate cooldown at that time the unit is able to attack out of it's lane again, as if the units is attacking so quickly that it hits before the activation of the cooldown is even triggered, or the trigger itself even has time to run again.
Events
Unit - Any Unit starts attacking
Local Variables
Conditions
(Owner of (Attacking Unit)) == 3
((Acquired Target) is in Player3) != true
Actions
Unit - Disable the Attack ability for (Triggering unit)
General - Wait 0.5 Game Time seconds
Unit - Enable the Attack ability for (Triggering unit)
Solution/workaround brainstorming, GO!
Bumpetybump
@Hakiki: Go
prevent unit from turning and give its weapon a limited attack arc then face it in the direction you want it to attack