OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 10 Feb 2005, 09:38:56
-
i have a trigger wich detects if aload of people are alive and that includes an m2 machine gun but it doesnt detect if the person in it is dead only if the m2 is blown up. is there a way of detecting if only the person in it is dead i tried using an empty m2 and having a soldier get in it but once hes in it makes the m2 there side?
-
If the name of your machinegun is emTwo, then the name of the gunner will be emTwoG.
-
so if i put something like "not alive emtwog" that will check for the gunner not the gun itself ill check it later today
-
nominesine's solution should work.
More generally this problem will occur with any vehicle (M2 is a vehicle according to OFP). As a general solution you could use crew as a means of getting at all loons that are in a vehicle. So something like
{not (alive _x)} forEach crew unit
would be useful for anytype of unit. If the unit is an M2 mg then it will check the gunner, if it is a tank it will check the commander, the gunner and the driver. If it is an APC it will also check any units that are in cargo, and if it is a simple solder it will just check him.
-
where would i place that in the mg init field?
-
My brain is not working properly today. What you would need to do is to use the count command with crew. Something like:
(not (alive _x)) count (crew unit)
This would tell you how many loons in the unit are not alive. Drop the not to get a count on the number that are alive. So for an M2
if ((alive _x) count (crew unit) < 1) then {do what ever you want when the guy is dead} else {do what ever you want if the guy is still alive}
The line above would be a something you would put in a script. Or you might put somethign like
(alive _x) count (crew unit) < 1
in the condition field of a trigger that you want to fire when all the loons in a vehicle are dead.
-
oh right thanks get it now