Saturday, February 23, 2013

[Script] Air Combat IV (AC-IV)

This script makes possible to spawn Jets with custom number of engines, flaps/elevators, gears, cannons, rockets with lock on target feature, bombs and flares. Also you can spawn enemies in jets to combat

Download: GTA 4 Mods

This one im really proud of, really complex script, started with an request of CORE.MAX2010 to create engine fire and jet sound for jets, when i finished this task i tested the idea of using AI drivers in jets and worked very well, then the real complex script started.





Controls:
To control the jet:
W (accel.)
S (desaccel.)
A (or numpad 4)
D (or numpad 6)
Shift (or numpad 8)
Control (or numpad 5)
numpad 7 - turn left
numpad 9 - turn right
X - Switch cam
Right click - Follow missile/bomb with camera
Space shoot missiles
Numpad0 - Shoot cannon
Q - Drop bomb
E - Release flare to avoid missiles (hold to release one by one)
F - Enter Jet / Exit Jet / Eject (if flying)
Left/Right help "drive" the jet while in the ground
0 - Spawn menu
Enter - Spawn select Jet in spawn menu, hold shift to spawn and start flying
2 - Spawn enemy
3 - Spawn fugitive
When on ground:
Left/Right (or numpads 7/9) - turn left or right
S - Break


XBox 360 controller controls:
Hold left and right Shoulders to see/hide jet spawn menu, use A to spawn on air or use X to spawn on ground
A - Shoot rockets
X - Shoot cannon
Y - Release flares
DPad Down - Drop bombs
B - Eject/Exit/Enter jet
Left Thumb stick - Pitch and Roll
Left/Right Shoulder - Turn left or right
Left Trigger - slow down
Right Trigger - Accelerate








In this one i used a lot of custom classes to be used in lists, this helped a lot and make the script more easy to modify.

You can have one list of jets to spawn, each one with custom configuration for weapons, engines, flaps, etc

Also its possible to set jet spawn/aquirement points

To create the rocket lock feature i must list the possible targets in a list of vehicles, then use this calc to see if the object is close to center of aiming position:


Dim tmpDist As Double = v.Position.DistanceTo(Game.CurrentCamera.Position)
Dim tmpPos As Vector3 = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * tmpDist

If v.Position.DistanceTo(tmpPos) < (tmpDist / 3) Then

' mark the vehicle as an locked target...
end if

obs.: "v" is one vehicle in the possible targets list

The use of classes made easy to make the enemy jets do the same rocket lock on the player and control they flight
//propaganda YT float style='display:none;'