Changes for page Mission Director Guide
Last modified by Klaus Meyer on 2025/03/31 16:39
From version 32984.1
edited by Klaus Meyer
on 2025/03/31 16:39
on 2025/03/31 16:39
Change comment:
There is no comment for this version
To version 32972.2
edited by Heinrich Unrau
on 2024/10/17 13:10
on 2024/10/17 13:10
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -xwiki:XWiki. Klaus1 +xwiki:XWiki.Heinrich - Content
-
... ... @@ -220,6 +220,8 @@ 220 220 Messages printed with <debug_text> are usually only visible when the "scripts" debug filter is enabled, see [[Script debug output>>doc:||anchor="HScriptdebugoutput"]] 221 221 {{/info}} 222 222 223 +Script debug output 224 + 223 223 Each child action in a <do_any> node can have a //**weight**// attribute, which can be used to control the random selection of an action node. The default weight of a child node is 1. 224 224 225 225 Also available is **<do_if>**, which completes the enclosed action(s) only if one provided value is non-null or matches another. Directly after a <do_if> node, you can add one or more **<do_elseif>** nodes to perform additional checks only in case the previous conditions were not met. The node **<do_else>** can be used directly after a <do_if> or a <do_elseif>. It is executed only if none of the conditions are met. ... ... @@ -226,11 +226,8 @@ 226 226 227 227 **<do_while>** also exists, but should be used carefully, since it is the only action that could cause an infinite loop, which freezes the game without any chance of recovery. 228 228 229 -Every action can have a //**chance**// attribute, if you only want it to be performed with that chance, given as percentage. Otherwise it will simply be skipped. 231 +Every action can have a //**chance**// attribute, if you only want it to be performed with that chance, given as percentage. Otherwise it will simply be skipped. If chance is used on a conditional action such as <do_if>, the script will behave as if the condition check failed. 230 230 231 -* If chance is used on a conditional action such as <do_if>, the script will behave as if the condition check failed. 232 -* If chance is provided on an action within a <do_any>, it will have no effect on the random selection of the action. Only when the action gets selected, the chance will determine whether the action actually gets performed or skipped. 233 - 234 234 = Libraries = 235 235 236 236 Libraries are cues which are not created directly but only serve as templates for other cues. This allows for modularisation, so you can re-use library cues in many different missions. ... ... @@ -570,20 +570,24 @@ 570 570 |-|binary|{{code language="xml"}}1 - 1{{/code}}|{{code language="xml"}}0{{/code}}|Subtraction 571 571 | 572 572 lt 573 -\\< (<)|binary| 574 -{{code language="xml"}}1 lt 3{{/code}}|{{code language="xml"}}true{{/code}}|Less than 572 +\\< (<)|binary| 573 +{{code language="xml"}}1 lt 3{{/code}} 574 +\\{{code language="xml"}}1 < 3{{/code}}|{{code language="xml"}}true{{/code}}|Less than 575 575 | 576 576 le 577 -\\<=|binary| 578 -{{code language="xml"}}1 le 3{{/code}}|{{code language="xml"}}true{{/code}}|Less than or equal to 577 +\\<=|binary| 578 +{{code language="xml"}}1 le 3{{/code}} 579 +\\{{code language="xml"}}1 <= 3{{/code}}|{{code language="xml"}}true{{/code}}|Less than or equal to 579 579 | 580 580 gt 581 -\\> (>)|binary| 582 -{{code language="xml"}}1 gt 3{{/code}}|{{code language="xml"}}false{{/code}}|Greater than 582 +\\> (>)|binary| 583 +{{code language="xml"}}1 gt 3{{/code}} 584 +\\{{code language="xml"}}1 > 3{{/code}}|{{code language="xml"}}false{{/code}}|Greater than 583 583 | 584 584 ge 585 -\\>=|binary| 586 -{{code language="xml"}}1 ge 3{{/code}}|{{code language="xml"}}false{{/code}}|Greater than or equal to 587 +\\>=|binary| 588 +{{code language="xml"}}1 ge 3{{/code}} 589 +\\{{code language="xml"}}1 >= 3{{/code}}|{{code language="xml"}}false{{/code}}|Greater than or equal to 587 587 |((( 588 588 589 589 )))|binary|{{code language="xml"}}1 + 1 == 2.0{{/code}}|{{code language="xml"}}true{{/code}}|Equal to ... ... @@ -712,7 +712,7 @@ 712 712 713 713 * Strings must start with '$', like variables 714 714 * null cannot be used as table key (but the number 0 is valid) 715 -* Lists, tables, groups ,buildplans,loadouts andconstructionsequences cannot be used as table keys718 +* Lists, tables, groups and buildplans cannot be used as table keys 716 716 717 717 These restrictions only apply to the keys, there are no restrictions for values that you assign to them. For example: 718 718 ... ... @@ -723,8 +723,6 @@ 723 723 * {{code language="xml"}}table[$foo = 'bar']{{/code}}⟹ exactly the same, just a shorter notation for string keys 724 724 * {{code language="xml"}}table[foo = 'bar']{{/code}}⟹ error, 'foo' does not start with a '$' 725 725 * {{code language="xml"}}table[{1} = [], {2} = table[]] {{/code}}⟹ a table that maps 1 to an empty list and 2 to an empty table 726 -* {{code language="xml"}}table[faction.argon = 'bar']{{/code}}⟹ error, the expression faction.argon will not be resolved into a key value. Requires { } braces. 727 -* {{code language="xml"}}table[{faction.argon} = 'bar'] {{/code}}⟹ a table that maps the value faction.argon to the string 'bar' 728 728 729 729 Just like lists, tables are stored as references, so it's possible that multiple variables reference the same table (see above). 730 730 ... ... @@ -1006,32 +1006,9 @@ 1006 1006 1007 1007 * MD scripts and cues are identified by their names. So a script can only be refreshed if it has the same script name as before (file name is irrelevant). 1008 1008 * If there are new script files or new cue nodes (i.e. scripts/cues with new names) they are created and added properly. If you remove script files or cue nodes, the corresponding scripts/cues are removed from the game, including instances. 1009 -** (!) Pitfall: It is recommended that cues are not removed if they were previously released in public builds, to prevent future cues with the same name leading to errors (see example below). Instead they can be emptied and marked as deprecated. 1010 -* As a consequence, you CANNOT rename scripts or cues if you want to refresh them. Doing so would remove the old script or cue and add a new one with the new name. 1011 -* You CANNOT change a <cue> to a <library> or vice versa. 1012 -* You CANNOT add, remove, or change the "ref" attribute of a cue. But it is possible to remove the whole cue. (If all references to a library are removed you can also remove the library itself.) 1013 -* You CANNOT change the cue tree structure, i.e. if you move a cue out of its <cues> node, you also have to change its name (see above). Changing the order of cues within the same <cues> node is possible, however, the order of execution is not reliable anyway. 1014 -* You CAN change a library and change/add/remove its sub-cues. This automatically updates all cues that use the library. 1015 -* You CAN change library parameters (both in libraries and in referencing cues). However, this does not change the variables of a referencing cue if it is already enabled. 1016 -* You CAN change conditions without restrictions. You can even change between event and non-event conditions. If a cue has enabled condition checks, they are aborted and restarted (even if there is no change). 1017 -* Adding root cues enables their condition checks immediately (if the module attribute allows it). 1018 -* Adding sub-cues to active or complete cues enables their condition checks immediately. 1019 -* You CAN change/add/remove <actions>, <force>, <delay>, and all attributes without restrictions, except for the "ref" attribute (see above). You can even change the <delay> while the cue is already active and the timer is running. 1020 -* Changing instantiate="false" to "true" turns the cue into "waiting" state if it was active or complete before. 1021 -* Changing instantiate="true" to "false" removes all instantiated cues and their descendants. 1022 - 1023 -{{warning}} 1024 -Be aware that completed instances can be auto-deleted, and so added sub-cues will not become active in such a case. 1025 -{{/warning}} 1026 - 1027 -{{warning}} 1028 -When adding a variable in a new MD script version and using that variable in multiple places, be aware that the variable doesn't exist yet in older savegames. You may have to check the existence of the variable before accessing it, or add some patch logic that initiailses the variable after loading the savegame, if necessary. 1029 -{{/warning}} 1030 - 1031 -{{warning}} 1032 -(% id="cke_bm_221021S" style="display:none" %) (%%)Cue Removal Pitfall: 1010 +** (!) Pitfall: Cue Removal 1033 1033 If you remove a cue and then later add another cue with the same name, old save files will not know that the cue has been removed inbetween. In the following example the first cue was created setting $val_1 and the game is saved. 1034 -{{code language="xml"}}<cue name="Deprecated_Test1"> 1012 +{{code language="xml"}}<cue name="Deprecated_Test1" namespace="this"> 1035 1035 <actions> 1036 1036 <set_value name="$val_1" exact="'old value'"/> 1037 1037 <debug_text text="$val_1"/> ... ... @@ -1038,7 +1038,7 @@ 1038 1038 </actions> 1039 1039 </cue>{{/code}} 1040 1040 \\If the Cue is deleted and years later a new cue with the same name appears, the old save will consider the new cue as already completed without executing its actions. The Cue PrintValue will fail to find a variable set up in its parent. 1041 -{{code language="xml"}}<cue name="Deprecated_Test1"> 1019 +{{code language="xml"}}<cue name="Deprecated_Test1" namespace="this"> 1042 1042 <actions> 1043 1043 <set_value name="$val_2" exact="'new value'"/> 1044 1044 <debug_text text="$val_2"/> ... ... @@ -1046,7 +1046,7 @@ 1046 1046 <cues> 1047 1047 <cue name="PrintValue"> 1048 1048 <actions> 1049 - <debug_text text="$val_2"/> 1027 + <debug_text text="parent.$val_2"/> 1050 1050 </actions> 1051 1051 </cue> 1052 1052 </cues> ... ... @@ -1054,8 +1054,27 @@ 1054 1054 \\To avoid this, do not delete any cues (once they are public for save game compatibility), but empty them out and mark them as deprecated. This will prevent new cues with the same name in the script. 1055 1055 {{code language="xml"}}<!-- Deprecated Cues, kept to not duplicate names in future cues --> 1056 1056 <cue name="Deprecated_Test1" comment="deprecated"></cue>{{/code}} 1035 +* As a consequence, you CANNOT rename scripts or cues if you want to refresh them. Doing so would remove the old script or cue and add a new one with the new name. 1036 +* You CANNOT change a <cue> to a <library> or vice versa. 1037 +* You CANNOT add, remove, or change the "ref" attribute of a cue. But it is possible to remove the whole cue. (If all references to a library are removed you can also remove the library itself.) 1038 +* You CANNOT change the cue tree structure, i.e. if you move a cue out of its <cues> node, you also have to change its name (see above). Changing the order of cues within the same <cues> node is possible, however, the order of execution is not reliable anyway. 1039 +* You CAN change a library and change/add/remove its sub-cues. This automatically updates all cues that use the library. 1040 +* You CAN change library parameters (both in libraries and in referencing cues). However, this does not change the variables of a referencing cue if it is already enabled. 1041 +* You CAN change conditions without restrictions. You can even change between event and non-event conditions. If a cue has enabled condition checks, they are aborted and restarted (even if there is no change). 1042 +* Adding root cues enables their condition checks immediately (if the module attribute allows it). 1043 +* Adding sub-cues to active or complete cues enables their condition checks immediately. 1044 +* You CAN change/add/remove <actions>, <force>, <delay>, and all attributes without restrictions, except for the "ref" attribute (see above). You can even change the <delay> while the cue is already active and the timer is running. 1045 +* Changing instantiate="false" to "true" turns the cue into "waiting" state if it was active or complete before. 1046 +* Changing instantiate="true" to "false" removes all instantiated cues and their descendants. 1047 + 1048 +{{warning}} 1049 +Be aware that completed instances can be auto-deleted, and so added sub-cues will not become active in such a case. 1057 1057 {{/warning}} 1058 1058 1052 +{{warning}} 1053 +When adding a variable in a new MD script version and using that variable in multiple places, be aware that the variable doesn't exist yet in older savegames. You may have to check the existence of the variable before accessing it, or add some patch logic that initiailses the variable after loading the savegame, if necessary. 1054 +{{/warning}} 1055 + 1059 1059 == Patching == 1060 1060 1061 1061 Cues can have **<patch>** elements with actions that will be performed when an old savegame is loaded. To control which savegames should be affected, you can add a //**version **//attribute to the <cue> node and a //**sinceversion**// attribute in the patch. When a cue is loaded from a savegame that has an older version than //sinceversion//, the <patch> actions will be performed immediately after loading.