Jump to content
doc. caliban

Setting string in setVariable array with output from a function

Recommended Posts

Hello.

 

I am using the script-only version of Gaia and would like to dynamically set the zone number in the unit init field.

 

An example of the normal init statement looks like this:

 

(group this) setVariable ["GAIA_ZONE_INTEND",[ "1", "MOVE"], false];

 

The "1" is the marker name of the "zone" the unit should be in.  

 

I'd like to have that string value be defined automatically on init by using the BIS_fnc_nearestPosition function, where the output would be the string name of the nearest marker, such as:

 

_zone = ([allMapMarkers, _this] call BIS_fnc_nearestPosition;

 

_zone would be the string that needs to go where the "1" is in the first example instead of me having to manually enter it.

 

What is the correct method / syntax to incorporate this function into the init for the purpose of passing the string name of the nearest marker to the first value being defined in the array in my first example.

 

I'm not sure if I'm explaining that well, but in short I would like to use this function in the init to automatically populate that value based on the name of the nearest marker to the unit.

 

Thanks!

 

EDIT: Got it:

 

(group this) setVariable ["GAIA_ZONE_INTEND",[([allMapMarkers, this] call BIS_fnc_nearestPosition), "MOVE"], false];

 

Now looking into getMarkerSize to see if I can get it to base the proximity on the area of the marker instead of it's center point.

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

×