You won't need a script for this. Create a trigger covering the area with whatever condition you want to activate it, like "West Detected By East", then in On Activation put:
"_x setbehaviour combat" foreach units thislist; "_x setcombatmode red" foreach units thislist
Behaviour is one of: "CARELESS", "SAFE", "AWARE", "COMBAT", "STEALTH".
Mode may be one of: "BLUE" (Never fire), "GREEN" (Hold fire - defend only), "WHITE" (Hold fire, engage at will), "YELLOW" (Fire at will), "RED" (Fire at will, engage at will).