b3lx 161 Posted January 31, 2018 Since I got the habit of placing tons of stuff in eden to get terrains to look better for my missions I ended up making a script that makes it much easier are a lot faster. The replaceobjects.sqf replaces whatever (even billboards in the fallujah map) and allows for tuning orientation, probability, randomisation, etc. I am satisfied with the results, but my lack of knowledge does not allow any further improvement. So I am asking for help to optimize the script and make it run in less time. I have no coding skills whatsoever so is highly probable that there are obviously better ways of doing stuff than the ones I used. This script makes it easy to mass replace buildings and other stuff. Here's two pictures of what it can do in two of my favourite maps: fallujah and diyala: This is my script: /* Replaceobjects.sqf by b3lx. This script replaces terrain objects randomly chosen out of a defined array. Good for batch changes in terrains like replacing tree types or houses. The following arguments have to be passed to the script - _pos = the center position of the area to include. - _radius = limits the max search range - _type = (optional) lists the types of objects the script should filter for. if empty it uses classnames passed through _oldobjlist - _oldobjlist = (optional) object classes to replace; only used if _type is empty - _newobjlist = object classes for replacement - _customdir = (optional) leave empty ("") or define aditional rotation angle for new objects. - _hidden = (optional) if true replacing includes hidden objects, default is false; - _percent = (optional) random percentage of matching object to replace, default is 1; - _sizefilter = (optional) array that defines minimum and maximum size values for object to be filtered. Useful when types or classnames don't work or if you want to use diferent replacements for different sized objects. Use [0,100] if you don't want to filter. - _code = (optional) custom code to be executed on each object, default is {}; - _altreplacer = classes to use when terrain slope is greater than 18 degrees (check isflatempty below). IF empty or false its not used. If true uses classes defined below in _altreplacerdefaul, otherwise use an array with desired classes. - _debug = (optional) markers for each replacement and message with number of replacements. Example 1: Replaces all "Land_House_L_6_EP1" houses with two RSO buildings with disabled simulation and rotated 180 degrees, and places debug markers. [player,200,[],["Land_House_L_6_EP1"],["rso_h21","rso_hut3"],180,true,1,[0,100], {_this disableSimulation true},false,true] execVM "replaceobjects.sqf"; Example 2: replaces 20% of houses around player between 0 and 10 size with two RSO buildings or rubble if the terrain is sloped [[worldsize select 0, worldsize select 1], (worldsize select 0) / 2,["house"],[],["rso_h21","rso_hut3"],0,true,0.2,[0,10], {},["Land_Fortress_01_bricks_v1_F"]] execVM "replaceobjects.sqf"; Example 3: replaces all houses around player with two RSO buildings [[player, worldsize,["house"],[],["rso_h21","rso_hut3"]] execVM "replaceobjects.sqf"; Example 4: replaces all billboards in fallujah by empty ones [replacer, radius,[],[], ["Land_Billboard_F"],0,true,1,[6.00263,6.00264]] execVM "replaceobjects.sqf"; List of types that can be filtered by, according to BIS: "TREE", "SMALL TREE", "BUSH", "object", "HOUSE", "FOREST BORDER", "FOREST TRIANGLE", "FOREST SQUARE", "CHURCH", "CHAPEL", "CROSS", "BUNKER", "FORTRESS", "FOUNTAIN", "VIEW-TOWER", "LIGHTHOUSE", "QUAY", "FUELSTATION", "HOSPITAL", "FENCE", "WALL", "HIDE","BUSSTOP", "ROAD", "FOREST", "TRANSMITTER", "STACK", "RUIN", "TOURISM", "WATERTOWER", "TRACK", "MAIN ROAD","ROCK", "ROCKS", "POWER LINES", "RAILWAY", "POWERSOLAR", "POWERWAVE", "POWERWIND", "SHIPWRECK", "TRAIL" */ //shuffle array function from killzonekid KK_fnc_arrayShuffle = { private "_cnt"; _cnt = count _this; for "_i" from 1 to _cnt do { _this pushBack (_this deleteAt floor random _cnt); if _debug then {systemchat format ["%1 randomized", _i]}; }; _this }; private ["_objArray","_filteredArray","_altreplacerdefault","_slctrl","_pos","_radius","_type","_oldobjlist","_newobjlist","_customdir","_hidden","_percent","_sizefilter","_code","_altreplacer","_debug"]; params ["_pos","_radius","_type","_oldobjlist","_newobjlist","_customdir","_hidden","_percent","_sizefilter","_code","_altreplacer","_debug"]; //finds objects according to criteria and puts them in an array _objArray = []; if (count _oldobjlist == 0) then { _objArray = nearestTerrainObjects [_pos, _type, _radius, false, true]; } else { _fullarray = nearestTerrainObjects [_pos, _type, _radius, false, true]; {if (typeOf _x in _oldobjlist) then {_objArray pushback _x}} forEach _fullarray; }; //filters array according to min and max size defined in _sizefilter if (isNil "_filteredArray") then {_filteredArray = []}; if (!isNil "_sizefilter") then { _sizeA = _sizefilter select 0; _sizeB = _sizefilter select 1; {if (((boundingboxREAL _x select 1 select 0) - (boundingboxREAL _x select 0 select 0) > _sizeA) && ((boundingboxREAL _x select 1 select 0) - (boundingboxREAL _x select 0 select 0) < _sizeB)) then { _filteredArray pushback _x}} forEach _objArray; } else { _filteredArray = _objArray; }; sleep 1; //sets default variables if undefined by user if (isNil "_customdir") then {_customdir = 0}; if (isNil "_hidden") then {_hidden = false}; if (isNil "_percent") then {_percent = 1}; if (isNil "_debug") then {_debug = false}; if (isNil "_code") then {_code = {}}; //houses to use if terrain slope is too great for specified ones. default values are used if _altreplacer is set to true _altreplacerdefault = ["Land_Addon_02_b_white_ruins_F"]; _altreplacer = true; if (isNil "_altreplacer" || !_altreplacer) then {_slctrl = false} else { _slctrl = true; if _altreplacer then {_altreplacer = _altreplacerdefault}; }; //randomizes the array using KK function _filteredArray call KK_fnc_arrayShuffle; if _debug then {systemchat "shuffled"}; reverse _filteredArray; sleep 1; _filteredArray resize (floor ((count _filteredArray) * _percent)); _rplcount = 0; //function that replaces the object _replaceobject = { params ["_oldobject", "_replacer"]; private ["_newobject"]; _position = getPosATL _oldobject; _direction = direction _oldobject; _oldobject hideObjectGlobal true; //checks if slope filter is used and selects from which array of objects (normal or for sloped terrain) to create new object if (!_slctrl) then { _newobject = _replacer createVehicle _position; } else { if (position _oldobject isFlatEmpty [-1, -1, 0.4, 1, 0, false] isEqualto []) then { _newobject = (selectRandom _altreplacer) createVehicle _position; _customdir = 0; } else { _newobject = _replacer createVehicle _position; }; }; //positions new created object on floor, adding custom direction and vertical orientation _newobject setPosATL [_position select 0, _position select 1, 0]; _newobject setDir _direction + _customdir; _newobject setvectorUp [0,0,1]; _newobject call _code; _rplcount = _rplcount + 1; //places debug markers if debug is on if (_debug) then { _mrk = createMarker [str _rplcount,_position]; _mrk setMarkerShape "ICON"; _mrk setMarkerType "hd_dot"; }; }; //checks if hidden objects are to be replaced and calls replacement function accordingly //sleep 1; if _hidden then { {[_x, (selectRandom _newobjlist)] call _replaceobject} forEach _filteredArray; } else { { if (!(isObjectHidden _x)) then {[_x, (selectRandom _newobjlist)] call _replaceobject} } forEach _filteredArray; }; if _debug then {systemchat format ["script replaced %1 objects", _rplcount]}; 2 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted April 5, 2018 On 31/1/2018 at 9:50 PM, b3lx said: buildings and other Hello there b3lx ! Nice script and thanks for sharing this ! I have also something similar , for everyone who wants to take a look: One for buildings ( as items ) and one, with some help of davidoss for trees ( .p3d ojects ) Thanks again! Share this post Link to post Share on other sites
b3lx 161 Posted April 5, 2018 the p3d method looks great! I might use it to replace my workaround which was a size filter for objects without classnames. I changed my script a bit and now is faster (I'll post a new version) but still laggs a bit. Another thing I tried was to do it with 3den objects, so that the script would run in the editor and doesn't have to run every time I start a mission but it doesn't work as expected because buildings behave weirdly (can't change their position for example). It would be really great if there was some way of making the changes done by these scripts saveable so that it wouldn't take so much time. In the fallujah map I do it by increasing the radius every some seconds, so its possible to start playing while the script is doing the furher parts because it's a huge map. Thanks for sharing, it really helps to get some ideias. 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted April 5, 2018 22 minutes ago, b3lx said: It would be really great if there was some way of making the changes done by these scripts saveable so that it wouldn't take so much time. Yes , this would be great ! 1 Share this post Link to post Share on other sites
pognivet 151 Posted November 28, 2020 Do you happen to have the mission file or the script example for when you replaced the Fallujah buildings with RSO ones? I really don't want to have to troubleshoot that all myself since from your screenshot it looks like you've got it working pretty good. Thanks in advance. Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted November 28, 2020 You can always run the script on the entire map with the preInit parameter, should speed things up quite a bit. Pre_and_Post_Init Worth a shot! Edit: Just realized this was dug up from the dead. Cheers 2 Share this post Link to post Share on other sites
Larrow 2820 Posted November 28, 2020 And to add to Grumpys suggestion, do it behind a loading screen( BIS_fnc_startLoadingScreen ), where scripts will run at full speed( 50ms rather than normal 3ms ). 4 Share this post Link to post Share on other sites
zagor64bz 1225 Posted November 28, 2020 1 hour ago, Larrow said: And to add to Grumpys suggestion, do it behind a loading screen( BIS_fnc_startLoadingScreen ), where scripts will run at full speed( 50ms rather than normal 3ms ). 4 hours ago, Grumpy Old Man said: You can always run the script on the entire map with the preInit parameter, should speed things up quite a bit. Pre_and_Post_Init Worth a shot! 7.000++ hours on Arma, and I didn't even knew we hat a pre-init.Damn... you two guys are a well of Arma-wisdom...👍 And how you use the pre-init..it's not very clear in the wiki mentioned... Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted November 28, 2020 19 minutes ago, zagor64bz said: And how you use the pre-init..it's not very clear in the wiki mentioned... It is, you need to define the function inside the description.ext as a CfgFunction, as seen in the example slightly above where the link leads you. Cheers 1 1 Share this post Link to post Share on other sites
zagor64bz 1225 Posted November 28, 2020 3 minutes ago, Grumpy Old Man said: It is, you need to define the function inside the description.ext as a CfgFunction, as seen in the example slightly above where the link leads you. Cheers Right.... but how you call that function? So, let's say I define it in the description.ext as for the wiki example: Spoiler class CfgFunctions { class myTag { class myCategory { class myFunction { preInit = 1; // (formerly known as "forced") 1 to call the function upon mission start, before objects are initialized. Passed arguments are ["preInit"] postInit = 0; // 1 to call the function upon mission start, after objects are initialized. Passed arguments are ["postInit", didJIP] preStart = 1; // 1 to call the function upon game start, before title screen, but after all addons are loaded (config.cpp only) ext = ".sqf"; // Set file type, can be ".sqf" or ".fsm" (meaning scripted FSM). Default is ".sqf". headerType = -1; // Set function header type: -1 - no header; 0 - default header; 1 - system header. recompile = 1; // 1 to recompile the function upon mission start (config.cpp only; functions in description.ext are compiled upon mission start already) }; }; }; }; Is the function called by default at the mission start, without any command? And, furthermore, if I have a mission with the "regular" init.sqf, how do I make that init run as pre-init? Just define the class in the description? Sorry for my ignorance in this matter... Share this post Link to post Share on other sites
pierremgi 4862 Posted November 28, 2020 lol preInit and postInit make your function automatic (the main reason BIKI mentioned they are efficient but to be used with caution). See initialization order. Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted November 28, 2020 2 hours ago, zagor64bz said: Is the function called by default at the mission start, without any command? And, furthermore, if I have a mission with the "regular" init.sqf, how do I make that init run as pre-init? Just define the class in the description? Sorry for my ignorance in this matter... Just how it says in the example. If the preInit parameter is set to 1, the function will run once during preInit. This is also the point where the function can run at full speed. You can't change how the init.sqf is handled, it's pretty much set in stone. If you have other functions that you want to run during pre/postInit or pre mission start you have to define them within CfgFunctions inside description.ext. Just give it a try and goof around with it, worst thing to happen could be a game crash. Cheers Share this post Link to post Share on other sites
zagor64bz 1225 Posted November 28, 2020 47 minutes ago, Grumpy Old Man said: Just give it a try and goof around with it, worst thing to happen could be a game crash. 👍👍👍 Thank you..I will 1 Share this post Link to post Share on other sites
ZaellixA 383 Posted November 28, 2020 Well, you do have a lot of well-placed tips to make your script/function run faster. I have to admit I didn't go through the whole script, but I do have a couple of things to mention. In the following, you set the defaults if not provided by the user. You could very well do that at the line where you declare the variables and since you will use an engine command it will be faster than manually checking each variable. Quote //sets default variables if undefined by user if (isNil "_customdir") then {_customdir = 0}; if (isNil "_hidden") then {_hidden = false}; if (isNil "_percent") then {_percent = 1}; if (isNil "_debug") then {_debug = false}; if (isNil "_code") then {_code = {}}; A possible solution to this would look like params[["_customdir", 0, [0]], // Create a _customdir variable, set its default to 0 and possible values to be numbers ["_hidden", false, [false]], // Create a _hidden variable, set its default to false and possible values to be booleans ["_percent", 1, [0]], // Create a _percent variable, set its default to 1 and possible values to be numbers ["_debug", false, [false]], // Create a _debug variable, set its default to false and possible values to be booleans ["_code", {}, []]]; // Create a _code variable, set its default to {} (empty scope) and possible values to be everything Of course, in the same way, you could declare/define/create the rest of the variables, which, personally, I believe is the best way to do it. This way, you make the code more efficient (I am not sure how much you could gain with the aforementioned change though) and you make the code more readable by declaring your intentions clearly. I will try to go through the whole script and provide some alternative if I manage to find any. One thing to note here is that I am not an ArmA 3 script expert, so I can only provide information on what I know about. In any case, if the information I provide is questionable I will make sure to try my best to inform you about it. I hope I'll find some time to spot more points that could be improved. 1 Share this post Link to post Share on other sites
b3lx 161 Posted December 3, 2020 Thanks everyone for your suggestions!. I use postInit because contrary to preInit it makes it possible to use together with editor hide object modules. Definitely much faster than after mission initialised. I've been using a different updated version of this script that I put in my object replacement mod. @pognivet this is what I used for fallujah together with another script only to replace trees. Best way is to define the replacement script as a function and call it instead of execVM and call it pre or postInit. You can use center=player and use a small radius to see a preview in the editor. Don't use worldsize as radius if you don't use pre or post init, it will take forever. _center = [worldsize/2,worldsize/2]; _radius = worldsize; //chernarusian billboards [_center, _radius,[],["bilboard_cigara_chernomorky.p3d","bilboard_toaletak_armasan.p3d","bilboard_vodka.p3d","bilboard_beach.p3d","bilboard_everon.p3d","bilboard_likery_bardak.p3d","bilboard_strana_noveho_radu.p3d","bilboard_smadny_maskrnik.p3d","bilboard_bienvenudo.p3d","bilboard_escape.p3d","bilboard_seci_stroje.p3d","bilboard_riviera.p3d","bilboard_pizza_presto.p3d","bilboard_alkohol.p3d","bilboard_hlinik.p3d","bilboard_cibulka.p3d"], ["Land_Billboard_F"],0,false,1,[0,100],{_this setobjecttexture [0,(selectrandom billboardstextures)]}] execVM "replaceobjects.sqf"; //house with arches small and hut with no interior [_center,_radius,["HOUSE"],["Land_Dum_istan2","Land_Dum_olez_istan2"], ["rso_construct3","rso_complex5","rso_complex6","rso_h1","rso_h10","rso_h19","rso_shop3","rso_shop3b","rso_apartmentcomplex","rso_garages","rso_garage1","Land_villa_b","Land_villa"],0,false,1,[12,16]] execVM "replaceobjects.sqf"; //cubic buildings with interior [_center,_radius,["BUILDING","HOUSE"],["Land_Dum_olez_istan2_maly2","Land_Dum_olez_istan2_maly"], ["rso_hut1","rso_hut2","rso_hut4","rso_stores","rso_shack"],0,false,1,[8,10]] execVM "replaceobjects.sqf"; //old building very large [_center,_radius,["BUILDING","HOUSE"],["Land_Dum_istan2_02"], ["rso_big_f"],270,false,1] execVM "replaceobjects.sqf"; //old buildings single piece and double piece [_center, _radius,["BUILDING"],["Land_Dum_istan2_01","Land_Dum_istan2_03","Land_Dum_istan2_03a"], ["Land_House_C_10_EP1","rso_stores2","rso_stores3","rso_shop1"],0,false,1] execVM "replaceobjects.sqf"; //brown house small [_center, _radius,["HOUSE","BUILDING"],["Land_Dum_istan3_pumpa"], ["rso_store1","Land_House_C_4_EP1","Land_Unfinished_Building_01_F"], 0,false,0.5] execVM "replaceobjects.sqf"; //old house no interior [_center, _radius,["BUILDING"],["dum_mesto3_istan.p3d"], ["Land_17str","Land_17strb","rso_h20","rso_h21","Land_14str","Land_Unfinished_Building_02_F"],90,false] execVM "replaceobjects.sqf"; //brown house big [_center, _radius,[],["Land_Dum_istan3_hromada2"], ["rso_h17","Land_5str","Land_villa","Land_6str","Land_villa3","Land_villa_b"], 0,false,0.5] execVM "replaceobjects.sqf"; //house with arches big [_center, _radius,["house"],["Land_Dum_istan3"], ["rso_h18","Land_16str","Land_7str","Land_22str","rso_h6","rso_h15"], 90,false,0.5,[22.7,22.9]] execVM "replaceobjects.sqf"; //house without classname (parasol) [_center, _radius,[],["dum_olez_istan1_open.p3d"], ["Land_House_C_1_EP1","Land_House_C_1_v2_EP1","rso_cornershop1","Land_21str","Land_21str_b","Land_21str_c"]] execVM "replaceobjects.sqf"; //yellow apartment buildings [_center, _radius,["house"],["Land_Dum_istan4","Land_Dum_istan4_big"], ["rso_complex1","rso_complex2","rso_complex3","rso_complex4"], 180,false,0.1] execVM "replaceobjects.sqf"; //phonebooth [_center, _radius,[],["phone_box.p3d"], ["Land_GarbageHeap_02_F"]] execVM "replaceobjects.sqf"; //dumpster [_center, _radius,[],["kontejner.p3d"], ["Land_ChairPlastic_F","Oil_Spill_F", "Land_Plank_01_4m_F","Land_CratesPlastic_F","Land_CanisterFuel_Blue_F","Land_BarrelEmpty_F","Land_BarrelTrash_grey_F","Land_MetalBarrel_empty_F"]] execVM "replaceobjects.sqf"; 1 Share this post Link to post Share on other sites
b3lx 161 Posted January 4, 2021 forget my previous fallujah RSO replacement script. Here's a great and fast one I'm working on for RSO, CUP and METIS Nature. The replacement function I use on on the Object Replament Modules mod is good for simple all purpose modifications but for so many different changes on a terrain it's better a specific script like this one. Spoiler _center = player; _radius = 1000; b3lx_fal_loadingscreen = true; b3lx_fal_globaldensity = 1; clearRadio; if b3lx_fal_loadingscreen then {["b3lx_loadingScreen","b3lx_loadingScreen_start"] call BIS_fnc_startLoadingScreen}; _rplFNC = { params [ ["_array",[]], ["_newobjarray",[]], ["_setdir",0], ["_rndZ",false] ]; { private ["_obj","_pos","_dir","_new","_type","_weighted"]; _obj = _x; if ((count _newobjarray > 1) && (typeName (_newobjarray select 1) == "SCALAR")) then {_weighted = true} else {_weighted = false}; if !(isObjectHidden _obj) then { _pos = getposATL _obj; _dir = getdir _obj; hideobject _obj; _obj allowdamage false; if (b3lx_fal_globaldensity*10 >= random 10) then { if _weighted then { _type = selectRandomWeighted _newobjarray; } else { _type = selectRandom _newobjarray; }; _new = _type createvehicle [0,0,0]; _new setdir (_dir + _setdir); if (_type == "Phoenixrupicola_2") then { _pos = _pos getpos [2.2,180+_dir]; }; if _rndZ then { _pos set [2,0-(random 1)]; }; _new setposATL _pos ; }; }; } forEach _array; true }; _allveg = nearestTerrainObjects [_center,["TREE","SMALL TREE","BUSH"],_radius]; _bushes = nearestTerrainObjects [_center,["BUSH"],_radius]; _trees = _allveg - _bushes; _houseTrees = _allveg select {count(nearestTerrainObjects [_x,["house"],25]) > 0}; _waterTrees = _allveg select {position _x isFlatEmpty [-1, -1, 0.2, 1, 0, false] isEqualto []}; if b3lx_fal_loadingscreen then {progressLoadingScreen 0.1}; _mainroadTrees = _allveg select {((getModelInfo ((_x nearroads 25) select 0)) select 0) in ["asf1_25.p3d","city_25.p3d"]}; if b3lx_fal_loadingscreen then {progressLoadingScreen 0.2}; _roadtrees = _trees select {!((_x nearroads 15) isEqualTo [])}; _RemainderTrees = _trees - (_houseTrees + _waterTrees +_roadTrees); _roadTreeTypes = ["Oleander_White","Oleander_White"]; _waterTreeTypes = ["Cane1","Ficus_Bush_3"]; _junk = [ "Land_ChairPlastic_F", 1, "Land_EmergencyBlanket_01_discarded_F",1, "Land_WaterBottle_01_compressed_F",1, "Land_Garbage_square3_F",5, "Land_Garbage_square5_F",5, "Land_GarbageBarrel_02_F",1, "Land_GarbagePallet_F",1, "Land_GarbageWashingMachine_F",1, "Oil_Spill_F",1, "Land_GarbageHeap_02_F",1, "Land_JunkPile_F",1, "Land_Tyre_F",1, "Land_Pallets_F",1, "Land_PaperBox_01_small_destroyed_brown_IDAP_F",1, "Land_PaperBox_01_small_ransacked_brown_F",1, "Land_FoodSack_01_empty_brown_F",1, "Land_CratesPlastic_F",1, "Land_Bucket_painted_F",1, "Land_CanisterFuel_F",1, "Land_CanisterPlastic_F",1, "Land_GasCanister_F",1 ]; _housetreesTypes = [ "CUP_t_JuniperusC2s_EP1",8, "FagusSylvatica_b_1f",8, "FagusSylvatica_1fb",8, "Oleander_White",8, "Oleander1",8, "rosaCanina_2s",8, "sambucusNigra_1s",8, "sambucusNigra_2s",8, "Betula_pendula_2s",8, "Betula_pendula_2w",8, "Betula_pendula_stump",4, "Cupressus_1",1, "Cupressus_2",1, "Olive_1",2, "Ficus_3",3, //dead "Ficus_1",1, //small "Ficus_2",1, //big "Ficus_small",1, //"Palm_2",1, //"Palm_1",1, "Phoenixrupicola_1",8, "Phoenixrupicola_2",8, "PiceaAbies_b_1fb",1, "PiceaAbies_1f",1, "PiceaAbies_1sb",1, "Pine_1",1, "Pine_2",1, "Pine_3",1, "PinusSylvestris_1f",8, //small pine "PinusSylvestris_1s",8, //small pine "PinusSylvestris_2sb",1, //tall pine "CUP_t_PinusE2s_EP1",1, "CUP_t_pinusN1s",1, "CUP_t_PinusS3s_EP1",1 ]; _fartrees = [ "Phoenixrupicola_1",2, "Phoenixrupicola_2",10, "Ficus_Bush_3",1, "Ficus_Bush_1",1, "Ficus_Bush_2",1, "sambucusNigra_1s",1, "sambucusNigra_2s",1 ]; if b3lx_fal_loadingscreen then {progressLoadingScreen 0.3}; _housesToreplace = [ //house with arches small and hut with no interior [["dum_istan2b.p3d","dum_istan2.p3d","dum_olez_istan2.p3d"],["rso_h1","rso_h10","rso_h19","rso_shop3","rso_shop3b","rso_garages","rso_garage1"],180], //cubic buildings with interior [["dum_olez_istan2_maly_open.p3d","dum_olez_istan2_maly2.p3d","dum_olez_istan2_maly.p3d"],["Land_Shed_06_F","Land_GuardHouse_01_F","Land_i_Garage_V1_F","Land_Ind_Garage01_EP1","rso_hut2","rso_hut4","rso_stores","rso_shack"]], //old building very large [["dum_istan2_02.p3d"],["rso_big_f","Land_Offices_01_V1_F","rso_arches","rso_mosque1"],270], //old building corner [["dum_istan2_04a.p3d"],["rso_h9","Land_House_C_4_EP1"]], //old buildings single piece and double piece [["dum_istan2_01.p3d","dum_istan2_03.p3d","dum_istan2_03a.p3d"],["rso_h16","Land_House_C_10_EP1","rso_stores2","rso_stores3","rso_shop1"]], //brown house terrace [["dum_istan3_hromada2.p3d"],["rso_h17",1,"rso_construct3",2,"rso_h11",1]], //brown house big [["dum_istan3_hromada.p3d"],["rso_h20","Land_House_C_10_EP1"],90], //brown house small [["dum_istan3_pumpa.p3d"],["Land_i_House_Small_03_V1_F",1,"rso_store1",1,"Land_Unfinished_Building_01_F",5]], //old house no interior [["dum_mesto3_istan.p3d"],["Land_i_House_Small_03_V1_F","rso_h21","Land_Unfinished_Building_02_F"],90], //house with arches big [["dum_istan3.p3d"],["Land_i_House_Small_03_V1_F","rso_h18","rso_h6","rso_h15"],90], //house without classname (parasol) [["dum_olez_istan1_open.p3d"],["Land_House_C_1_EP1","Land_House_C_1_v2_EP1","rso_cornershop1"]], //yellow apartment buildings [["dum_istan4.p3d","dum_istan4_big.p3d","dum_istan4_big_inverse.p3d","dum_istan4_inverse.p3d","dum_istan4_detaily1.p3d"],["rso_complex1","rso_complex2","rso_complex3","rso_complex4","rso_complex5","rso_complex6","rso_apartmentcomplex"],180], //billboards [["bilboard_cigara_chernomorky.p3d", "bilboard_toaletak_armasan.p3d", "bilboard_vodka.p3d", "bilboard_beach.p3d", "bilboard_everon.p3d", "bilboard_likery_bardak.p3d", "bilboard_strana_noveho_radu.p3d", "bilboard_smadny_maskrnik.p3d", "bilboard_bienvenudo.p3d", "bilboard_escape.p3d", "bilboard_seci_stroje.p3d", "bilboard_riviera.p3d", "bilboard_pizza_presto.p3d", "bilboard_alkohol.p3d", "bilboard_hlinik.p3d", "bilboard_cibulka.p3d"],["Land_Billboard_F","Land_Billboard_03_blank_F"]], //phonebox and dumpster [["phone_box.p3d","kontejner.p3d"],_junk], //tank statue [["a_statue02.p3d"],["rso_shrine"]] ];//end _objInfoArr = []; _allobjects = nearestTerrainObjects [_center,[],_radius]; _allobjects = _allobjects - _allveg; _progresshouses = count _housestoReplace; { private _modelNames = _x select 0; private _objectsToReplace = _allobjects select {(getModelInfo _x select 0) in _modelnames}; private _types = _x select 1; if (count _objectsToReplace>0) then { private _dir = 0; if (count _x > 2) then {_dir = _x select 2}; _objInfoArr pushback [_objectsToReplace,_types,_dir]; }; if b3lx_fal_loadingscreen then {progressLoadingScreen (0.3 + (_forEachIndex/_progresshouses))}; } forEach _housesToreplace; if b3lx_fal_loadingscreen then {progressLoadingScreen 0.4}; [_mainroadTrees,_roadTreeTypes] call _rplFNC; if b3lx_fal_loadingscreen then {progressLoadingScreen 0.5}; [_watertrees,_waterTreeTypes,0,true] call _rplFNC; if b3lx_fal_loadingscreen then {progressLoadingScreen 0.6}; [_roadtrees,_junk] call _rplFNC; if b3lx_fal_loadingscreen then {progressLoadingScreen 0.7}; [_housetrees,_housetreesTypes] call _rplFNC; if b3lx_fal_loadingscreen then {progressLoadingScreen 0.8}; [_RemainderTrees,_fartrees,0,true] call _rplFNC; if b3lx_fal_loadingscreen then {progressLoadingScreen 0.9}; {_x call _rplFNC} forEach _objInfoArr; if b3lx_fal_loadingscreen then {"b3lx_loadingScreen" call BIS_fnc_endLoadingScreen}; systemchat "done replacing"; And this is the result: Spoiler Share this post Link to post Share on other sites
pognivet 151 Posted November 24, 2022 On 1/4/2021 at 8:58 AM, b3lx said: forget my previous fallujah RSO replacement script. Here's a great and fast one I'm working on for RSO, CUP and METIS Nature. The replacement function I use on on the Object Replament Modules mod is good for simple all purpose modifications but for so many different changes on a terrain it's better a specific script like this one. Sorry to necro an old thread twice (I've been away for a while), but I have two questions: 1. the RSO dev site is shut down and armaholic is dead. do you know where i can get the building pack now? looked all over and i cant find a mirror anywhere. 2. I cant seem to get the script to run on startup. i added the following to description.ext: class CfgFunctions { class TAG { class replacer { class postInit { postInit = 1; file = "replacer.sqf"; }; }; }; }; I put your script in the mission folder named "replacer.sqf". Even though I don't have RSO when I run the mission I still don't see the result of "systemchat "done replacing";" so I assume its not running at all. Do you think you could help me? I really want to get this working. And thanks for posting your scripts and trying to help. Share this post Link to post Share on other sites
pognivet 151 Posted November 24, 2022 Every time I run it I get this error as well: https://files.catbox.moe/07f6hm.jpg Share this post Link to post Share on other sites