Jump to content
Sign in to follow this  
yet another arma player

Tired of loosing vehicles on your base?

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 )

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...