Lesson 7: Creating your first ARMED airplane

All kneel for the Great Configfile!


...OH DEAR LORD! Is it Death? Satan? George Bush??. NO, its FAR worse!! Its the evil and scary configfile!! Nooooooooooooo! The dreaded file that with its alien C++ nature eats n00bs as if they were Pringels!

O my God, its nothing like I have ever seen before! We have done weapons, cars, planes and the likes. And it has kept getting bigger and meaner each time. But now we want an airplane, WITH a machinegun, and not one, but TWO different rocket types, one of them OUR OWN CUSTOM ROCKET!. We`re really asking for trouble here, and the Mighty one seems pretty pissed off at the moment. Jeezees, we are talking about several pages here! Maybe as hight as...(scary drumroll) TWO or THREE! pages of text! Noooooooo.....

Ok, lets cut the crap, shall we ;). As you can see, im getting bored writing this tut now so thank god we are nearly done! As always, I have done the configfile and we`ll walk trough it together with me highlighting some important issues. Im not doing a tutorial on configfiles, for that you need to get a C++ Programming tut (or at least the Configfile tut at OFPEC.com). Lets go!


Part 1

At the top is the usual stuff, just some standard declarations, the CfgPatches class where we introduce our planemodel. NOte that we dont list the weapons we have since we arent gonna use them in other PBOs (aka not export the weapons for use on other vehicles). Then its CfgModels, where we define out airplane class and the custom proxy weapon we are gonna use. Note that when we have our own custom made rocket, we must mention it in this class. And, whenever we have proxys, its crucial that the rocket class name match the actual rocket filename! (class sidewinder, sidewinder.p3d).


Part 2

Next class up is CfgAmmo. In this class all the ammo we are gonna use is defined (remember rocket is an ammo). NOte that since we are gonna use OFP bullets for our machinegun and OFP rockets for the unguided rockets, we dont need to define them in anyway. They are defined elsewere in the game and we can just put them on our plane without much writing. Our sidewinder is defined in this class.

The CfgWeapons class natuarally is the place to define the weapons we have onboard our plane. First up is the machinegun, which is a pretty standard gun using "Bullet30", which is a standard OFP-defined explosive bullet. Count indicate we have 500 rounds and autofire=true that we can hold down the fire button and bump out bullets automatically. Reloadtime 0.08 means that it is 8/100 second between each bullet being fired.


Part 3

Here is the rest of the CfgWeapons class and here the sidewinder launcher is defined. Now, we could have put the the AA rocket in a tube, but we want them naked on the wings. But we still need to define a launcher, and in this case the launcher is using the same model as the ammo, "sidewinder.p3d". And by doing it this way, the engine removes a rocket model (a launcher) from the wing (if the "count=x" is equal to the number of rocket proxys on the plane, in this case 6).

There is also the class for the unguided missile launcher. It dont have a model, its just gonna fire its rockets out from the two points we defined in Memory LOD. The rockets being fired is the standard rockets fired from the OFP ZuniLauncher, henche the class we are inheriting from (a bit of C++ there, n00bz, sorry). The count=80 gives us 80 rockets to play with.


Part 4

Then its the CfgVehicle class, which you have seen all over the tutorials so far so I wont go in detail here. Just note the two arrays Weapons[] and Magazines[] containing the weapon names we have defined earlier.


Part 5

And last but not least, the all-important CfgNonAIVehicles that we need for all addons that have weapon and ammo classes in them. Notice we have the class names here with a added "Proxy" before each name. Here you mention the weapons used in the addon. Note that the unguided rocket launcher is missing, I forgot it but it worked anyway, so i guess its just weapons that you have defined a custom ammo class to, aka just the MG and the AA rocket in this case. The important thing is the Proxyclass for the sidewinder, where we tell that the sidewinder.p3d file is inserted as a proxy. Very important this one!

So boring stuff all this, but at the same time so important! But I hope that this configfile will help you in your future projects. If you have questions, ask me or any other cpp-knowing fellow. But for now, lets compile and test!!

Back__Home__Next