Billy EatWorld 0 Posted August 3, 2021 Hey guys! So I'm just struggling to figure out how to do anything with map objects that haven't been defined... The goal is to hide specific objects on an entire map that don't fit a particular theme (WW2), so defining them and doing them in real time is not an option (takes hours to scan the map). I've created an array with objects that need to be hidden but obviously this code doesn't work. Any Ideas? (This is only a very small chunk of the array which is 1700+ objects). _blacklistedObjects = [ 948464: wreck_bmp2_f.p3d, 2860122: wreck_bmp2_f.p3d, 1020605: wreck_bmp2_f.p3d, 2882561: wreck_bmp2_f.p3d, 2882560: wreck_bmp2_f.p3d, 2882562: wreck_bmp2_f.p3d, 2223850: wreck_bmp2_f.p3d, 2705791: wreck_bmp2_f.p3d, 1108177: wreck_bmp2_f.p3d, 1108175: wreck_bmp2_f.p3d ]; // Hide Objects { _x hideObject true; } forEach _blacklistedObjects; Share this post Link to post Share on other sites
itisnotlogical 6 Posted August 3, 2021 (edited) I found this snippet in an old thread: { if (_x typeOf "Land_City_8m_F" || _x typeOf "Land_City_8mD_F") then { deleteVehicle _x; }; } forEach nearestObjects [player, ["All"], 1000000]; I can't test it myself at the moment but the docs for nearestObjects says you can put the classnames where "All" is in the above snippet, which would save script cycles on looping through every object in the defined radius. EDIT: I read the thread closer and apparently it doesn't work. Oops, I'm bad. Also, the .p3d is unnecessary when referring to objects by classname in a script. I wish you luck with your scenario 😃 Edited August 3, 2021 by itisnotlogical I didn't know what I was talking about. Share this post Link to post Share on other sites
pierremgi 4906 Posted August 3, 2021 start with: {_x hideObject true} count nearestTerrainObjects [ [worldSize/2,worldSize/2], ["hide"], worldSize/1*4, false, true]; Run it locally (i.e. in initPlayerLocal.sqf) 2 Share this post Link to post Share on other sites
sarogahtyp 1109 Posted August 3, 2021 9 minutes ago, pierremgi said: worldSize/1*4 looks wrong for me. should be worldSize * sqrt 2 / 2 Also it's important to run it before the player spawns. It will be much faster then. Therefore you have to ensure to run it before lines which wait for the player object spawned like waitUntil {sleep 1; time > 0 }; or waitUntil { player == player }; 1 Share this post Link to post Share on other sites
pierremgi 4906 Posted August 3, 2021 Typo. corrected Share this post Link to post Share on other sites
Billy EatWorld 0 Posted August 3, 2021 Answered my own question... For anyone wondering the trick is to get the object from the object ID using nearestObject _blacklistedObjects = [ 948464, 2860122, 1020605, 2882561, 2882560, 2882562, 2223850 ]; { // Get Object From ID _obj = [0,0,0] nearestObject _x; // Hide Object _obj hideObject true; } forEach _blacklistedObjects; Share this post Link to post Share on other sites
Billy EatWorld 0 Posted August 3, 2021 4 hours ago, itisnotlogical said: I found this snippet in an old thread: { if (_x typeOf "Land_City_8m_F" || _x typeOf "Land_City_8mD_F") then { deleteVehicle _x; }; } forEach nearestObjects [player, ["All"], 1000000]; I can't test it myself at the moment but the docs for nearestObjects says you can put the classnames where "All" is in the above snippet, which would save script cycles on looping through every object in the defined radius. EDIT: I read the thread closer and apparently it doesn't work. Oops, I'm bad. Also, the .p3d is unnecessary when referring to objects by classname in a script. I wish you luck with your scenario 😃 Thanks for the reply! Unfortunately this wouldn't work. To be a bit clearer, basically the issue I was finding is that some terrain objects I was trying to find were super simple objects... i.e. don't have a classname. The solution for me was to search the map for objects with a matching model (instead of looking for the classname)... on livonia that was 3 million objects by about 100+ object types that needed to be checked (hours of processing). I ended up with a list of about 1700+ objects that matched (in the format in the OP)... and was just struggling with how to hide them. I've put the solution in this thread... essentially it was just my misunderstanding of how objectID's work. Share this post Link to post Share on other sites
Billy EatWorld 0 Posted August 3, 2021 3 hours ago, pierremgi said: start with: {_x hideObject true} count nearestTerrainObjects [ [worldSize/2,worldSize/2], ["hide"], worldSize/1*4, false, true]; Run it locally (i.e. in initPlayerLocal.sqf) Thanks for the reply mate! I posted my solution in this thread if you're interested. Basically the issue was I was wanting to hide specific objects... some which were super simple objects and didn't have a class name. I solved that by comparing by the object model instead, but there was still around 3 million map objects x about 100+ different model types. The processing took more than an hour.. so any real time processing in game would obviously be impractical. Share this post Link to post Share on other sites
pierremgi 4906 Posted August 3, 2021 OK. Using the object IDs seems to me a long personal process, especially for 1700+ objects.. 1 Share this post Link to post Share on other sites
Harzach 2518 Posted August 3, 2021 Also, object IDs can change on game update. 1 Share this post Link to post Share on other sites
jakeplissken 81 Posted August 3, 2021 Do it like this. { _x hideObjectGlobal TRUE; } foreach (nearestTerrainObjects [[14620.6,16776.1,0],[],500] select {getModelInfo _x #0 in ["t_phoenixc1s_f.p3d","t_oleae1s_f.p3d","wreck_car_f.p3d","wreck_offroad2_f.p3d","junkpile_f.p3d","b_ficusc1s_f.p3d","garbagepallet_f.p3d","t_phoenixc3s_f.p3d","garbagebags_f.p3d","garbagewashingmachine_f.p3d","t_ficusb1s_f.p3d","t_ficusb2s_f.p3d"]}); This hides via the model name. This can hide anything and runs best in a preinit function. Run it like this. Setup the fn_replace function in CfgFunctions as shown below. class replace{ file = "functions\fn_replace.sqf"; preInit = 1; }; Then it will run in mission preinit and hide trees or junk, anything you wish to be hidden. Share this post Link to post Share on other sites