Jump to content

He-Man

Developer
  • Posts

    808
  • Joined

  • Last visited

  • Days Won

    63

Posts posted by He-Man

  1. EPOCH_isBuildAllowed.sqf:

    Spoiler

    if (getNumber(_config >> "buildingNearbyMilitary") == 0) then{
        _range = getNumber(_config >> "buildingNearbyMilitaryRange");
        if (_range > 0) then {
            _restricted = nearestObjects [player, ["ProtectionZone_Invisible_F","Cargo_Tower_base_F","Cargo_HQ_base_F","Cargo_Patrol_base_F","Cargo_House_base_F"], 300];
        } else {
            _restricted = nearestObjects [player, ["Cargo_Tower_base_F","Cargo_HQ_base_F","Cargo_Patrol_base_F","Cargo_House_base_F"], _range];
            _restricted append (nearestObjects [player, ["ProtectionZone_Invisible_F","Cargo_Tower_base_F","Cargo_HQ_base_F","Cargo_Patrol_base_F","Cargo_House_base_F"], 300]);
        };
    } else {
        _restricted = nearestObjects [player, ["ProtectionZone_Invisible_F"], 300];
    };

    should be

    Spoiler

    if (getNumber(_config >> "buildingNearbyMilitary") == 0) then{
        _range = getNumber(_config >> "buildingNearbyMilitaryRange");
        if (_range > 0) then {
            _restricted = nearestObjects [player, ["Cargo_Tower_base_F","Cargo_HQ_base_F","Cargo_Patrol_base_F","Cargo_House_base_F"], _range];
            _restricted append (nearestObjects [player, ["ProtectionZone_Invisible_F"], 300]);
        } else {
            _restricted = nearestObjects [player, ["ProtectionZone_Invisible_F","Cargo_Tower_base_F","Cargo_HQ_base_F","Cargo_Patrol_base_F","Cargo_House_base_F"], 300];
        };
    } else {
        _restricted = nearestObjects [player, ["ProtectionZone_Invisible_F"], 300];
    };

    Or am I wrong?
     

  2. I noticed, that we have to use remoteexec very carefully!

    While many tests, I found out, that the following code is very dangerous:

    _owner = owner _vehicle;

    [_blabla,_blablabla] remoteexec ["xxx",_owner];

    If _vehicle does not exists (because of a script failure or the vehicle no longer exists), the remoteexec will be executed on every client.

     

    Same for:

    [_blabla,_blablabla] remoteexec ["xxx",(owner _vehicle)];

     

    Better use directly:

    [_blabla,_blablabla] remoteexec ["xxx",_vehicle];

    If here the _vehicle does not exist, nothing will be executed.

     

    From https://community.bistudio.com/wiki/remoteExec:

    Object - the function will be executed only where unit is local

     

    So NEVER use the owner of anything for remoteexec!!!

     

    Some Epoch codes are also using the owner for remoteexecs.

    This should be changed...  

  3. Here the complete working files:

    client_init.sqf

    Spoiler

    /*
        Author: Aaron Clark - EpochMod.com

        Contributors:

        Description:
        Initalize variables used client side and start login FSM

        Licence:
        Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike

        Github:
        https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/init/client_init.sqf
    */
    EPOCH_CraftingItem = "";
    EPOCH_ESP_TARGETS = [];
    EPOCH_ESPMAP_TARGETS = [];
    EPOCH_ESPGROUPS = [];
    EPOCH_ESPGROUPCOLORS = [];
    EPOCH_ESP_PLAYER = false;
    EPOCH_ESP_VEHICLES = false;
    EPOCH_ESP_VEHICLEPLAYER = [];
    EPOCH_group_level_img = ["x\addons\a3_epoch_code\data\owner.paa", "x\addons\a3_epoch_code\data\mod.paa", "x\addons\a3_epoch_code\data\member.paa"];
    if (isNil 'EPOCH_diag_fps') then {
        EPOCH_diag_fps = 0;
    };
    EPOCH_playerIsSwimming = false;
    EPOCH_lastTrash = diag_tickTime;
    EPOCH_tradeDone = false;
    EPOCH_bankBalance = 0;
    EPOCH_antiWallCount = 0;
    EPOCH_lastTargetTime = diag_tickTime;
    EPOCH_lastSave = diag_tickTime;
    EPOCH_arr_countdown = [];
    EP_light = objNull;
    EPOCH_p2ptradeTarget = objNull;
    EPOCH_lastPlayerPos = getPosATL player;
    EPOCH_Holstered = "";
    Epoch_invited_GroupUID = "";
    Epoch_invited_GroupName = "";
    Epoch_invited_GroupUIDs = [];
    Epoch_invited_GroupUIDsPrev = [];
    Epoch_my_Group = [];
    EPOCH_lastPlayerPos = [0,0,0];
    EPOCH_prevOffer = [];
    EPOCH_drawIcon3d = false;
    EPOCH_velTransform = false;
    EPOCH_stabilityTarget = objNull;
    EPOCH_currentTarget = objNull;
    EPOCH_LootedBlds = [];
    EPOCH_lootObjects = [];
    EPOCH_soundLevel = 1;
    EPOCH_arr_interactedObjs = [];
    EPOCH_buildOption = 0;
    EPOCH_nearestLocations = [];

    ["EPOCH_onEachFrame", "onEachFrame", EPOCH_onEachFrame] call BIS_fnc_addStackedEventHandler;

    EPOCH_LastAirDrop = time;
    EPOCH_AirDropCheck = getNumber(getMissionConfig "CfgEpochAirDrop" >> "AirDropFreq");
    if(EPOCH_AirDropCheck < 120)then{EPOCH_AirDropCheck = 120;};
    EPOCH_AirDropChance = getNumber(getMissionConfig "CfgEpochAirDrop" >> "AirDropChance");
    if(EPOCH_AirDropChance < 0)then{EPOCH_AirDropChance = 101;EPOCH_AirDropCheck = 99999;};

    EPOCH_droneRndChance = 100;

    // Custom Keys
    EPOCH_keysActionPressed = false; //prevents EH spam
    0 call EPOCH_clientKeyMap;

    //ON INIT and RESPAWN
    call EPOCH_clientInit;

    [] execFSM "epoch_code\system\SPVEH.fsm";
    [] execFSM "epoch_code\system\player_login.fsm";

    true
     

    EPOCH_Group_update.sqf:

    Spoiler

    /*
        Author: Niklas Wagner - EpochMod.com

        Contributors: Aaron Clark

        Description:
        TODO: DESC-TBA

        Licence:
        Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike

        Github:
        https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/gui/group/EPOCH_Group_update.sqf
    */
    if (!isNull (findDisplay -1300)) then {
        (findDisplay -1300) closeDisplay 0;
        uisleep 0.2;                            // Ignatz
        createDialog "Epoch_myGroup";
    };
     

    EPOCH_server_upgradeGroup.sqf:

    Spoiler

    /*
        Author: Aaron Clark - EpochMod.com

        Contributors:

        Description:
        Add or remove members from a group

        Licence:
        Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike

        Github:
        https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server/compile/epoch_group/EPOCH_server_updatePlayerGroup.sqf
    */
    private ["_groupID","_selectedPlayerUID","_addOrRemove","_modOrMember","_modOrMemberRevert","_response","_contentArray","_modArray","_memberArray","_selectedPlayerName","_group","_removePlayerArray","_modOrMemberArray","_found"];

    if !([_this select 4, _this select 5] call EPOCH_server_getPToken) exitWith {};

    _groupID = _this select 0;
    if (_groupID == "") exitWith{ diag_log format["Epoch: GROUP: No Group Selected %1", _this]; };

    diag_log format["Epoch: GROUP: Update %1", _this];

    _selectedPlayerUID = _this select 1;
    _addOrRemove = _this select 2; //add = true
    _modOrMember = if (_this select 3) then [{3},{4}];
    _modOrMemberRevert = if (_this select 3) then [{4},{3}];

    // [_groupName, _leaderName, _groupSize, _modArray, _memberArray]
    _response = ["Group", _groupID] call EPOCH_fnc_server_hiveGETRANGE;
    if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
        _contentArray = _response select 1;

        //_groupName = _contentArray select 0;
        //_leaderName = _contentArray select 1;
        //_groupSize = _contentArray select 2;
        _modArray = _contentArray select 3;
        _memberArray = _contentArray select 4;

        if (_addOrRemove) then { //Add
            _selectedPlayerName = "Dead Player";

            {
                _selectedPlayerName = if (alive _x) then {name _x};
                if ((_x getVariable ["GROUP",""]) != _groupID) then {
                    _x setVariable ["GROUP", _groupID];
                    _group = grpNull;
                    {
                        if ((_x getVariable["GROUP",""]) == _groupID) exitWith {
                            _group = group _x;
                        };
                    }count playableUnits;

                    if (isNull _group) then {
                        _group = createGroup west;
                    };
                    [_x] joinSilent _group;
                };
            } forEach (allPlayers select {getPlayerUID _x == _selectedPlayerUID});
            
    // new ...
            _memberrange = ["PlayerData", _selectedPlayerUID] call EPOCH_fnc_server_hiveGETRANGE;
            if (count (_memberrange select 1) > 0) then {
                if (typename (_memberrange select 1 select 0) == "STRING") then {
                    _selectedPlayerName = _memberrange select 1 select 0;
                };
            };
    // ... new

            _removePlayerArray = _contentArray select _modOrMemberRevert;

            {
                if (_x select 0 == _selectedPlayerUID) exitWith {
                    _removePlayerArray deleteAt _forEachIndex;
                    _contentArray set [_modOrMemberRevert, _removePlayerArray];
                };
            } forEach _removePlayerArray;

            _modOrMemberArray = _contentArray select _modOrMember;
            _modOrMemberArray pushBack [_selectedPlayerUID, _selectedPlayerName];

            _contentArray set [_modOrMember, _modOrMemberArray];

        } else {

            //Remove
            _found = false;

            {
                _x setVariable ["GROUP", nil];
                [_x] joinSilent (createGroup west);
                [["resetGroup", true], _x] call EPOCH_sendRemoteExecClient;
            } forEach (allPlayers select {getPlayerUID _x == _selectedPlayerUID});

            {
                if (_x select 0 == _selectedPlayerUID) exitWith {
                    _memberArray deleteAt _forEachIndex;
                    _found = true;
                };
            } forEach _memberArray;

            if (_found) then {
                _contentArray set [4, _memberArray];
            } else {
                {
                    if (_x select 0 == _selectedPlayerUID) exitWith {
                        _modArray deleteAt _forEachIndex;
                        _found = true;
                    };
                } forEach _modArray;
                _contentArray set [3, _modArray];
            };

            if (!_found) then {
                diag_log format ["Epoch: %1 cannot remove Player! (%1)", __FILE__, _this]
            };
        };

        {
            [["groupUpdate", _contentArray], _x] call EPOCH_sendRemoteExecClient;
        } forEach (allPlayers select {(_x getVariable["GROUP", ""]) == _groupID});

        // Save Group Data
        ["Group", _groupID, _contentArray] call EPOCH_fnc_server_hiveSET;
    };
     

     

  4. To give the Buttons their functions back, change in ...\mpmissions\epoch.xxx\epoch_code\init\client_init.sqf:

    EPOCH_group_level_img = ["x\addons\a3_epoch_code\Data\owner.paa", "x\addons\a3_epoch_code\Data\mod.paa", "x\addons\a3_epoch_code\Data\member.paa"];

    to

    EPOCH_group_level_img = ["x\addons\a3_epoch_code\data\owner.paa", "x\addons\a3_epoch_code\data\mod.paa", "x\addons\a3_epoch_code\data\member.paa"];

     

    When adding a member / change moderators...

    The diplay reloads, but is empty. To prevent an empty display add in ...\mpmissions\epoch.xxx\epoch_code\gui\scripts\group\EPOCH_Group_update.sqf a sleep:

    if (!isNull (findDisplay -1300)) then {
        (findDisplay -1300) closeDisplay 0;
        createDialog "Epoch_myGroup";
    };

    to

    if (!isNull (findDisplay -1300)) then {
        (findDisplay -1300) closeDisplay 0;
        uisleep 0.2;     // new
        createDialog "Epoch_myGroup";
    };
     

    Optional: By changing moderators...

    If the player is not ingame, you become a "dead player" in your group array. To prevent this, you can take the player name from the db. To do this, change in ...\a3_epoch_server\compile\epoch_group\EPOCH_server_upgradeGroup.sqf:

    Spoiler

            {
                _selectedPlayerName = if (alive _x) then {name _x};
                if ((_x getVariable ["GROUP",""]) != _groupID) then {
                    _x setVariable ["GROUP", _groupID];
                    _group = grpNull;
                    {
                        if ((_x getVariable["GROUP",""]) == _groupID) exitWith {
                            _group = group _x;
                        };
                    }count playableUnits;

                    if (isNull _group) then {
                        _group = createGroup west;
                    };
                    [_x] joinSilent _group;
                };
            } forEach (allPlayers select {getPlayerUID _x == _selectedPlayerUID});
            
            _removePlayerArray = _contentArray select _modOrMemberRevert;

    to 

    Spoiler

            {
                _selectedPlayerName = if (alive _x) then {name _x};
                if ((_x getVariable ["GROUP",""]) != _groupID) then {
                    _x setVariable ["GROUP", _groupID];
                    _group = grpNull;
                    {
                        if ((_x getVariable["GROUP",""]) == _groupID) exitWith {
                            _group = group _x;
                        };
                    }count playableUnits;

                    if (isNull _group) then {
                        _group = createGroup west;
                    };
                    [_x] joinSilent _group;
                };
            } forEach (allPlayers select {getPlayerUID _x == _selectedPlayerUID});
            
    // new ...
            _memberrange = ["PlayerData", _selectedPlayerUID] call EPOCH_fnc_server_hiveGETRANGE;
            if (count (_memberrange select 1) > 0) then {
                if (typename (_memberrange select 1 select 0) == "STRING") then {
                    _selectedPlayerName = _memberrange select 1 select 0;
                };
            };
    // ... new

            _removePlayerArray = _contentArray select _modOrMemberRevert;

    I hope this helps...

    He-Man

  5. I noticed, that ForceStaticTraders = true and the defined Traderpositions not really works.

    I set ForceStaticTraders = true, and the Trader Positions are often not in traderBlds from CfgEpoch.

    That's because this lines:

    EPOCH_server_spawnTraders:

    Spoiler

                _pos = _home;
    ...

                      if (daytime > (_schedule select 0) && daytime < (_schedule select 1)) then {
                            _pos = _work;
                        };

    This causes, that the Trader Position is sometimes _home and sometimes _work.

    But the traderBlds have only effect on the _work position. _home is absolutely random.

     

    To fix this, Change:

    EPOCH_server_spawnTraders.sqf:

    Spoiler

                        if (daytime > (_schedule select 0) && daytime < (_schedule select 1)) then {
                            _pos = _work;
                        };
                        if (EPOCH_forceStaticTraders) then {     // new
                            _pos = _work;                                             // new
                        };                                                                       // new

     

    EPOCH_server_loadTraders.sqf:

    Spoiler

                    if (daytime > (_schedule select 0) && daytime < (_schedule select 1)) then {
                        _pos = (_work select 0);
                    };
                    if (EPOCH_forceStaticTraders) then {        // new
                        _pos = (_work select 0);                           // new
                    };                                                                     // new

    Now the Traderposition is always the _work position, if forceStaticTraders = true and the traderBlds from CfgEpoch will take effect.

  6. Hi,

    I have noticed a random error while interaction with the Traders.

    The Message is:

    Spoiler

    Error in expression <ursorTarget getVariable['AI_SLOT', -1]) != -1))} else {false};>
     0:41:53   Error position: <!= -1))} else {false};>
     0:41:53   Error Allgemeiner Fehler in Ausdruck

    I also got this message on a self written script, that checks all Trader inventory.

    Anybody an Idea, why  ... getVariable['AI_SLOT', -1]) != -1... sometimes give an Error?

    It happens only on some Traders and not every restart the same Trader!.

    If I check the AI_Slot by hand (with console), it push me back a valid value.

     

    For my own script, I have fixed it by checking the variable AI_Items.

    But I'm wondering about this problem...

  7. Found the problem! It is not an Epoch failure, its from Infistar!

    - Open A3AH.sqf

    - Search for EPOCH_server_save_vehicles

    - Change

    EPOCH_arr_interactedObjs remoteExec['EPOCH_server_save_vehicles', 2];

    to

    [EPOCH_arr_interactedObjs] remoteExec['EPOCH_server_save_vehicles', 2];

     

    This failure also causes, that Vehicles / Storages will not be saved after put in / take items, so chage it !!!

  8. Execvm is no Problem, but not execvm via remoteexec. What exactly do you want? 

    Execvm execute a local sqf file

    Execvm via remoteexec executes a given Function on a remote client or the Server.

    Edit: Sorry, misunderstood your plan. Your first post sounds, as you tried to remoteexec a function given from the client on the Server. 

×
×
  • Create New...