OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: True Immortal on 30 Sep 2002, 19:24:10
-
is there a way to find out if a unit is fired upon?
i thought of using nearestObject to do it but since that function doesnt work in Resistance i have no way to do it
-
One possible solution is to store arrays of all units in your mission, and query their ammo in a script. If a unit has opened fire you then have to check it against all other units to see if he's facing him (you can do that using getdir and trigonometry, or maybe using vectors and dotproduct).
This isn't very reliable though, and its also quite complicated to script.
-
yah it's too complicated and tottaly not what i want.
-
Welcome to the forums, guys
You could try the behaviour command...
If your units were set to safe, then when fired upon they will go into combat mode. The behaviour command will detect this.
If they were set to aware, hopefully they go into combat mode... I'm not too sure ;). Anyway, give it a go... the syntax for a group would be is:
"behaviour _x == ""combat""" count (units group) > 0