Jump to content
Sign in to follow this  
UNN

External Base Classes

Recommended Posts

In OFP we had to define all the inherited classes, like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgVehicles

       {

       class All {};

       class AllVehicles: All {};

       class Land: AllVehicles {};

       class Man: Land {};

       class Soldier: Man {};

       class SoldierWB: Soldier {};

       

       class MySoldier : SoldierWB

               {

               displayName = "My Soldier";

               };

In Arma, thanks to external bases classes we can now do this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class cfgVehicles

       {

       class SoldierWB;

     

       class MySoldier : SoldierWB

               {

               displayName = "My Soldier";

               };

       };

Does anyone know if it's possible to define our own external base classes?

I would like to be able to do something like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class cfgVehicles

       {

       class UNNBaseClass;

     

       class MySoldier : UNNBaseClass

               {

               displayName = "My Soldier";

               };

       };

Cheers

Share this post


Link to post
Share on other sites

Sure, you can load any class from any config. Make sure you have the required Cfg in your requiredAddons section, though. smile_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]Sure, you can load any class from any config. Make sure you have the required Cfg in your requiredAddons section, though.

Thats what I thought, so I did try that already, without much luck. Although you don't have to include any of the default Arma Cfg's to the requiredAddons section, to inherit from their base classes?

But it's late and it was a last minute thing. I will give it another go tomorrow.

Cheers

Share this post


Link to post
Share on other sites
Quote[/b] ]Although you don't have to include any of the default Arma Cfg's to the requiredAddons section, to inherit from their base classes?

i guess you don't have to include any ArmA cfgPatches classes.

at least if you did the requiredAddons section right in your addon.

what about posting your example configs?

Share this post


Link to post
Share on other sites

You should add ArmA cfgs there as well.

Example:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches

{

class CWR_weapons_launchers

{

units[] = {};

weapons[] = {};

requiredVersion = 0.33;

requiredAddons[] = {Cold_War_Rearmed, CAWeapons};

};

};

class CfgWeapons

{

class RocketPods;

class FFARLauncher: RocketPods

{

displayName = "$STR_DN_FFAR";

sound[] = {"\ca\Weapons\Data\Sound\Javelin1",31.622778,1};

soundFly[] = {"\ca\Weapons\Data\Sound\rocket_fly1",25.118866,0.800000};

magazines[] =

{

"14Rnd_FFAR","38Rnd_FFAR","28Rnd_FFAR",

//add more classes here if needed

"ZuniLauncherOH"

};

};

};This does not work, as the CAA10 does overwrite this class as well. If I write this (note requiredAddons):<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches

{

class CWR_weapons_launchers

{

units[] = {};

weapons[] = {};

requiredVersion = 0.33;

requiredAddons[] = {Cold_War_Rearmed, CAWeapons,CAA10};

};

};

class CfgWeapons

{

class RocketPods;

class FFARLauncher: RocketPods

{

displayName = "$STR_DN_FFAR";

sound[] = {"\ca\Weapons\Data\Sound\Javelin1",31.622778,1};

soundFly[] = {"\ca\Weapons\Data\Sound\rocket_fly1",25.118866,0.800000};

magazines[] =

{

"14Rnd_FFAR","38Rnd_FFAR","28Rnd_FFAR",

//add more classes here if needed

"ZuniLauncherOH"

};

};

};It works perfectly.

So you should put at least the config with the "latest" definitions of the required classes in your requiredAddons section.

Share this post


Link to post
Share on other sites

After your reply I knocked up a basic example to test and it works without any problems now. So I can only put my previous problems down to fatigue, after spending most of the night trying to inherit from CfgMovesBasic. Not had chance to test it with my new CfgMovesBasic class, but I'm sure it will be ok now. So thanks for setting me straight.

As a side note, I could still get my basic test to work even without the RequiredAddons section:

MyBaseClass.pbo:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches

       {

       class MyBaseClass

               {

               units[] = {"MyBaseSoldier"};

               weapons[] = {};

               requiredVersion = 0.1;

               requiredAddons[] = {};

               };

       };

class cfgVehicles

       {

       class SoldierWB;

       class MyBaseSoldier : SoldierWB

               {

               Scope=1;

               DisplayName="";

               };

       };

Which I then reference using...

AWestSoldier.pbo:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches

       {

       class AWestSoldier

               {

               units[] = {"AWestSoldier"};

               weapons[] = {};

               requiredVersion = 0.1;

               requiredAddons[] = {};

               };

       };

class cfgVehicles

       {

       class MyBaseSoldier;

       class AWestSoldier : MyBaseSoldier

               {

               Scope=2;

               DisplayName="My New Soldier";

               };

       };

Like I said, it appears to work without any problems. But I'm sure It's better to explicitly define the required addons section as you do in your example. As it will probably help to avoid problems in the future, when things start to get more complicated.

Cheers

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  

×