Jump to content

[Release] Build Vectors - Rotate objects in Dayz Epoch (v2.34 P4L & non-P4L)


striker

Recommended Posts

Hi Everyone,
 
I've got a problem with vector build. Since I've installed the mod the worldspace of my vehicles don't sync with the database. If i get in a car and get out the worldspace changes in all cases to any, any. My rpt says:
 
Error in expression <eCargoGlobal  _object;


_object setdir _dir;

if(_vecExists)then{
_object setVe>
19:32:13   Error position: <_dir;

if(_vecExists)then{
_object setVe>
19:32:13   Error Undefined variable in expression: _dir
 
This is my server_monitor.sqf:

private ["_nul","_result","_pos","_wsDone","_dir","_isOK","_countr","_objWpnTypes","_objWpnQty","_dam","_selection","_totalvehicles","_object","_idKey","_type","_ownerID","_worldspace","_intentory","_hitPoints","_fuel","_damage","_key","_vehLimit","_hiveResponse","_objectCount","_codeCount","_data","_status","_val","_traderid","_retrader","_traderData","_id","_lockable","_debugMarkerPosition","_vehicle_0","_bQty","_vQty","_BuildingQueue","_objectQueue","_superkey","_shutdown","_res","_hiveLoaded","_ownerUID","_oQty","_originsQueue","_isOrigins"];



dayz_versionNo =         getText(configFile >> "CfgMods" >> "DayZ" >> "version");
dayz_hiveVersionNo =     getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");

_hiveLoaded = false;

waitUntil{initialized}; //means all the functions are now defined

diag_log "HIVE: Starting";

waituntil{isNil "sm_done"}; // prevent server_monitor be called twice (bug during login of the first player)

// Custom Configs
if(isnil "MaxVehicleLimit") then {
    MaxVehicleLimit = 250;
};

if(isnil "MaxDynamicDebris") then {
    MaxDynamicDebris = 100;
};
if(isnil "MaxAmmoBoxes") then {
    MaxAmmoBoxes = 3;
};
if(isnil "MaxMineVeins") then {
    MaxMineVeins = 5;
};
// Custon Configs End

if (isServer && isNil "sm_done") then {

    serverVehicleCounter = [];
    _hiveResponse = [];

    for "_i" from 1 to 5 do {
        diag_log "HIVE: trying to get objects";
        _key = format["CHILD:302:%1:", dayZ_instance];
        _hiveResponse = _key call server_hiveReadWrite;  
        if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")})) then {
            if ((_hiveResponse select 1) == "Instance already initialized") then {
                _superkey = profileNamespace getVariable "SUPERKEY";
                _shutdown = format["CHILD:400:%1:", _superkey];
                _res = _shutdown call server_hiveReadWrite;
                diag_log ("HIVE: attempt to kill.. HiveExt response:"+str(_res));
            } else {
                diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse));
            
            };
            _hiveResponse = ["",0];
        } else {
            diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" );
            _i = 99; // break
        };
    };
    _BuildingQueue = [];
    _objectQueue = [];
    if (isNil "_originsQueue") then {
    _originsQueue = [];
    };
    owner_B1 = [];
    owner_B2 = [];
    owner_B3 = [];
    owner_H1 = [];
    owner_H2 = [];
    owner_H3 = [];
    owner_SG = [];
    owner_LG = [];
    owner_KING = [];
    owner_SH = [];
    
    if ((_hiveResponse select 0) == "ObjectStreamStart") then {
    
        // save superkey
        profileNamespace setVariable ["SUPERKEY",(_hiveResponse select 2)];
        
        _hiveLoaded = true;
    
        diag_log ("HIVE: Commence Object Streaming...");
        _key = format["CHILD:302:%1:", dayZ_instance];
        _objectCount = _hiveResponse select 1;
    _bQty = 0;
    _vQty = 0;
    _oQty = 0;

    for "_i" from 1 to _objectCount do {
    _isOrigins = false;
    _hiveResponse = _key call server_hiveReadWriteLarge;
    //diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);
    {
        if((_hiveResponse select 2) isKindOf _x) exitWith {
            _originsQueue set [_oQty,_hiveResponse];
            _oQty = _oQty + 1;
            _isOrigins = true;
        };
    } forEach DZE_Origins_Buildings;
    if(!_isOrigins) then {
        if ((_hiveResponse select 2) isKindOf "ModularItems") then {
            _BuildingQueue set [_bQty,_hiveResponse];
            _bQty = _bQty + 1;
        } else {
            _objectQueue set [_vQty,_hiveResponse];
            _vQty = _vQty + 1;
        };
    };
};
        diag_log ("HIVE: got " + str(_bQty) + " Epoch Objects and " + str(_vQty) + " Vehicles");
    };
    
    // # NOW SPAWN OBJECTS #
    _totalvehicles = 0;
    {
        _idKey =         _x select 1;
        _type =            _x select 2;
        _ownerID =         _x select 3;

        _worldspace =     _x select 4;
        _intentory =    _x select 5;
        _hitPoints =    _x select 6;
        _fuel =            _x select 7;
        _damage =         _x select 8;
        
        _dir = 0;
        _pos = [0,0,0];
        _wsDone = false;
        if (count _worldspace >= 2) then
        {
            _dir = _worldspace select 0;
            if (count (_worldspace select 1) == 3) then {
                _pos = _worldspace select 1;
                _wsDone = true;
            }
        };            
        
        if (!_wsDone) then {
            if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
            _pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
            if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
            diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
        };
        
        _vector = [[0,0,0],[0,0,0]];
        _vecExists = false;
        _ownerPUID = "0";    
        if (count _worldspace >= 3) then{
          if(count _worldspace == 3) then{
            if(typename (_worldspace select 2) == "STRING")then{
                _ownerPUID = _worldspace select 2;
                 }else{
                 if(typename (_worldspace select 2) == "ARRAY")then{
                    _vector = _worldspace select 2;
                    if(count _vector == 2)then{
                        if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
                            _vecExists = true;
                        };
                    };
                };                    
            };
            
           }else{
           //Was not 3 elements, so check if 4 or more
           if(count _worldspace == 4) then{
            if(typename (_worldspace select 3) == "STRING")then{
                _ownerPUID = _worldspace select 3;
            }else{
                if(typename (_worldspace select 2) == "STRING")then{
                    _ownerPUID = _worldspace select 2;
                };
            };
    
    
            if(typename (_worldspace select 2) == "ARRAY")then{
                _vector = _worldspace select 2;
                if(count _vector == 2)then{
                    if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
                        _vecExists = true;
                    };
                };
            }else{
                if(typename (_worldspace select 3) == "ARRAY")then{
                    _vector = _worldspace select 3;
                    if(count _vector == 2)then{
                        if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
                            _vecExists = true;
                        };
                    };
                };
            };
            
        }else{
            //More than 3 or 4 elements found
            //Might add a search for the vector, ownerPUID will equal 0
        };
    };
};
        

        if (_damage < 1) then {
            //diag_log format["OBJ: %1 - %2", _idKey,_type];
            
            //Create it
            _object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
            if (typeOf (_object) in  DZE_DoorsLocked) then {
            _object setVariable ["doorfriends", _intentory, true];
            };
            _object setVariable ["lastUpdate",time];
            _object setVariable ["ObjectID", _idKey, true];
            if (typeOf (_object) == "Plastic_Pole_EP1_DZ") then {
            _object setVariable ["plotfriends", _intentory, true];
            };

            _lockable = 0;
            if(isNumber (configFile >> "CfgVehicles" >> _type >> "lockable")) then {
                _lockable = getNumber(configFile >> "CfgVehicles" >> _type >> "lockable");
            };

            // fix for leading zero issues on safe codes after restart
            if (_lockable == 4) then {
                _codeCount = (count (toArray _ownerID));
                if(_codeCount == 3) then {
                    _ownerID = format["0%1", _ownerID];
                };
                if(_codeCount == 2) then {
                    _ownerID = format["00%1", _ownerID];
                };
                if(_codeCount == 1) then {
                    _ownerID = format["000%1", _ownerID];
                };
            };

            if (_lockable == 3) then {
                _codeCount = (count (toArray _ownerID));
                if(_codeCount == 2) then {
                    _ownerID = format["0%1", _ownerID];
                };
                if(_codeCount == 1) then {
                    _ownerID = format["00%1", _ownerID];
                };
            };

            _object setVariable ["CharacterID", _ownerID, true];
            
            clearWeaponCargoGlobal  _object;
            clearMagazineCargoGlobal  _object;
            // _object setVehicleAmmo DZE_vehicleAmmo;
            
            _object setdir _dir;
            
            if(_vecExists)then{
                _object setVectorDirAndUp _vector;
            };
            
            _object setposATL _pos;
            _object setDamage _damage;
            
            if ((typeOf _object) in dayz_allowedObjects) then {
                _object setVariable["memDir",_dir,true];
                if (DZE_GodModeBase) then {
                    _object addEventHandler ["HandleDamage", {false}];
                } else {
                    _object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
                };
                // Test disabling simulation server side on buildables only.
                _object enableSimulation false;
                // used for inplace upgrades && lock/unlock of safe
                _object setVariable ["OEMPos", _pos, true];
                
            };
            
            /*ZSC*/
            if( count (_intentory) > 3)then{
            _object setVariable ["bankMoney", _intentory select 3, true];
            }else{
               _object setVariable ["bankMoney", 0, true];
            };
            /*ZSC*/

            if ((count _intentory > 0) && !(typeOf( _object) == "Plastic_Pole_EP1_DZ") && !(typeOf( _object) in  DZE_DoorsLocked)) then {
                if (_type in DZE_LockedStorage || _type in DZE_Origins_Buildings) then {
                    // Fill variables with loot
                    _object setVariable ["WeaponCargo", (_intentory select 0),true];
                    _object setVariable ["MagazineCargo", (_intentory select 1),true];
                    _object setVariable ["BackpackCargo", (_intentory select 2),true];
                } else {

                    //Add weapons
                    _objWpnTypes = (_intentory select 0) select 0;
                    _objWpnQty = (_intentory select 0) select 1;
                    _countr = 0;                    
                    {
                        if(_x in (DZE_REPLACE_WEAPONS select 0)) then {
                            _x = (DZE_REPLACE_WEAPONS select 1) select ((DZE_REPLACE_WEAPONS select 0) find _x);
                        };
                        _isOK =     isClass(configFile >> "CfgWeapons" >> _x);
                        if (_isOK) then {
                            _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
                        };
                        _countr = _countr + 1;
                    } count _objWpnTypes;
                
                    //Add Magazines
                    _objWpnTypes = (_intentory select 1) select 0;
                    _objWpnQty = (_intentory select 1) select 1;
                    _countr = 0;
                    {
                        if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow
                        if (_x == "ItemTent") then { _x = "ItemTentOld" };
                        _isOK =     isClass(configFile >> "CfgMagazines" >> _x);
                        if (_isOK) then {
                            _object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
                        };
                        _countr = _countr + 1;
                    } count _objWpnTypes;

                    //Add Backpacks
                    _objWpnTypes = (_intentory select 2) select 0;
                    _objWpnQty = (_intentory select 2) select 1;
                    _countr = 0;
                    {
                        _isOK =     isClass(configFile >> "CfgVehicles" >> _x);
                        if (_isOK) then {
                            _object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
                        };
                        _countr = _countr + 1;
                    } count _objWpnTypes;
                };
            };    
            
            if (_object isKindOf "AllVehicles") then {
                {
                    _selection = _x select 0;
                    _dam = _x select 1;
                    if (_selection in dayZ_explosiveParts && _dam > 0.8) then {_dam = 0.8};
                    [_object,_selection,_dam] call object_setFixServer;
                } count _hitpoints;

                _object setFuel _fuel;

                if (!((typeOf _object) in dayz_allowedObjects)) then {
                    
                    //_object setvelocity [0,0,1];
                    _object call fnc_veh_ResetEH;        
                    
                    if(_ownerID != "0" && !(_object isKindOf "Bicycle")) then {
                        _object setvehiclelock "locked";
                    };
                    
                    _totalvehicles = _totalvehicles + 1;

                    // total each vehicle
                    serverVehicleCounter set [count serverVehicleCounter,_type];
                };
            };

            //Monitor the object
            if(_type in DZE_Origins_Buildings) then {
    //diag_log format["Origins Object: %1 - %2", _type,_ownerID];
    _object setVariable ["CanBeUpdated",false, true];

    {
        _object setVariable ["OwnerUID",(_x select 0), true];
        _object setVariable ["OwnerName",(_x select 1), true];
    }   count _hitPoints;
    _ownerUID = _object getVariable ["OwnerUID","0"];
    switch(_type) do {
        case "Uroven1DrevenaBudka"  : { owner_B1 set [count owner_B1, _ownerUID];};
        case "Uroven2KladaDomek"    : { owner_B2 set [count owner_B2, _ownerUID];};
        case "Uroven3DrevenyDomek"  : { owner_B3 set [count owner_B3, _ownerUID];};
        case "Uroven1VelkaBudka"    : { owner_H1 set [count owner_H1, _ownerUID];};
        case "Uroven2MalyDomek"     : { owner_H2 set [count owner_H2, _ownerUID];};
        case "Uroven3VelkyDomek"    : { owner_H3 set [count owner_H3, _ownerUID];};
        case "malaGaraz"            : { owner_SG set [count owner_SG, _ownerUID];};
        case "velkaGaraz"           : { owner_LG set [count owner_LG, _ownerUID];};
        case "kingramida"           : { owner_KING set [count owner_KING, _ownerUID];};
        case "krepost"              : { owner_SH set [count owner_SH, _ownerUID];};
    };
    if((_pos select 2) < 0.25) then {
        _object setVectorUp surfaceNormal position _object;
    };
    _object setVectorUp surfaceNormal position _object;
};
            PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
        };
    } count (_BuildingQueue + _originsQueue + _objectQueue);
    // # END SPAWN OBJECTS #

    // preload server traders menu data into cache
    if !(DZE_ConfigTrader) then {
        {
            // get tids
            _traderData = call compile format["menu_%1;",_x];
            if(!isNil "_traderData") then {
                {
                    _traderid = _x select 1;

                    _retrader = [];

                    _key = format["CHILD:399:%1:",_traderid];
                    _data = "HiveEXT" callExtension _key;

                    //diag_log "HIVE: Request sent";
            
                    //Process result
                    _result = call compile format ["%1",_data];
                    _status = _result select 0;
            
                    if (_status == "ObjectStreamStart") then {
                        _val = _result select 1;
                        //Stream Objects
                        //diag_log ("HIVE: Commence Menu Streaming...");
                        call compile format["ServerTcache_%1 = [];",_traderid];
                        for "_i" from 1 to _val do {
                            _data = "HiveEXT" callExtension _key;
                            _result = call compile format ["%1",_data];
                            call compile format["ServerTcache_%1 set [count ServerTcache_%1,%2]",_traderid,_result];
                            _retrader set [count _retrader,_result];
                        };
                        //diag_log ("HIVE: Streamed " + str(_val) + " objects");
                    };

                } forEach (_traderData select 0);
            };
        } forEach serverTraders;
    };

    if (_hiveLoaded) then {
    //  spawn_vehicles
    _vehLimit = MaxVehicleLimit - _totalvehicles;
    if(_vehLimit > 0) then {
        diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
        for "_x" from 1 to _vehLimit do {
            [] spawn spawn_vehicles;
        };
    } else {
        diag_log "HIVE: Vehicle Spawn limit reached!";
    };
    };
    
    //  spawn_roadblocks
    diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
    for "_x" from 1 to MaxDynamicDebris do {
        [] spawn spawn_roadblocks;
    };
    //  spawn_ammosupply at server start 1% of roadblocks
    diag_log ("HIVE: Spawning # of Ammo Boxes: " + str(MaxAmmoBoxes));
    for "_x" from 1 to MaxAmmoBoxes do {
        [] spawn spawn_ammosupply;
    };
    // call spawning mining veins
    diag_log ("HIVE: Spawning # of Veins: " + str(MaxMineVeins));
    for "_x" from 1 to MaxMineVeins do {
        [] spawn spawn_mineveins;
    };

    if(isnil "dayz_MapArea") then {
        dayz_MapArea = 10000;
    };
    if(isnil "HeliCrashArea") then {
        HeliCrashArea = dayz_MapArea / 2;
    };
    if(isnil "OldHeliCrash") then {
        OldHeliCrash = false;
    };

    // [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire]
    if(OldHeliCrash) then {
        _nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite;
    };
    if (isDedicated) then {
        // Epoch Events
        _id = [] spawn server_spawnEvents;
        // server cleanup
        [] spawn {
            private ["_id"];
            sleep 200; //Sleep Lootcleanup, don't need directly cleanup on startup + fix some performance issues on serverstart
            waitUntil {!isNil "server_spawnCleanAnimals"};
            _id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
        };

        // spawn debug box
        _debugMarkerPosition = getMarkerPos "respawn_west";
        _debugMarkerPosition = [(_debugMarkerPosition select 0),(_debugMarkerPosition select 1),1];
        _vehicle_0 = createVehicle ["DebugBox_DZ", _debugMarkerPosition, [], 0, "CAN_COLLIDE"];
        _vehicle_0 setPos _debugMarkerPosition;
        _vehicle_0 setVariable ["ObjectID","1",true];

        // max number of spawn markers
        if(isnil "spawnMarkerCount") then {
            spawnMarkerCount = 10;
        };
        actualSpawnMarkerCount = 0;
        // count valid spawn marker positions
        for "_i" from 0 to spawnMarkerCount do {
            if (!([(getMarkerPos format["spawn%1", _i]), [0,0,0]] call BIS_fnc_areEqual)) then {
                actualSpawnMarkerCount = actualSpawnMarkerCount + 1;
            } else {
                // exit since we did not find any further markers
                _i = spawnMarkerCount + 99;
            };
            
        };
        diag_log format["Total Number of spawn locations %1", actualSpawnMarkerCount];
        
        endLoadingScreen;
    };

    [] ExecVM "\z\addons\dayz_server\origins\variables.sqf";
    [] ExecVM "\z\addons\dayz_server\WAI\init.sqf";
    allowConnection = true;    
    sm_done = true;
    publicVariable "sm_done";
};

