OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: onionres on 06 Jun 2004, 06:59:25
-
I'm creating a Top Gun style mission and i need a bit of help with some scripting:
1. How do i detect when my craft is going vertically up?
2. How can i detect if i'm being locked on in a dogfight?
3. How do you activate triggers after a certain objective is completed.
4. I also want to detect a craft in my vicinity
5. How can i limit a plane to a certain speed?
Any help will be much appreciated!
-
1. How do i detect when my craft is going vertically up?
2. How can i detect if i'm being locked on in a dogfight?
3. How do you activate triggers after a certain objective is completed.
4. I also want to detect a craft in my vicinity
5. How can i limit a plane to a certain speed?
Any help will be much appreciated!
1 : Find the bank/pitch script in the editors depot.. :)
2. No idea
3. In the trigger that tells the game you've completed the objective, put in the activation, goalcomplete true
And then in another trigger, the condition this time, put goalcomplete = true
Then it waits till that 1st trigger is activated, and the second is activated :)
4. Nearestobject command?
5.
_plane = this select 0
#loop
_velox = _plane velocity select 0
_veloy = _plane velocity select 1
_veloz = _plane velocity select 2
?(_velox > 200):GOTO "slowdown"
?(_veloy > 200):GOTO "slowdown"
?(_veloz > 200):GOTO "slowdown"
~0.1
GOTO "loop"
#slowdown
HINT "Slow down now"
;not sure of code for here
~5
GOTO "loop"
Save that as slowdown.sqs
Change the 200 to different values for different planes.. Call the script with this in the planes INIT field :
[this] exec "slowdown.sqs"
Hope some of this is some use t'ya :)
- Ben
-
2. How can i detect if i'm being locked on in a dogfight?
Well you could make a script that checks distance to see if a plane is within a certain radius. Then to checks that planes position relative to "you". See if it is lined up verticaly and horizontailly and also it direction. If the planes is with in a certain distance and and with in a firing arc(which is defined by the script) a message and/or sound is made.
Also some aircraft have "incoming missile" alarms. You could contact the creators to see how they added that to the addons.
-
Yeah, the DKM mod's Commanche has a "Missile Lock, Break Break" alarm thing (I managed to lock a missile onto my self, in third person)
So it must be one of the scripts in there
Have a look on OFP.info
The file isn't too huge either
Oh, the Addons Depot, the F18 has missile lock warning too.. I'm sure
- ben
-
2. use the incomingmissile eventhandler described in the tutorial on event handlers
5. Use
Plane = your plane to limit speed
MaxVelocity = the max speed the plane will be allowed to travel in a single direction (note diagonals will produce higher velocitys)
#loop
~0.5
? (Velocity Plane select 0 > MaxVelocity) : SetVelocity [MaxVelocity, Velocity Plane select 1,Velocity Plane select 2]
? (Velocity Plane select 1 > MaxVelocity) : SetVelocity [Velocity Plane select 0, MaxVelocity,Velocity Plane select 2]
? (Velocity Plane select 2> MaxVelocity) : SetVelocity [Velocity Plane select 0, Velocity Plane select 1,MaxVelocity]
goto "loop"
Ron
-
3. In the trigger that tells the game you've completed the objective, put in the activation, goalcomplete true
And then in another trigger, the condition this time, put goalcomplete = true
Then it waits till that 1st trigger is activated, and the second is activated :)
For the condition, wouldn't it be goalcomplete == true ?