SpeedSter

Member
  • Content count

    4
  • Donations

    0.00 EUR 
  • Joined

  • Last visited

Everything posted by SpeedSter

  1. SpeedSter

    Exile Beginners Guide *Updated*

    This is pinned in the wrong forum
  2. 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"
  3. SpeedSter

    How to override existing class values?

    Thanks Mezo, I already had my addon settings in my exile_server_config, but I wanted to move those settings to my server addon config.cpp. I probably fat fingered some code or forgot to save some file before packing. However, it is working now as an addon, which is nice because it centralizes the time settings in my addon.
  4. New to sqf and have experience in cpp. I have written a server side exile addon and want to store my defined values (class member variables) in the addons config.cpp, instead of the mission or server_config config.cpp. For example accessing a defined value or class member is done as such, configFile >> "CfgSettings" >> "SomeClass" >> "somesetting"; or for mission config.cpp using missionConfigFile. My config.cpp is stored in myaddon.pbo. I want to do this without making the values global variables, or by passing local variables as parameters to another function. Hopefully, someone can shed some light on this, or maybe I am going about this the wrong way. Basically what I am trying to do is either add variables to an existing class, such as class Time or class Weather, define my own class, or use class inheritance, and add my variables in through the addons config.cpp, so that they can be accessed by my newly added functions. Instead of users having to add my variables to the main config, they can just install the addon and edit the config.cpp in the addon pbo Edit: Not going to lie, but I had made a change earlier and published it to my server and noticed later some log output showing it working. I just made a single class with no base class or parent, put in my config.cpp "configFile >> "MyClass" >> "variable;" and it worked. I'm guessing exile or the game code merges config files at some point? I must have been using class inheritance wrong earlier. Edit2: In my addons config.cpp. How do I override the existing "class Time" variables and add my own variables in. Can I only override existing variables of the Time class and need create my own class for my new variables? In other words, say I am making a time addon that depends on the exile_server_config time settings and want to centralize those settings with my addon time settings. This is how I have tried to do it: class CfgSettings; class Time : CfgSettings { // Uses Dedicated Server time as ingame Time useRealTime = 0; // Will overide RealTime useStaticTime = 1; // time in ARMA FORMAT << CONFIG // https://community.bistudio.com/wiki/setDate staticTime[] = {2039,10,24,8,0}; // My inserted values newvalue = 0; anothernewvalue = 1; }; Edit3: I must have been looking at code for too long. Anyway I got it working as I had originally done it. This will override the original time values and add my own in. Another way is to make my own class with CfgSettings as parent. class CfgSettings { class Time { // Uses Dedicated Server time as ingame Time useRealTime = 0; // Will overide RealTime useStaticTime = 1; // time in ARMA FORMAT << CONFIG // https://community.bistudio.com/wiki/setDate staticTime[] = {2039,10,24,8,0}; // My inserted values newvalue = 0; anothernewvalue = 1; }; };