Jump to content
Spriterfight

Select nearest from an array

Recommended Posts

I have 3 sector and want to select the nearest to a sepcific group how can i achieve this beside using BIS_fnc_nearestPosition

Share this post


Link to post
Share on other sites

Well, if you read the wiki page for the function you'll notice that the array of objects can be just about anything and the origin may be as well. I suggest using the group's squad leader as the origin (give him a variable name in his editor attributes) and the using the variable names for your sectors in the array (if it is a marker, the name must be entered in the array as a string).

For example:

// "Sectors" are 2d triggers with global variable names 'trigger_0' through 'trigger_2' (three total)
// "Origin" is group/squad leader from which to find the nearest sector named 'mySquadLeader'

_nearestSector = [[trigger_0,trigger_1,trigger_2],mySquadLeader] call BIS_fnc_nearestPosition;

 

  • Like 1

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

×