Jump to content

Recommended Posts

Hello everyone, i need some help with my scripts.

 

Is it possible to use instead of !isPlayer something like !isWest and count everything else?

waitUntil {sleep 5; {!isPlayer _x} count allUnits <= 2;};

 

And same with my deletescript, is there a way to delete everything except West units?

{if (!isPlayer _x) then {deleteVehicle _x}} forEach allunits;

 

And my last question, Is it possible to remoteexec a script only for those players that are near a specific marker? Like teleporting them back to base.

Share this post


Link to post
Share on other sites

waitUntil {sleep 5; count allUnits - (west countSide allUnits) <= 2};

 

{deleteVehicle _x} forEach (allUnits select {side group _x != west});

  • Like 2

Share this post


Link to post
Share on other sites
19 hours ago, Robustcolor said:

Is it possible to remoteexec a script only for those players that are near a specific marker? Like teleporting them back to base.

Yes.

//Find players: assumes variables _marker and _distance has been defined
private _selectedPlayers = allPlayers select {_x distance2D markerPos _marker < _distance};

//Remote execution: assumes the function "fnc_someFunc" is defined elsewhere, preferably using the A3 Functions Library.
["someParameters"] remoteExec ["fnc_someFunc", _selectedPlayers];

//fnc_someFunc could look like this (note this is an inappropiate definition, use the A3 Functions Library's CfgFunctions to define it properly)
fnc_someFunc = {
	player setPos markerPos "baseMarker"; 
};

Note that if you're only teleporting players (like in the above example) you don't need remoteExec, setPos is plenty enough since it's an AG EG command (Argument Global, Effect Global).

private _selectedPlayers = allPlayers select {_x distance2D markerPos _marker < _distance};
{
	_x setPos markerPos "baseMarker";
} forEach _selectedPlayers;

 

  • 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

×