Jump to content
travhimself

nearestObjects won't find all fuel pumps

Recommended Posts

I'm using nearestObjects to find and disable all fuel pumps on Tanoa. The search looks something like this:

_pumpclasses = [
    "Land_FuelStation_Feed_F", // rusty white pump, altis/stratis
    "Land_fs_feed_F", // oldschool white pump, altis/stratis
    "Land_FuelStation_01_pump_F", // modern white/red pump, tanoa
    "Land_FuelStation_02_pump_F" // oldschool yellow pump, tanoa
];

_fuelpumps = nearestObjects [mapcenter, _pumpclasses, mapradius];

{
    _x enableSimulation false;
} foreach _fuelpumps;

 

However, I've discovered that this only finds about half the existing pumps. I ran some experiments with progressively more liberal searches, and I've confirmed that some pumps will not be picked up at all by nearestObjects. Here is an example:

 

A gas station with four fuel pumps:

7JZFJ88.jpg

 

Map showing four fuel pump markers (one of them is partially obscured):

269pFfD.jpg

 

I then ran the following code to find and mark ALL buildings nearby:

_places = nearestObjects [player, ["All"], 50]; 

{ 
    _position = getPos _x; 
    _positionx = _position select 0; 
    _positiony = _position select 1; 


    _placesmarkername = format ["places%1", _forEachIndex]; 
    _placesmarker = createMarker [_placesmarkername, [_positionx, _positiony] ]; 
    _placesmarkername setMarkerColor "ColorBlack"; 
    _placesmarkername setMarkerType "n_unknown"; 
} foreach _places; 

The resulting map shows that only one of the four pumps (the partially obscured one) has been marked.

ndVAst4.jpg

 

Can anyone take a stab at explaining why this might be happening, and how to work around it?

Share this post


Link to post
Share on other sites

_fuelpumps = nearestObjects [player, _pumpclasses, 50];  finds all four pumps on my end...? :confused:

 

You could try:

_fuelpumps = nearestTerrainObjects [mapcenter, ["fuelstation"], mapradius, false];
  • Like 1

Share this post


Link to post
Share on other sites

 

_places = nearestObjects [player, ["All"], 50]; 

{ 
    _position = getPos _x; 
    _positionx = _position select 0; 
    _positiony = _position select 1; 


    _placesmarkername = format ["places%1", _forEachIndex]; 
    _placesmarker = createMarker [_placesmarkername, [_positionx, _positiony] ]; 
    _placesmarkername setMarkerColor "ColorBlack"; 
    _placesmarkername setMarkerType "n_unknown"; 
} foreach _places; 

The resulting map shows that only one of the four pumps (the partially obscured one) has been marked.

All have been marked. Its just the Markers are semi-transparent. Look gain. White to a Grey.

Share this post


Link to post
Share on other sites

Yep, you're absolutely right Von Quest. Did a little more experimenting and noticed the same thing myself. Odd that the markers sometimes layer in front, and sometimes behind. But at any rate, case closed.

 

Thanks to those who chimed in with suggestions!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×