HereIsJones 20 Posted July 15, 2021 I'm trying to get a handle on a specific object and am having some trouble. My code is looking for "Land_MarketShelter_F" within a specific radius. isKindOf says the market shelter is a "Building", and if I type in the debug console - copyToClipboard str nearestObjects [_thisAnchorPos, ["building"], 200]; ...I can see "Land_MarketShelter_F" in the array. But when I use this code in my script - _thisShelter = nearestObjects [_thisAnchorPos, ["building"], 200]; { if (typeOf _x == "Land_MarketShelter_F") then { [_x] call BIS_fnc_replaceWithSimpleObject; }; } forEach _thisShelter; ...it's not in the array. In fact, that last bit of code returns a much smaller array of objects. It doesn't help that isKindOf says the market shelter is a "Building", but BIS_fnc_objectType says it's a "House". Anyone know what I'm doing wrong? Share this post Link to post Share on other sites
pierremgi 4879 Posted July 15, 2021 _thisShelter = nearestObjects [_thisAnchorPos, ["building"], 200]; { if (typeOf _x == "Land_MarketShelter_F") then { [_x] call BIS_fnc_replaceWithSimpleObject; }; } forEach _thisShelter works for me (in SP). Just verify your position (_thisAnchorPos) as reference. 1 1 Share this post Link to post Share on other sites
HereIsJones 20 Posted July 15, 2021 Thanks. Somewhere above this code, I was using BIS_fnc_objectsMapper to spawn in a composition, and even though I could see all the objects spawned in, apparently there is something that goes on in the background and the composition takes a few seconds to fully "initialize". I moved my code down a bit and put a sleep 5; in front of it, and now it works. Share this post Link to post Share on other sites