Jump to content
1para{god-father}

Help with Hunt Script Dialog

Recommended Posts

Hi need some help I am trying to sort out a Hunt script so  >  My Dialog lists all players >  click on player and run the hunt code so they are chased by AI.

 

so Populate my list box with all players



{
if (isPlayer _x) then {
	_index = lbAdd [1100, name _x];
       _data = lbSetData [1100, _index, getPosATL _x]; 
};
} forEach allUnits;

get player name

/////Grab Player Name 

_playername = lbData [ 1100, lbCurSel 1100 ];
_playernamecheck = if (_playername  isEqualTo "") then {"error"} else {_playername };

 

Then run the hunt, my issue is  how can I user the players name  ?

_hunted  = ???????

 

while {{alive _x} count (units _grpP)  >= 1} do {
  				_pos = _hunted call CBA_fnc_getpos;
				[_grpP,_pos,50,"SAD", "AWARE", "RED","FULL","COLUMN", "_grpP spawn CBA_fnc_searchNearby"] call CBA_fnc_addWaypoint;
				sleep 30 + (random 15);
				deleteWaypoint  [_grpP, 0];
				 };

Hope that makes some sense  - if there is a better way please let me know !

Share this post


Link to post
Share on other sites

Try

_playername = lbData [ 1100, lbCurSel 1100 ];
_player = (allplayers select {name _x isEqualTo _playername}) select 0;

Cheers

Share this post


Link to post
Share on other sites

? Hang on you store the players position in the lbData, yet when you retrieve it your trying to pull out a players name??

 

Call BIS_fnc_objectVar on the unit to give it and store its vehicleVarName as STRING

lbSetData [1100, _index, _player call BIS_fnc_objectVar ];
_hunted = missionNamespace getVariable ( lbData[1100, lbCurSel 1100] );
  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, Larrow said:

? Hang on you store the players position in the lbData, yet when you retrieve it your trying to pull out a players name??

 

Call BIS_fnc_objectVar on the unit to give it and store its vehicleVarName as STRING


lbSetData [1100, _index, _player call BIS_fnc_objectVar ];

_hunted = missionNamespace getVariable ( lbData[1100, lbCurSel 1100] );

Neat solution,

 

Cheers

Share this post


Link to post
Share on other sites

Sorry thought it worked but i am getting an error

 

lbSetData [1100, _index, _player call BIS_fnc_objectVar ];


};
}>
16:14:38   Error position: <_player call BIS_fnc_objectVar ];
                                    
16:14:38   Error Undefined variable in expression: _player

 

Share this post


Link to post
Share on other sites

_player was there for you to replace with what ever you were iterating, so _x from the forEach of allUnits.

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

×