Home   Help Search Login Register  

Author Topic: m2 problem  (Read 655 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
m2 problem
« 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?

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re:m2 problem
« Reply #1 on: 10 Feb 2005, 11:24:57 »
If the name of your machinegun is emTwo, then the name of the gunner will be emTwoG.
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline 456820

  • Contributing Member
  • **
Re:m2 problem
« Reply #2 on: 10 Feb 2005, 11:30:04 »
so if i put something like "not alive emtwog" that will check for the gunner not the gun itself ill check it later today

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:m2 problem
« Reply #3 on: 10 Feb 2005, 11:39:55 »
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.

Offline 456820

  • Contributing Member
  • **
Re:m2 problem
« Reply #4 on: 10 Feb 2005, 11:41:52 »
where would i place that in the mg init field?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:m2 problem
« Reply #5 on: 10 Feb 2005, 11:53:44 »
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.

« Last Edit: 10 Feb 2005, 11:54:20 by THobson »

Offline 456820

  • Contributing Member
  • **
Re:m2 problem
« Reply #6 on: 10 Feb 2005, 11:58:45 »
oh right thanks get it now