JakeHekesFists

Chernarus Building Replacement Script

96 posts in this topic

If for whatever reason, you want the old version of this script. I archived the original page here: http://archive.is/LxNxW

29/11/2016
I have Made some updates to this old script.
I have now made use of changes to Arma 3 that weren't available/I didn't know about, way back when I first posted this.
I have also changed a couple of the building replacement types, Removed quite a number of different clutter items and signs.
And also global simulation has been disabled on just about everything except for lights.

chernarus_replace.sqf
Pastebin link for easier copying: http://pastebin.com/AK9gsqL5

/* 
	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.4b (for Arma III)  	
		11/10/2016 Updated for A3 Exile w/ CUP Terrains - 21DMD Zerkforge edit
		28/11/2016 (ANNOYING SHIT ARRAY REMOVAL + GLOBAL SIM DISABLE ON REPLACED BUILDINGS FOR HOPEFULLY BETTER PERFORMANCE)
		29/11/2016 
			*	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
		04/12/2016
			*	fuel pumps require simulation to auto refuel - fixed (add classes to _DMD_FuelPumps array if using non-chernarus map)
*/
if (isServer) then {	
	private _DMD_CloseHouse = [
		// DELETE ONLY 
		"CUP_A2_boots_ep1","CUP_A2_drevo_hromada","CUP_A2_haystack","CUP_A2_metalcase_01","CUP_A2_metalcase_02","CUP_A2_woodpile","Land_fuel_tank_small","Land_Hut06","Land_Ind_BoardsPack1","Land_Ind_BoardsPack2","Land_Ind_Timbers","Land_Kontejner","Land_loco_742_blue","Land_Misc_GContainer_Big","Land_Nasypka","Land_seno_balik","Land_Shed_M01","Land_Shed_M02","Land_Shed_M03","Land_Shed_W03","Land_SignB_Hotel_CZ2","Land_SignB_PostOffice","Land_SignB_Pub_CZ2","Land_SignB_Pub_CZ3","Land_SignB_Pub_RU3","Land_Sign_Bar_RU","Land_Tec","Land_wagon_box",
		// REPLACE
		"Land_A_Office02","Land_Church_01","Land_Ind_SawMill","Land_Church_02","Land_Church_02a","Land_HouseV2_01A","Land_HouseV2_01B","Land_HouseV2_02_Interier","Land_HouseV2_03","Land_HouseV2_03B","Land_HouseV2_04_interier","Land_HouseV2_05","Land_HouseV_1I1","Land_HouseV_1I2","Land_HouseV_1I3","Land_HouseV_1L2","Land_HouseV_1L1","Land_HouseV_1T","Land_HouseV_2I","Land_HouseV_2L","Land_houseV_2T1","Land_houseV_2T2","Land_HouseV_3I1","Land_HouseV_3I2","Land_HouseV_3I3","Land_HouseV_3I4","Land_Ind_Workshop01_03","Land_Mil_Barracks","Land_Mil_Barracks_L","Land_Mil_Guardhouse","Land_Misc_WaterStation","Land_Shed_W4","Land_Shed_W02"
	];

	/*
		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 = [
		[[8672,2467,0],357998],[[8672,2467,0],357948],[[8672,2467,0],358030],[[8672,2425,0],358098],[[8672,2425,0],358099],[[8672,2425,0],358074],[[9423,8929,0],244751],[[9423,8929,0],244752],[[9423,8929,0],244744],[[9423,8929,0],244746],[[9423,8929,0],244747],[[9423,8929,0],244749],[[9423,8929,0],244750],[[9423,8929,0],244753],[[9423,8929,0],244754],[[9423,8929,0],244755],[[9423,8929,0],244756],[[9423,8929,0],244757],[[9423,8929,0],244758],[[9423,8929,0],244759],[[9423,8929,0],244745],[[9423,8929,0],244743],[[9423,8929,0],244742],[[12016,9078,0],262014],[[12016,9078,0],262127],[[12016,9078,0],262126],[[12016,9078,0],262522],[[12016,9078,0],262196],[[12016,9078,0],261912],[[12016,9078,0],262527],[[12016,9078,0],262159],[[12016,9078,0],262160],[[12016,9078,0],262161],[[12016,9078,0],262162],[[12016,9078,0],262163],[[12016,9078,0],262164],[[12016,9078,0],262165],[[12016,9078,0],262166],[[12016,9078,0],262158],[[12016,9078,0],262167],[[12016,9078,0],262168],[[12016,9078,0],963460],[[6203,10405,0],993525],[[6203,10405,0],993526],[[10371,7427,0],275286],[[10371,7427,0],275287],[[10371,7427,0],275293],[[10453,8894,0],249766],[[6726,9263,0],965108],[[6726,9263,0],965159],[[6726,9263,0],965069],[[6726,9263,0],965070],[[6726,9263,0],965169],[[6726,9263,0],965190],[[6726,9263,0],965167],[[6726,9263,0],965166],[[6726,9263,0],965127],[[6820,2777,0],966603],[[6820,2777,0],966594],[[6820,2777,0],966502],[[6820,2777,0],966631],[[6820,2777,0],966554],[[6820,2777,0],966513],[[6820,2777,0],966504],[[6820,2777,0],966555],[[6820,2777,0],966605],[[6820,2777,0],966604],[[6820,2777,0],966514],[[6820,2777,0],966606],[[6820,2777,0],966556],[[4564,9595,0],145259],[[4564,9595,0],145260]
	];

	/* Buildings to Replace */
	// Format: 	[[Building to Replace],[Replacement Building]]	
	private _DMD_Replacement_List = [
		[["Land_HouseV_1I2"],["Land_i_Stone_Shed_V3_F"]],
		[["Land_Ind_SawMill"],["Land_dp_mainFactory_F"]],
		[["Land_HouseV_1I1"],["Land_i_House_Small_02_V1_F"]],
		[["Land_Shed_W4"],["Land_Slum_House03_F"]],
		[["Land_HouseV_1I3"],["Land_i_House_Small_03_V1_F"]],
		[["Land_HouseV_1L2"],["Land_i_House_Big_02_V1_F"]],
		[["Land_Misc_WaterStation"],["Land_ReservoirTank_V1_F"]],
		[["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_A_Office02"],["Land_Offices_01_V1_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_3I2"],["Land_i_Shop_02_V3_F"]],
		[["Land_HouseV_1L1"],["Land_i_Stone_HouseBig_V2_F"]],
		[["Land_houseV_2T1"],["Land_i_Stone_HouseBig_V3_F"]],
		[["Land_houseV_2T2"],["Land_i_Stone_HouseSmall_V1_F"]],
		[["Land_HouseV_1T"],["Land_i_Stone_HouseSmall_V1_F"]],
		[["Land_HouseV_2L"],["Land_cwa_ryb_domek"]],
		[["Land_HouseV2_03B"],["Land_i_Stone_HouseSmall_V3_F"]],
		[["Land_HouseV2_01A"],["CUP_A1_Cihlovej_dum_in"]],
		[["Land_HouseV2_01B"],["Land_i_House_Small_01_V3_F"]],
		[["Land_HouseV2_03"],["Land_i_House_Big_01_V3_F"]],
		[["Land_HouseV2_02_Interier"],["Land_i_House_Big_02_V2_dam_F"]],
		[["Land_HouseV2_04_interier"],["Land_i_Shop_01_V3_dam_F"]],
		[["Land_HouseV2_05"],["Land_CarService_F"]],
		[["Land_Church_01"],["Land_Chapel_V1_F"]],
		[["Land_Church_02"],["Land_Chapel_V1_F"]],
		[["Land_Church_02a"],["Land_Chapel_V1_F"]],
		[["Land_Mil_Guardhouse"],["Land_Cargo_Tower_V1_No5_F"]]
	];
	
	private _FFA_LHOUSEV =	[];
	private _FFA_HOUSES =	[];
	private _DMD_FuelPumps = ["Land_A_FuelStation_Feed"];

	_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 !(_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];
			_house enableSimulationGlobal false;
		};
	};
	
	{
		private _posX = _x select 0;
		private _objX = _x select 1; 
		private _delObj1 = (_posX nearestObject _objX); 
		deleteVehicle _delObj1;
		_delObj1 hideObjectGlobal true;
	} foreach _DMD_AnnoyingShit;
};

