zapat 56 Posted October 14, 2010 How can I check every object near player, except helis? Is there an easy way to do this, or I have to manually put all classes but helis in [] ? I use this code for selecting all objects: {...}foreach (nearestObjects [player,[],50]); thanks in advance Share this post Link to post Share on other sites
Muzzleflash 111 Posted October 14, 2010 I would do this instead for smaller radius (eg. not 2000): _all = nearestObjects [player, ["All"], 50]; _helis = nearestObjects [player, ["Helicopter"], 50]; _notHelis = _all - _helis; _notHelis has what you are looking for. Share this post Link to post Share on other sites
zapat 56 Posted October 14, 2010 Thanks, this is a good idea. And what would you do for a 2000 radius? :rolleyes: (my idea is growing, and it may need some more space. :) ) Share this post Link to post Share on other sites
jamesf1 0 Posted October 14, 2010 _all = nearestObjects [player, ["All"], [color=red][b]2000[/b][/color]]; _helis = nearestObjects [player, ["Helicopter"], [color=red][b]2000[/b][/color]]; _notHelis = _all - _helis; Share this post Link to post Share on other sites
Muzzleflash 111 Posted October 14, 2010 And what would you do for a 2000 radius? :rolleyes: Well I would... I guess.... But.... You got me. Guess I would use the above method too, now that I think about it. :D Like JamesF1 suggests. Except Evil_Echo now filled in the blanks in m triple dots above :), due to being more efficient. Share this post Link to post Share on other sites
Evil_Echo 11 Posted October 14, 2010 The easiest way would be set arithmatic, just subtract the helos. {...} foreach (nearestObjects [player,[],50]) - (nearestObjects [player,["Helicopter"],50]) ; But you could just use a statement inside your loop that checks for parent classes and skip helos there. Slightly more complicated, but much more efficient. { if ( _x isKindOf "Helicopter" ) then { // skip rest of this loop } else { ... }; } foreach (nearestObjects [player,[],50]); Share this post Link to post Share on other sites
zapat 56 Posted October 14, 2010 (edited) JamesF1: lol, that was a good one, indeed. :D Evil_Echo: thanks, this is what i am looking for, only couldn't say it this nice. But now: { if ( !(_x isKindOf "Helicopter") ) then { ... }; } foreach (nearestObjects [player,[],2000]); Edited October 14, 2010 by zapat Share this post Link to post Share on other sites
Evil_Echo 11 Posted October 14, 2010 (edited) Yes, the inverted test is nicer in your case. I actually use a slightly more complex version to knock out several classes as part of a damage routine for nukes. Use caution when checking for all objects at large radii. It's far faster to do get all objects and filter ( method 2 or varient ) vs multiple calls that each check for different class types. Edited October 14, 2010 by Evil_Echo Share this post Link to post Share on other sites