OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: MetalG on 06 Apr 2005, 17:55:17

Title: Check if unit is in a vehicle
Post by: MetalG 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.
Title: Re:Check if unit is in a vehicle
Post by: Blanco 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
Title: Re:Check if unit is in a vehicle
Post by: bedges 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.
Title: Re:Check if unit is in a vehicle
Post by: MetalG 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!