Jump to content
rofz

Class inheritance not working (baffling!)

Recommended Posts

class CfgPatches
{
    class BS_Faction
    {
        name = "BS";
        author = "rofz";
        versionStr = "1.1";
        versionAr[] = {1,10};
        requiredVersion = 1.60;
        requiredAddons[] = { "A3_Functions_F" };
        units[] = {
            "IP_B_BS_Heli_Transport_01_Tropic_F",
            "IP_B_BS_Heli_Transport_01_Base_H",
            "IP_B_BS_Heli_Transport_01_Base_F"
        };
        weapons[] = {};
    };
};

class CfgFactionClasses
{
    class BS
    {
        displayName = "BS";
        side = 1;
        priority = 2;
    };
};

class CfgUnitInsignia { };

class CfgVehicles
{
    class B_Heli_Transport_01_F;
    class IP_B_BS_Heli_Transport_01_Base_F : B_Heli_Transport_01_F
    {
        displayName = "BS Heli Transport 01 Base";
        scope = 0;
        class Turrets;
    };
    class IP_B_BS_Heli_Transport_01_Base_H : IP_B_BS_Heli_Transport_01_Base_F
    {
        class Turrets : Turrets
        {
            class CopilotTurret;
            class MainTurret;
            class RightDoorGun;
        };
    };
    class IP_B_BS_Heli_Transport_01_Tropic_F : IP_B_BS_Heli_Transport_01_Base_H
    {
        author = "rofz";
        crew = "B_Fighter_Pilot_F";
        displayname = "My Helo (Final)";
        faction = "BS";
        typicalCargo[] = {"B_recon_F"};
        class Turrets : Turrets
        {
            class CopilotTurret : CopilotTurret
            {
                gunnerType = "B_Fighter_Pilot_F";
            };
            class MainTurret : MainTurret
            {
                gunnerType = "B_helicrew_F";
            };
            class RightDoorGun : RightDoorGun
            {
                gunnerType = "B_recon_LAT_F";
            };
        };
    };
};

class CfgGroups { };

 

Hello all,

 

I'm trying the simplest thing: replace the unit that operates a particular turret in a helo, but so far I could not make it work. It keeps complaining about missing individual attributes! I also tried with the same code showed here and read the Turret Config Reference multiple times to try to find a clue of what could be wrong to no avail. The issue remais the same.

 

The code (config.cpp) is above. It's 100% reproducible.

 

Things I have already cleared:

1) unloaded all possible mods and DLCs

2) other modules that do the same (change a Turret default unit) - like the KSK mod by IndeedPete (mentioned in the linked forum post) - work fine, regardless of the loaded mods/DLCs

3) the root cause seem to be related to the parent/base class (IP_B_BS_Heli_Transport_01_Base_F) inheritance of the Turrets class to not be working. Its Turrets config is completely blank when viewed with the Config Viewer (which does not happen with IndeedPete's KSK mod - the Turrets' config gets correctly populated) 

 

I believe the config.cpp is not correctly written or there could be some other stupid parameter missing, like a #define ENABLE_CLASS_INHERITANCE 1 or something 😠.

 

Any ideas/suggestions would be greatly appreciated.

 

Have a nice day!

 

Share this post


Link to post
Share on other sites

Fix this part first, add the name of the addon you are changing. Get the name with activatedAddons. Functions is irrelevant btw.

requiredAddons[] = { "A3_Functions_F" };

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×