OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Scratchdat on 24 Mar 2003, 22:50:50

Title: When Chopper Reaches Certain Height...
Post by: Scratchdat on 24 Mar 2003, 22:50:50
Simple question, should b easy 4 u clever ppl to answer  ;)

I just wanna make an event happen when my chopper reaches 20 metres height.

I tried using this (name of chopper is rah)

?(height rah > 20): goto "whatever"

but it didn't work.

Any ideas?
Title: Re:When Chopper Reaches Certain Height...
Post by: macguba on 24 Mar 2003, 22:58:38
"height" isn't a command, so it wouldn't work.  ;)  In this sort of circumstance you should always check the command ref, to see what it can tell you.

I can't remember the easiest way to do what you are trying to do ... and it depends whether you want height above the ground or above sea level.     The basic principle is to set a game logic or trigger at the relevant place and measure the difference in y coordinate between the two.   (OFP calls height the y coordinate - it goes [x,z,y])

I have a feeling that triggers are always at sea level, and GLs are at ground level, but don't quote me.   Search the forum, this has come up before.  :)
Title: Re:When Chopper Reaches Certain Height...
Post by: Scratchdat on 24 Mar 2003, 23:09:40
That sound like a good idea.

So how about if i put a game logic (gl) on the ground under the chopper.


?(rah distance gl > 20):goto "whatever"


I know that probably aint how the distance command works but do u get what i'm sayin?
Title: Re:When Chopper Reaches Certain Height...
Post by: macguba on 24 Mar 2003, 23:50:16
yep, that's it ... I think distance works vertically.    

anyway try it and see if it does what you want  :)
Title: Re:When Chopper Reaches Certain Height...
Post by: Artak on 25 Mar 2003, 07:32:51
The exact way would be

#loop
_height = getpos chopper select 2
?_height > 20: goto "whatever"
~1
goto "loop"
Title: Re:When Chopper Reaches Certain Height...
Post by: Scratchdat on 25 Mar 2003, 17:17:49
Thanks guys both way worked  ;D