Jump to content

Tired of loosing vehicles on your base?


yet another arma player

Recommended Posts

Well, let's research and figure out the roots of evil.

@epochhive\addons\epoch_server\compile\epoch_vehicle\EPOCH_server_save_vehicle.sqf

        _VAL = [typeOf _vehicle,[(getposATL _vehicle call EPOCH_precisionPos),vectordir _vehicle,vectorup _vehicle],damage _vehicle,_hitpoints,fuel _vehicle,_inventory,magazinesAmmo _vehicle,_colorSlot];
        ["Vehicle", _vehHiveKey, EPOCH_expiresVehicle, _VAL] call EPOCH_fnc_server_hiveSETEX;

Okay. WTF is EPOCH_precisionPos?

@epochhive\addons\epoch_server\compile\epoch_server\EPOCH_precisionPos.sqf

private["_low"];
_low = _this apply {_x - (_x % 1)};
[_low, _this vectorDiff _low]

Looks weird, but there is nothing rly suspicious if you do some math.

Okay. Let's research MOAR!

@epochhive\addons\epoch_server\compile\epoch_vehicle\EPOCH_load_vehicles.sqf

                        // set final direction and postion of vehicle
                        _vehicle setVectorDirAndUp _worldspace;
                        _vehicle setposATL _location;

where _location is just a record taken from DB (previously saved)

So, what the duck is wrong with this code? Why we are still loosing our vehicles after server restart?

The answer is setPosATL. This function always adds random offset to coords of your object. setPosASL do it in the same way (Hello BIS! Burn in hell ya all!)

As a result all saved vehicles and buildings will be spawned not in exactly saved position.

So, how to solve this problem?

The answer is getPosWorld/setPosWorld.

https://community.bistudio.com/wiki/setPosWorld

If you change any "ATL/ASL" functions to "World", you will get control of precisious positioning of any objects on the map.

Here is simple sp-mission to test  http://steamcommunity.com/sharedfiles/filedetails/?id=769644621

P.S. Sorry for my bad googletranslanguage )

 

 

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
  • Discord

×
×
  • Create New...