Jump to content
FederalRazer89

"if" command cause error in a sector control type setup

Recommended Posts

Hello

I am creating a script that will check several zones, and when diffrent side enter the triggered area the markers should change color. But because an unexpected error that say that ")" is missing, i cant proceed with the script.
The line with the error is marked

The script:
_mainzone = getMarkerPos "marker1";
_zone2    = getMarkerPos "marker2";
_zone3    = getMarkerPos "marker3";
_zone4    = getMarkerPos "marker4";
_zone5    = getMarkerPos "marker5";
_zone6    = getMarkerPos "marker6";


//Friendly
mainzonetrg = createTrigger ["EmptyDetector", _mainzone, true];
mainzonetrg setTriggerArea [500, 500, 0, false];
mainzonetrg setTriggerActivation ["WEST", "WEST D", true];

zone2trg = createTrigger ["EmptyDetector", _zone2, true];
zone2trg setTriggerArea [500, 500, 0, false];
zone2trg setTriggerActivation ["WEST", "WEST D", true];

zone3trg = createTrigger ["EmptyDetector", _zone3, true];
zone3trg setTriggerArea [500, 500, 0, false];
zone3trg setTriggerActivation ["WEST", "WEST D", true];

zone4trg = createTrigger ["EmptyDetector", _zone4, true];
zone4trg setTriggerArea [500, 500, 0, false];
zone4trg setTriggerActivation ["WEST", "WEST D", true];

zone5trg = createTrigger ["EmptyDetector", _zone5, true];
zone5trg setTriggerArea [500, 500, 0, false];
zone5trg setTriggerActivation ["WEST", "WEST D", true];

zone6trg = createTrigger ["EmptyDetector", _zone6, true];
zone6trg setTriggerArea [500, 500, 0, false];
zone6trg setTriggerActivation ["WEST", "WEST D", true];


//Enemy
Emainzonetrg = createTrigger ["EmptyDetector", _mainzone, true];
Emainzonetrg setTriggerArea [500, 500, 0, false];
Emainzonetrg setTriggerActivation ["east", "east D", true];

Ezone2trg = createTrigger ["EmptyDetector", _zone2, true];
Ezone2trg setTriggerArea [500, 500, 0, false];
Ezone2trg setTriggerActivation ["east", "east D", true];

Ezone3trg = createTrigger ["EmptyDetector", _zone3, true];
Ezone3trg setTriggerArea [500, 500, 0, false];
Ezone3trg setTriggerActivation ["east", "east D", true];

Ezone4trg = createTrigger ["EmptyDetector", _zone4, true];
Ezone4trg setTriggerArea [500, 500, 0, false];
Ezone4trg setTriggerActivation ["east", "east D", true];

Ezone5trg = createTrigger ["EmptyDetector", _zone5, true];
Ezone5trg setTriggerArea [500, 500, 0, false];
Ezone5trg setTriggerActivation ["east", "east D", true];

Ezone6trg = createTrigger ["EmptyDetector", _zone6, true];
Ezone6trg setTriggerArea [500, 500, 0, false];
Ezone6trg setTriggerActivation ["east", "east D", true];

/
/Check the Zone owners

while {true} do{
FriendlyZoneCount = _Z2 + _Z3 + _Z4 + _Z5 + _Z6;


mainzoneVal = _Fsum1 + _Esum1;
zone2Val    = _Fsum2 + _Esum2;
zone3Val    = _Fsum3 + _Esum3;
zone4Val    = _Fsum4 + _Esum4;
zone5Val    = _Fsum5 + _Esum5;
zone6Val    = _Fsum6 + _Esum6;


if (triggerActivated mainzonetrg) then{_Fsum1 = 1};
if (triggerActivated Emainzonetrg) then{_Esum1 = -1};

if (triggerActivated zone2trg) then{_Fsum2 = 1};
if (triggerActivated Ezone2trg) then{_Esum2 = -1};

if (triggerActivated zone3trg) then{_Fsum3 = 1};
if (triggerActivated Ezone3trg) then{_Esum3 = -1};

if (triggerActivated zone4trg) then{_Fsum4 = 1};
if (triggerActivated Ezone4trg) then{_Esum4 = -1};

if (triggerActivated zone5trg) then{_Fsum5 = 1};
if (triggerActivated Ezone5trg) then{_Esum5 = -1};

if (triggerActivated zone6trg) then{_Fsum6 = 1};
if (triggerActivated Ezone6trg) then{_Esum6 = -1};


if (mainzoneVal = 1) then {endMission}; //The problem
if (zone2Val = 1) then {_Z2 = 1;"marker2" setMarkerColor "colorblue";};
if (zone2Val = 0) then {"marker2" setMarkerColor "ColorOrange"};
if (zone2Val = -1) then {_Z2 = -1;"marker2" setMarkerColor "colorred";};

if (zone3Val = 1) then {_Z3 = 1;"marker3" setMarkerColor "colorblue";};
if (zone3Val = 0) then {"marker3" setMarkerColor "ColorOrange"};
if (zone3Val = -1) then {_Z3 = -1;"marker3" setMarkerColor "colorred";};

if (zone4Val = 1) then {_Z4 = 1;"marker4" setMarkerColor "colorblue";};
if (zone4Val = 0) then {"marker4" setMarkerColor "ColorOrange"};
if (zone4Val = -1) then {_Z4 = -1;"marker4" setMarkerColor "colorred";};

if (zone5Val = 1) then {_Z5 = 1;"marker5" setMarkerColor "colorblue";};
if (zone5Val = 0) then {"marker5" setMarkerColor "ColorOrange"};
if (zone5Val = -1) then {_Z5 = -1;"marker5" setMarkerColor "colorred";};

if (zone6Val = 1) then {_Z6 = 1;"marker6" setMarkerColor "colorblue";};
if (zone6Val = 0) then {"marker6" setMarkerColor "ColorOrange"};
if (zone6Val = -1) then {_Z6 = -1;"marker6" setMarkerColor "colorred";};


sleep 30;

};


 

Share this post


Link to post
Share on other sites
Guest

Hello.

Conditions takes two '='.

If (something == somethingelse)

Please refer to the Bohémia wiki to avoid this kind of errors.

 

Regards.

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

×