Link to comment
Share on other sites

If you want more you get more XD

 

20:00:53 "MOVED OBJ: "2217" of class SUV_Blue_DZE2 to pos: [13336.4,16280.9,0]"
20:00:53 Error in expression <eCargoGlobal  _object;


_object setdir _dir;



_object setposATL _pos;
_object>
20:00:53   Error position: <_dir;



_object setposATL _pos;
_object>
20:00:53   Error Undefined variable in expression: _dir
20:00:53 File z\addons\dayz_server\system\server_monitor.sqf, line 246
20:00:53 "MOVED OBJ: "2223" of class LandRover_MG_TK_EP1_DZE to pos: [8361.71,16476.3,0]"
20:00:53 Error in expression <eCargoGlobal  _object;


_object setdir _dir;



_object setposATL _pos;
_object>
20:00:53   Error position: <_dir;



_object setposATL _pos;
_object>
20:00:53   Error Undefined variable in expression: _dir
20:00:53 File z\addons\dayz_server\system\server_monitor.sqf, line 246
20:00:53 "MOVED OBJ: "2228" of class UH1Y_DZE to pos: [12842.6,16397.5,0]"
20:00:53 Error in expression <eCargoGlobal  _object;


_object setdir _dir;



_object setposATL _pos;
_object>
20:00:53   Error position: <_dir;



