Saturday, February 23, 2013

[Script] AC-130

This script, as many ideas, started with simple ideas, actually me and TheVideoVolcano was talking about scripts, he was asking how to do things, and he asked me if i can create one script to make an air attack, like call one stealth bomber to fly over the city and launch some bombs in a waypoint, then the name AC-130 came out.

I played Modern Warfare 2 multiplayer a lot, so i knew something about the AC-130 features (at least in MW2 game), so i started the development trying to recreate MW2's AC-130 features.

First i made an custom camera and made it fly over city, just going always in same direction, when press A or D the direction change, and after some tests i figured out that the cars and peds are only loaded by the game in an region close to player position, so i did  a litle trick: move the player with the camera hehe.

Download: GTA 4 Mods

First weapon was the .105mm:

Very powerfull, i used one rocket model (cj_rpg_rocket) that is launched from an position close to camera position, applied the same rocket particle effect used by the game, and used the native function
SET_OBJECT_RECORDS_COLLISIONS and HAS_OBJECT_COLLIDED_WITH_ANYTHING to identify when the rocket collided with anything, and when it happens i detect peds and cars surround rocket position and push them away, also use an explosion particle effect with increased size

Second weapon as .40mm, this one was composed by ten objects, i throw then one by one and do the same that i did with .105 to detect collision, then add an litle explosion in the collision position, also i move the camera in the direction of ground to simulate an zoom in

Third was the .20mm, just using FIRE_SINGLE_BULLET to shoot bullets against the ground and used graphics draw event to draw an fake bullet trace, i did this because the particle effect for bullet trace dont work well sometimes

One of the most interesting ideas that i had in this script was the train derail, when the .105 collision detects an train (that is an object of type gta.vehicle) i get info about the train position, rotation and speed, then delete the original and create an fake train, put in same place, same rotation and same speed, then apply force to it pushing away :)

Also i created an ground control system, using an fake binocular you can aim at peds, vehicles or ground and call an attack of .105, .40 or .20mm gun, its very interesting and more fun than the normal attack mode:

google matched content

//propaganda YT float style='display:none;'