OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: madmedic on 15 Feb 2005, 23:28:00

Title: Checking if a pilot is in his airplane
Post by: madmedic on 15 Feb 2005, 23:28:00
I need to write a line in a script that checks if a pilot is actually IN an airplane, and checks if he is NOT in an airplane...and then activate the scripts I have written for both situations.

I intend to make him wear his helmet only while in the airplane, and take it off when he is not.
But I dont know what lines to write that will actually check that.
The rest of the script I have figured out. (I can remove his helmet by triggering the script)

Im guessing it will have to loop, so that it knows when he gets out of the plane.

Any ideas?
Title: Re:Checking if a pilot is in his airplane
Post by: Tyger on 15 Feb 2005, 23:37:05
to see if unit loon_1 is in the airplane cessna_1, you would enter the code in a trigger as follows:

Code: [Select]
(loon_1 in cessna_1)
and to see if loon_1 is not in cessna_1:

Code: [Select]
!(loon_1 in cessna_1) or
Code: [Select]
not (loon_1 in cessna_1)
that simple  ;D
Title: Re:Checking if a pilot is in his airplane
Post by: madmedic on 15 Feb 2005, 23:48:44
to see if unit loon_1 is in the airplane cessna_1, you would enter the code in a trigger as follows:

Code: [Select]
(loon_1 in cessna_1)
and to see if loon_1 is not in cessna_1:

Code: [Select]
!(loon_1 in cessna_1) or
Code: [Select]
not (loon_1 in cessna_1)
that simple  ;D

What I want to do is put a script in my pilots PBO that will activate with the "init" in his config, checking to see if he is in ANY plane.

I was hoping to make it where nothing has to be done in init line in the editor, and the planes dont have to be named in the editor.

Would I be able to use a variation of what you wrote ...inside a script
Title: Re:Checking if a pilot is in his airplane
Post by: macguba on 16 Feb 2005, 00:05:17
It would be something like

? typeOf vehicle pilot == "air" : consequence

Not guaranteed at all.    Maybe its countType rather than typeOf.   Any maybe its not air but plane, but hopefully you get the idea.
Title: Re:Checking if a pilot is in his airplane
Post by: Fragorl on 16 Feb 2005, 01:13:18
"Air" counttype [vehicle pilot]  == 1 . Or maybe "air" and  [vehicle pilot] round the other way.
One or the other  ;D