_object setposATL _pos;
_object>
20:00:53   Error Undefined variable in expression: _dir
20:00:53 File z\addons\dayz_server\system\server_monitor.sqf, line 246
20:00:53 "MOVED OBJ: "2231" of class UH60M_EP1_DZE to pos: [14102,16419.8,0]"
20:00:53 Error in expression <eCargoGlobal  _object;


_object setdir _dir;



_object setposATL _pos;
_object>
20:00:53   Error position: <_dir;



_object setposATL _pos;
_object>
20:00:53   Error Undefined variable in expression: _dir
20:00:53 File z\addons\dayz_server\system\server_monitor.sqf, line 246
20:00:53 "MOVED OBJ: "2235" of class MV22_DZ to pos: [13866.2,10228.4,0]"
20:00:53 Error in expression <eCargoGlobal  _object;


_object setdir _dir;



_object setposATL _pos;
_object>
20:00:53   Error position: <_dir;



_object setposATL _pos;
_object>
20:00:53   Error Undefined variable in expression: _dir
20:00:53 File z\addons\dayz_server\system\server_monitor.sqf, line 246

Link to comment
Share on other sites

try this monitor.sqf:

private ["_nul","_result","_pos","_wsDone","_dir","_isOK","_countr","_objWpnTypes","_objWpnQty","_dam","_selection","_totalvehicles","_object","_idKey","_type","_ownerID","_worldspace","_intentory","_hitPoints","_fuel","_damage","_key","_vehLimit","_hiveResponse","_objectCount","_codeCount","_data","_status","_val","_traderid","_retrader","_traderData","_id","_lockable","_debugMarkerPosition","_vehicle_0","_bQty","_vQty","_BuildingQueue","_objectQueue","_superkey","_shutdown","_res","_hiveLoaded","_ownerUID","_oQty","_originsQueue","_isOrigins"];

