Jump to content
Sign in to follow this  
Gudsawn

Prevent Inheritance/Remove Class

Recommended Posts

I'm creating a config that aims to remove a specific class from an already existing config.

class myClass {
class mySubClass {
	// stuff in here
};
};

class myReplacementClass : myClass {
};

How can I prevent inheriting values from mySubClass inside myReplacementClass? I tried using:

class myReplacementClass : myClass {
class mySubClass {};
};

to force mySubClass to hold no values, but then it is still being referenced in the config (i.e. if I look in the config viewer I can see that myReplacementClass still has a mySubClass). Even though mySubClass is empty, I need it to not exist in there at all. Is this possible?

Share this post


Link to post
Share on other sites

Many thanks Das Attorney, this is exactly what I was looking for :)

Share this post


Link to post
Share on other sites

Tried using the delete command but It doesn't seem to work. The class still is still there and doesn't delete. The log is showing no relating errors. I even tried setting the class to a null value (so that it has no children) and then deleting it, but that results in "Member already defined". Here's what I'm doing:

class myReplacementClass : myClass {
delete mySubClass; // Still shows in config viewer
};

So then I tried this:

class myReplacementClass : myClass {
class mySubClass {};
delete mySubClass; // Results in "Member already defined"
};

What am I doing wrong?

Also, how did you find out about the delete command? I tried searching for documentation on other config commands but none seems to exist.

Edited by Goodson

Share this post


Link to post
Share on other sites

Can you post up your config?

It's hard to work out what's going on without seeing the inheritance.

Share this post


Link to post
Share on other sites

Sure, here's the config:

class CfgWorlds {
class DefaultWorld {
	class Weather {
		class Overcast {
			class Weather1;	// External class reference
			class Weather2;	// External class reference
			class Weather3;	// External class reference
			class Weather4;	// External class reference
			class Weather5;	// External class reference
			class Weather6 : Weather5 {};
		};
	};
};

class Takistan : DefaultWorld {
	class Weather : Weather {
		delete NewLighting; // Doesn't appear to do anything
	};

};
};

The class NewLighting still shows in the config viewer. As I mentioned in my previous post, I can set NewLighting to an empty value (which shows up correctly in the config viewer), but trying to delete it just doesn't seem to work.

Share this post


Link to post
Share on other sites

No matter what I do, I just can't seem to delete any config classes. Look at this example:

class CfgWorlds {
class DefaultWorld {
	class Weather; // External reference
};

class CAWorld : DefaultWorld {
	class Weather : Weather {
		class LightingNew {
			delete Lighting1; // Still appears in config viewer
		};
	};
};
};

Lighting1 just will not delete. I can still see it in the config viewer ("cfgWorlds" >> "CAWorld" >> "Weather" >> "LightingNew" >> "Lighting1"). No relating errors are being shown in the RPT log. It doesn't seem to make any sense.

Does this have anything to do with Access?

Edit: Tried a different approach, still doesn't delete it:

class CfgWorlds {
class CAWorld {
	class Weather {
		class LightingNew; // External reference
	};
};

class CAWorld_2 : CAWorld {
	class Weather : Weather {
		delete LightingNew;
	};
};
};

CAWorld_2 still inherits LightingNew...

Edit 2: Another attempt:

class CfgWorlds {
class CAWorld {
	class Weather {
		class LightingNew {
			delete Lighting1;
			delete Lighting2;
			delete Lighting3;
		};
	};
};
};

Still does not delete :mad:

Edited by Goodson

Share this post


Link to post
Share on other sites

I looked at the config for Takistan A2 and I can't find a class called LightingNew. Is it one of the ones for A3MP?

Also, in your second example, you refer to it as LightingNew and the other example as NewLighting.

Share this post


Link to post
Share on other sites

My mistake with NewLighting, it should be LightingNew (see my added edits above where I do use LightingNew but still cannot delete the class).

LightingNew is used in vanilla Arma 3 maps (Stratis, Altis). A3MP gives CAWorld (which is defined in A3MP) the LightingNew class from Stratis, which means that any island that inherits from CAWorld will be given exactly the same lighting values as Stratis. Instead, these lighting values should be defined for each island and not at the masterclass (CAWorld). This is what vanilla Arma 3 does with its own maps - Stratis defines its own LightingNew values in its own class (and not from its inherited class - DefaultWorld).

f9a86323bd33b67885e53be8a1c6f2e2.png

My goal is to remove LightingNew from maps such as Takistan (that inherit LightingNew from CAWorld). As you can see from my attempts above, it's proving to be almost impossible to achieve this.

Edited by Goodson

Share this post


Link to post
Share on other sites

Maybe it's a protected class - I've had some trouble trying to modify core configs in the game - sometimes with success, sometimes without.

Sometimes you can delete them and they don't show up in the config editor anymore but the contents of the class are still used by the game somehow.

I'll have a go this evening and see if I can do anything with it.

Share this post


Link to post
Share on other sites

I was afraid you might say something like that. It might be that LightingNew is set as a protected class or something.

If you could manage to get it working that would be fantastic. Either way, I really appreciate your help!

Share this post


Link to post
Share on other sites

I managed to fix this in the end - it was in fact due to the spelling mistake you pointed out (post #7) :o

NewLighting should be LightingNew. Thanks again Das Attorney.

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  

×