Jump to content
SirBassi

Member already defined | Struggle with External Base Class(es)

Recommended Posts

Hello everyone,

 

I was able to learn a lot in the last few weeks by browsing through many posts here and also asking about it. It's really great how much input you can collect here as a beginner.

 

I would like to retrofit the Cayuse helicopters with a GPS from the SOG CDLC. Addressing the basics for this with a class name, creating and integrating by own mod also works when I just "activate" the first two Helis from my actual config.cpp.

But now, as a non-programmer, I'm getting to a point where determining parent and child classes becomes very abstract to me with all the 7 Cayuse want to integrate.

Attached is my current code and the error message I get when I start the game. I also understand the reason for the error. But I'm a bit confused as to how to come to a solution now.

 

Am I on the right track if I use the BI Wiki as a guide when it comes to external base classes? And which way is the next one then? Orientation using the example of two or the Implied child classes?

 

Actual Code - Config.cpp

Spoiler

class CfgPatches {

    class Spielwiese_Cayuse {

        author = "SirBassi | Arma Spielwiese";

        name = "Cayuse mit GPS";

        url = "https://discord.gg/....";

        units[] = {};

        weapons[] = {};

        requiredVersion = 0.1;

        requiredAddons[] = {"loadorder_f_vietnam"};

    };

};

 

class CfgVehicles

{

    class vn_air_oh6a_cargo_base;

    class vn_b_air_oh6a_01_asw: vn_air_oh6a_cargo_base

    {

        enableGPS = 1;

    };

 

    class vn_air_oh6a_base;

    class vn_b_air_oh6a_03_asw: vn_air_oh6a_base

    {

        enableGPS = 1;

    };

 

    class vn_b_air_oh6a_04;

    class vn_b_air_oh6a_05_asw: vn_b_air_oh6a_04

    {

        enableGPS = 1;

    };

 

    class vn_b_air_oh6a_04;

    class vn_b_air_oh6a_06_asw: vn_b_air_oh6a_04

    {

        enableGPS = 1;

    };

 

    class vn_b_air_oh6a_04;

    class vn_b_air_oh6a_07_asw: vn_b_air_oh6a_04

    {

        enableGPS = 1;

    };

 

    class vn_b_air_oh6a_02;

    class vn_b_air_oh6a_04_asw: vn_b_air_oh6a_02

    {

        enableGPS = 1;

    };

 

    class vn_b_air_oh6a_base;

    class vn_b_air_oh6a_02_asw: vn_b_air_oh6a_base

    {

        enableGPS = 1;

    };

};

 

Classes and Rootpaths of the Cayuse Helicopters

Spoiler

Rootpath: "All","AllVehicles","Air","Helicopter","Helicopter_Base_F","Helicopter_Base_H",...


configFile >> "CfgVehicles" >>  "vn_b_air_oh6a_01"

["vn_helicopter_base",                "vn_air_oh6a_base",     "vn_air_oh6a_cargo_base"]

 

configFile >> "CfgVehicles" >>  "vn_b_air_oh6a_02"

["vn_helicopter_base",                "vn_air_oh6a_base"]

 

configFile >> "CfgVehicles" >>  "vn_b_air_oh6a_03"

["vn_helicopter_base",                "vn_air_oh6a_base"]

 

configFile >> "CfgVehicles" >>  "vn_b_air_oh6a_04"

["vn_helicopter_base",                "vn_air_oh6a_base",     "vn_b_air_oh6a_02"]

 

configFile >> "CfgVehicles" >>  "vn_b_air_oh6a_05"

["vn_helicopter_base",                "vn_air_oh6a_base",     "vn_b_air_oh6a_02",     "vn_b_air_oh6a_04"]

 

configFile >> "CfgVehicles" >>  "vn_b_air_oh6a_06"

["vn_helicopter_base",                "vn_air_oh6a_base",     "vn_b_air_oh6a_02",     "vn_b_air_oh6a_04"]

 

configFile >> "CfgVehicles" >>  "vn_b_air_oh6a_07"

["vn_helicopter_base",                "vn_air_oh6a_base",     "vn_b_air_oh6a_02",     "vn_b_air_oh6a_04"]

 

My Error Hint by Starting Arma

WyeY6DQ.jpg

 

 

Ideas for the next step to solve

