-
Notifications
You must be signed in to change notification settings - Fork 59
war3map.wtg Triggers
The wtg file contains the definition of variables, triggers and the contents of gui triggers. Refer to war3map.wct for jass code.
Triggers, comments and scripts can be in any order so check the classifier and disregard the order given below. (it seems all three have the same format so trigger format has been copied for scripts and comments which may be incorrect)
Events, conditions and actions can be in any order so check the classifier and disregard the order given in this document.
Thanks to BogdanW3 for the specification and his hard work on HiveWE!
For the legacy pre 1.31 specification see this page
char[4] magic_number
int32 format_version
int32 game_version
int32 header_count
int32 deleted_header_count
for each deleted_header {
int32 header_id
}
int32 library_count
int32 deleted_library_count
for each deleted_library {
int32 library_id
}
int32 category_count
int32 deleted_category_count
for each deleted_category {
int32 variable_id
}
int32 trigger_count
int32 deleted_trigger_count
for each deleted_trigger {
int32 variable_id
}
int32 trigger_comment_count
int32 deleted_comment_count
for each deleted_comment {
int32 comment_id
}
int32 custom_script_count
int32 deleted_script_count
for each deleted_script {
int32 script_id
}
int32 variable_count
int32 deleted_variable_count
for each deleted_variable {
int32 variable_id
}
int32 ?
int32 ?
int32 trigger_definition_version
int32 existing_variables_count
for each existing_variable {
string name
string type
int32 ?
int32 is_array
if game_version == 7 {
int32 array_length
}
int32 is_initialized
string initial_value
int32 variable_id
int32 parent_category_id
}
for each element_count {
int32 classifier
if header/library/category {
int32 category_id
string category_name
if game_version == 7 {
int32 is_comment
}
int32 is_expanded
int32 parent_category_id
}
if trigger/comment/script {
string trigger_name
string trigger_comment
if game_version == 7 {
int32 is_comment
}
int32 trigger_id
int32 is_enabled
int32 is_custom_script
int32 initially_off
int32 run_on_map_initialization
int32 parent_category_id
int32 ECA_count
if trigger {
for each ECA {
int32 classifier
if is_child {
int32 group
}
string Event
int32 enabled
Parameters
int32 child_eca_count
ECA[] ECAs
}
}
} else if variable {
int32 variable_id
string name
int32 parent_category_id
}
}
char[4] magic_number
Used to identify the file type. Always "WTG!"
int32 format_version
Used to identify which format the file is.
04 00 00 80 -> 1.31
int32 game_version
4 -> RoC
7 -> TFT
int32 header_count
Includes both existing and deleted headers. (Map script headers?)
int32 deleted_header_count
for each deleted_header {
int32 header_id
}
int32 library_count
Includes both existing and deleted libraries. As to what they even are, BogdanW3 said: "They work almost like map headers for all intents and purposes, but they were likely meant to be exportable and importable between maps"
int32 deleted_library_count
for each deleted_library {
int32 library_id
last byte is 00 instead of 01
}
int32 category_count
Includes both existing and deleted categories
int32 deleted_category_count
for each deleted_category {
int32 variable_id
The last byte is 00 instead of 02
}
int32 trigger_count
Includes both existing and deleted triggers
int32 deleted_trigger_count
for each deleted_trigger {
int32 variable_id
The last byte is 00 instead of 03
}
int32 trigger_comment_count
Includes both existing and deleted comments
int32 deleted_comment_count
for each deleted_comment {
int32 comment_id
The last byte is 00 instead of 04
}
int32 custom_script_count
Includes both existing and deleted scripts
int32 deleted_script_count
for each deleted_script {
int32 script_id
The last byte is 00 instead of 05
}
int32 variable_count
Includes both existing and deleted variables
int32 deleted_variables_count
for each deleted_variable {
int32 variable_id
The last byte is 00 instead of 06
}
int32 ?
0 always observed
int32 ?
0 always observed
int32 trigger_definition_version
Unconfirmed, seems to be 1 in ROC, 2 in TFT
int32 existing_variables_count
for each existing_variable {
string name
string type
int32 ?
1 always observed
int32 is_array
if game_version == 7 {
int32 array_length
}
int32 is_initialized
1 if initial_value is set.
string initial_value
int32 variable_id
Last byte always 06
int32 parent_category_id
}
int32 element_count
map header + library_count + category_count + trigger_count + comment_count + custom_script_count + variable_count
for each map_header/library/category/trigger/comment/script/variable {
int32 classifier
header: 1
library: 2
category: 4
trigger: 8
comment: 16
custom script 32
variable: 64
if header/library/category {
int32 category_id
Last byte is:
header: 00
library: 01
categry: 02
string category_name
if game_version == 7 {
int32 is_comment
}
int32 is_expanded
Whether the folder was expanded in the trigger editor at the time of saving.
int32 parent_category_id
0 when not a subcategory, otherwise it refers to its parent ID
}
if trigger/comment/script {
string trigger_name
string trigger_comment
if game_version == 7 {
int32 is_comment
Always 0 for trigger and custom script
}
int32 trigger_id
Last byte for every type is:
trigger: 03
comment: 04
script: 05
int32 is_enabled
Always 1 for comments, differing for triggers and custom script
int32 is_custom_script
Always 1 for custom script, 1 for converted triggers, always 0 otherwise
int32 initially_off
Always 0 for custom script and comments. Variable for triggers
int32 run_on_map_initialization
Only possible for triggers converted to text? Alweays 0 for comments and custom script?
int32 parent_category_id
int32 ECA_count
if trigger {
for each ECA {
int32 classifier
event: 0
condition: 1
action: 2
if is_child {
int32 group
}
string Event
int32 enabled
Effectively a boolean
Parameters
int32 child_eca_count
ECA[] ECAs
}
}
} else if variable {
int32 variable_id
Last byte always 06
string name
int32 parent_category_id
}
}