ACCESSING CCdataBase\\ RETRIEVING CCcontentMessage\\ .. msg:"Welcome, user7576."


TRIGGER AND MISSION BRIEFING FORMAT
Author Version 1.00
Covers Brood Wars v1.05

Definitions of symbols used in this file:

Data Symbols

char - 1 byte, designates text use
byte - 1 byte, designates use as a numbers
int - 2 bytes of data forming an unsigned integer, stored in low-high order. (normal IBM-PC order) sometimes used as flags
long - 4 bytes of data forming a single number, stored in lowest-highest byte order (normal IBM-PC order)

Starcraft Versions

beta57 - section is present in the beta format of scenarios. judging from the parts not present, this was a VERY early beta version
1.00 - section is present in the Release(1.00) version of SC
1.04 - section is present in the Enhanced SC(1.04 patch) version, and is a 1.00/Brood hybrid
Brood - section is present in the Brood Wars release version

Note: All numbers in this file are decimal, unless specified by an 'h', (i.e. h8a = decimal 138) and 0-based, unless otherwise specified

x: Section 'TRIG', 'MBRF' - Scenario Triggers, Mission Briefings

Note: Alright, Blizzard really outdid itself on sloppiness this time. Blizzard packed far too much data in too few bytes; so bear with me, and try not to get confused.

Second Note: These specs are for the TRIG section in CHK files. The .TRG files, generated when you use the 'Save Triggers' command from inside StarEdit, have a completely(okay, maybe not completely) different file format. And no, I don't feel like writing the specs for that.

Another Note: Blizzard also uses the trigger format for mission briefings. Basically, the only difference between triggers and briefings is that, in briefings, the conditions section is completely discarded. Even still, the first condition will always be condition #13, which specifies a briefing. Also, not suprisingly, briefings have a different set of actions than triggers do. Any other changes in the format will be listed in these specs.

16 conditions - Conditions for the trigger. There will always be 16 conditions, regardless of whether they're all used, and can never be more than 16 conditions. Each condition is one of the following structures {

1 long - location number for condition(1-based?)

1 long - group(0 based) condition applies to. see Appendix D

1 long - qualified number(how many/resource amount)

1 int - unit type condition applies to. see Appendix E

1 byte - comparison type/switch state. see Appendix E

1 byte - condition byte. see Appendix A for conditions

1 byte - resource/score type/switch no. see Appendix E

1 byte - various flags

bit 0 - unknown/unused
bit 1 - enabled flag. if on, then condition is disabled
bit 2-4 - unknown/unused
bit 5 - if on, unit type is used
bit 6-7 - unknown/unused

2 bytes - unknown/unused. probably padding

}

64 actions - Action for the trigger. There will always be 64 actions, regardless of whether they're all used, and can never be more than 64 actions. Each action is one of the following structures {

1 long - 'source'(or only) location #(1 based). not used for briefings

1 long - string number for trigger/briefing text

1 long - string number for trigger/briefing sound(WAV)

1 long - seconds/milliseconds of time. during transmissions, this will be the time of the WAV. during mission triggers/briefings that don't use WAVs, this will be the time for text or wait

1 long - first(or only) group affected. see Appendix D. for briefings, this is the portrait slot #(0 based)

1 long - second group affected/'destination' location(1 based)/trigger unit property number/number/AI script/switch. see Appendix D. for transmissions, this is the time(in miliiseconds) for the text messages

1 int - unit/score/resource type/alliance status. see Appendix E. for briefings, this is unit type

1 byte - action byte. specifies the actions action. see Appendix B for triggers, Appendix C for briefings

1 byte - number of units/switch action/unit order/modify type. 0 specifies 'all units'. see Appendix E. for transmissions, this is the time modifier type

1 byte - various action flags

bit 0 - unknown/unused
bit 1 - enabled flag. on if trigger/briefing action is disabled
bit 2 - always display flag. on if 'Always Display' is set for action. defaults to on for any actions that don't display text in Starcraft. always off for anything that uses the 'Text' property but cannot select 'Always Display'.(i.e. Leaderboards)
bit 3 - unit properties is used?
bit 4 - unit type is used
bit 5-7 - unknown/unused

3 bytes - unknown/unused. probably padding

}

4 bytes - unknown. probably padding

28 bytes - 1 byte for each player in the Groups list.

00 - trigger is not executed for player
01 - trigger is executed for player

Appendix A: Conditions List

0 = No Condition
1 = Countdown Timer(QNumber)
2 = Command(Player, TUnit, QNumber)
3 = Bring(Player, TUnit, Loc, QNumber)
4 = Accumulate(Player, QNumber, ResType)
5 = Kill(Player, TUnit, QNumber)
6 = Command the Most(TUnit)
7 = Commands the Most At(TUnit, Loc)
8 = Most Kills(TUnit)
9 = Highest Score(Score)
10 = Most Resources(ResType)
11 = Switch(Switch)
12 = Elapsed Time(QNumber)
13 = Data is a Mission Briefing. Conditions are N/A
14 = Opponents(Player, QNumber)
15 = Deaths(Player, TUnit, QNumber)
16 = Command the Least(TUnit)
17 = Command the Least At(TUnit, Loc)
18 = Least Kills(TUnit)
19 = Lowest Score(Score)
20 = Least Resources(ResType)
21 = Score(Player, Score, QNumber)
22 = Always
23 = Never
Appendix B: Trigger Actions List
Note: Only the first 45 actions were available in the Starcraft
release version. The final 12 actions were added in 1.04/Brood Wars

