Sign in to follow this  
Followers 0
SpeedSter

How to override config.bin class values?

4 posts in this topic

I swear this feels a lot like my last post, but this is different. I am trying to change the member variables of the SnapPositions in the CfgConstruction class. This is located both in the exile_server config.bin and the exile_client.bin. I am trying to make a server addon that will override these snap values. I have made an exile_construct.pbo in the ExileServer addons folder. I need help because I have seen this done serverside, but I believe I am doing something wrong. I am obviously trying to do more than change these snap values, but this is the wrench in the road that will prevent me from further coding new exile construction features.

My config.cpp looks similar to the following:

class CfgPatches
{
    class exile_construct
	{
        requiredVersion = 0.1;
        requiredAddons[] = {"exile_server","exile_client"};
        units[] = {};
        weapons[] = {};
    };
};
/* Tried with and without pre/posInit
class CfgFunctions
{
    class exile_construct
	{
        class main
		{
            file="exile_construct\bootstrap";
            class preInit {preInit = 1;};
            class postInit {postInit = 1;};
        };
    };
};
*/
class AbstractConstruction;
class CfgConstruction
{
	class AbstractWall: AbstractConstruction
	{
		class SnapPositions
		{
			Wall01[]={0,0,0}; //Set to zero just for an example
			Wall02[]={0,0,0};
			Wall03[]={0,0,0};
			Wall04[]={0,0,0};
			Floor01[]={0,2.875,3};
			Floor02[]={0,-2.875,3};
		};
		class SnapObjects
		{
			class Exile_Construction_WoodWallHalf_Static
			{
				positions[]=
				{
					"Wall01",
					"Wall02",
					"Wall03",
					"Wall04"
					//Took out Wall05 - 08
				};
			};
			...//the rest of the objects follow
		};
	};
};

My addon has no functions, so when I used pre/postInit my preInit looked like this:

{
    _code = compileFinal (preprocessFileLineNumbers (_x select 1));
    missionNamespace setVariable [(_x select 0), _code];
}
forEach
[
];

Edit1 20170904: Seems like the ExileClient_construction_thread and my ExileServer_system_checkClass get different values for output.

My ExileServer_system_checkClass code:

private["_array"];
_array = getArray (configFile >> "CfgConstruction" >> "AbstractWall" >> "SnapPositions" >> "Wall01");
{
	if( _forEachIndex == 0)then { format["Wall01 X: %1",_x] call ExileServer_util_log;};
	if( _forEachIndex == 1)then { format["Wall01 Y: %1",_x] call ExileServer_util_log;};
	if( _forEachIndex == 2)then { format["Wall01 Z: %1",_x] call ExileServer_util_log;};
}
forEach _array;

//Outputs the value I want them to be; Even if I check against ConcreteDoor instead of Abstract wall I get the same output
14:52:50 "ExileServer - Wall01 X: -3"
14:52:50 "ExileServer - Wall01 Y: 1.5"
14:52:50 "ExileServer - Wall01 Z: 0"

