It's not too difficult, just a bit of quick config work. You'll want to get your hands on the config.cpp file that's got the class you want to replace and ditto for the class you're replacing it with. If you're lucky, the class you want to replace it with won't inherit from the class you're replacing, but if you don't know, it's important to check!
If they don't, then it's a simple matter of having this sort of config for your replacement addon:
CODE
class CfgVehicles
{
class NewClass; //External Class Reference
class OldClass: NewClass {};
};
(Obviously, you'll replace "oldclass" and "newclass" with the classnames you'd want!
If they do inherit from each other, you can try the first method, but I don't think it'll work (recursion and all that, I should also point out that I've told you not to do this, so I'm not responsible for any damage you might do to your computer if you do it!), you need to rewrite whole thing, so, let's say you wanted to replace the class "SoldierEMG" with a variant that's got a different model and equipment. So the replacement class looks like this:
CODE
class HSO_ETroopLMG : SoldierEMG
{
model="\HSO_SLA\Soldier.p3d";
displayName="Infantry Autorifleman (RPK74)";
vehicleClass="HSO_SLAMan";
weapons[]={HSO_RPK74,DefaultManWeapons};
magazines[]=
{
HSO_545_RPK,HSO_545_RPK,HSO_545_RPK,HSO_545_RPK,
HSO_545_RPK,HSO_545_RPK,
HandGrenade,HandGrenade,HandGrenade,HandGrenade
};
class Wounds
{
tex[]={};
mat[]={
"ca\characters\data\np_hhl.rvmat",
"ca\characters\data\np_hhl_wound1.rvmat",
"ca\characters\data\np_hhl_wound2.rvmat",
"HSO_SLA\tex\SLA_body.rvmat",
"HSO_SLA\tex\SLA_body_wound1.rvmat",
"HSO_SLA\tex\SLA_body_wound2.rvmat"
};
};
};
You'll need to find the class you'd normally inherit from, SoldierEMG from characters.pbo (it's best to extract the file directly from the pbo for this, to make sure it's the latest version!) which looks like this:
CODE
class SoldierEMG: SoldierEB
{
displayName=$STR_DN_MGUNNER;
cost=60000;
accuracy=1.5;
nameSound="machineGunner";
weapons[]={PK,DefaultManWeapons};
magazines[]=
{
100Rnd_762x54_PK,100Rnd_762x54_PK,100Rnd_762x54_PK,100Rnd_762x54_PK,
100Rnd_762x54_PK
};
threat[]={1, 0.1, 0.8};
respawnWeapons[]={pk,DefaultManWeapons};
respawnMagazines[]={100Rnd_762x54_PK,100Rnd_762x54_PK,};
};
Then you'll want to replace the relevant parts with the one from the replacement class: (if something isn't there in the original class, such as the wound definitions here, you'll need to add them in)
CODE
class SoldierEMG: SoldierEB
{
model="\HSO_SLA\Soldier.p3d";
displayName="Infantry Autorifleman (RPK74)";
cost=60000;
accuracy=1.5;
nameSound="machineGunner";
weapons[]={HSO_RPK74,DefaultManWeapons};
magazines[]=
{
HSO_545_RPK,HSO_545_RPK,HSO_545_RPK,HSO_545_RPK,
HSO_545_RPK,HSO_545_RPK,
HandGrenade,HandGrenade,HandGrenade,HandGrenade
};
threat[]={1, 0.1, 0.8};
respawnWeapons[]={pk,DefaultManWeapons};
respawnMagazines[]={100Rnd_762x54_PK,100Rnd_762x54_PK,};
class Wounds
{
tex[]={};
mat[]={
"ca\characters\data\np_hhl.rvmat",
"ca\characters\data\np_hhl_wound1.rvmat",
"ca\characters\data\np_hhl_wound2.rvmat",
"HSO_SLA\tex\SLA_body.rvmat",
"HSO_SLA\tex\SLA_body_wound1.rvmat",
"HSO_SLA\tex\SLA_body_wound2.rvmat"
};
};
};
(Ok, before you point it out, yeah, I did forget to define the respawnweapons and respawnmagazines classes in the addon I based this on, sue me
)
Finally,
Do not sign replacement addons. Using them online with other players who aren't can cause a lot of problems for everyone.