Mikeeeyy

[Release] Precise Positions

16 posts in this topic

Precise Positions
In Arma when large numbers with decimals are turned into a string they get rounded resulting in only 1 or 2 decimals left over, which in effect can alter the position of objects quite significantly after a server restart. This mod ensures everything is saved precisely including: players, vehicles, base objects, storage objects and territories. See the results below!

With                                                       Without

PYJes8e.png?1             qxHA0Kx.png?1
Top is Without
cR9yRdN.png
Bottom is With

Credit to KillzoneKid for the float to string code, fixed by me.
Show your appreciation by clicking here.

  1. Un-PBO your exile_server.pbo.
  2. Navigate to 'exile_server\code', once there create a file with this name: 'ExileServer_util_floatToString.sqf'. Open the file and paste the following code inside:
    private "_arr";
    if (abs (_this - _this % 1) == 0) exitWith { str _this };
    _arr = toArray str abs (_this % 1);
    _arr set [0, 32];
    toString (toArray str (
    	abs (_this - _this % 1) * _this / abs _this
    ) + _arr - [32])

    Save the file and close it.

  3. Navigate to 'exile_server\bootstrap' and open up this file: 'fn_preInit.sqf'.
    Go all the way to the bottom and above the last '];' paste this code:

    ['ExileServer_util_floatToString', 'exile_server\code\ExileServer_util_floatToString.sqf']

    Then the line above the one you just pasted, add a comma to the end of it.
    Save the file and close it.

  4. Now do the following for each of these files:
    ExileServer_object_container_database_insert.sqf
    ExileServer_object_container_database_update.sqf
    ExileServer_object_vehicle_database_insert.sqf
    ExileServer_object_vehicle_database_update.sqf
    ExileServer_object_construction_database_insert.sqf
    ExileServer_system_territory_database_insert.sqf


    Navigate to 'exile_server\code' and open up x file.
    Find this code:

    _position select 0,
    _position select 1,
    _position select 2,

    and replace it with:

    _position select 0 call ExileServer_util_floatToString,
    _position select 1 call ExileServer_util_floatToString,
    _position select 2 call ExileServer_util_floatToString,

    Save all the files and close them.

  5. Navigate to 'exile_server\code' and open up this file: 'ExileServer_object_player_database_update.sqf'.
    Find this code:

    _playerPos select 0,
    _playerPos select 1,
    _playerPos select 2,

    and replace it with:

    _playerPos select 0 call ExileServer_util_floatToString,
    _playerPos select 1 call ExileServer_util_floatToString,
    _playerPos select 2 call ExileServer_util_floatToString,

    Save the file and close it.

  6. Repack your 'exile_server' folder into a PBO and you're done! :)

Edited by Mikeeeyy
  • Like 7

Share this post


Link to post
Share on other sites
Advertisement

Nice work... Trying this later 9_9

Nice first post! Will def check this out!

Just did this going to see how it works out. I said F it just placed it on the production server. 

Thanks, let me know if you encounter any problems.

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.