ExileClient_construction_thread code:

			case 3:
			{
				ExileClientConstructionIsSnapped = false;
				if (ExileClientConstructionIsInSelectSnapObjectMode) then 
				{
					ExileClientConstructionPossibleSnapPositions = [];
					ExileClientConstructionCurrentSnapToObject = objNull;
					_position = getPosATL player;
					_position set [2, -500]; 
					_rotation = (ExileClientConstructionRotation + (getDir player) + 360) % 360;
					_vectorDirection = [sin(_rotation), cos(_rotation), 0]; 
					_potentionalSnapObject = cursorTarget;
					if !(isNull _potentionalSnapObject) then
					{
						if (_potentionalSnapObject distance player < 12) then 
						{
							_snapToClassName = typeOf _potentionalSnapObject;
							if (_snapToClassName in ExileClientConstructionSnapToObjectClassNames) then
							{
								ExileClientConstructionCurrentSnapToObject = _potentionalSnapObject;
								_snapToConfig = ("getText(_x >> 'staticObject') == _snapToClassName" configClasses(configFile >> "CfgConstruction")) select 0;
								//Begin my check
								diag_log format["Not array, _snapToConfig = %1", _snapToConfig];
								//End my check
								{
									_snapPosition = getArray (_snapToConfig >> "SnapPositions" >> _x);
									//Begin my check
									_snapPositionName = _x;
									{
										if( _forEachIndex == 0)then { diag_log format["%1 X: %2", _snapPositionName, _x]};
										if( _forEachIndex == 1)then { diag_log format["%1 Y: %2", _snapPositionName, _x]};
										if( _forEachIndex == 2)then { diag_log format["%1 Z: %2", _snapPositionName, _x]};
									}
									forEach _snapPosition;
									//End my check
									_possibleSnapPosition = ASLtoATL (AGLtoASL (_potentionalSnapObject modelToWorld _snapPosition));
									ExileClientConstructionPossibleSnapPositions pushBack _possibleSnapPosition;
								}
								forEach getArray (ExileClientConstructionConfig >> "SnapObjects" >> _snapToClassName >> "positions");
							};
						};
					};	
				}
                          
//Output the old values, that I do not want
14:53:03 "Not array, _snapToConfig = bin\config.bin/CfgConstruction/ConcreteDoor"
14:53:03 "Wall01 X: -6"
14:53:03 "Wall01 Y: 0"
14:53:03 "Wall01 Z: 0"
14:53:03 "Wall02 X: -2.875"
14:53:03 "Wall02 Y: -2.875"
14:53:03 "Wall02 Z: 0"
14:53:03 "Wall03 X: 2.875"
14:53:03 "Wall03 Y: -2.875"
14:53:03 "Wall03 Z: 0"
14:53:03 "Wall04 X: 6"
14:53:03 "Wall04 Y: 0"
14:53:03 "Wall04 Z: 0"
14:53:03 "Wall05 X: 2.875"
14:53:03 "Wall05 Y: 2.875"
14:53:03 "Wall05 Z: 0"
14:53:03 "Wall06 X: -2.875"
14:53:03 "Wall06 Y: 2.875"
14:53:03 "Wall06 Z: 0"
14:53:03 "Wall07 X: 0"
14:53:03 "Wall07 Y: 0"
14:53:03 "Wall07 Z: 3"
14:53:03 "Wall08 X: 0"
14:53:03 "Wall08 Y: 0"
14:53:03 "Wall08 Z: -3"

 

Edited by SpeedSter
Still need help

Share this post


Link to post
Share on other sites

Hi dude, im very interested in doing a similiar server-side-addon .pbo. I do not have much experience in Arma scripting, but im trying to override:

class CfgMagazines

class AbstractConstruction

class CfgConstruction

class CfgVehicles

...based in "Extended Base Mod" and "DonkeyPuncheD Exile Addon Mod" i only want to add vanilla arma buildings into the exile construction base system.

Have you had any success with your idea?

Share this post


Link to post
Share on other sites
Advertisement
On 9/6/2017 at 5:34 PM, MARKKOS said:

server-side-addon .pbo

I'm pretty sure you it's not possible to override/outsource server sided:

CfgVehicles

CfgMagazines

@SpeedSter

Why don't just outsource cfgConstructions class into missionfile/config.cpp and point to missionconfigfile? Shouldn't that work at all?

_snapToConfig = ("getText(_x >> 'staticObject') == _snapToClassName" configClasses(missionconfigFile >> "CfgConstruction")) select 0;

 

Edited by WURSTKETTE

Share this post


Link to post
Share on other sites

I also interested in changing only one line in exile_client config.bin. I want to make it possible to open food cans with a Exile_Item_Knife in addition to Exile_Item_CanOpener.

 I found out that this check is "hidden" inside config.bin , class CfgMagazines >     class Exile_AbstractItem_Interaction_Eating_Can: Exile_AbstractItem_Interaction_Eating  .   Is it possible to call for customized value for this somehow?

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.