Jump to content

Recommended Posts

I don't know how to trigger my mission's end using this method but with owner being independent / resistance / guer instead of west or east. All I get are errors. Is it even possible for Ind to win sector module based sector control missions?
 

Quote

((sectorA getVariable "owner") == west) && ((sectorB getVariable "owner") == west) && ((sectorC getVariable "owner") == west) && ((sectorD getVariable "owner") == west) && ((sectorE getVariable "owner") == west) && ((sectorF getVariable "owner") == west) && ((sectorG getVariable "owner") == west);

 

Share this post


Link to post
Share on other sites

Use the scripted event "ownerChanged"

Spoiler

//initServer.sqf

//For all sectors in the mission
{
	//Add event for when sectors owner changes
	[ _x, "ownerChanged", {
		params[ "_sector", "_owner" ];

		//If the sectors owner is independent
		if ( _owner isEqualTo independent ) then {
			
			//Get all other sectors
			//( "owner" on this changing sector is not updated yet, but we know it is independent ) 
			_allSectors = BIS_fnc_moduleSector_sectors - [ _sector ];
			
			//Get all independent sectors
			_allIndepSectors = _allSectors select{ _x getVariable[ "owner", sideUnknown ] isEqualTo independent };
			
			//If all sectors are independent
			if ( _allSectors isEqualTo _allIndepSectors ) then {
				
				//Get independent players
				_winners = allPlayers select{ side group _x isEqualTo independent };
				//Get all other players
				_losers = allPlayers - _winners;
				
				//Remote call correct ending on winners/losers
				[ "SideWon" ] remoteExec[ "BIS_fnc_endMission", _winners ];
				
				//Not sure if your mission is MP or not so better check there are some losers
				if !( _losers isEqualTo [] ) then {
					[ "SideLost" ] remoteExec[ "BIS_fnc_endMission", _losers ];
				};
				
				//If this is a dedicted server
				if ( isDedicated ) then {
					//End mission
					[] call BIS_fnc_endMission;
				};
			};
		};

	}] call BIS_fnc_addScriptedEventHandler;

}forEach BIS_fnc_moduleSector_sectors;

 

 

  • Like 1
  • Thanks 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

×