save this file in your mission.pbo
for the sake of this example i will place it in the scripts folder, and call it chernarus_replace.sqf

to execute the script simply add:

#include "scripts\chernarus_replace.sqf"

to the bottom of init.sqf,  if you don't have an init.sqf in your mission.pbo already, just create it.

WARNING: some of the buildings may overlap roads in some places, or some churches may poke through the fence. you may find some floating signposts around. but overall, at least theres more places to loot. 
Gorka factory is especially bad for floating... so theres a fix for it Here:     http://pastebin.com/ccxpeAra

Some Screenshots:
Infistar Server Diagnostics: (I have a LOT of custom map edits running on this server. and A whole lot of AI missions. Server FPS @ 49 / 50) - Minimal impact.
vxoaXhl.png

Chernogorsk
tJIozGN.jpg

Zeleno (Hospital not included)
y20OyCR.jpg

Stary (Barracks behind red shed not included)
Mvpgaba.png

 

Edited by JakeHekesFists
Updated code to be less sucky
6 people like this

Share this post


Link to post
Share on other sites
Advertisement

great idea, i saw chernarus before that as obsolete map for a3, but this could help to get it up-to-date again!

 

how does AI behave with these buildings?

Share this post


Link to post
Share on other sites

great idea, i saw chernarus before that as obsolete map for a3, but this could help to get it up-to-date again!

 

