Help - Search - Members - Calendar
Full Version: How can i Make a replacement mod?
Armed Assault Info Forums > English > ArmA II - Combined Operations > Addons - Works in Progress
Beretta
I was wondering if someone could help me or send me to a tutorial on how to make replacement mods for units.


Any help is appreciated
D@V
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 tongue.gif )

Finally, Do not sign replacement addons. Using them online with other players who aren't can cause a lot of problems for everyone.
Beretta
That's a great help, Thanks D@ve smile.gif. Would that also work for Razor in the campaign?
D@V
weirdsmiley.gif
For some reason I thought this was in the ArmA.1 section.

It should work for Razor, AFAIK there's nothing particularly special about them configwise, just FR troops with fixed identities.
Beretta
The last question, Where are the config.cpp files stored for the original Arma 2 units?
D@V
It depends on what you're looking for, almost all of it can be found in the addons folder's pbo files (the filenames are pretty descriptive), most of them are binarized though, (they'll be named "config.bin", rather than "config.cpp") you'll need something like eliteness to view them.
Beretta
QUOTE(D@V @ Aug 23 2011, 22:09) *
It depends on what you're looking for, almost all of it can be found in the addons folder's pbo files (the filenames are pretty descriptive), most of them are binarized though, (they'll be named "config.bin", rather than "config.cpp") you'll need something like eliteness to view them.


Thanks smile.gif
Suicide Commando
Hi D@V, I was wondering if you could help me out. I'm trying to make a unit replacement file that swaps the OA Delta Force characters for ardvarkdb's awesome AOR-1 SEALs and Multicam Rangers from his TF86 Temp SF pack. I took another replacement mod, un-pbo'ed it, then extracted the .bat file. Then I edited the files with the correct strings, I think, and now I'm not sure what to do next. I have four files, $PREFIX$, CfgPatches.hpp, CfgVehicles.hpp and config.cpp. What do I do next? Could I maybe send you them to look at? I really, really want to get this working. These units are the best out there.

Link to the mod is here:

http://www.multiupload.com/RTRRBZELOK

And some pics:

http://forums.bistudio.com/showpost.php?p=...;postcount=1691

http://forums.bistudio.com/showpost.php?p=...;postcount=1693
D@V
IMO, trying to reverse engineer another replacement mod is just asking for a headache. Read the first post I made in this thread, what you'll want is just a config.cpp file that looks something like this:
CODE
class CfgPatches
{
    class My_replacement_Mod
    {
        units[] = {};
        weapons[] = {};
        requiredVersion = 0.1;
        requiredAddons[] = {"CAweapons"};
    };
};

class CfgVehicles
{
    //External Class References
    class NewClass1;
    class NewClass2;
    class NewClass3;
    class NewClass4;
    class NewClass5;
    class NewClass6;
    class NewClass7;
    class NewClass8;
    class NewClass9;
    class NewClass10;
    class NewClass11;

    //Class Replacements
    class US_Delta_Force_AR_EP1: NewClass1 {};
    class US_Delta_Force_Air_Controller_EP1: NewClass2 {};
    class US_Delta_Force_Assault_EP1: NewClass3 {};
    class US_Delta_Force_EP1: NewClass4 {};
    class US_Delta_Force_M14_EP1: NewClass5 {};
    class US_Delta_Force_MG_EP1: NewClass6 {};
    class US_Delta_Force_Marksman_EP1: NewClass7 {};
    class US_Delta_Force_Medic_EP1: NewClass8 {};
    class US_Delta_Force_Night_EP1: NewClass9 {};
    class US_Delta_Force_SD_EP1: NewClass10 {};
    class US_Delta_Force_TL_EP1: NewClass11 {};
};

Replace "NewClass1" through to "Newclass11" with the vehicle classes from the the addon you want to use as a replacement, plonk it in a pbo, and you're good to go. (Unless ardvarkdb's used the DFOR classes as a base, though I wouldn't expect he would...)
Suicide Commando
Ok, I'll give it a try.
Suicide Commando
Doesn't work, provided I did everything correctly and have the right classes from the mod. Nothing is changed in-game.
D@V
Does it throw out any kind of error message? If it isn't doing anything, then it's possible the addon hasn't been packed correctly - check the config is a cpp file (ie, it's actually called "config.cpp", not something like "config.cpp.txt", be warned that some versions of windows like to hide the .txt extension!).

Otherwise, are you using a modfolder? I don't think addons like this would work if you just put them in the default addons folder.
Suicide Commando
No, there is no error message, simply doesn't work. It is a .cpp file, no other extension at the end. And yes, I put it in it's own mod folder and activated it.
D@V
Hmm... I just checked with the latest version, and this method doesn't seem to work. weirdsmiley.gif

Not sure if this is something do with the arrowhead classes or the config itself I checked with the CDF classes, it's an issue with my terrible config, I'll have a punter around later, see if I can figure out what's up...
Suicide Commando
Ok, sounds good. I really appreciate this too D@V. Thanks for your time and effort.
D@V
Well, I've puntered around a bit, and I haven't really made any progress. As best I can tell it is overwriting the pre-existing class in some ways (ie, you can change the weapons used by a character doing this), but not in others (you can't change the model).

I don't know why this is. The best explanation I can think of is some kind of otherwise undetectable conflict between addons, but to be certain I'd have to build a replacement addon from the ground up (ie, not requiring any external addons), and I don't really have the free time right now to do something like that.

Sorry I can't be of anymore of help here sad.gif
Suicide Commando
Well, I do appreciate you trying. Guess I'm back to square one again...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.