Jump to content
Sign in to follow this  
MrSherenai

Overwrite classes

Recommended Posts

Hey dudes,

I' new to Arma2 scripting, so I started with analyzing existing mods to learn the basics because I cant find any good tutorials for the basics that teach the background of what is done. My first "project" is very simple I think, but I cant get it to work. So here is the situation. I want to make a fix that makes two mods compatible with each other without editing the mods itself cuz that would show lack of respect to the author IMO and I'm not sure about copyright at all. One mod overwrites some object classes, see this code:

class CfgNonAIVehicles
{
access = 0;
class StreetLamp
{
	scope = 0;
	model = "";
	destrType = "DestructTree";
	simulation = "thing";
};
class Land_lampa_sidl: StreetLamp
{
	scope = 1;
	model = "\ca\buildings\Misc\lampa_sidl";
};
class Land_lampa_sidl_2: StreetLamp
{
	scope = 1;
	model = "\ca\buildings\Misc\lampa_sidl_2";
};
class Land_lampa_sidl_3: StreetLamp
{
	scope = 1;
	model = "\ca\buildings\Misc\lampa_sidl_3";
};
class Land_lampa_ind: StreetLamp
{
	scope = 1;
	model = "\ca\buildings\Misc\lampa_ind";
};
class Land_lampa_ind_zebr: StreetLamp
{
	scope = 1;
	model = "\ca\buildings\Misc\lampa_ind_zebr";
};
};

The other mod is using the streetlamps so I wrote this to overwrite the overwritten class once again:

// some basic defines
#define TWest 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7

#define true 1
#define false 0

// type scope
#define private 0
#define protected 1
#define public 2

class CfgPatches
   {

   class reEnable
       {
       units[]={};
       weapons[]={};
       requiredAddons[]= {};

       };
   };

class CfgNonAIVehicles {
   access = ReadAndWrite;

   class StreetLamp {
   aggregatereflectors[] = {};
   animated = 0;
   armorlights = 1;
   armorstructural = 1;
   brightness = 0.15;
   colorambient[] = {0.02, 0.02, 0.02};
   colordiffuse[] = {0.9, 0.8, 0.6};
   destrtype = "DestructTree";
   model = "";
   simulation = "StreetLamp";
   class HitPoints {
       class HitBulb {
           armor = 1;
           material = 60;
           name = "lampa";
           passthrough = 1;
       };
   };
   class Reflectors {
       class LampLight {
           ambient[] = {0.1, 0.1, 0.1, 1};
           brightness = 0.2;
           color[] = {0.9, 0.8, 0.6, 1};
           direction = "";
           hitpoint = "lampa";
           position = "Light";
           selection = "";
           size = 0.5;
       };
   };
};


   class Land_lampa_sidl : StreetLamp {
       scope = protected;
       model = "\ca\buildings\Misc\lampa_sidl";
   };

   class Land_lampa_sidl_2 : StreetLamp {
       scope = protected;
       model = "\ca\buildings\Misc\lampa_sidl_2";
   };

   class Land_lampa_sidl_3 : StreetLamp {
       scope = protected;
       model = "\ca\buildings\Misc\lampa_sidl_3";
   };

   class Land_lampa_ind : StreetLamp {
       scope = protected;
       model = "\ca\buildings\Misc\lampa_ind";
   };

   class Land_lampa_ind_zebr : StreetLamp {
       scope = protected;
       model = "\ca\buildings\Misc\lampa_ind_zebr";
   };
};

As stated above this is not working at all. So, what did I do wrong? Syntax errors in the config.cpp? Do I have to find the standard config for the other lamp classes too to make them working again? (Forexample for class Land_lampa_ind_zebr ) Or is this the wrong way to solve my problem anyway?

Greetings and thanks in advance

Share this post


Link to post
Share on other sites

You need to make your config loaded AFTER the other two - otherwise yours gets overwritten by them.

You do this by adding their cfgPatches classes into your requiredAddons section.

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  

×