hrm... found a bug - even if my Friendly units aren't selected they will shoot at (not move) an enemy unit I click on.
Behaviour should be only to engage an Enemy unit if the Friendly is selected.
Investigating...
EDIT
Resolved this by adding another condition to my new event (described in original post) to make sure a Friendly is selected (using the already defined IsSelected var).
EDIT 2
Strike that, 1/2 resolved. If nothing is selected then there is no action. Sweet!
When I have 1 Friendly unit selected and attack a close by Enemy unit, all friendly units attack but any unselected don't move.
I think it's still my 'new' event, which is;
On Left button Clicked on EnemyBases AND FriendlyBases is IsSelected
{
EnemyBases: Set IsTargeted to True
FriendlyTurrets: Turret acquire target EnemyBases
}
Pretty sure "FriendlyTurrets: Turret acquire target EnemyBases" tells ALL FriendlyTurrets to acquire the Enemy... not just the selected instance.
EDIT 3
3/4 Resolved. I disabled the suspect action and added a sub-event to pick a specific instance of a FriendlyTurret based on the TurretUID stored as a var in the FriendlyBase.
It worked!
On Left button Clicked on EnemyBases AND FriendlyBases is IsSelected
{
EnemyBases: Set IsTargeted to True
Pick instance with UID FriendlyBases.TurretUID
{
FriendlyTurrets: Turret acquire target EnemyBases
}
}
Side-effect: if I select multiple FriendlyBase only the first selected will shoot... think I need to set a new var and throw an ELSE and/or FOR in somewhere
Investigating...