BiWiki: https://community.bistudio.com/wiki/Class_Inheritance#Basic_config_concepts

Spoiler

Example two

 

//// the 'template'

class externalRootClass

{

    class externalBaseClass;

};

///////////

class myClass: externalRootClass

{

    class externalChildClass: externalChildClass // import ALL the values from the original

    {

        // ... add, or make, changes

    };

    // ...

};

 

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

 

Implied child classes

 

class A

{

    class B

    {

        /* ...whatever */

    };

};

 

class C : A

{

    class D

    {

        // whatever

    };

};

 

class E : C

{

    class D : D // fairly standard

    {

        // change things

    };

    class B : B // fairly strange!

    {

        // change things

    };

};

 

 

Thank you for your ideas and help and a push in the right direction!

 

Share this post


Link to post
Share on other sites

I'm not mod maker my self but the obvious problem in your config is that you have "class vn_b_air_oh6a_04" multiple times. just do that once at the top of your file and you should be fine

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, gc8 said:

I'm not mod maker my self but the obvious problem in your config is that you have "class vn_b_air_oh6a_04" multiple times. just do that once at the top of your file and you should be fine

This.

You only need to define an external (or otherwise already defined classname) once, and you don't need to re-reference it later.

I haven't tested this code and knocked it together quick so don't overwrite your existing config for fear I've missed something or broken it:

class CfgPatches
{
	class Spielwiese_Cayuse 
	{
        author = "SirBassi | Arma Spielwiese";
        name = "Cayuse mit GPS";
        url = "https://discord.gg/....";
        units[] = {};
        weapons[] = {};
        requiredVersion = 0.1;
        requiredAddons[] = {"loadorder_f_vietnam"};
    };
};

class CfgVehicles
{
	class vn_air_oh6a_cargo_base; // not sure if this is defined in another config, if it is you'll need to add its cfgPatches name in to requiredAddons field above (unless its defined in "loadorder_f_vietnam" in which case you are good to go. If its not an external reference it'll throw an 'undefined base class error'
	class vn_b_air_oh6a_01_asw: vn_air_oh6a_cargo_base
	{
		enableGPS = 1;
	};

	class vn_air_oh6a_base;
	class vn_b_air_oh6a_03_asw: vn_air_oh6a_base
	{
		enableGPS = 1;
	};

	class vn_b_air_oh6a_04;
	class vn_b_air_oh6a_05_asw: vn_b_air_oh6a_04
	{
		enableGPS = 1;
	};

	class vn_b_air_oh6a_06_asw: vn_b_air_oh6a_04
	{
		enableGPS = 1;
	};

	class vn_b_air_oh6a_07_asw: vn_b_air_oh6a_04
	{
		enableGPS = 1;
	};

	class vn_b_air_oh6a_02;
	class vn_b_air_oh6a_04_asw: vn_b_air_oh6a_02
	{
		enableGPS = 1;
	};

	class vn_b_air_oh6a_base;
	class vn_b_air_oh6a_02_asw: vn_b_air_oh6a_base
	{
		enableGPS = 1;
	};
};

Take note of the commented // parts

  • Like 1

Share this post


Link to post
Share on other sites

Thanks a lot guys.

 

With you Input I got it solved.

I took one class "higher" as Base Class and defined in it each Helicopter.

I get no config Error Messages by starting, editing and loading Missions so I think it works fine.

 

Final Code

Spoiler

class CfgVehicles

{

    class vn_air_oh6a_base;

    class vn_b_air_oh6a_01: vn_air_oh6a_base

    {

        enableGPS = 1;

    };

   

    class vn_b_air_oh6a_03: vn_air_oh6a_base

    {

        enableGPS = 1;

    };

   

    class vn_b_air_oh6a_04: vn_air_oh6a_base

    {

        enableGPS = 1;

    };

   

    class vn_b_air_oh6a_05: vn_air_oh6a_base

    {

        enableGPS = 1;

    };

   

    class vn_b_air_oh6a_06: vn_air_oh6a_base

    {

        enableGPS = 1;

    };

 

    class vn_b_air_oh6a_07: vn_air_oh6a_base

    {

        enableGPS = 1;

    };

 

    class vn_b_air_oh6a_02: vn_air_oh6a_base

    {

        enableGPS = 1;

    };

};

 

Thanks a lot guys.

  • Like 1

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

×