bull_a 44 Posted September 19, 2015 Hi all, I've had a quick search on the forums and couldn't find what I was looking for. I'm trying to create an array of "Land_Atm_01_F" objects which I can create markers for on the map. Code: _worldRadius = worldSize / 2; _worldCenter = [_worldRadius,_worldRadius,0]; _atmObjects = nearestObjects [_worldCenter,["Land_Atm_01_F","Land_Atm_02_F"],_worldRadius]; _atmObjects; // return At The Moment (excuse the pun) the function is only returning an empty array. When I position a player and look at an ATM the cursorTarget returns nil. I'm struggling to understand why this is happening, so if anyone can shed light on the situation I would be grateful. Regards, Bull Share this post Link to post Share on other sites
seed 11 Posted September 19, 2015 Here is thread from this forum, that might help you. https://forums.bistudio.com/topic/163142-fuel-gas-station-disable/ The thema was how to disable all gas stations. Nimrod_Z provided the solution. The script below is from the linked thread. It returns all the positions of " Land_fs_feed_F" on the map. /* put function in init file then execute with: call getFuelpumps; */ getFuelpumps = { _pos = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition"); _blds=nearestobjects [_pos,["Land_fs_feed_F"], 20000]; _ary=[]; {_ary=_ary+[getpos _x]} foreach _blds; hint str _ary; copyToClipboard str _ary; }; Regards Seed Share this post Link to post Share on other sites
ceeeb 147 Posted September 19, 2015 ATM objects likely do not have a class, which means you can't search for them by class name. It is possible to script a search for all classless objects, then filter each object by checking if the string of its object model contains the name you want, but it is slow. _classlessObjects = nearestObjects [_pos, [], _radius]; if (str _object find " atm_" > 0) then "_object is an atm"; On a large map like Altis, using nearObjects with such a large radius to return all objects on the map will lock up Arma for a very long time. Share this post Link to post Share on other sites
Greenfist 1863 Posted September 19, 2015 I don't know what's the technical term for it, but "ATMs aren't that kind of objects". They're like trees, bees, and footprints. The class name filter in nearestobjects won't return anything, and for the same reason cursortarget doesn't detect them. You can only find their ID and model name "123456: atm_01_f.p3d" So basically you need to go through every single object in the map to find them. _worldRadius = worldSize / 2; _worldCenter = [_worldRadius,_worldRadius,0]; _atmObjects = []; { if (str _x find ": atm_" > -1) then { _atmObjects pushback _x }; } foreach (nearestObjects [_worldCenter, [], _worldRadius]); This will take ages to run. Instead, you should find their positions beforehand and store a fixed array of them in your mission. 1 Share this post Link to post Share on other sites
bull_a 44 Posted September 19, 2015 Thanks all, I was hoping this wouldn't be the case, but I was starting to think that the ATM's were "landscape" objects. Performance is not an issue as it is a script ran once in Pre-Init (just means higher load on the server at the start, along with a slower loading time, not really important atm) Sucks that not all world objects are standardise :( Thanks for the help, Bull Share this post Link to post Share on other sites
ceeeb 147 Posted September 19, 2015 One more thing. Searching with _worldRadius around the centre won't cover the corners of the map. You need to use a radius of _worldRadius * 2^0.5 to reach the corners. Share this post Link to post Share on other sites
MrCopyright 107 Posted September 20, 2015 Hello. I created a script which can return if you are looking at an ATM, it was the best compromise I could come up with for my mission. _array1 = lineIntersectsWith [eyePos player, ATLtoASL screenToWorld [0.5,0.5]]; if (count _array1 < 1) exitWith {}; _obj = _array1 select ((count _array1) - 1); _objA = toArray str(_obj); _objA deleteRange [0, (count _objA) - 12]; if ((toString _objA) in ["atm_01_f.p3d","atm_02_f.p3d"] and player distance _obj < 3) then { execVM "Dialogs\Menu_ATM.sqf" }; I call this script when the player presses the general action key assigned in my mission. Hope this helps. EDIT: A new command has been introduced in the DEV branch called cursorObject which does return map objects such as ATMs. Share this post Link to post Share on other sites