Home   Help Search Login Register  

Author Topic: Top Gun Scripts  (Read 769 times)

0 Members and 1 Guest are viewing this topic.

onionres

  • Guest
Top Gun Scripts
« 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!

DBR_ONIX

  • Guest
Re:Top Gun Scripts
« Reply #1 on: 06 Jun 2004, 11:41:50 »
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.
Code: [Select]
_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

OrangeLeader

  • Guest
Re:Top Gun Scripts
« Reply #2 on: 06 Jun 2004, 18:03:22 »
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.
« Last Edit: 06 Jun 2004, 18:04:21 by OrangeLeader »

DBR_ONIX

  • Guest
Re:Top Gun Scripts
« Reply #3 on: 06 Jun 2004, 19:04:45 »
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

RonMcAsskick

  • Guest
Re:Top Gun Scripts
« Reply #4 on: 10 Jun 2004, 14:42:45 »
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

Homefry31464

  • Guest
Re:Top Gun Scripts
« Reply #5 on: 10 Jun 2004, 19:47:44 »
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 ?