how does AI behave with these buildings?

As long as simulation is enabled on them then AI should treat those buildings the same as they would in stock A3.  We know this because as you look in the above code the old buildings are just being hidden.  They're being completely deleted, so there's nothing left behind for AI to get "confused" as to which structure they're moving around in.  

And as a side note, if you don't like the Mediterranean style buildings on Chernarus there's plenty of other A2 style buildings that are fully enterable that you can replace the non-enterable buildings with.  You'll just have to get the building class names and replace them as needed in the above code.  

Share this post


Link to post
Share on other sites

Hell yea. This is great. Could def use something like this for JBAD buildings... Also how did you get the A3 hospital all lined up and looking pretty?

Share this post


Link to post
Share on other sites

Have you checked how many objects this creates on Chernarus?

Honestly no, I've not checked that.
However as the script hides and deletes the existing buildings, I don't believe it necessarily creates any extras. Just replaces those that are already there.
Some of my screenshots however do contain extra buildings from my map edits.

As long as simulation is enabled on them then AI should treat those buildings the same as they would in stock A3.  We know this because as you look in the above code the old buildings are just being hidden.  They're being completely deleted, so there's nothing left behind for AI to get "confused" as to which structure they're moving around in.  

And as a side note, if you don't like the Mediterranean style buildings on Chernarus there's plenty of other A2 style buildings that are fully enterable that you can replace the non-enterable buildings with.  You'll just have to get the building class names and replace them as needed in the above code.  

When I adapted this script for my A2 Overpoch server, Zombies were still able to path in and out of the buildings, and Mission AI still respected the buildings as much as any other.  I was using buildings from Napf/Sauerland as my replacement then,
With my a3 epoch server, the sappers would go straight through the buildings, but I think that was just shitty antagonists, and not anything to judge it by.

Never used this script in exile myself, I ran my servers on Altis and Taviana, so there wasn't really any need for it.

Hell yea. This is great. Could def use something like this for JBAD buildings... Also how did you get the A3 hospital all lined up and looking pretty?

That was m3editor for rough placement, and manually editing the number values to align it correctly. could probably be easier done with attachto, like we do with airports, but I never figured out the correct attachto co-ords.

http://killzonekid.com/arma-scripting-tutorials-automating-sliding-doors-at-airport-terminal/
can just place the center part of an airport somewhere on a map, grab the co-ords then use the KK script above to align it correctly.

Seeing as I've decided that I wont be running servers anymore,
I'm gonna start dumping my old map edits and stuff as I get time to do it.

Got a pretty good (in my opinion) hospital area at guglovo somewhere on my home pc.


 

Share this post


Link to post
Share on other sites

Ok, so help me understand this script.

FFA_CLOSEHOUSE is a list of buildings that are closed, that can't be entered?

On the _dmdRepXXXX lines, is the first classname a building that can't be entered and the second classname a building that will replace it?

Edited by BetterDeadThanZed

Share this post


Link to post
Share on other sites

Honestly no, I've not checked that.
However as the script hides and deletes the existing buildings, I don't believe it necessarily creates any extras. Just replaces those that are already there.

I'm more worried about performance drop that comes from this as there is big difference between original map buildings and buildings spawned with createVehicle.

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.