Jump to content
Sign in to follow this  
Grester

[SOLVED]Partial subclass inheritance issue

Recommended Posts

Without going to much off topic I'll give a bit of background on why such question...

I'm working on a clothes mod that creates new uniforms, helmets,etc. The scripts weren't much optimized and were pretty much copy+paste based. Worked but if I wanted to change a value of a type of vest then I had to change them all.

So I started adapting the scripts to be based on inheritance so that all I had to change for the childs were textures. However I started to face some issues of many values not being inherited, particularly stats of uniforms which could be perhaps answered with the fact that some stats are present in subclasses which weren't declared in the children. However my vests children don't have subclasses declared and have the correct stats so I'm not sure.

 

As I was doing some research looking for answers I've stumbled upon Macros which seems to be a replacement for my inheritance based system since it just copycats the parent and all I have to do is input the values into the parameters.

 

Thus my question, which should have I used in the first place? May have I miswritten the inheritances? Or perhaps a mix of both?

I haven't fixed the problem yet as I was looking for an answer on the best aproach towards the problem.

It seems that backpacks, vests and helmets are working correctly but I'm not entirely sure since uniforms stats and some subclasses variables are missing/generating errors. This also brings me doubts wether or not Units are correcly setup despite at first glance they seem to have inherited correctly.

Below I'll leave an example of my classes. (For the sake of simplicity for now I'll just take a segment from my vests. If it's due necessary later on I could post segments from the Units/Uniforms files.)

//Also authors don't seem to inherit properly.

(...)
class cfgWeapons
{
    class VestItem;
    class Vest_Camo_Base: ItemCore
    {
        class ItemInfo;        
    };
    #include "cfgVest.hpp"
};

(...)

class VEST_TAC_Desert: Vest_Camo_Base 
    { 
        author = "Example";
        //vehicleClass = myVest;
        side = TWest;
        scope = 2; 
        displayName = "TacticalVest Desert"; 
        picture = "\A3\characters_f\Data\UI\icon_v_tacvest_blk_ca.paa"; 
        model = "A3\Characters_F\Common\equip_tacticalvest.p3d"; 
        hiddenSelections[] = {"Camo"};
        hiddenSelectionsMaterials[] = {"A3\Characters_F\Common\Data\tacticalvest.rvmat"};       
        hiddenSelectionsTextures[] = {"forces\tex\vest\deserttactical.paa"}; 
      
        class ItemInfo: VestItem 
        { 
        class HitpointsProtectionInfo
            {
                class Chest {
                    HitpointName = "HitChest";
                    armor = 8;
                    PassThrough = 0.3;
                };

                class Diaphragm {
                    HitpointName = "HitDiaphragm";
                    armor = 8;
                    PassThrough = 0.3;
                };

                class Abdomen {
                    hitpointName = "HitAbdomen";
                    armor = 8;
                    passThrough = 0.3;
                };

                class Body {
                    hitpointName = "HitBody";
                    passThrough = 0.3;
                };
            };
        uniformModel = "A3\Characters_F\Common\equip_tacticalvest.p3d"; 
        containerClass = "Supply120"; 
        mass = 80;  
        hiddenSelections[] = {"camo"}; 
        }; 
    };

    class VEST_TAC_WoodlandA: VEST_TAC_Desert 
    { 
        author = "Example";
        displayName = "TacticalVest Woodland-A";
        hiddenSelectionsTextures[] = {"forces\tex\vest\woodlandtactical.paa"}; 
    }; 

Share this post


Link to post
Share on other sites

To be honest, as far as I'm aware its all down to personal preference. From personal testing, so long as your inheritance is correct (and your's does appear to be) you should be fine

 

That said though, I'd change

class ItemInfo: VestItem

to

class ItemInfo: ItemInfo

