OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: The-Architect on 07 Apr 2007, 01:54:23
-
How do I do it?
I have aguy who starts in a plane, (this moveindriver). He gets shot down but ejects. How do I detect the height he is at when he ejects or any altitude on the way down to the ground?
-
If you are interestend into above ground altitude:
getPos vehicle player select 2
If you are intereseted into above sea level altitude:
_sea = "EmptyDetector" createVehicle [0,0,0]
_sea setPos [getPos vehicle player select 0, getPos vehicle player select 1,0]
_asl_altitude = _sea distance vehicle player
deleteVehicle _sea
exit
-
I don't understand it Mandoble.
How would I use the first one in a script?
? getPos vehicle player select 2 : goto "whatever"
Like that? :confused:
And what about if I want to check whether he's at 2000m or higher?
-
For AGL:
? (getPos vehicle player select 2)>=2000:goto "whatever"
For ASL:
_sea = "EmptyDetector" createVehicle [0,0,0]
_sea setPos [getPos vehicle player select 0, getPos vehicle player select 1,0]
_asl_altitude = _sea distance vehicle player
deleteVehicle _sea
?_als_altitude >= 2000: goto "whatever"
...
...
exit
-
Ok cool. Now, how would it look if I wanted to setpos him to a certain height?
What happens is this,
I have a guy who bails. If he's above 2000 he blacks out and wakes up at say 500.
Obviously I get his height, then blackout with camera stuff and then set his height during a fade.
-
_unit = _this select 0
_sea = "EmptyDetector" createVehicle [0,0,0]
_sea setPos [getPos vehicle _unit select 0, getPos vehicle _unit select 1,0]
_asl_altitude = _sea distance vehicle _unit
?_als_altitude < 2000: goto "skipblackout"
<... BLACK OUT CODE HERE
_logic = "logic" createVehicle [0,0,0]
_logic setPos [getPos vehicle _unit select 0, getPos vehicle _unit select 1,0]
_height_of_ground_here = _logic distance _sea
vehicle _unit setPos [getPos vehicle _unit select 0, getPos vehicle _unit select 1, 500 - _height_of_ground_here]
deleteVehicle _logic
<...AWAKE CODE HERE
#skipblackout
deleteVehicle _sea
exit
-
It don't work. I get an error type any expected object on the following line,
_logic setPos [getPos vehicle _unit select 0, getPos vehicle _unit select 1,0]
-
How do you execute that script? Do you pass the soldier unit as agument?
-
no just a [] exec
-
Works now that I used [pilot] and changed the lone "_als_altitude" to "_asl_altitude".
Cheers m8 you're a star. :D
-
Archy Archy, no double posting :no: