OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Aldo15 on 15 Mar 2011, 04:22:35

Title: height 0
Post by: Aldo15 on 15 Mar 2011, 04:22:35
I want to make a script that when a chopper has height 0, get a radio message or a titletext or anything.
How Can I do that?
Title: Re: height 0
Post by: haroon1992 on 15 Mar 2011, 06:29:53
helicopter name  = heli1


script.sqs

Code: [Select]

#loopy
~1
? (getpos heli1 select 2) > 0 : goto "Loopy"

~2
titleText ["The chopper is successfully landed!", "PLAIN"]
player sideChat "We have landed the choppa right here! Yay!"

By using the above script, you can only use it for the helicopter named heli1.
A message and a titletext will appear when it is at or below height 0.

And it is NOT sea level, just the ground level right below the helicopter.
(For see level, a gamelogic might be needed)




snippet.sqs
Code: [Select]
_heli = _this select 0
_hei = _this select 1
_delay = _this select 2
_code = _this select 3

#Loop
~1
? (getpos _heli select 2) > _hei : goto "Loop"

~_delay
call _code
exit


With this one, you can check for any helicopter or even other vehicles.
Format :
Code: [Select]
[ heliname, height, delay, code ] exec "snippet.sqs"
Sample :
Code: [Select]
[ heli1, 0, 3, {player sideChat "Yay we are at 0 height!"}] exec "snippet.sqs"
Script will display radio message 3 s after heli1 has reached height 0.

Always enclose code with { and }
Examples : { man1 moveingunner heli1 } / { chopLanded = TRUE } / {hint "Choppa is landed"}

Hope this helps pal.

Regards,
Haroon1992
Title: Re: height 0
Post by: Aldo15 on 15 Mar 2011, 23:25:24
Hi haroon1992,

I've tested your examples, and I've got to say that are good, Now I can to put a message when the chopper have got an height of 0

Cheers,
Aldo15