OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: The-Architect on 29 Apr 2006, 09:38:20
-
Are we allowed to ask questions again?
If so I'd like to know how to check if a unit (AI) has been told to hold fire.
-
dunno, really. the boards aren't public yet so we won't really be answering questions until they are.
however, i believe the answer is
combatMode unit_name
which will return "BLUE" (Never fire), "GREEN" (Hold fire - defend only), "WHITE" (Hold fire, engage at will), "YELLOW" (Fire at will), or "RED" (Fire at will, engage at will).
dunno if that works with explicit "hold fire" instructions, but a quick experiment will tell you.
-
The command you can give to your squad as the leader results in the same as
unit setcombatmode "blue"
-
I have this guy, a member of my squad. When my squad identifies all of an enemy AI squad he fires a flare.
Only trouble is that with the script I'm running, he fires even when he's told to hold fire. I want to add a bit into the script that detects whether or not he's been told to hold fire, and if he has, to loop until otherwise.
-
so....
.... other code here...
if !(combatMode _unit == "RED") then {goto "WaitLoop"}
.... more code....
#WaitLoop
~1
if (combatMode _unit == "RED") then {goto "MainLoop"}
goto "WaitLoop"
.... code here...
-
He still fires the flare. He's retarded. :-[
-
my only other suggestion would be a workaround whereby you set up a loop which checks if the loon's combatmode is white, green or blue, and if so remove flares. then jump to another loop which waits until the loon's combatmode is yellow or red and give them back for him to play with, so long as he promises to tidy them up when he's finished. then jump back to the first loop.