Jump to content
Sign in to follow this  
alleycat

Inheritance problem in config

Recommended Posts

I am creating a mod that removes thermal optics from certain infantry weapons. So far I have this:

class CfgPatches	{

class cat_thermal	{
	units[] = {};
	requiredVersion = 1.000000;
	requiredAddons[] = {};
	version = "1.0";
	author[] = {"cat" };
	//authorUrl = "http://dev-heaven.net/projects/cca";

	};
};



class CfgWeapons
{


class launch_B_Titan_F
{

	class OpticsModes
	{
		class StepScope
		{
			visionMode[] = {"Normal"};

		};

	};

};
};

However I get "no entry for...." errors for parameters in the same scope as visionMode. Is this an inheritance problem? And how do I fix that?

Share this post


Link to post
Share on other sites

So if I read this correctly I have to duplicate all lines in the stepscope class for it to work? Isnt inheritance supposed to inherit stuff up to that point so that I only have to replace the desired line instead of this?

Edited by alleycat

Share this post


Link to post
Share on other sites
So if I read this correctly I have to duplicate all lines in the stepscope class for it to work? Isnt inheritance supposed to inherit stuff up to that point so that I only have to replace the desired line instead of this?

You problem might actually be that you did not consider using the requiredAddons line including the respective Arma3 addon that contains the launcher (something like A3_weapons_f or similar).

Without that the contents of the imported launcher class might be simply empty thus leading up to that error.

Apart from that you do certainly not have to repeat all lines from an inherited class, because that would defy the whole idea of inheritance as you stated.

Sometimes you do have to explicitely state though the subclass that you want to inherit, but i am not sure if that applies to your case.

class launch_B_Titan_F {	
class OpticsModes;
};

Edited by Charon Productions

Share this post


Link to post
Share on other sites

I have tried both, but I cant get the required mod part right. I have used the weapons_f.pbo with and without the .pbo extension but it always reports undefined parameter errors.

Share this post


Link to post
Share on other sites
I have tried both, but I cant get the required mod part right. I have used the weapons_f.pbo with and without the .pbo extension but it always reports undefined parameter errors.

You need also to state the inheritance relationship inside your actual weapon class. You forgot to explicitly write the parent class after the child class.

This config does the job:

class CfgPatches	{
class cat_thermal	{
	units[] = {};
	weapons[] = {"MYLAUNCHER"};
	requiredVersion = 1.000000;
	requiredAddons[] = {"A3_Weapons_F","A3_Weapons_F_Beta"};
	version = "1.0";
	author[] = {"cat" };	
	};
};


class OpticsModes;
class StepScope;
class CfgWeapons
{
class Launcher;
class Launcher_Base_F : Launcher{
	class OpticsModes;	
}
class launch_Titan_base : Launcher_Base_F{
	class OpticsModes: OpticsModes {
		class StepScope;
	};
};

class MYLAUNCHER : launch_Titan_base
{
	scope = 2;
	class OpticsModes : OpticsModes
	{
		class StepScope : StepScope
		{
			visionMode[] = {"Normal"};
			testconfigvalue = "test";
		};	
	};
};
};

Hope that gets you going.

Share this post


Link to post
Share on other sites

How to find what pbo it is in? The pbo extractor cant open them.

edit: wrote the above without seeing charons latest post.

edit: thx for the example, replacing MYLAUNCHER with the launcher I wanted to be changed works.

Edited by alleycat

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  

×