dayz_versionNo =         getText(configFile >> "CfgMods" >> "DayZ" >> "version");
dayz_hiveVersionNo =     getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");

_hiveLoaded = false;

waitUntil{initialized}; //means all the functions are now defined

diag_log "HIVE: Starting";

waituntil{isNil "sm_done"}; // prevent server_monitor be called twice (bug during login of the first player)

// Custom Configs
if(isnil "MaxVehicleLimit") then {
    MaxVehicleLimit = 250;
};

if(isnil "MaxDynamicDebris") then {
    MaxDynamicDebris = 100;
};
if(isnil "MaxAmmoBoxes") then {
    MaxAmmoBoxes = 3;
};
if(isnil "MaxMineVeins") then {
    MaxMineVeins = 5;
};
// Custon Configs End

if (isServer && isNil "sm_done") then {

    serverVehicleCounter = [];
    _hiveResponse = [];

    for "_i" from 1 to 5 do {
        diag_log "HIVE: trying to get objects";
        _key = format["CHILD:302:%1:", dayZ_instance];
        _hiveResponse = _key call server_hiveReadWrite;  
        if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")})) then {
            if ((_hiveResponse select 1) == "Instance already initialized") then {
                _superkey = profileNamespace getVariable "SUPERKEY";
                _shutdown = format["CHILD:400:%1:", _superkey];
                _res = _shutdown call server_hiveReadWrite;
                diag_log ("HIVE: attempt to kill.. HiveExt response:"+str(_res));
            } else {
                diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse));
            
            };
            _hiveResponse = ["",0];
        } else {
            diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" );
            _i = 99; // break
        };
    };
    _BuildingQueue = [];
    _objectQueue = [];
    if (isNil "_originsQueue") then {
    _originsQueue = [];
    };
    owner_B1 = [];
    owner_B2 = [];
    owner_B3 = [];
    owner_H1 = [];
    owner_H2 = [];
    owner_H3 = [];
    owner_SG = [];
    owner_LG = [];
    owner_KING = [];
    owner_SH = [];
    
    if ((_hiveResponse select 0) == "ObjectStreamStart") then {
    
        // save superkey
        profileNamespace setVariable ["SUPERKEY",(_hiveResponse select 2)];
        
        _hiveLoaded = true;
    
        diag_log ("HIVE: Commence Object Streaming...");
        _key = format["CHILD:302:%1:", dayZ_instance];
        _objectCount = _hiveResponse select 1;
    _bQty = 0;
    _vQty = 0;
    _oQty = 0;

    for "_i" from 1 to _objectCount do {
    _isOrigins = false;
    _hiveResponse = _key call server_hiveReadWriteLarge;
    //diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);
    {
        if((_hiveResponse select 2) isKindOf _x) exitWith {
            _originsQueue set [_oQty,_hiveResponse];
            _oQty = _oQty + 1;
            _isOrigins = true;
        };
    } forEach DZE_Origins_Buildings;
    if(!_isOrigins) then {
        if ((_hiveResponse select 2) isKindOf "ModularItems") then {
            _BuildingQueue set [_bQty,_hiveResponse];
            _bQty = _bQty + 1;
        } else {
            _objectQueue set [_vQty,_hiveResponse];
            _vQty = _vQty + 1;
        };
    };
};
        diag_log ("HIVE: got " + str(_bQty) + " Epoch Objects and " + str(_vQty) + " Vehicles");
    };
    
    // # NOW SPAWN OBJECTS #
    _totalvehicles = 0;
    {
        _idKey =         _x select 1;
        _type =            _x select 2;
        _ownerID =         _x select 3;

        _worldspace =     _x select 4;
        _intentory =    _x select 5;
        _hitPoints =    _x select 6;
        _fuel =            _x select 7;
        _damage =         _x select 8;
        
 		_dir = 0;


		_pos = [0,0,0];
		_wsDone = false;
		if (count _worldspace >= 2) then
		{
			if ((typeName (_worldspace select 0)) == "STRING") then {
				_worldspace set [0, call compile (_worldspace select 0)];
				_worldspace set [1, call compile (_worldspace select 1)];
			};
			_dir = _worldspace select 0;
			if (count (_worldspace select 1) == 3) then {
				_pos = _worldspace select 1;
				_wsDone = true;
			}
		};			
		
		if (!_wsDone) then {
			if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
			_pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
			if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
			diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
		};
		
		_vector = [[0,0,0],[0,0,0]];
		_vecExists = false;
		_ownerPUID = "0";
		if (count _worldspace >= 3) then{
			if(count _worldspace == 3) then{
					if(typename (_worldspace select 2) == "STRING")then{
						_ownerPUID = _worldspace select 2;
					}else{
						 if(typename (_worldspace select 2) == "ARRAY")then{
							_vector = _worldspace select 2;
							if(count _vector == 2)then{
								if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
									_vecExists = true;
								};
							};
						};					
					};
					
			}else{
				//Was not 3 elements, so check if 4 or more

				if(count _worldspace == 4) then{
					if(typename (_worldspace select 3) == "STRING")then{
						_ownerPUID = _worldspace select 3;
					}else{
						if(typename (_worldspace select 2) == "STRING")then{
							_ownerPUID = _worldspace select 2;
						};
					};
			
			
					if(typename (_worldspace select 2) == "ARRAY")then{
						_vector = _worldspace select 2;
						if(count _vector == 2)then{
							if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
								_vecExists = true;
							};
						};
					}else{
						if(typename (_worldspace select 3) == "ARRAY")then{



							_vector = _worldspace select 3;
							if(count _vector == 2)then{
								if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
									_vecExists = true;
								};
							};
						};
					};
					
				}else{
					//More than 3 or 4 elements found
					//Might add a search for the vector, ownerPUID will equal 0
				};
			};
		};
        

        if (_damage < 1) then {
            //diag_log format["OBJ: %1 - %2", _idKey,_type];
            
            //Create it
            _object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
            if (typeOf (_object) in  DZE_DoorsLocked) then {
            _object setVariable ["doorfriends", _intentory, true];
            };
            _object setVariable ["lastUpdate",time];
            _object setVariable ["ObjectID", _idKey, true];
            if (typeOf (_object) == "Plastic_Pole_EP1_DZ") then {
            _object setVariable ["plotfriends", _intentory, true];
            };

            _lockable = 0;
            if(isNumber (configFile >> "CfgVehicles" >> _type >> "lockable")) then {
                _lockable = getNumber(configFile >> "CfgVehicles" >> _type >> "lockable");
            };

            // fix for leading zero issues on safe codes after restart
            if (_lockable == 4) then {
                _codeCount = (count (toArray _ownerID));
                if(_codeCount == 3) then {
                    _ownerID = format["0%1", _ownerID];
                };
                if(_codeCount == 2) then {
                    _ownerID = format["00%1", _ownerID];
                };
                if(_codeCount == 1) then {
                    _ownerID = format["000%1", _ownerID];
                };
            };

            if (_lockable == 3) then {
                _codeCount = (count (toArray _ownerID));
                if(_codeCount == 2) then {
                    _ownerID = format["0%1", _ownerID];
                };
                if(_codeCount == 1) then {
                    _ownerID = format["00%1", _ownerID];
                };
            };

            _object setVariable ["CharacterID", _ownerID, true];
            
            clearWeaponCargoGlobal  _object;
            clearMagazineCargoGlobal  _object;
            // _object setVehicleAmmo DZE_vehicleAmmo;
            
            _object setdir _dir;
            
            if(_vecExists)then{
                _object setVectorDirAndUp _vector;
            };
            
            _object setposATL _pos;
            _object setDamage _damage;
            
            if ((typeOf _object) in dayz_allowedObjects) then {
                _object setVariable["memDir",_dir,true];
                if (DZE_GodModeBase) then {
                    _object addEventHandler ["HandleDamage", {false}];
                } else {
                    _object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
                };
                // Test disabling simulation server side on buildables only.
                _object enableSimulation false;
                // used for inplace upgrades && lock/unlock of safe
                _object setVariable ["OEMPos", _pos, true];
                
            };
            
            /*ZSC*/
            if( count (_intentory) > 3)then{
            _object setVariable ["bankMoney", _intentory select 3, true];
            }else{
               _object setVariable ["bankMoney", 0, true];
            };
            /*ZSC*/

            if ((count _intentory > 0) && !(typeOf( _object) == "Plastic_Pole_EP1_DZ") && !(typeOf( _object) in  DZE_DoorsLocked)) then {
                if (_type in DZE_LockedStorage || _type in DZE_Origins_Buildings) then {
                    // Fill variables with loot
                    _object setVariable ["WeaponCargo", (_intentory select 0),true];
                    _object setVariable ["MagazineCargo", (_intentory select 1),true];
                    _object setVariable ["BackpackCargo", (_intentory select 2),true];
                } else {

                    //Add weapons
                    _objWpnTypes = (_intentory select 0) select 0;
                    _objWpnQty = (_intentory select 0) select 1;
                    _countr = 0;                    
                    {
                        if(_x in (DZE_REPLACE_WEAPONS select 0)) then {
                            _x = (DZE_REPLACE_WEAPONS select 1) select ((DZE_REPLACE_WEAPONS select 0) find _x);
                        };
                        _isOK =     isClass(configFile >> "CfgWeapons" >> _x);
                        if (_isOK) then {
                            _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
                        };
                        _countr = _countr + 1;
                    } count _objWpnTypes;
                
                    //Add Magazines
                    _objWpnTypes = (_intentory select 1) select 0;
                    _objWpnQty = (_intentory select 1) select 1;
                    _countr = 0;
                    {
                        if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow
                        if (_x == "ItemTent") then { _x = "ItemTentOld" };
                        _isOK =     isClass(configFile >> "CfgMagazines" >> _x);
                        if (_isOK) then {
                            _object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
                        };
                        _countr = _countr + 1;
                    } count _objWpnTypes;

                    //Add Backpacks
                    _objWpnTypes = (_intentory select 2) select 0;
                    _objWpnQty = (_intentory select 2) select 1;
                    _countr = 0;
                    {
                        _isOK =     isClass(configFile >> "CfgVehicles" >> _x);
                        if (_isOK) then {
                            _object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
                        };
                        _countr = _countr + 1;
                    } count _objWpnTypes;
                };
            };    
            
            if (_object isKindOf "AllVehicles") then {
                {
                    _selection = _x select 0;
                    _dam = _x select 1;
                    if (_selection in dayZ_explosiveParts && _dam > 0.8) then {_dam = 0.8};
                    [_object,_selection,_dam] call object_setFixServer;
                } count _hitpoints;

                _object setFuel _fuel;

                if (!((typeOf _object) in dayz_allowedObjects)) then {
                    
                    //_object setvelocity [0,0,1];
                    _object call fnc_veh_ResetEH;        
                    
                    if(_ownerID != "0" && !(_object isKindOf "Bicycle")) then {
                        _object setvehiclelock "locked";
                    };
                    
                    _totalvehicles = _totalvehicles + 1;

                    // total each vehicle
                    serverVehicleCounter set [count serverVehicleCounter,_type];
                };
            };

            //Monitor the object
            if(_type in DZE_Origins_Buildings) then {
    //diag_log format["Origins Object: %1 - %2", _type,_ownerID];
    _object setVariable ["CanBeUpdated",false, true];

    {
        _object setVariable ["OwnerUID",(_x select 0), true];
        _object setVariable ["OwnerName",(_x select 1), true];
    }   count _hitPoints;
    _ownerUID = _object getVariable ["OwnerUID","0"];
    switch(_type) do {
        case "Uroven1DrevenaBudka"  : { owner_B1 set [count owner_B1, _ownerUID];};
        case "Uroven2KladaDomek"    : { owner_B2 set [count owner_B2, _ownerUID];};
        case "Uroven3DrevenyDomek"  : { owner_B3 set [count owner_B3, _ownerUID];};
        case "Uroven1VelkaBudka"    : { owner_H1 set [count owner_H1, _ownerUID];};
        case "Uroven2MalyDomek"     : { owner_H2 set [count owner_H2, _ownerUID];};
        case "Uroven3VelkyDomek"    : { owner_H3 set [count owner_H3, _ownerUID];};
        case "malaGaraz"            : { owner_SG set [count owner_SG, _ownerUID];};
        case "velkaGaraz"           : { owner_LG set [count owner_LG, _ownerUID];};
        case "kingramida"           : { owner_KING set [count owner_KING, _ownerUID];};
        case "krepost"              : { owner_SH set [count owner_SH, _ownerUID];};
    };
    if((_pos select 2) < 0.25) then {
        _object setVectorUp surfaceNormal position _object;
    };
    _object setVectorUp surfaceNormal position _object;
};
            PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
        };
    } count (_BuildingQueue + _originsQueue + _objectQueue);
    // # END SPAWN OBJECTS #

    // preload server traders menu data into cache
    if !(DZE_ConfigTrader) then {
        {
            // get tids
            _traderData = call compile format["menu_%1;",_x];
            if(!isNil "_traderData") then {
                {
                    _traderid = _x select 1;

                    _retrader = [];

                    _key = format["CHILD:399:%1:",_traderid];
                    _data = "HiveEXT" callExtension _key;

                    //diag_log "HIVE: Request sent";
            
                    //Process result
                    _result = call compile format ["%1",_data];
                    _status = _result select 0;
            
                    if (_status == "ObjectStreamStart") then {
                        _val = _result select 1;
                        //Stream Objects
                        //diag_log ("HIVE: Commence Menu Streaming...");
                        call compile format["ServerTcache_%1 = [];",_traderid];
                        for "_i" from 1 to _val do {
                            _data = "HiveEXT" callExtension _key;
                            _result = call compile format ["%1",_data];
                            call compile format["ServerTcache_%1 set [count ServerTcache_%1,%2]",_traderid,_result];
                            _retrader set [count _retrader,_result];
                        };
                        //diag_log ("HIVE: Streamed " + str(_val) + " objects");
                    };

                } forEach (_traderData select 0);
            };
        } forEach serverTraders;
    };

    if (_hiveLoaded) then {
    //  spawn_vehicles
    _vehLimit = MaxVehicleLimit - _totalvehicles;
    if(_vehLimit > 0) then {
        diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
        for "_x" from 1 to _vehLimit do {
            [] spawn spawn_vehicles;
        };
    } else {
        diag_log "HIVE: Vehicle Spawn limit reached!";
    };
    };
    
    //  spawn_roadblocks
    diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
    for "_x" from 1 to MaxDynamicDebris do {
        [] spawn spawn_roadblocks;
    };
    //  spawn_ammosupply at server start 1% of roadblocks
    diag_log ("HIVE: Spawning # of Ammo Boxes: " + str(MaxAmmoBoxes));
    for "_x" from 1 to MaxAmmoBoxes do {
        [] spawn spawn_ammosupply;
    };
    // call spawning mining veins
    diag_log ("HIVE: Spawning # of Veins: " + str(MaxMineVeins));
    for "_x" from 1 to MaxMineVeins do {
        [] spawn spawn_mineveins;
    };

    if(isnil "dayz_MapArea") then {
        dayz_MapArea = 10000;
    };
    if(isnil "HeliCrashArea") then {
        HeliCrashArea = dayz_MapArea / 2;
    };
    if(isnil "OldHeliCrash") then {
        OldHeliCrash = false;
    };

    // [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire]
    if(OldHeliCrash) then {
        _nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite;
    };
    if (isDedicated) then {
        // Epoch Events
        _id = [] spawn server_spawnEvents;
        // server cleanup
        [] spawn {
            private ["_id"];
            sleep 200; //Sleep Lootcleanup, don't need directly cleanup on startup + fix some performance issues on serverstart
            waitUntil {!isNil "server_spawnCleanAnimals"};
            _id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
        };

        // spawn debug box
        _debugMarkerPosition = getMarkerPos "respawn_west";
        _debugMarkerPosition = [(_debugMarkerPosition select 0),(_debugMarkerPosition select 1),1];
        _vehicle_0 = createVehicle ["DebugBox_DZ", _debugMarkerPosition, [], 0, "CAN_COLLIDE"];
        _vehicle_0 setPos _debugMarkerPosition;
        _vehicle_0 setVariable ["ObjectID","1",true];

        // max number of spawn markers
        if(isnil "spawnMarkerCount") then {
            spawnMarkerCount = 10;
        };
        actualSpawnMarkerCount = 0;
        // count valid spawn marker positions
        for "_i" from 0 to spawnMarkerCount do {
            if (!([(getMarkerPos format["spawn%1", _i]), [0,0,0]] call BIS_fnc_areEqual)) then {
                actualSpawnMarkerCount = actualSpawnMarkerCount + 1;
            } else {
                // exit since we did not find any further markers
                _i = spawnMarkerCount + 99;
            };
            
        };
        diag_log format["Total Number of spawn locations %1", actualSpawnMarkerCount];
        
        endLoadingScreen;
    };

    [] ExecVM "\z\addons\dayz_server\origins\variables.sqf";
    [] ExecVM "\z\addons\dayz_server\WAI\init.sqf";
    allowConnection = true;    
    sm_done = true;
    publicVariable "sm_done";
};

