Jump to content
Sign in to follow this  
Alias001

Player dependent triggers & dropouts

Recommended Posts

I'm trying to design an end mission trigger which is supposed to fire when all player units are back at their base. At the moment I'm using the code: "({_x in thisList} count [Pl1,Pl2,Pl3,Pl4,Pl5]) == 5" which does seem to work but I'm concerned about what would happen if, for example, pl4 were to drop out. As I understand the game, it'd react in a very literal way to the trigger and wait for pl4 for eternity and never end the mission.

It seems that the most efficient solution is to have it detect blufor to establish when any of them is in the area, run a check to get the total number of currently connected players and then fire the trigger when the number of players within the trigger area equals the number of connected players but I'm not sure what syntax I'd need to use. Could anyone help me out?

Share this post


Link to post
Share on other sites

Get an array of all blufor players, then run the check to make sure all counts of blufor in the trigger is the same as the count of blufor in the array.

---------- Post added at 12:30 ---------- Previous post was at 12:26 ----------

Code example:

BluforArray = [];
{ 
if (side _x == blufor) then {
 BluforArray = BluforArray + [_x];
}
} foreach playableUnits;

Ah yes of course you can use playableUnits instead of all units.

Trigger condition.

count thisList == count BluforArray;

Something like that. You'll have to do something else if there's more blufor units than the players.

Edited by Tinter

Share this post


Link to post
Share on other sites

create a trigger:

Type: None

Activation: site of the players

Repeatedly

Present

Condition: this

On Act:

_h = hisTrigger spawn TAG_fnc_endMission

init.sqf

if (!isDedicated) then
{
TAG_fnc_endMission = compileFinal preprocessFileLineNumbers "fn_endMission.sqf";
};

fn_endMission.sqf

while {triggerActivated _this} do
{
_result = true;

{
	if (!(_x in (list _this))) then
	{
		_result = true;
	}; 

}forEach playableUnits;

if (_result) then
{
	"end1" call BIS_fnc_endMission;
};
};

this should do the job...

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  

×