Arma 3
When all area markers turn blue end the mission
im not sure how to script this. im making a simple SP CTI mission but i have trigger zones with overlayed area markers.
when opfor are not present it turns the area blue (colorblufor in script)

what i need to do when the mission is complete is when all markers are blue end the mission

all my markers are using "sector" as a variable so like sector, sector_1 sector_2 etc..

all triggers linked to each sector when activated run this line:
"sector_8" setMarkerColor "Colorblufor";

^^ so this is the area trigger for sector_8

i need to learn or see an example to check if all markers using "sector" as a variable then show the mission end screen?

guessing this would need to be done on a loop.

the bis page on IF statements is alittle confusing.. i understand if statements, but unsure on syntax in arma 3

pretty much need to check the marker colors of all area markers with "sector" as a variable are all the color blue (actually using blufor blue)

can anyone help me out. or know of a better way. i could also give all the triggers a variable and check if all them triggers are activated.. then mission end.
< >
Showing 1-5 of 5 comments
SeraphinicIna Jan 22, 2021 @ 12:33am 
Originally posted by Spelmo3 | Tactical-Gaming.net:
i could also give all the triggers a variable and check if all them triggers are activated.. then mission end.
That would be the better solution instead of checking the marker colors.

You could also make a variable e.g. called "captureScore = 0" and when a trigger fires it increases that value with "captureScore = captureScore + 1". Place another trigger that fires when that variable reaches a certain score which ends the mission.
Spelmo3 | TGN Jan 22, 2021 @ 4:11am 
Originally posted by NobodysLaw:
Originally posted by Spelmo3 | Tactical-Gaming.net:
i could also give all the triggers a variable and check if all them triggers are activated.. then mission end.
That would be the better solution instead of checking the marker colors.

You could also make a variable e.g. called "captureScore = 0" and when a trigger fires it increases that value with "captureScore = captureScore + 1". Place another trigger that fires when that variable reaches a certain score which ends the mission.

i think setting a global variable would be a better way too! so in mission init do something like: CaptureScore = 0

in each trigger i can add
CaptureScore = CaptureScore + 1

this is where i struggle with if and loop syntax.

in my head its something like

" if ( mycapturescore >= 25 ) then ( "end1" call BIS_fnc_endMission; ) else (re run this line in 60 or 120 secs) "

i cant seem to get my head around these statements in arma.
i could do with a basic example. if you wouldnt mind helping me understand. everything i've tried using If's i never get to work.

Last edited by Spelmo3 | TGN; Jan 22, 2021 @ 5:17am
Spelmo3 | TGN Jan 22, 2021 @ 4:41am 
just to add...

CaptureScore = if (CaptureScore >= 25) then {"end1" call BIS_fnc_endMission; };

this is what im coming up with basically. from reading the bis site.
Last edited by Spelmo3 | TGN; Jan 22, 2021 @ 5:17am
SeraphinicIna Jan 22, 2021 @ 7:12am 
1. place a "Game Logic" in the editor somewher (doesn't matter where, just you know where it is) and write
CaptueScore = 0
in the init field of it. or write that in that in the init.sqf - your call

2. write
CaptureScore = CaptureScore + 1
in each activation field of each trigger that should fire that code when a sector was taken

3. create a new trigger with activation/type to none. place it too somewhere where you want. In that one in the condition field you write
CaptureScore >= 25
(remove the "this")

4. in the same trigger, write
["end1", true]call BIS_fnc_endMission]
in the activation field

-----------------------
For clarifying:

The variable before the if statements are optional, they are not used to "bound" the if statement to a variable but to be able to use the return value of the code (which is not needed). What you did there was acutally even worse: you overwrote the counter variable with the if statement which would render it useless then.

if (CaptureScore >= 25) then {["end1", true] call BIS_fnc_endMission;}
Just do it like this. But you don't need the in this case as we did your example with triggers only.
Last edited by SeraphinicIna; Jan 22, 2021 @ 7:18am
Spelmo3 | TGN Jan 22, 2021 @ 10:14am 
Originally posted by NobodysLaw:
1. place a "Game Logic" in the editor somewher (doesn't matter where, just you know where it is) and write
CaptueScore = 0
in the init field of it. or write that in that in the init.sqf - your call

2. write
CaptureScore = CaptureScore + 1
in each activation field of each trigger that should fire that code when a sector was taken

3. create a new trigger with activation/type to none. place it too somewhere where you want. In that one in the condition field you write
CaptureScore >= 25
(remove the "this")

4. in the same trigger, write
["end1", true]call BIS_fnc_endMission]
in the activation field

-----------------------
For clarifying:

The variable before the if statements are optional, they are not used to "bound" the if statement to a variable but to be able to use the return value of the code (which is not needed). What you did there was acutally even worse: you overwrote the counter variable with the if statement which would render it useless then.

if (CaptureScore >= 25) then {["end1", true] call BIS_fnc_endMission;}
Just do it like this. But you don't need the in this case as we did your example with triggers only.


Thanks a bunch! i already added to my init.sqf. i dont know why i even called the variable, but i think we're i was going wrong was also expecting the if statement to have to loop. again if its in a trigger that wouldnt be needed..

again thanks for the advice and a great explanation! should have it working
< >
Showing 1-5 of 5 comments
Per page: 1530 50

Date Posted: Jan 21, 2021 @ 5:17pm
Posts: 5