Home   Help Search Login Register  

Author Topic: detect a player's altitude  (Read 1730 times)

0 Members and 1 Guest are viewing this topic.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
detect a player's altitude
« 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?
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: detect a player's altitude
« Reply #1 on: 07 Apr 2007, 02:02:25 »
If you are interestend into above ground altitude:
Code: [Select]
getPos vehicle player select 2
If you are intereseted into above sea level altitude:
Code: [Select]
_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

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: detect a player's altitude
« Reply #2 on: 07 Apr 2007, 03:47:00 »
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?
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: detect a player's altitude
« Reply #3 on: 07 Apr 2007, 09:42:28 »
For AGL:
Code: [Select]
? (getPos vehicle player select 2)>=2000:goto "whatever"
For ASL:
Code: [Select]
_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

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: detect a player's altitude
« Reply #4 on: 07 Apr 2007, 14:12:41 »
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.
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: detect a player's altitude
« Reply #5 on: 07 Apr 2007, 15:14:25 »
Code: [Select]
_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

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: detect a player's altitude
« Reply #6 on: 07 Apr 2007, 16:18:02 »
It don't work. I get an error type any expected object on the following line,

Code: [Select]
_logic setPos [getPos vehicle _unit select 0, getPos vehicle _unit select 1,0]
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: detect a player's altitude
« Reply #7 on: 07 Apr 2007, 16:21:17 »
How do you execute that script? Do you pass the soldier unit as agument?

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: detect a player's altitude
« Reply #8 on: 07 Apr 2007, 17:46:07 »
no just a [] exec
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: detect a player's altitude
« Reply #9 on: 09 Apr 2007, 00:27:06 »
Works now that I used [pilot] and changed the lone "_als_altitude" to "_asl_altitude".

Cheers m8 you're a star.  :D
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: detect a player's altitude
« Reply #10 on: 09 Apr 2007, 10:26:48 »
Archy Archy, no double posting :no:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.