Jump to content
Sign in to follow this  
messiahua

Is it possible to completely override existing class

Recommended Posts

Hello,

for example I have some addonX.pbo, which defines some class:

class CfgVehicles {
   class Truck...
   class Vehicle: Truck {...};
};

I want to completely drop/clear/redefine this "Vehicle" in another addonY.pbo with some other base class for example:

class CfgVehicles {
   class OtherVehicle;
   class Vehicle : OtherVehicle {};
};

I tried this way, but all the parameters are still there and are not redefined by this new base class. That makes sense, thus I also tried an alternate way to create addonZ.pbo with only this definition to completely clear class:

class CfgVehicles {
   class Vehicle {};
};

But still it doesn't work. By the way requiredAddons is in place and addonY requires addonZ and addonZ requires addonX.

I pretty much doubt, that it is possible at all, but anyways, probably I don't know something.

Thanks for any answers/suggestions in advance.

Share this post


Link to post
Share on other sites

No you cannot. However there are alternatives - you only need to re-define all values inside the class to the desired.

Only some base classes like car, air, plane etc have hardcoded behavior.

But basically you can make the a10 class behave and look like the M1A1 if you set all config values inside the a10 class like the M1A1 has (and its parents!)

There is also:

delete A10;

However this can only be done without parents - though you can do this step by step recursively by multiple addons.

Share this post


Link to post
Share on other sites

Thanks a lot for pointing out "delete"! I just hoped, that now I will be able to pull this off, but unfortunately it doesn't work or I'm doing something wrong. I tried multiple variants, then searched all over the place for any example, but no luck.

May I please ask for any example, if you had an experience with it.

Share this post


Link to post
Share on other sites

a) What is your example?

b) What didnt work/how did it not work?

c) An example:

class CfgPatches
{
class deleteExample
{
	units[] = {};
	weapons[] = {};
	requiredVersion = 0.1;
	requiredAddons[] = {"caui"};
};
};
class RscStandardDisplay;
class RscDisplayMain: RscStandardDisplay
{
class controls
{
	delete CA_Expansions;
};
};

Share this post


Link to post
Share on other sites

Strange, I did everything the same, very simple for testing and "proof of concept":

addonX.pbo:

class CfgPatches {
   class addonX { ... };
};
class CfgVehicles {
   class Truck...
   class Vehicle: Truck {...};
};

Vehicle is not base for any other class.

addonY.pbo:

class CfgPatches {
   class addonY { requiredAddons[] = {"addonX"}; };
};
class CfgVehicles {
   delete Vehicle;
};

After this class still exists and I can use (createVehicle/addWeapon) it.

Just did few more tests to be sure (with weapon also).

Share this post


Link to post
Share on other sites

Post your real example. Your dummy is not really helpful.

Share this post


Link to post
Share on other sites

Strange, sorry, so I guess it's not possible to do it the way I need.

By the way no error in rpt.

Share this post


Link to post
Share on other sites

Read my edited message again please Messiah.

Share this post


Link to post
Share on other sites

Oh, well, real example is all the same, but bit longer:

utg_transparent_ruck.pbo:

class CfgPatches {
   class UTG_Transparent_Ruck {
       requiredVersion = 1;
       requiredAddons[] = {"ace_sys_ruck"};
       units[] = {};
       weapons[] = {"UTG_Transparent_Rucksack"};
   };
};

class CfgWeapons {
   class ACE_Rucksack;

   class UTG_Transparent_Rucksack : ACE_Rucksack {
       displayName = "Transparent Rucksack";
       model = "";
       picture = "\x\ace\addons\sys_ruck\data\equip\w_molle_g_ca.paa";
   };
};

utg_test.pbo:

class CfgPatches {
   class utg_test {
       requiredVersion = 1;
       requiredAddons[] = {"UTG_Transparent_Ruck"};
       units[] = {};
       weapons[] = {};
   };
};

class CfgWeapons {
   delete UTG_Transparent_Rucksack;
};

Share this post


Link to post
Share on other sites

Try this:

weapons[] = {"UTG_Transparent_Rucksack"};

=>

weapons[] = {};

---

Maybe this is the wrong approach for your problem anyway.

So what are you actually trying to achieve?

Share this post


Link to post
Share on other sites

Tried to clear weapons array, same result.

This is just an example, I want to achieve some effect before moving forward, but the goal for me is to take CWR2 mod and write my own replacement configs for all classes, so that it could work with/without original configs. Of course I can redefine each parameter in each class manually, but that's hell of a lot work and there will be no inheritance, so if something will change in base class, I won't get those changes in my classes.

Share this post


Link to post
Share on other sites

Sorry I cannot follow.

Hide their classes they you dont want/need.

Overwrite values you want to be different.

Or can you make an example of your issue. Thanks

Share this post


Link to post
Share on other sites

I want to use only part of mod and replace all similar vehicles by those, which exist in original game + ACE and I want compatibility, so that all original class names exist and create duds for data files.

So I can't just overwrite one value in each class, because class contents can be completely different (different models + ACE features).

Anyways, thanks for your time and suggestions! I see only one way - not to use original cwr2 configs.

Share this post


Link to post
Share on other sites

Certainly the most easiest way. Maybe you can get them to split their configs to separate pbos.

This would make your goal a lot more convenient to achieve.

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  

×