Jump to content
Sign in to follow this  
mihikle

Mission end when three markers are same color?

Recommended Posts

Is it possible to make a mission end when 3 markers are all the same color?

I'm working on a mission where the enemy players have to storm a friendly trench and use an 'addAction' to change the marker color. A hint also comes up at this point to say whether the Germans or British have captured a point (yes, this is with I44!). What I would like to know is if it is possible to end the mission when all three of the markers are the color Blue and another three are the color Red? If so, how would this be done :P

Thanks!

Share this post


Link to post
Share on other sites

marker colour checker function

examples:

nul = [[["mkr1"],["mkr2"],["mkr3"]],["ColorBlue","ColorRed","ColorGreen"]] execVM "mkrColorChecker.sqf";

nul = [[["mkr1","mkr2","mkr3"],["mkr4","mkr5","mkr6"]],["ColorBlue","ColorRed"]] execVM "mkrColorChecker.sqf";

nul = [[["mkr1"],["mkr2"],["mkr3"],["mkr4"]],["ColorBlue","ColorRed","ColorGreen","ColorYellow"]] execVM "mkrColorChecker.sqf";

nul = [[["mkr1"]],["ColorBlue"]] execVM "mkrColorChecker.sqf";

nul = [[["mkr1","mkr2"],["mkr3","mkr4"]],["ColorBlue","ColorRed"]] execVM "mkrColorChecker.sqf";

Those good at following and extrapolating patterns wil have much success with this!

private ["_clrArr","_mkrArr","_clr","_n","_clchk","_r"];

_mkrArr = _this select 0;
_clchk = _this select 1;
_clrArr = + _mkrArr;

while {true} do
{
       _r = 0;

   for "_i" from 0 to ((count _mkrArr)-1) do
   {
       _n = 0;
       {
           _clr = markerColor _x; (_clrArr select _i) set [ _n, _clr];
           _n = _n + 1;
       } forEach (_mkrArr select _i);

       if ({_x==(_clchk select _i)} count (_clrArr select _i) == count (_mkrArr select _i)) then
       {
           _r = _r + 1;
       };
   };
   sleep 3;

   if (_r==(count _mkrArr)) exitWith
   {
       endMission "END1";
       //or whatever code you need to run here.
       // replace with true to get a boolean return
   };
};

Tested in game

Had to edit this several times - it's ok now.

Edited by Mattar_Tharkari

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  

×