OFPEC Forum

Addons & Mods Depot => OFP - Addons & Mods General => Topic started by: Grayhawk on 28 Jun 2004, 10:35:14

Title: CPP Question...
Post by: Grayhawk on 28 Jun 2004, 10:35:14
Hi everyone,

I've got a simple question about config.cpp files. Is it possible to modify a class defined in the main config.bin (the one in "Bin" directory) using an addon?

 ???

I'll try to explain it better...  ;)

I create an addon containing only a config.cpp file. In this file I write, for example...

class CfgVehicles
{
   class All {};
   class AllVehicles: All {};
   class Land: AllVehicles {};
   class LandVehicle: Land {};
   class Tank: LandVehicle {};
   class APC: Tank {};
     class M1Abrams: Tank
     {
      displayName= "Test";
   };
};


Will this override the main config.bin class and change the name of the default Abrams? And if not, how can I do it without having to edit the original config.bin file?

Thanks in advance!  :)

Luca "Grayhawk" Antonini
Title: Re:CPP Question...
Post by: Roni on 21 Jul 2004, 14:48:58
Hi Grayhawk

AFAIK - you can't simply override entries in the default config.bin file, but you CAN modify a standard unit by way of a config only addon which will have the same effect.

I am about as far from being an expert as you can get (having just started looking into config files today !   ;D ), but from what I can tell by looking through the main config and a number of addons each lower level of class simply modifies the class above it in some way.  Anyone can make a new class (and thus a new lower order item) simply by changing the class immediately above it in some small way.

So in your example - you have defined a new class of vehicle, different to the standard M1Abrams by a change to the display name only.  You might call this a M1DisplayingAsTest.  To get this to work you would have to add the line

class M1DisplayingAsTest: M1Abrams immediately before your change.

That's my guess and remember - it is just a guess !  :D

(But a reasonably informed one !)

The above all being said - I happen to have a sub folder with a number of replacement files for the standard config.bin file.  I dl'd it years ago, but have only just gone back to it (today !) to see how it works.

From what I can remember, if I rename the new folder BIN and move or rename the original BIN folder then the new files get read by the system as if they are the default.   :wow:  The good news is that the new files have stored the config file as a cpp - which I can read and edit !  ;D

Over the next few days I intend to get to work seeing just how much damage I can do to the basic workings of the game.  New default recoils, binoculars that zoom, better souds for my favourite guns - it's all going to happen.

Stay posted !



Roni