--- edited 29-Sep-2013 ---
(fixed some errors and described Zone Flags)
This guide is about my scheme of DCS World event logic flags and group names.
Major changes to the document. Lots more explanation and examples. Let me know if you see any mistakes or have comments!
Link to latest Flags file -
https://docs.google.com/file/d/0BwHk38uryutrMXZBWlk5ZjdRbjQ/edit?usp=sharing==========================================================
DCS World Five Digit Flags and Group Names
This guide describes a method of using five digit flags with DCS World Events -> Conditions -> Actions features. It also explains the corresponding naming convention for groups and units.
In DCS World, event flags can be up to five digits in length. Flags must start with 1-9; leading zeroes are not allowed; alpha characters are not allowed.
A five digit flag can uniquely identify the state of a unit, group, or coalition.
===
The Basics of Five Digit Flags
Red flags get a leading '1' through '4':
Red Main & Aircraft Groups: 1
Red Helicopter Groups: 2
Red Vehicle Groups: 3
Red Ship Groups: 4
Blue flags get a leading '5' through '8':
Blue Main & Aircraft Groups: 5
Blue Helicopter Groups: 6
Blue Vehicle Groups: 7
Blue Ship Groups: 8
Group numbers are the second & third digits. Unit numbers are the fourth digit.
The State is the fifth digit:
0: Count (use for Flag Increment and Decrement)
1: is Dead, or Lost
2: is Alive, or Won
3: is Attacking
4: Broadcast; enables a repeating message with Condition = Time Since Flag (Flag x), and Action = Flag On (Flag x) & Message
5: Zone Clear
6: Delay; use with Time Since Flag
7: Zone Entered
8: Zone Captured
9: Deactivated (vs Dead)
Examples:
Red Aircraft group 24 is dead: 12401 = True
Red Aircraft group 24 unit 3 is dead: 12431
Red Aircraft group 24 unit 4 is in a zone: 12447
Red Aircraft group 24 unit 4 is out of a zone: 12445
Red Vehicle group 5 is deactivated: 30509 = True, 30501 is kept False when 30509 is True
Red Ship group 31 is in a zone: 43107
Blue Aircraft group 24 is dead: 52401 = True
Blue Helicopter group 9 unit 2 is attacking: 60923
Blue Vehicle group 44 is dead: 74401
Blue Vehicle group 44 is broadcasting a repeating message: 74404
A coalition flag can be used for the state of Red or Blue:
Red counter flag: 10000
Red lost the mission: 10001
Red won the mission: 10002
Blue counter flag: 50000
Blue lost the mission: 50001
Blue won the mission: 50002
---
Examples of AI Group names:
Red AGrp01 Mig-29
Red HGrp01 Ka-50
Red SGrp01 Speedboat
Red SGrp02 Cruiser
Red VGrp01-1 Gen Vaz HQ Support*
Red VGrp01-2 Gen Vaz HQ ADA*
Blue AGrp11 AWACS
Blue AGrp12 F/A-18C SEAD
Blue AGrp23-1 B-1B Buckshot
Blue AGrp23-2 B-1B Buckshot
Blue AGrp23-3 B-1B Buckshot
Blue AGrp23-4 B-1B Buckshot
Blue AGrp24-1 B-1B Blackcat
Blue AGrp24-2 B-1B Blackcat
Blue AGrp24-3 B-1B Blackcat
Blue AGrp24-4 B-1B Blackcat
Blue HGrp01 Cobras
Blue SGrp01 Carrier
Blue SGrp02 Civ Boat
Blue VGrp03-1 Kutaisi Defense*
Blue VGrp03-2 Kutaisi ADA*
Note how the fourth digit can be used to associate groups by function instead of designating a unit of a group; your choice.
===
Beyond Basics
AI Large Aircraft Groups
Large aircraft, such as heavy bombers and tankers, are best kept to one unit per group. Multiple units within a group of large a/c do not respond well to waypoints and events. Even with this restriction, large a/c can be associated together.
Example - a Blue AI bomber aircraft 'group' of four uses group number 20:
Blue AGrp20-1 B-1B, flag 5201x (where x is the State flag)
Blue AGrp20-2 B-1B, flag 5202x
Blue AGrp20-3 B-1B, flag 5203x
Blue AGrp20-4 B-1B, flag 5204x
---
AI Group Association
- By Location*:
Red VGrp01-1 Gen Vaz HQ Support
Red VGrp01-2 Gen Vaz HQ ADA
Blue VGrp03-1 Kutaisi Support
Blue VGrp03-2 Kutaisi ADA
- To Spawn - after the first group dies, spawn the next, and then the next, etc.:
Red VGrp10-0 Armor
Red VGrp10-1 Armor
Red VGrp10-2 Armor
Red VGrp10-3 Armor
Red VGrp10-4 Armor
===
Client Aircraft Group Names
Client (or Player) groups are named differently. A single Client is its own group, limited to one unit. Client aircraft group names start with the aircraft type followed by the Group number; this is also the a/c BORT number (for Blue). This makes for easy identification of available slots when joining a mission (and the Nose Number of the a/c will correspond to the multiplayer slot number for the Own ID on A-10C aircraft).
Examples of Client Aircraft Group names:
A-10C 01 Vaziani Cold Start
A-10C 02 Vaziani Cold Start
A-10C 03 Vaziani Cold Start
A-10C 04 Vaziani Cold Start
A-10C 11 Vaziani Warm Start
A-10C 12 Vaziani Warm Start
A-10C 13 Vaziani Air Start
A-10C 14 Vaziani Air Start
F-15C 01 Kutaisi Cold Start
F-15C 02 Kutaisi Cold Start
F-15C 03 Kutaisi Warm Start
F-15C 04 Kutaisi Warm Start
UH-1H 01 FARP London Cold
UH-1H 01 FARP London Warm
MiG-29S 01 Anapa Cold
MiG-29S 02 Anapa Air
Ka-50 01 FARP Vetka Warm
Ka-50 02 FARP Vetka Warm
Ka-50 03 FARP Vetka Warm
Ka-50 04 FARP Vetka Warm
Note that these Client Group names do not need to include the 'Blue' or 'Red' coalition at the beginning. These words would take up unneeded space in the window where the Client slots are already grouped by coalition.
===
Notes
Second & Third Digits: Group numbers
The five-digit flag scheme allows group numbers of two digits. By numbering groups with two digits, a five-digit flag can be used to uniquely identify coalition and unit type, group number, unit number and a 'state'. With this scheme, each coalition can have 100 groups of any type. It is often better to start a Client aircraft group number using 'x1', like '11', '21', '31', etc., instead of 10, 20, 30...; this is for associating Client a/c BORT and Callsign values to correspond to the group number. Save the Group = '00' for high-level flags like win/lose conditions, and counters.
Group Names
The second and third digits represent the group number. The group number is used in the Group Name field when setting up the mission. The coalition, such as Red or Blue, starts the Group Name and separates the names in the Unit List. Additional descriptions may be added at the end of the Group Name.
I do not use the unit numbers very often, and I typically do not take the time to enter these unit numbers into the Unit Name field. I will only do so if I need to flag the unit for some purpose, such as Explode Unit or Smoke On Unit.
In my missions, Clients don't typically need flags. Therefore, the Group number in the Client names above can be the same as for AI Groups. If you need to set flags for Clients as well as AI then the Group numbers would need to be unique.
There is no editor control of the Client slot names for Combined Arms.
A high level Blue coalition State can use flag 5000x to designate the state; Red can use 1000x.
The States were developed over many missions. The order is not ideal, but I kept it to support all of my missions. Occasionally, I will fudge these a bit, more so with numbers 5, 6, and 8 -- the zone states. You may find the Dead vs Deactivate useful, as these conditions may have different consequences in your mission.
I also do use two-digit flags, since leading zeroes are not allowed. I will use Flag 10 for a repeating message throughout the mission (I repeat mission messages every 23 minutes, or 1380 seconds). I use flags 50-60 to wrap up a mission, typically with messages every few minutes to countdown to a new mission load.
There is another category, using leading digit 9. I have used leading 9 flags for coalition counters:
Red Counter: 91xxx
Blue Counter: 95xxx
Coalition scores to 100 can be tallied with these flags.
Leading digit 9 flags can be used with numbered Zones. I usually color Zones yellow and use the States of 5, 7 and 8 to indicate when a Group/Unit is in or out of a Zone (8 not so much).
Using a similar convention for the counters above, where the second digit belons to a coalition/type, that leaves the third and fourth digits for the Zone number and fifth for the State. For these flags the Group number cannot be specified.
Mist scripts can detect the type of Vehicle, Aircraft, Helicopter and Ship; see the Mist Guide for these functions:
mist.flagFunc.units_in_zones
mist.flagFunc.units_in_moving_zones
There are a couple of great Mist scripts by St3v3f at DCS World forums to detect in and out of zone conditions and set flags accordingly.
Red Aircraft in Zone 3: 91037 = True
Red Helicopters were in Zone 20 and left: 92207 = False, 92205 = True
Red Vehicles in Zone 15: 93157
Blue Ships are in Zone 2: 98027 = True
Blue Ships are out of Zone 2: 98025 = True, 98027 = False
===
Mission Version
My mission names begin with my initials, such as "WC's iShot The Shilka". The names also include a version indication with a revision, like "126v3d". This lets me know what version of DCS World the mission was last saved under, as well as a revision number that allows me to make incremental revisions: a, b, c, .., as well as show a major change from a revision like "3d" to "4a".
WC's iShot The Shilka 126v3d.miz
WC's iShot The Shilka 126v3e.miz
WC's iShot The Shilka 127v3f.miz
WC's iShot The Shilka 127v4a.miz
===
Mist
I will load Mist with a Condition -> Time More (5), and Action -> Message 'Load Mistv2_0.lua' (1 second). The message lets me know the Mist version later.
Other Mist events will include a Condition -> Time More (10). This is necessary to prevent the event from throwing an error before Mist is loaded.
All of the Mist events use Type -> Once and Event -> No Event. The names of these events all begin with 'mist.' for easy identification.
===
Displaying Flag Values With Text Messages
Use a Do Script Action (does not require Mist) -
local msg = {}
msg[#msg + 1]='Blue All Points Flag 10000 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('10000')
msg[#msg + 1]='. \n'
msg[#msg + 1]='Blue Vehicles In Zone Points Flag 20000 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('20000')
msg[#msg + 1]='. \n'
msg[#msg + 1]='. \n'
msg[#msg + 1]='Blue Aircraft Points Flag 50000 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('50000')
msg[#msg + 1]='. \n'
msg[#msg + 1]='Blue Heli Points Flag 60000 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('60000')
msg[#msg + 1]='. \n'
msg[#msg + 1]='Blue Vehicle Points Flag 70000 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('70000')
msg[#msg + 1]='. \n'
msg[#msg + 1]='Blue Ship Points Flag 80000 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('80000')
msg[#msg + 1]='. \n'
msg[#msg + 1]='\n'
msg[#msg + 1]='Press Pause to freeze the action. \n'
trigger.action.outText(table.concat(msg), 6)
===
F° = ((C° * 9) / 5) + 32
C° = (F° - 32) * 5 / 9
===
Designer Notes
The Is User flags are limited to less than five digits. I do not use those flags, and have no advice for them (except for ED to increase them to five digits).
Wrecking Crew
Edited 29-Sep-2013
===========================================================