Link to comment
Share on other sites

Unfortunately it doesn't work. Now i get this errors:

 

22:08:07 "MOVED OBJ: "1585" of class V3S_Open_TK_EP1 to pos: [7194.78,8899.1,0]"
22:08:07 "MOVED OBJ: "1619" of class CH53_DZE to pos: [13448.8,16005.3,0]"
22:08:07 Error in expression <eCargoGlobal  _object;


_object setdir _dir;

if(_vecExists)then{
_object setVe>
22:08:07   Error position: <_dir;

if(_vecExists)then{
_object setVe>
22:08:07   Error Undefined variable in expression: _dir
22:08:07 File z\addons\dayz_server\system\server_monitor.sqf, line 258

Link to comment
Share on other sites

Yes it's really weird. The database saves everything of the vehicle except the worldspace. If i get in a fresh spawned car there is a worldspace and when i get out of it everything has synchronised except the worldspace. For example [16856.56, 12545.456] changes to [any,any] in every case. Maybe it is the server_updateobject.sqf? I don't know. I hope anyone has the same problem and found a solution.

Link to comment
Share on other sites

Yeah me too :D But this problem is so annoying that it's keep myself awake. Anyway this is my server_updateobject.sqf. Really thank you for your tips ;)

 

/*
[_object,_type] spawn server_updateObject;
*/
private ["_object","_type","_objectID","_uid","_lastUpdate","_needUpdate","_object_position","_object_inventory","_object_damage","_isNotOk","_parachuteWest","_firstTime","_object_killed","_object_repair","_isbuildable"];
 
_object = _this select 0;
 
if(isNull(_object)) exitWith {
diag_log format["Skipping Null Object: %1", _object];
};
 
_type = _this select 1;
_parachuteWest = ((typeOf _object == "ParachuteWest") || (typeOf _object == "ParachuteC"));
_isbuildable = (typeOf _object) in dayz_allowedObjects;
_isNotOk = false;
_firstTime = false;
 
_objectID = _object getVariable ["ObjectID","0"];
_uid = _object getVariable ["ObjectUID","0"];
 
if ((typeName _objectID != "string") || (typeName _uid != "string")) then
{
    diag_log(format["Non-string Object: ID %1 UID %2", _objectID, _uid]);
    //force fail
    _objectID = "0";
    _uid = "0";
};
if (!_parachuteWest && !(locked _object)) then {
if (_objectID == "0" && _uid == "0") then
{
_object_position = getPosATL _object;
    _isNotOk = true;
};
};
 
// do not update if buildable && not ok
if (_isNotOk && _isbuildable) exitWith {  };
 
// delete if still not ok
if (_isNotOk) exitWith { deleteVehicle _object; diag_log(format["Deleting object %1 with invalid ID at pos [%2,%3,%4]",typeOf _object,_object_position select 0,_object_position select 1, _object_position select 2]); };
 
 
_lastUpdate = _object getVariable ["lastUpdate",time];
_needUpdate = _object in needUpdate_objects;
 
// TODO ----------------------
_object_position = {
private["_position","_worldspace","_fuel","_key"];
_position = getPosATL _object;
_worldspace = [
(getDir _object) call KK_fnc_floatToString,
_position call KK_fnc_positionToString
];
_fuel = 0;
if (_object isKindOf "AllVehicles") then {
_fuel = fuel _object;
};
_key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
};
 
_object_inventory = {
    private["_inventory","_previous","_key","_updateGear"];
    _updateGear = false;
    if((typeOf _object) in DZE_Origins_Buildings) then {
        _state = _object getVariable ["CanBeUpdated",false];
        if(_state) then {
            _updateGear = true;
            _object setVariable ["WeaponCargo", getWeaponCargo _object,true];
            _object setVariable ["MagazineCargo", getMagazineCargo  _object,true];
            _object setVariable ["BackpackCargo", getBackpackCargo  _object,true];
            _inventory = [
                _object getVariable["WeaponCargo",[]],
                _object getVariable["MagazineCargo",[]],
                _object getVariable["BackpackCargo",[]]
            ];
        };
    } else {
        _updateGear = true;
        _inventory = [
            getWeaponCargo _object,
            getMagazineCargo _object,
            getBackpackCargo _object
        ];
    };
_isNormal = true;
if (typeOf (_object) == "Plastic_Pole_EP1_DZ") then{
    _isNormal = false;
    _inventory = _object getVariable ["plotfriends", []]; //We're replacing the inventory with UIDs for this item
};
if (typeOf (_object)in DZE_DoorsLocked) then{
    _isNormal = false;
    _inventory = _object getVariable ["doorfriends", []]; //We're replacing the inventory with UIDs for this item
};

if(_isNormal)then {
_inventory = [
getWeaponCargo _object,
getMagazineCargo _object,
getBackpackCargo _object
/*ZSC*/
, _object getVariable["bankMoney",0]
/*ZSC*/
];
};
_previous = str(_object getVariable["lastInventory",[]]);
if (str(_inventory) != _previous) then {
_object setVariable["lastInventory",_inventory];
if (_objectID == "0") then {
_key = format["CHILD:309:%1:%2:",_uid,_inventory];
} else {
_key = format["CHILD:303:%1:%2:",_objectID,_inventory];
};
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
};
    if(_updateGear) then {
        _previous = str(_object getVariable["lastInventory",[]]);
        if (str(_inventory) != _previous) then {
            _object setVariable["lastInventory",_inventory];
            if (_objectID == "0") then {
                _key = format["CHILD:309:%1:%2:",_uid,_inventory];
            } else {
                _key = format["CHILD:303:%1:%2:",_objectID,_inventory];
            };
            //diag_log ("HIVE: WRITE: "+ str(_key));
            _key call server_hiveWrite;
        };
    };
};
 
_object_damage = {
private["_hitpoints","_array","_hit","_selection","_key","_damage"];
_hitpoints = _object call vehicle_getHitpoints;
_damage = damage _object;
_array = [];
{
_hit = [_object,_x] call object_getHit;
_selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
_object setHit ["_selection", _hit];
} count _hitpoints;
 
_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
_object setVariable ["needUpdate",false,true];
};
 
_object_killed = {
private["_hitpoints","_array","_hit","_selection","_key","_damage"];
_hitpoints = _object call vehicle_getHitpoints;
//_damage = damage _object;
_damage = 1;
_array = [];
{
_hit = [_object,_x] call object_getHit;
_selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
_hit = 1;
_object setHit ["_selection", _hit];
} count _hitpoints;
 
if (_objectID == "0") then {
_key = format["CHILD:306:%1:%2:%3:",_uid,_array,_damage];
} else {
_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
};
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
_object setVariable ["needUpdate",false,true];
if ((count _this) > 2) then {
_killer = _this select 2;
_charID = _object getVariable ['CharacterID','0'];
_objID = _object getVariable['ObjectID','0'];
_objUID = _object getVariable['ObjectUID','0'];
_worldSpace = getPosATL _object;
if (getPlayerUID _killer != "") then {
_name = if (alive _killer) then { name _killer; } else { format["OBJECT %1", _killer]; };
diag_log format["Vehicle killed: Vehicle %1 (TYPE: %2), CharacterID: %3, ObjectID: %4, ObjectUID: %5, Position: %6, Killer: %7 (UID: %8)", _object, (typeOf _object), _charID, _objID, _objUID, _worldSpace, _name, (getPlayerUID _killer)];
} else {
diag_log format["Vehicle killed: Vehicle %1 (TYPE: %2), CharacterID: %3, ObjectID: %4, ObjectUID: %5, Position: %6", _object, (typeOf _object), _charID, _objID, _objUID, _worldSpace];
};
};
};
 
_object_repair = {
private["_hitpoints","_array","_hit","_selection","_key","_damage"];
_hitpoints = _object call vehicle_getHitpoints;
_damage = damage _object;
_array = [];
{
_hit = [_object,_x] call object_getHit;
_selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
_object setHit ["_selection", _hit];
} count _hitpoints;
 
_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
_object setVariable ["needUpdate",false,true];
};
// TODO ----------------------
 
_object setVariable ["lastUpdate",time,true];
switch (_type) do {
case "all": {
call _object_position;
call _object_inventory;
call _object_damage;
};
case "position": {
if (!(_object in needUpdate_objects)) then {
//diag_log format["DEBUG Position: Added to NeedUpdate=%1",_object];
needUpdate_objects set [count needUpdate_objects, _object];
};
};
case "gear": {
call _object_inventory;
};
case "damage": {
if ( (time - _lastUpdate) > 5) then {
call _object_damage;
} else {
if (!(_object in needUpdate_objects)) then {
//diag_log format["DEBUG Damage: Added to NeedUpdate=%1",_object];
needUpdate_objects set [count needUpdate_objects, _object];
};
};
};
case "killed": {
call _object_killed;
};
case "repair": {
call _object_damage;
};
};

Link to comment
Share on other sites

have you defined this somewhere in your server_functions.sqf?

KK_fnc_floatToString

and this:

KK_fnc_positionToString

if not try replacing this in your update_object.sqf

_object_position = {
private["_position","_worldspace","_fuel","_key"];
_position = getPosATL _object;
_worldspace = [
(getDir _object) call KK_fnc_floatToString,
_position call KK_fnc_positionToString
];
_fuel = 0;
if (_object isKindOf "AllVehicles") then {
_fuel = fuel _object;
};
_key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
}; 

with this:


_object_position = {
	private["_position","_worldspace","_fuel","_key"];
		_position = getPosATL _object;
		_worldspace = [
			round(direction _object),
			_position
		];
		_fuel = 0;
		if (_object isKindOf "AllVehicles") then {
			_fuel = fuel _object;
		};
		_key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
		//diag_log ("HIVE: WRITE: "+ str(_key));
		_key call server_hiveWrite;
};

Link to comment
Share on other sites

Hi everyone,

 

i got this error after I've installed building vectors:

Error in expression <;
_usedVec = false;
{
_element = _x;
if(typeName _element == "ARRAY") then{
_vec>
20:16:19   Error position: <typeName _element == "ARRAY") then{
_vec>
20:16:19   Error Generic error in expression
20:16:19 File z\addons\dayz_server\init\server_functions.sqf, line 616
20:16:57 Error in expression <;
_usedVec = false;
{
_element = _x;
if(typeName _element == "ARRAY") then{
_vec>
20:16:57   Error position: <typeName _element == "ARRAY") then{
_vec>
20:16:57   Error Generic error in expression
20:16:57 File z\addons\dayz_server\init\server_functions.sqf, line 616

 

This error occurs everytime if someone trys to build something. Everything is saved to the database except the buildings of players. Does anyone have a solution for this?

 

Best regards,

 

GudrunGisela

 

 

Link to comment
Share on other sites

  • 2 weeks later...
I have problem with Snap Building PRO with Vector Building, I'm not sure I write in good thread but I try.
 
This small sign sphere 10cm should be only one the object what you build, but when you click Snap Build ON this small signs are on the every wall/doors/object and it makes really low fps number. It happened after I install Vector Building with Snap and snap_build.sqf is other than normal:
 
Here is snap_build.sqf with Vector:
 
 
And here is snap_build.sqf without Vector Building:
 
Link to comment
Share on other sites

  • 2 weeks later...

Hey there,

 

got a big problem. I set up my Server new 4 Weeks ago and everything works really fine. I have builded a complete base without any problem.

But now the building skript doesn´t work any more... I tried almost everything (not re-installing Server). But i got no Menu for the building skript.

 

I cant find any error in the log file....

 

Just found the error......

 

the owner of the server had a problem and loaded an hole backup from the Server... that was the old Server files before i set it up new. Now i uploaded the new server files and everything still working like before...

Link to comment
Share on other sites

Hey everyone... I have a weird issue. This script works great, no errors in the RPT but there is something strange going on.

 

When someone upgrades a wall or doorway they have placed via the vectors, it pops up to a normal build position. 

 

So for example, someone tries to build a horizontal wall. It works, but when he goes to upgrade the cinder wall to a full size wall, it pops 90 degrees up to a normal position that a wall would be in (up and down, as opposed to flat on the ground)

 

Any Ideas?

Link to comment
Share on other sites

Alright search for your player_upgrade.sqf , in specifig this Line:

 

PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location],_classname,_obj,player];

And change it to:
 

PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_vector],_classname,_obj,player];

Next search for:

_object setDir _dir;

and add below:

_object setVectorDirAndUp _vector;

Then search for

private ["_Lots","_of","_variables"];

and add inside
 

private ["_Lots","_of","_variables","_vector"];

 

Link to comment
Share on other sites

what would this error be guys? Sorry if this has been asked already. ErrorMessage: File mpmissions\__cur_mp.chernarus\custom\snap_pro\snappoints.hpp, line 401: .SnapBuilding: Member already defined.

you are defining 2 identical files, use one.

Link to comment
Share on other sites

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
  • Advertisement
×
×
  • Create New...