as that is how I have mine set up and it all appears to work fine.

	class SSQN_VestTest_01: Vest_Camo_Base
	{
		author = "S Squadron";
		scope = 0;
		scopeArsenal = 0;
		displayName = "BASE CLASS SO THIS DOES NOT MATTER";
		descriptionShort = "Armor Level III";
		picture = "\A3\characters_f\Data\UI\icon_V_plate_carrier_1_CA.paa";
		model = "\A3\Characters_F\BLUFOR\equip_b_vest02";
		DLC = "SSQN";
		hiddenSelectionsTextures[] = {"\SSQN_Equipment\Data\crye_vests_mx1_co.paa"};
		hiddenSelectionsMaterials[] = {"\SSQN_Equipment\Data\crye_vests.rvmat"};
		class ItemInfo: ItemInfo
		{
			uniformModel = "\A3\Characters_F\BLUFOR\equip_b_vest02";
			containerClass = "Supply140";
			mass = 80;
			class HitpointsProtectionInfo 
			{
                		class Chest 
				{
                   			HitpointName = "HitChest";
                    			armor = 16;
                    			PassThrough = 0.2;
                		};

                		class Diaphragm 
				{
                    			HitpointName = "HitDiaphragm";
                    			armor = 16;
                    			PassThrough = 0.2;
                		};

                		class Abdomen 
				{
                    			HitpointName = "HitAbdomen";
                    			armor = 16;
                    			passThrough = 0.2;
                		};

                		class Body 
				{
                   			HitpointName = "HitBody";
                    			passThrough = 0.2;
                		};
            		};
		};
	};

	class SSQN_CryeCPC_01MCM: SSQN_VestTest_01
	{
		author = "S Squadron";
		scope = 2;
		scopeArsenal = 2;
		picture = "\A3\characters_f\Data\UI\icon_V_plate_carrier_1_CA.paa";
		displayName = "Crye CPC 1 (Multicam 1)";
		model = "\A3\Characters_F\BLUFOR\equip_b_vest02";
		hiddenSelectionsTextures[] = {"\SSQN_Equipment\Data\crye_vests_mcm_co.paa"};
		hiddenSelectionsMaterials[] = {"\SSQN_Equipment\Data\crye_vests.rvmat"};
		class ItemInfo: ItemInfo
		{
			uniformModel = "\A3\Characters_F\BLUFOR\equip_b_vest02.p3d";
		};
	};

I have many camo variants of the vests set up in exactly the same manner and I've just checked the in-game config viewer to be sure and all armour values are inherited correctly. 

That said, the Arsenal doesn't display armour values correctly in the slider-bar graph thing, as BI are yet to update the Arsenal side of things.

  • Like 1

Share this post


Link to post
Share on other sites

To be honest, as far as I'm aware its all down to personal preference. From personal testing, so long as your inheritance is correct (and your's does appear to be) you should be fine

 

I have many camo variants of the vests set up in exactly the same manner and I've just checked the in-game config viewer to be sure and all armour values are inherited correctly. 

That said, the Arsenal doesn't display armour values correctly in the slider-bar graph thing, as BI are yet to update the Arsenal side of things.

 

Thanks for the heads up although I'm not sure if it is a relief. On the uniforms the parent/master uniform shows to have max armor (I don't know how it got that much but let's ignore that fact for now) and the inheritances don't. Also curiously it appears that my ghilliesuits inheritances have a subclass container issue which the game shows up as an error when selecting it on arsenal. I'll show a piece of code to clarify that.

	class UNIF_Desert: Uniform_Base 
	{
		author = "Example";
		scope = 2;
		displayName = "Uniforme Desert";
		picture = "forces\tex\ui\desert.paa";
		model = "\A3\Characters_F\Common\Suitpacks\suitpack_universal_F.p3d";
		hiddenSelections[] = {"camo"};
		hiddenSelectionsTextures[] = {"forces\tex\ui\desert1.paa"};
		class ItemInfo: UniformItem 
		{
			uniformModel = "-";
			uniformClass = "BOT_Desert";
			containerClass = "Supply40";
			mass = 40;
			hiddenSelections[] = {"Camo"};
		};
	};

	class UNIF_SNIP_Desert: UNIF_Desert 
	{
		author = "Example";
		displayName = "Ghillie Desert";
		picture = "forces\tex\ui\desertSniper.paa";
		model = "\A3\Characters_F\Common\Suitpacks\suitpack_universal_F.p3d";
		hiddenSelectionsTextures[] = {"forces\tex\ui\desert1Sniper.paa"};

		class ItemInfo: UniformItem 
		{
			uniformClass = "BOT_SNIP_Desert";
			containerClass = "Supply30"; //If I don't specify the container it produces a error
		};
	};	
    class UNIF_SNIP_WoodlandA: UNIF_SNIP_Desert
    {
        author = "Example";
        displayName = "Ghillie Woodland-A";
        picture = "alforces\tex\ui\woodlandSniper.paa";
        hiddenSelectionsTextures[] = {"forces\tex\ui\woodland1Sniper.paa"};

        class ItemInfo: UniformItem
        {
            uniformClass = "BOT_SNIP_WoodlandA";
            containerClass = "Supply30"; //I need to specify container for every children
        };
    };

If I don't explicitly specify the containerclass it produces a bland error. Could it be due to the fact it's named UniformItem as you said? BIS Wiki article about it actualy shows it entitled like that so not sure.

Odd thing is, I do seem to remember it used to not produce such error which makes me wonder wether or not the Units could have a issue in them, thus not linking correctly. Also it only happens on the ghilies and I have to redefine the container for every ghilie children despite their parent be the ghilie not the regular uniform.

 

UPDATE: Changing to ItemInfo all subclasses in all my classes helped a lot. Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

Yeah, it'll help for the uniforms to change it to ItemInfo too if you haven't already.

Share this post


Link to post
Share on other sites

Yeah, it'll help for the uniforms to change it to ItemInfo too if you haven't already.

Yeah its what I did, all values are the same now.

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
Sign in to follow this  

×