Being active/inactive is best done using a status effect to 'mark' the combatant being in that state. Effects can be hidden e.g. in case you don't want them to be visible to the player.
The battle AI needs to check if the effect is applied to the combatant and perform different things based on it.
1) Easiest setup: Using a
Trigger Machine on the combatants that add that effect to it when the player enters the collider.
If you want it based on grid ranges, you can e.g. use a
turn start schematic on the combatant to check if an enemy (of the combatant) is within range. Use the
Select Grid Cells node for that - it has an option to store the combatants of the cells. Next use a
Filter Selected Combatants node to e.g. only use enemies of the combatant. Finally, use a
Selected Data Count node to check how many combatants have been found, e.g. count being greather than 0 means there's an enemy within range, so you add the effect to the combatant.
2) This can be added in the death schematics of your combatants. E.g. use a global variable to count the killed enemies and add the effect to all once enough where killed.
3) Either add the status effect via target changes of your attacks, or using
Change Schematics of your health status value to add the effect on any negative change.
4) As said at the start - the battle AI needs to check for the status effect (
Check Status node). If the effect is not applied, to patrol stuff, e.g.
Grid Move node to move to a specific cell type (e.g. you could have cell types to define waypoints).
5) Basically same as
#1.
Here I'd recommend just using trigger machines - one on trigger enter adding the effect, one on trigger exit to remove the effect.
Combine the trigger machine with a
combatant trigger to easily get all combatants within the area.