Chernarus Building Replacement Script (Updated Dec 2017)

103 posts in this topic

Ok to those who can't get the doors to open here is what you have to do:


First, change the "true" in this statement to "false" (this is one of the first lines):

if (isServer) then {
    private _disableSimulation = true; 


Second, change your "ExileServer_object_construction_database_load.sqf" to this:


 * ExileServer_object_construction_database_load
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
_constructionID = _this;
_data = format ["loadConstruction:%1", _constructionID] call ExileServer_system_database_query_selectSingle;
_position = [_data select 4, _data select 5, _data select 6];
_vectorDirection = [_data select 7, _data select 8, _data select 9];
_vectorUp = [_data select 10, _data select 11, _data select 12];
_constructionObject = createVehicle [(_data select 1), _position, [], 0, "CAN_COLLIDE"];
_constructionObject setPosATL _position;
_constructionObject setVectorDirAndUp [_vectorDirection, _vectorUp];
_constructionObject setVariable ["ExileDatabaseID", _data select 0];
_constructionObject setVariable ["ExileOwnerUID", (_data select 2)];
_constructionObject setVariable ["ExileIsPersistent", true];
_constructionObject setVariable ["ExileTerritoryID", (_data select 15)];
_damageLevel = (_data select 17);
_public = _damageLevel > 0;
_constructionObject setVariable ["ExileConstructionDamage",_damageLevel,_public];
    _constructionObject call ExileServer_util_setDamageTexture;
_pinCode = _data select 14;
if !(_pinCode isEqualTo "000000") then
    _constructionObject setVariable ["ExileAccessCode", _pinCode];
    _constructionObject setVariable ["ExileIsLocked", (_data select 13), true];

//if (getNumber(configFile >> "CfgVehicles" >> (_data select 1) >> "exileRequiresSimulation") isEqualTo 1) then
//    _constructionObject enableSimulationGlobal true;
//    _constructionObject call ExileServer_system_simulationMonitor_addVehicle;
//    _constructionObject enableSimulationGlobal false;

if (typeOf _constructionObject in ["Exile_Construction_ConcreteDoor_Static", 
    "Land_HouseV_2I", "Land_i_House_Big_01_V3_F",
    "Land_Mil_Barracks_L", "Land_Cargo_HQ_V1_F",
    "Land_Mil_Barracks", "Land_Unfinished_building_01_F",
    "Land_Ind_Workshop01_03","Land_Ind_Workshop01_04" ,
    "Land_Shed_W02","Land_Slum_House01_F" ,
    "Land_HouseV_3I3","Land_i_Shop_01_V1_F" ,
    "Land_HouseV_3I1","Land_i_Shop_01_V2_F" ,
    "Land_HouseV_3I4","Land_i_Shop_02_V1_F" ,
    "Land_HouseV_1L1","Land_i_Stone_HouseBig_V2_F" ,
    "Land_houseV_2T1","Land_i_Stone_HouseBig_V3_F" ,
    "Land_Mil_Guardhouse","Land_Cargo_Tower_V1_No5_F"]) then
    _constructionObject enableSimulationGlobal true;
    _constructionObject call ExileServer_system_simulationMonitor_addVehicle;
    _constructionObject enableSimulationGlobal false;


_constructionObject setVelocity [0, 0, 0];
_constructionObject setPosATL _position;
_constructionObject setVelocity [0, 0, 0];
_constructionObject setVectorDirAndUp [_vectorDirection, _vectorUp];
_constructionObject setVelocity [0, 0, 0];

And if that doesn't work it's probably because if infiSTAR. Just go into you Exile_AHAT_config and change:

BadActionCheck = "true"; ----> False

check_doors_n_gates = "true";  ------> false

reset_inGameUIEventHandler = "true"; ----> false

Edited by Super Jerome

Share this post

Link to post
Share on other sites

I'm running 64 bit server and database, Exile 1.0.3, Arma3 v1.78, and Infistar v0088.  I'm building out a Kerama map and my base map with no other additions, mods, or scripts runs fine.

So tried the script in the OP and commented out the "crap" deletions for Chernarus and only added a few buildings to replace, just to get a feel for how it works.  I spawn in as a seagull!  In the .rpt, it says "0 buildings replaced" and I'm sure the buildings I have in the file are really on the map.  So I repeat it with Brun's smaller script.   I still spawn in as a seagull!   Does it not work with the latest versions of everything?   Or did I miss something?


edit:  But if I put it as execVM "replacebldgs3.sqf" in init.sqf, I'm not a seagull.   The script appears to run but nothing is deleted or replaced either.  And then I get this in my scripts.log:


execVM "replacebldgs3.sqf.sqf";

execVM "addons\intro\intro.sqf""
05.12.2017 22:21:16: Me (xx.xx.xx.xx:2334) xxxxxxxxxxxxxxxxxxxx - #2 "iag_fps];
};#line 3 "mpmissions\__CUR_MP.Kerama\init.sqf"

