Jump to content
Sign in to follow this  
pcc

class CargoTurret inheritance

Recommended Posts

I want to override some CargoTurret classes of vehicles but the properties aren't overriding in my attempts.

class Heli_Light_01_unarmed_base_F: Heli_Light_01_base_F
{
    class Turrets;
    class CopilotTurret;
};
class B_Heli_Light_01_F: Heli_Light_01_unarmed_base_F
{
        class Turrets: Turrets
        {
            class CopilotTurret: CopilotTurret
            {
                //works
            };
            class CargoTurret_01;  
            class CargoTurret_02;
            class CargoTurret_01: CargoTurret_01
            {
                //Doesn't work
            };
            class CargoTurret_02: CargoTurret_02
            {
                //Doesn't work
            };
            ...
        }; 
};

 

Share this post


Link to post
Share on other sites
1 hour ago, pcc said:

I want to override some CargoTurret classes of vehicles but the properties aren't overriding in my attempts.


class Heli_Light_01_unarmed_base_F: Heli_Light_01_base_F
{
    class Turrets;
    class CopilotTurret;
};
class B_Heli_Light_01_F: Heli_Light_01_unarmed_base_F
{
        class Turrets: Turrets
        {
            class CopilotTurret: CopilotTurret
            {
                //works
            };
            class CargoTurret_01;  
            class CargoTurret_02;
            class CargoTurret_01: CargoTurret_01
            {
                //Doesn't work
            };
            class CargoTurret_02: CargoTurret_02
            {
                //Doesn't work
            };
            ...
        }; 
};

 

I would actually say that whole inheritance is not working since there are couple of errors.

 

* You cannot have external reference (class CargoTurret_01;) & class definition (class CargoTurret_01: CargoTurret_01) in same scope. You need to unflod inheritance to one level deeper.

* class CopilotTurret; doesn't exists in class Heli_Light_01_unarmed_base_F, it's part of class Turrets
https://community.bistudio.com/wiki/Class_Inheritance

 

Take a look at this example - here you can see how deep you have to go go if you want to to replace one thing in turret config 😉


	class LandVehicle;
	class Tank: LandVehicle
	{
		class NewTurret;
	};
	class Tank_F: Tank
	{
		class Turrets
		{
			class MainTurret: NewTurret
			{
				class Turrets
				{
					class CommanderOptics;
				};
			};
		};
	};
	class rhs_a3t72tank_base: Tank_F
	{
		class Turrets: Turrets
		{
			class MainTurret: MainTurret
			{
				class Turrets: Turrets
				{
					class CommanderOptics;
					class CommanderMG;
				};
			};
		};
	};
	class rhs_t72ba_tv: rhs_a3t72tank_base
	{
	};
	class rhsgref_cdf_t72ba_tv: rhs_t72ba_tv
	{
		class Turrets: Turrets
		{
			class MainTurret: MainTurret
			{
				magazines[] =
					{
					"rhs_mag_3bm32_7",
					"rhs_mag_3bk18_6",
					"rhs_mag_3of26_5",
					"rhs_mag_9m119_4",
					"rhs_mag_762x54mm_250",
					"rhs_mag_762x54mm_250",
					"rhs_mag_762x54mm_250",
					"rhs_mag_762x54mm_250",
					"rhs_mag_762x54mm_250",
					"rhs_mag_762x54mm_250",
					"rhs_mag_762x54mm_250",
					"rhs_mag_762x54mm_250",
					"rhs_mag_3d17",
					"rhs_LaserFCSMag"
				};
				class Turrets: Turrets
				{
					class CommanderOptics: CommanderOptics
					{
						gunnerType="rhsgref_cdf_reg_crew_commander";
					};
					class CommanderMG: CommanderMG {};
				};
			};
		};
	};

 

  • Like 1

Share this post


Link to post
Share on other sites

Do you have an example with CargoTurret classes?  

I'm still stuck because CargoTurret and CargoTurret_01 doesn't exist in classes above B_Heli_Light_01_F.  Is it still possible to override it without having to copy its entire default properties?.  

I managed to get copilot to autoeject when dead, but I can't get the ones in cargoturrets seats to eject.

Share this post


Link to post
Share on other sites
6 minutes ago, pcc said:

 

I'm still stuck because CargoTurret and CargoTurret_01 doesn't exist in classes above B_Heli_Light_01_F.

That shouldn't be an issue - just try to unpack original addon or use all in one config dump ( https://forums.bohemia.net/forums/topic/191737-updated-all-in-one-config-dumps/?page=2 ) to check original inheritance structure and then try to recreate it in your addon.

Page that I linked before ( https://community.bistudio.com/wiki/Class_Inheritance ) should be more than enough to understand that concept.

6 minutes ago, pcc said:

Is it still possible to override it without having to copy the entire default properties?.  

 

No, you always have to recreate inheritance structure of objects that you are modifying.

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  

×