EO 11277 Posted May 29, 2017 So with the release of Malden on the Development Branch, we get a whole bunch of new and re-worked buildings, some of these look right at home on Altis.... Individual buildings can be replaced by placing this code into the init of proposed building... buildingZ = (position this nearestobject ID); this setPos [(getPos buildingZ select 0), (getPos buildingZ select 1), 0]; this setDir (getDir buildingZ); buildingZ hideObjectGlobal true; replace "ID" with the building ID you want to replace. My question is can this code be used on a grander scale? 2 Share this post Link to post Share on other sites
Greenfist 1863 Posted May 29, 2017 Take a look at nearestTerrainObjects. You can get all the map objects within seconds. Share this post Link to post Share on other sites
EO 11277 Posted May 29, 2017 Thx Greenfist, yes nearestTerrainObjects is great for finding specific building ID's, it's more how to implement those ID's into the above code....that's beyond my remit i'm afraid. Share this post Link to post Share on other sites
[A] Salbei 118 Posted May 30, 2017 I just spent a bit of time and made you these lines: /* Replacmentscript The follwoing parameters have to be passed to the script - _pos = the center position the script starts from working - _typs = lists the typs of objekts the script should filter for - _distance = limits the max search range List of typs that can be filtered by: "TREE", "SMALL TREE", "BUSH", "BUILDING", "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" */ params ["_pos", "_typs", "_distance"]; _housesArray = nearestTerrainObjects [_pos, _typs, _distance, false, true]; //replaces the building _replaceBuilding = { params ["_oldBuilding", "_replacer"]; _pos = getPos _oldBuilding; _dir = getDir _oldBuilding; _oldBuilding hideObjectGlobal true; _newBuilding = _replacer createVehicle _pos; _newBuilding setDir _dir; _newBuilding setPos _pos; }; //sorts the building { diag_log format ["Found: %1, Type: %2", _x, typeOf _x]; switch (typeOf _x) do { case "Land_Offices_01_V1_F" : {[_x, "Land_Offices_01_V1_F"] call _replaceBuilding;}; case "Land_u_Addon_01_V1_F" : {}; case "Land_i_Addon_02_V1_F" : {}; case "Land_i_Addon_03_V1_F" : {}; case "Land_i_Addon_03mid_V1_F" : {}; case "Land_i_Addon_04_V1_F" : {}; case "Land_i_Garage_V1_F" : {}; case "Land_i_Garage_V2_F" : {}; case "Land_Metal_Shed_F" : {}; case "Land_i_House_Big_01_V1_F" : {}; case "Land_i_House_Big_01_V2_F" : {}; case "Land_i_House_Big_01_V3_F" : {}; case "Land_u_House_Big_01_V1_F" : {}; case "Land_i_House_Big_02_V1_F" : {}; case "Land_i_House_Big_02_V2_F" : {}; case "Land_i_House_Big_02_V3_F" : {}; case "Land_u_House_Big_02_V1_F" : {}; case "Land_i_Shop_01_V1_F" : {}; case "Land_i_Shop_01_V2_F" : {}; case "Land_i_Shop_01_V3_F" : {}; case "Land_u_Shop_01_V1_F" : {}; case "Land_i_Shop_02_V1_F" : {}; case "Land_i_Shop_02_V2_F" : {}; case "Land_i_Shop_02_V3_F" : {}; case "Land_u_Shop_02_V1_F" : {}; case "Land_i_House_Small_01_V1_F" : {}; case "Land_i_House_Small_01_V2_F" : {}; case "Land_i_House_Small_01_V3_F" : {}; case "Land_u_House_Small_01_V1_F" : {}; case "Land_i_House_Small_02_V1_F" : {}; case "Land_i_House_Small_02_V2_F" : {}; case "Land_i_House_Small_02_V3_F" : {}; case "Land_u_House_Small_02_V1_F" : {}; case "Land_i_House_Small_03_V1_F" : {}; case "Land_Slum_House01_F" : {}; case "Land_Slum_House02_F" : {}; case "Land_Slum_House03_F" : {}; case "Land_i_Stone_HouseBig_V1_F" : {}; case "Land_i_Stone_HouseBig_V2_F" : {}; case "Land_i_Stone_Shed_V1_F" : {}; case "Land_i_Stone_Shed_V2_F" : {}; case "Land_i_Stone_Shed_V3_F" : {}; case "Land_i_Stone_HouseSmall_V1_F" : {}; case "Land_i_Stone_HouseSmall_V2_F" : {}; case "Land_i_Stone_HouseSmall_V3_F" : {}; case "Land_Unfinished_Building_01_F" : {}; case "Land_CarService_F" : {}; }; }forEach _housesArray; It filters the given area for objekts and then sorts them. You can replace the buildings by adding this line [_x, "Land_Offices_01_V1_F"] call _replaceBuilding; into the brakets of the switch. "Land_Offices_01_V1_F" would be the building you want as replacment. If you've got multiple buildings as replacement you could do this: [_x, selectRandom ["Land_Offices_01_V1_F", "Land_u_Addon_01_V1_F", "Land_i_Addon_02_V1_F"]] call _replaceBuilding; Kind regards Salbei 5 Share this post Link to post Share on other sites
EO 11277 Posted May 30, 2017 @Salbei, this is great man, really appreciate it! Share this post Link to post Share on other sites
sarogahtyp 1108 Posted May 30, 2017 Saw a possible bug while I took a quick look at it. _newBuilding setPos _dir;Should be: _newBuilding setPos _pos;sent from mobile using Tapatalk 1 Share this post Link to post Share on other sites
[A] Salbei 118 Posted May 31, 2017 @sarogahtyp yeah you're right. Just fixed it. Thanks Share this post Link to post Share on other sites
ShadowVVolf 0 Posted October 1, 2017 That image is fantastic! I am so confused on how you got it though, the camera looks like it gets some impossible angles and you're missing the bulky grass blobs. It's almost as if you had your camera lens be convex to get the image, even though I believe you just changed your FOV. I'd love to know what type of setup you did to get this image. Share this post Link to post Share on other sites
EO 11277 Posted October 2, 2017 Hi, and welcome to the forum! On 01/10/2017 at 6:34 AM, ShadowVVolf said: That image is fantastic! I am so confused on how you got it though, the camera looks like it gets some impossible angles and you're missing the bulky grass blobs. It's almost as if you had your camera lens be convex to get the image, even though I believe you just changed your FOV. I'd love to know what type of setup you did to get this image. The image was taken with the Splendid Camera feature. Check out the Weedkiller for Altis, Stratis and Malden mod which removes those "bulky grass blobs". Share this post Link to post Share on other sites
ShadowVVolf 0 Posted October 6, 2017 Sweet thank you! Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted February 7, 2018 Just adding also this script for building replacement: //["Building to replace","replaced Building"] myBuildings = [["Land_i_Stone_HouseSmall_V3_F","Land_HouseV_1I4",0], ["Land_i_House_Big_02_V3_F","Land_HouseV_1T",0], ["Land_i_Stone_HouseBig_V2_F","Land_HouseV_2T2",0], ["Land_i_House_Big_01_V1_F","Land_HouseV2_01A",0], ["Land_i_Shop_02_V1_F","Land_HouseBlock_C2",0], ["Land_i_Shop_02_V3_F","Land_HouseBlock_C5",0], ["Land_Slum_House01_F","Land_Shed_W4",0], ["Land_Hut06","Land_Shed_W02",0], ["Land_i_Shop_02_V2_F","Land_HouseBlock_B5",0], ["Land_Slum_House03_F","Land_HouseBlock_B3",0], ["Land_i_House_Small_01_V3_F","Land_HouseBlock_B4",0], ["Land_i_House_Small_01_V2_F","Land_HouseBlock_A1",0], ["Land_Kiosk_gyros_F","Land_HouseBlock_C4",0], ["Land_d_House_Big_01_V1_F","Land_HouseBlock_C3",0], ["Land_Unfinished_Building_01_F","Land_HouseBlock_B6",0], ["Land_Factory_Main_F","Land_Ind_Pec_03a",0], ["Land_MilOffices_V1_F","Land_a_stationhouse",0], ["Land_i_Stone_HouseBig_V3_dam_F","Land_HouseV_3I2",0], ["Land_i_Shed_Ind_F","Land_Shed_Ind02",0], ["Land_CarService_F","Land_Repair_center",0], ["Misc_Cargo1Bo_civil","Land_Shed_M02",0], ["Land_i_Stone_HouseBig_V2_dam_F","Land_HouseV_1L1",0], ["Land_i_Stone_HouseBig_V1_dam_F","Land_HouseV_1I1",0], ["Land_FuelStation_Build_F","Land_Misc_WaterStation",0], ["Land_Chapel_V2_F","Land_Church_02a",0], ["Land_i_Stone_Shed_V3_F","Land_HouseV_2L",0], ["Land_Chapel_V1_F","Land_HouseV_2I",0], ["Land_i_Barracks_V1_F","Land_Mil_House",0], ["Land_Mil_Barracks_i","Land_Mil_Barracks",0], ["Land_Cargo_HQ_V3_F","Land_Mil_Barracks_L",0], ["Land_Airport_Tower_F","Land_Mil_ControlTower",0] ]; for "_i" from 0 to(count myBuildings-1) do { _CurrentBuilding = (myBuildings select _i) select 0; _ReplacementBuilding = (myBuildings select _i) select 1; _DirectionOffset = (myBuildings select _i) select 2; { systemchat format["getPosATL: %2 getDir: %4 _CurrentBuilding %5",getpos _x, getPosATL _x, getPosASL _x, getdir _x, _x]; diag_log format["getPosATL: %1 getDir: %2 _CurrentBuilding %3 _ReplacementBuilding %4 _x %5", getPosATL _x, getdir _x, _CurrentBuilding, _ReplacementBuilding, _x]; hideObjectGlobal _x; _myReplacement = createVehicle [_ReplacementBuilding, getPosATL _x, [], 0, "CAN_COLLIDE"]; _myReplacement setDir (getdir _x) + _DirectionOffset; _myReplacement setPosATL (getPosATL _x) ; _myReplacement enableSimulationGlobal false; } forEach nearestObjects [markerpos "center", [_CurrentBuilding], worldsize]; }; hint "Replacmentscript end"; and also for trees (p3d) replacement: 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted February 7, 2018 also this is for checking the class: in the init.sqf : player addAction ["Check object class (cursor)", "checkclass.sqf"]; execvm "checkclass.sqf"; checkclass.sqf hint str [getModelInfo cursorObject, typeOf cursorObject]; copyToClipboard str [getModelInfo cursorObject, typeOf cursorObject]; Share this post Link to post Share on other sites
lucapec 7 Posted February 7, 2019 Hello! I would like to add some variety to the cities on Altis, replacing the original buildings with random colored version (Altis & Malden buildings). Using Salbei's multiple replacement it would look something like case "Land_u_House_Big_01_V1_F" : {[_x, selectRandom ["Land_u_House_Big_01_V1_F", "Land_i_House_Big_01_V1_F", "Land_i_House_Big_01_V2_F", "Land_i_House_Big_01_V3_F", "Land_i_House_Big_01_b_blue_F", "Land_i_House_Big_01_b_pink_F", "Land_i_House_Big_01_b_whiteblue_F", "Land_i_House_Big_01_b_white_F", "Land_i_House_Big_01_b_brown_F", "Land_i_House_Big_01_b_yellow_F"]] call _replaceBuilding;}; etc I am not a coder meaning that I don't understand the first part (_pos, _type, _distance...), could anybody explain it to me and guide me to make this script work? in alternative I don't know how to add random variation to George Floros's script.. 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted February 7, 2019 17 minutes ago, lucapec said: George Floros's script.. Hello there lucapec ! In order to do this in my script you can do the following : //["Building to replace","replaced Building"] So you can create an array with your "replaced Buildings" and change a certain building "Building to replace" _Replaced_Buildings = selectrandom [ "add_the_classname", "Land_HouseV_1I4" ]; so the code will then like : //["Building to replace","replaced Building"] myBuildings = [ ["Land_i_Stone_HouseSmall_V3_F",_Replaced_Buildings,0], ["Land_i_House_Big_02_V3_F",_Replaced_Buildings,0], etc It's not tested but it should be fine ! 1 Share this post Link to post Share on other sites
lucapec 7 Posted February 8, 2019 Thank you! The script is working, but it replaces every building with the same randomly chosen color🤣 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted February 8, 2019 7 hours ago, lucapec said: randomly chosen color🤣 Might the Malden buildings have randomization ? Anyone knows ? Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted February 8, 2019 I'm working also on Scipt- Mod environement (trees so far ! ) replacement but automatically detect and replacing the desired trees. I have also add presets for winter , jungle , cold evironement etc. So stay tuned here: Share this post Link to post Share on other sites
[A] Salbei 118 Posted February 8, 2019 Hey Lucapec, try it with this improved version: https://github.com/gruppe-adler/grad_randomizeMap 2 Share this post Link to post Share on other sites
lucapec 7 Posted February 8, 2019 HI! I've tried following the instruction on your version but I couldn't make it work.. 8 hours ago, GEORGE FLOROS GR said: I think it's in the script.. First it choose randomly a "replacer", then it replaces all the buildings which have the same classname with the same one hence the yellow Kavala 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted February 8, 2019 18 hours ago, GEORGE FLOROS GR said: So you can create an array with your "replaced Buildings" and change a certain building "Building to replace" _Replaced_Buildings = selectrandom [ "add_the_classname", "Land_HouseV_1I4" ]; You have add the classnames in the array , not the script ! So the classnames of the buildings that you have selected , for either buildings to replace or replaced will give you the certain result. If there is BIS randomization in the certain classnames of the Malden buildings is the question. It doesn't have to do anything with the script each self ! Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted February 8, 2019 From what i understand the problem is that it randomize the array once so you had the same building spawned in all cases right ? I think maybe it's time to write something new. 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted February 8, 2019 5 hours ago, lucapec said: I think I just finished with a new script , that will auto detect the entrable buildings and replace them on random , this are two images from the test : This will be published soon ! 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted February 8, 2019 I'll try to upload this now. This is also the debug once it's ready i will add a post here as well. Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted February 8, 2019 This is the GF Building Replacement Script - Mod : Thanks ! Share this post Link to post Share on other sites