Home   Help Search Login Register  

Author Topic: Check if unit is in a vehicle  (Read 803 times)

0 Members and 1 Guest are viewing this topic.

MetalG

  • Guest
Check if unit is in a vehicle
« on: 06 Apr 2005, 17:55:17 »
Heya,

I would like to know what the command is to check for a unit being in the cargo of a vehicle, in this case, a helicopter. Basically I need a trigger check if the unit is in the helicopter, if it is, end the mission.

Offline Blanco

  • Former Staff
  • ****
Re:Check if unit is in a vehicle
« Reply #1 on: 06 Apr 2005, 18:05:06 »
There are several ways to do this :
To check a unit is in a vehicle (general)

Code: [Select]
unitname != vehicle unitname
To check a unit is in a vehicle (specific, in this case car1)
Code: [Select]
unitname in car1
To check the unit is the driver :

Code: [Select]
driver car1 == unitname

To check the unit is the gunner :

Code: [Select]
gunner tank1 == unitname

 To check the unit is the commander

Code: [Select]
commander tank1 == unitname

Use it in the condition field of a trigger
« Last Edit: 06 Apr 2005, 18:07:29 by Blanco »
Search or search or search before you ask.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Check if unit is in a vehicle
« Reply #2 on: 06 Apr 2005, 19:01:02 »
alternatively, you could use a 'get in' event handler on the chopper in question...

from igor drukov's tutorial -

"getin" and "getout" (to vehicles only) :
_this select 0 : the vehicle the EH is attached to ;
_this select 1 : in/from what position (driver, gunner, commander, cargo) ;
_this select 2 : who's just got in/out ;

just in case you want to be specific about the player being in cargo, and not just in the chopper willy nilly.

heheh. i said 'willy nilly' :) archaic language is such fun.
« Last Edit: 06 Apr 2005, 19:01:40 by bedges »

MetalG

  • Guest
Re:Check if unit is in a vehicle
« Reply #3 on: 06 Apr 2005, 20:43:39 »
Blanco, Bedges, thanks for your help.

I got it to work with 'unitname in vehiclename', so I didn't try your approach out yet bedges. Thanks again!