0 = No Action
1 = Victory
2 = Defeat
3 = Preserve Trigger
4 = Wait(Time)
5 = Pause Game
6 = Unpause Game
7 = Transmission(Text, Unit, Loc, Time, Modifier, Wave, WavTime)
8 = Play WAV(Wav, WavTime)
9 = Display Text Message(Text)
10 = Center View(Loc)
11 = Create Unit with Properties(Player, Unit, Number, Loc, UnitProp)
12 = Set Mission Objectives(Text)
13 = Set Switch(Switch, SwAction)
14 = Set Countdown Timer(Number, Modifier)
15 = Run AI Script(AIScript)
16 = Run AI Script At Location(AIScript)
17 = Leader Board (Control) (Text, TUnit)
18 = Leader Board (Control At Location) (Text, TUnit, Loc)
19 = Leader Board (Resources) (Text, ResType)
20 = Leader Board (Kills) (Text, TUnit)
21 = Leader Board (Points) (Text, Score)
22 = Kill Unit (Player, TUnit)
23 = Kill Unit At Location(Player, TUnit, Number, Loc)
24 = Remove Unit(Player, TUnit)
25 = Remove Unit At Location(Player, TUnit, Number, Loc)
26 = Set Resources(Player, Number, Modifier, ResType)
27 = Set Score(Player, Number, Modifier, Score)
28 = Minimap Ping(Loc)
29 = Talking Portrait(Unit, Time)
30 = Mute Unit Speech
31 = Unmute Unit Speech
32 = Leaderboard Computer Players(State)
33 = Leaderboard Goal (Control) (Text, TUnit, Number)
34 = Leaderboard Goal (Control At Location) (Text, TUnit, Number, Loc)
35 = Leaderboard Goal (Resources) (Text, TUnit, Number, ResType)
36 = Leaderboard Goal (Kills) (Text, TUnit, Number)
37 = Leaderboard Goal (Points) (Text, Number, Score)
38 = Move Location(Player, TUnit, SLoc, DLoc)
39 = Move Unit(Player, TUnit, Number, SLoc, DLoc)
40 = Leaderboard (Greed) (Number)
41 = Set Next Scenario(Text)
42 = Set Doodad State(Player, TUnit, Loc, State)
43 = Set Invincibility(Player, TUnit, Loc, State)
44 = Create Unit(Player, Unit, Number, Loc)
45 = Set Deaths(Player, TUnit, Number, Modifier)
46 = Order(Player, TUnit, SLoc, DLoc, Order)
47 = Comment(Text)
48 = Give Units to Player(SPlayer, DPlayer, TUnit, Number, Loc)
49 = Modify Unit Hit Points(Player, TUnit, Number, ModAmount, Loc)
50 = Modify Unit Energy(Player, TUnit, Number, ModAmount, Loc)
51 = Modify Unit Shield Points(Player, TUnit, Number, ModAmount, Loc)
52 = Modify Unit Resource Amount(Player, Number, ModAmount, Loc)
53 = Modify Unit Hanger Count(Player, TUnit, Number, ModAmount, Loc)
54 = Pause Timer
55 = Unpause Timer
56 = Draw
57 = Set Alliance Status(Player, AllyStatus)

Appendix C: Mission Briefing Actions

0 - No Action
1 - Wait(Time)
2 - Play WAV(Wave, WavTime)
3 - Text Message(Text, Time)
4 - Mission Objectives(Text)
5 - Show Portrait(Unit, Slot)
6 - Hide Portrait(Slot)
7 - Display Speaking Portrait(Slot, Time)
8 - Transmission(Text, Slot, Time, Modifier, Wave, WavTime)
Appendix D: Groups List

0-11 - Player 1-12
12 - unknown/unused
13 - Current Player
14 - Foes
15 - Allies
16 - Neutral players
17 - All players
18 - Force 1
19 - Force 2
20 - Force 3
21 - Force 4
22-25 - unknown/unused
26 - Non Allied Victory Players
27-28 - unknown/unused
Appendix E: Misc. Common Values

Trigger Unit Types:

all normal units(0-228) plus:
229 - any unit
230 - men
231 - buildings
232 - factories

Resource Types:

0 - ore
1 - gas
2 - ore and gas

Score Types:

0 - total
1 - units
2 - buildings
3 - units and buildings
4 - kills
5 - razings
6 - kills and razings
7 - custom

Numeric Comparisons:

0 - at least
1 - at most
10 - exactly

Switch Conditions:

2 - switch is set
3 - switch is cleared

Alliance Statuses:

0 - Enemy
1 - Ally
2 - Allied Victory

Unit Orders:

0 - move
1 - patrol
2 - attack

Action States:

4 - enabled/set switch
5 - disabled/clear switch
6 - toggle/toggle switch
11 - randomize switch

Number Modifiers:

7 - Set To
8 - Add
9 - Subtract

CREDITS:

Primary Author(everything not otherwise credited): Justin Olbrantz(Quantam)
Conditions List: Camelot Systems
Actions List: Justin Olbrantz(Quantam), Camelot Systems
Players List: Camelot Systems