OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Resources Beta Testing & Submission => Topic started by: richardedwards on 30 Jun 2006, 02:04:05

Title: [SUBMITTED] Altimeter script
Post by: richardedwards on 30 Jun 2006, 02:04:05
~random 1
;
;            Altimeter script v1.1
;
;   Use this to get any positions height above sea level, very useful for avioding setting random generated
;   waypoints in the sea, and for "seek higher ground" commands.
;   Output is either a public variable "Altitude" or a hinted onscreen message
;
;
;   [Position X, Position Y,"hint"] exec "altimeter.sqs"    =   ONSCREEN MESSAGE
;   [Position X, Position Y,"var"] exec "altimeter.sqs"    =   VARIABLE "altitude" IS PRODUCED

;
;   example [getpos player select 0,getpos player select 1] exec "altimeter.sqs"
;
;
;********************************************************************************************************************



? format ["%1",AltimeterZERO] == "scalar bool array string 0xffffffef" : AltimeterZERO = "logic" camcreate [0,0,0]
? format ["%1",AltimeterPOS] == "scalar bool array string 0xffffffef" : AltimeterPOS = "logic" camcreate [0,0,0]
AltimeterPOS setpos [(_this select 0),(_this select 1)]
_pos1 = getpos AltimeterPOS
_pos2 = getpos AltimeterZERO
_B = sqrt (((_pos1 select 0) - (_pos2 select 0))^2 + ((_pos1 select 1) - (_pos2 select 1))^2)
_C = AltimeterPOS distance AltimeterZERO
_A = sqrt (_c^2 - _b^2)
? _this select 2 == "hint" : hint format ["Altitude %1",_A]
? _this select 2 == "var" : Altitude = _a
#EXIT
exit
Title: Re: Altimeter script , find the height above sea level for any position.
Post by: Mandoble on 30 Jun 2006, 02:36:03
As SetPos of emptydetectors always places them at sea level, you may try the following:
Code: [Select]
_pos = _this select 0
_sea = "EmptyDetector" camCreate [0,0,0]
_sea setPos [_pos select 0, _pos select 1, 0]
_ground = "logic" camCreate _pos
_asl = _sea distance _ground


hint format["%1 meters asl, %2 meters agl", _asl, _pos select 2]
deleteVehicle _sea
deleteVehicle _ground

Note that sea level moves up and down about 1.5 meters.
Title: Re: Altimeter script , find the height above sea level for any position.
Post by: klavan on 30 Jun 2006, 12:36:16
Quote
Note that sea level moves up and down about 1.5 meters.

If you're referring to the seatide, it changes up to 6 meters (positive and negative), depending by time of day and by the season.
Klavan
Title: Re: sealevel
Post by: richardedwards on 02 Jul 2006, 04:26:53
the script i submitted doesnt move with the sealevel. So i guess you could say it delivers an absolute height above zero.
I use it for testing random group movement positions before committing (so as to avoid driving vehicles into the sea)
Title: Re: Altimeter script , find the height above sea level for any position.
Post by: penguinman on 19 Jul 2006, 23:35:45
Quote
Quote: Note that sea level moves up and down about 1.5 meters.

Quote
Note that sea level moves up and down about 1.5 meters.

 as time goes by, yes there, are tides, but what he means is the sea also rises and falls indpendantly of the tide.