Jump to content
Sign in to follow this  
alleycat

side player check failing

Recommended Posts

Created an addaction to spawn a remote designator, but the script ignores my check for player side. It compiles but never places the right one.

onMapSingleClick " 
	global_pos=_pos;
	if (alive player) then 
	{     

		_vehicle = ""O_Static_Designator_02_F"";
		if ((side player) == east) then 		{_vehicle = ""O_Static_Designator_02_F""};
		if ((side player) == resistance) then {_vehicle = ""I_Static_Designator_02_F""};
		if ((side player) == west) then 		{_vehicle = ""B_Static_Designator_02_F""};
		_posmk = getmarkerpos ""strat_circle_target"";
		_distance = _posmk distance _pos;


		if (_distance < _limit) then 
			{
				player setpos _pos;
				hint format [""Placing remote designator \nDistance:%1"", _distance];
				createVehicleCrew (createVehicle [_vehicle, getpos player, [], 5, ""NONE""]);
				completed = 1;
			} 
		else 
			{
				hint format [""Placing failed.\n\nLocation not inside the combat zone.\nDistance:%1"", _distance];
				
			
			
			};	



		openMap false; 



		
		
		
		
		finished = true;
	};
	true
";

waitUntil {finished};
onMapSingleClick '';

Share this post


Link to post
Share on other sites
finished = false;
["11", "onMapSingleClick", {
global_pos = _pos;
if (alive player) then
{
  _vehicle = switch (side player) do {
    case west:
    {
    "B_Static_Designator_02_F";
    };
    case resistance:
    {
      "I_Static_Designator_02_F";
    };
    case east:
    {
      "O_Static_Designator_02_F";
    };
  };
  _posmk = getmarkerpos "strat_circle_target";
  _distance = _posmk distance _pos;
  _limit = 100;

  if (_distance < _limit) then
    {
      player setpos _pos;
      hint format ["Placing remote designator \nDistance:%1", _distance];
      createVehicleCrew (createVehicle [_vehicle, getpos player, [], 5, "NONE"]);
      hint format ["Vehicle: %1", _vehicle];
      completed = 1;
    } else {
      hint format ["Placing failed.\n\nLocation not inside the combat zone.\nDistance:%1", _distance];
    };
  openMap false;
  finished = true;
};
}] call BIS_fnc_addStackedEventHandler;

waitUntil {finished};
["laserDesignatorMap","onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
 

Just use a switch statement. I tested it and it seems to work (besides the fact it's not actually placing a laser designator, but at least _vehicle is correct)

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
Sign in to follow this  

×