execVM "addons\intro\intro.sqf";
if (isServer) then {



And the odd thing is the \init.sqf entry.  Without the replacement script everything runs fine with no errors or warnings.  I ran it through Be_AG and the resulting battleye filter did nothing at all - same msg.

For testing it out, I'm only replacing one building:


    file:    chernarus_replace.sqf
    Original Script Here: http://forums.bistudio.com/showthread.php?190404-Chernarus-Takistan

    Script edited by jakehekesfists[dmd] 08/05/2015
    -rev 2.6a (for Arma III)      
        11/10/2016 Updated for A3 Exile w/ CUP Terrains - 21DMD Zerkforge edit
            *    Code Streamline & pushback replaces set. 
            *    disable global sim on all map objects except lamps.
            *    hideObjectGlobal used on Server, no longer need anything to run on client
            *    fuel pumps require simulation to auto refuel - fixed (add classes to _DMD_FuelPumps array if using non-chernarus map)
            *    Removed CUP Buildings removed from Replace Array
            *    Added Simulation Toggle
            *    Logging Functions
if (isServer) then {
    private _disableSimulation = true;        // use this to toggle simulation disable - testing performance difference - minor fps boost in 1player trial
                                        // may cause issues with VEMFr mission/59cal spawning - set to false if you encounter problems. 
    diag_log format ["### DMD Chernarus_Replace | Pre-Init Current FPS %1",diag_fps];    
    diag_log format ["### DMD Chernarus_Replace | Global Simulation Disable is set to %1",_disableSimulation];
    private _DMD_CloseHouse = [

        to display object IDs in 3Den editor, execute the code below and exit back into the editor.
        do3DENAction "ToggleMapIDs";
    //     the _DMD_AnnoyingShit array will remove some random benches, junk piles & other assorted items around chernarus. edit it however you see fit
    // List of Locations and Map IDs to remove
    // format [[_position],OBJID] 

    private _DMD_AnnoyingShit = [

    /* Buildings to Replace */
    // Format:     [[Building to Replace],[Replacement Building]]    
    private _DMD_Replacement_List = [
    private _FFA_LHOUSEV =    [];
    private _FFA_HOUSES =    [];

    _FFA_LHOUSEV = nearestObjects [getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition"),["ALL"],15000];
    for "_i" from 0 to (count _FFA_LHOUSEV)-1 do {
        private _housev = _FFA_LHOUSEV select _i;
        if (_disableSimulation) then {
            // This ensures that Fuel Pumps and Lights still work
            private _DMD_FuelPumps = ["Land_A_FuelStation_Feed"];
            if !(_housev isKindOf "Lamps_Base_F") then { _housev enableSimulationGlobal false; };
            if ((typeOf _housev) in _DMD_FuelPumps) then { _housev enableSimulationGlobal true; };
        if ((typeOf _housev) in _DMD_CloseHouse) then { _FFA_HOUSES pushback _housev; };
    for "_i" from 0 to (count _FFA_HOUSES)-1 do {
        private _nBuilding = _FFA_HOUSES select _i;
        private _dirVector = vectorDir _nBuilding;
        private _objVector = vectorUp _nBuilding;
        private _worldPos = ASLtoATL getPosASL _nBuilding;
        _nBuilding hideObjectGlobal true;
        deleteVehicle _nBuilding;
        _type = "x";
        call { { if ((typeof _nbuilding) in (_x select 0)) exitWith { _type = (_x select 1) select 0; }; } forEach _DMD_Replacement_List; };        
        if !(_type isEqualTo "x") then {
            private _house = createVehicle [_type, _worldPos, [], 0, "CAN_COLLIDE"];
            _house setVectorDirAndUp [ _dirVector, _objVector];
            if (_disableSimulation) then { _house enableSimulationGlobal false; };            
    diag_log format ["### DMD Chernarus_Replace | %1 Buildings Replaced",(count _FFA_HOUSES)];
        private _posX = _x select 0;
        private _objX = _x select 1; 
        private _delObj1 = (_posX nearestObject _objX); 
        deleteVehicle _delObj1;
        _delObj1 hideObjectGlobal true;
    } foreach _DMD_AnnoyingShit;
    diag_log format ["### DMD Chernarus_Replace | Post-Init Current FPS %1",diag_fps];


Edited by Bob_the_K

Share this post

Link to post
Share on other sites

Updated the main post.

This will run as a server side pbo, much easier to install. doesn't require any editing of your mission file.
Just pop it @exileserver\addons folder and it's good to go.

If you want to change anything, or make it work with other maps. edit config.cpp and re-pbo it.
I rarely come on these forums, so I'm not great for support. tested this on a clean dev server tonight and it's all working

Share this post

Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.