Jump to content
Kingsley1997

Extend class by itself?

Recommended Posts

I'm trying to modify a class but I don't want to overwrite everything in it. I just want to change some values and leave the rest default. I tried this but it doesn't work:
class rhs_weap_ak74m_Base_F: rhs_weap_ak74m_Base_F
{
	#include "\z\ace\addons\ai\arc_rifle.hpp"
};

 

Share this post


Link to post
Share on other sites

That's not the correct way to do it.

 

First you should probably declare the addon where class rhs_weap_ak74m_Base_F is defined, in your requiredAddons[] array under cfg patches. This is so the game knows to load you addon after the RHS one and to patch your data on top of the existing class data.

 

At a guess, it's in the addon class rhs_c_weapons so the required code would be:

requiredAddons[] = ["rhs_c_weapons"]

But you'll probably need to check first that this is the right one.

 

Then you call the parent class of the weapon you're trying to modify, then you write the class you want to edit, still with its inheritance to the parent class.

 

I don't know what the parent for rhs_weap_ak74m_Base_F is, but basically the part under cfgweapons would be like this:

class parentClass; //External Class Reference

class rhs_weap_ak74m_Base_F : parentClass
{
    #include "\z\ace\addons\ai\arc_rifle.hpp"
};

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

×