OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: modderman on 09 Jun 2005, 18:13:07

Title: Height & Velocity Help
Post by: modderman on 09 Jun 2005, 18:13:07
A plane is going to be landing, and when it gets to a certain point where i have a trigger placed, will it execute a script...

This script needs to ceck the Height of the plane, and the velocity....
and if the plane is going less than 50, and its height is less than five,
it executes another script.....

_plane = _this select 0
_zpos = (getPos _plane) select 2
? (!_zpos<5) : goto "speedcheck"


i dont know how the _z<5 syntax should be

So #speedcheck will check the speed and if that works to then the script will execute my other script....

I guess in OFP we can't check the speed, but have to use velocity based on x,y,z, so the plane will be landing from left to right, if you are looking at the mission editor....
So i believe the x velocity will need to be faster than -50
so if the planes x velocity is -20 it will go on to exec my next script

Catch My Drift?
Anyone know? thank you!
Title: Re:Height & Velocity Help
Post by: h- on 09 Jun 2005, 18:41:54
The function speed does return the speed of a vehicle... ??

Quote
i dont know how the _z<5 syntax  should be
You want the script to go to the "speedcheck" when the plane's height is more than 5 or less??
If less:
? _zpos<5: goto "speedcheck"
Title: Re:Height & Velocity Help
Post by: UNN on 09 Jun 2005, 20:57:09
If this is based on a single event like a user action then something like:

Code: [Select]
_plane = _this select 0

_zpos = (getPos _plane) select 2

If ((_zpos<5) And ((Speed _Plane)<50)) Then {[] Exec YourScript.sqs}

But if you dont know exactly when the script will be activated:

Code: [Select]
_plane = _this select 0

#Loop

~1

_zpos = (getPos _plane) select 2
_Speed=Speed _plane

If ((_zpos>5) And (_Speed>50)) Then {goto "Loop"}

[] Exec YourScript.sqs