Jump to content

Recommended Posts

Hello,

I have a deathmatch mission which begins by opening the arsenal for all units and then teleporting them to starting positions as soon as they close the arsenal.

 

So far I have this line of code:

waitUntil {isnull (uinamespace getvariable "RSCDisplayArsenal")};

Unfortunately, this code fires whenever any player closes their arsenal, teleporting everybody else at the same time. What I would like is for the code to check until all players have closed their arsenals before continuing. Any suggestions?

Best regards.

Share this post


Link to post
Share on other sites

 

put this inside initPlayerLocal.sqf

	[missionNamespace, "arsenalClosed", {

		//code to teleport player here
	
	}] call BIS_fnc_addScriptedEventHandler;

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the suggestion, but unless I'm mistaken that would allow each player to teleport individually as soon as they close their respective arsenals. However I want them to be able to close the arsenals and only get teleported when every player has closed their arsenals. I'm not sure if that makes sense.

 

I was thinking to maybe add something along the lines of this:

 

[missionNamespace, "arsenalClosed", {

	player setVariable ["ready",1];
	
}] call BIS_fnc_addScriptedEventHandler;

Then the teleportation script would check for all players having that variable set to 1. But I'm not quite sure how to do that without the script telling me there are undefined variables in case not every player slot is filled.

Share this post


Link to post
Share on other sites
[missionNamespace, "arsenalClosed", {
	player setVariable ["ready",true,true];
}] remoteExecCall ["BIS_fnc_addScriptedEventHandler",[0,-2] select isDedicated];
waitUntil {{_x getVariable ["ready",false]} count allPlayers >= (playersNumber west +playersNumber east +playersNumber civilian +playersNumber independent)};
systemChat "DONE";

Run this on the server. I only tested it with a hosted server and only with myself on it.

  • Like 1

Share this post


Link to post
Share on other sites

That seems to work! Thank you both for your help! :)

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

×