Jump to content
Teutch

How to count the number of sectors

Recommended Posts

Is there a way to ensure that a trigger is activated when a certain number of sectors are in the hands of one side ?

 

A sort of mixture between these two codes :

 

_sector getvariable "owner" == east

({side _x == blufor} count allsector) == 10

 

Thank you in advance !

 

Share this post


Link to post
Share on other sites
count (allMissionObjects "logic" select {_x getVariable "owner" == WEST})

 

  • Like 2

Share this post


Link to post
Share on other sites

Clear and precise, thanks for your quick answer pierremgi !

Share this post


Link to post
Share on other sites
25 minutes ago, pierremgi said:

count (allMissionObjects "logic" select {_x getVariable "owner" == WEST})

 

It seems to work!
But one last question my good man:
How do you get a trigger to activate when, lets say, 10 sectors are in the hands of one side ?

ie : What will we have in it condition ?

Share this post


Link to post
Share on other sites
12 minutes ago, Teutch said:

What will we have in it condition ?

[ west ] call BIS_fnc_moduleSector == 10

 

  • Like 1

Share this post


Link to post
Share on other sites

Wow two legends answered my simple question !

its working now.
Thanks guys for your patience !

Share this post


Link to post
Share on other sites
6 hours ago, Teutch said:

Is there a way to ensure that a trigger is activated when a certain number of sectors are in the hands of one side ?

There is no need for the trigger if you want, you can get sectors to run an event when they change owner...

//initServer.sqf

//For each sector in the mission
{
	//Add a owner changed event to the sector
	[ _x, "ownerChanged", {
		params[ "_sector", "_owner" ];
		
		//If the sector changed owner to west
		if ( _owner == west ) then {
			
			//And west now own 10 sectors
			if ( [ west ] call BIS_fnc_moduleSector == 10 ) then {
				//Do what ever here
			};
		};
	} ] call BIS_fnc_addScriptedEventHandler;
  
}forEach ( [ true ] call BIS_fnc_moduleSector );

 

  • Like 3

Share this post


Link to post
Share on other sites

It's perfect! thank you very much Larrow !

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

×