ScriptTypes: Difference between revisions
m Updating with new sidebar |
Reverted to using script actions and made some other minor style changes. |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{WrongTitle|[ScriptTypes]}} | {{WrongTitle|[ScriptTypes]}} | ||
{{AIBar}} | <div style="float: right">{{AIBar}}<br style="clear: right" /> | ||
{{MappingBar}} | {{MappingBar}}</div> | ||
In {{ts}} through {{yr}}, this section defines a list of all AI | In {{ts}} through {{yr}}, this section defines a list of all AI scripts in the game. Scripts define what the AI controlled units actually do, like "attack enemy buildings", "gather just outside our own base", "move to nearest {{tt|GACNST}}", and so on. Consider it a primitive programming language which supports two kinds of loops and no conditional statements (the conditions are determined through [[triggers]] or [[AI triggers]] instead). | ||
Each script type needs its own section in the same file. That section should contain a zero-based list of actual [[ScriptActions|script actions]] with arguments for the [[TaskForces|task force]] to execute. Unlike most other object lists, the list containing the script actions '''does''' care about its ordering - it reads the lines indexed from {{Tt|0}} to {{Tt|49}} in ascending order. No other flags are read from that section, so nothing is stopping you from adding stuff like {{Tt|1=Name=}} for your own reference, which third party tools such as [[C&C AI Editor]] or [[FinalAlert 2]] usually can utilize as well. | |||
== Format == | == Format == | ||
Line 10: | Line 12: | ||
[0438CD41-G] | [0438CD41-G] | ||
Index = action,argument | Index = action, argument | ||
Index = action,argument | Index = action, argument | ||
[0438CD42-G] | [0438CD42-G] | ||
Index = action,argument | Index = action, argument | ||
Index = action,argument | Index = action, argument | ||
Both {{Tt|action}} and {{Tt|argument}} are numbers, the meaning of arguments is different for each | Both {{Tt|action}} and {{Tt|argument}} are numbers, the meaning of arguments is different for each action. | ||
'''Note''' again: {{Tt|Index}} is read from {{Tt|0}} to {{Tt|49}} inclusive in ascending order, unlike other object lists which read the contained items without paying attention to the keys on the left side. | '''Note''' again: {{Tt|Index}} is read from {{Tt|0}} to {{Tt|49}} inclusive in ascending order, unlike other object lists which read the contained items without paying attention to the keys on the left side. | ||
== | == Available Script Actions == | ||
[[ScriptTypes/ScriptActions|List of | [[ScriptTypes/ScriptActions|List of available script actions]] | ||
== Additional | == Additional Information == | ||
*This section is read from {{Ini|ai}} and the current map file. | *This section is read from {{Ini|ai}} and the current map file. | ||
*Unlike [[AITriggerTypes]], there is no difference on where a ScriptType is declared, they are compiled into a single list after reading both files. The game does keep track of which ones were declared in the "global" scope (ai(md).ini) and which - in the "local" scope (map itself), but the only usage of that seems to be the unused functions to save them back to the source file. | *Unlike [[AITriggerTypes]], there is no difference on where a ScriptType is declared, they are compiled into a single list after reading both files. The game does keep track of which ones were declared in the "global" scope (ai(md).ini) and which - in the "local" scope (map itself), but the only usage of that seems to be the unused functions to save them back to the source file. | ||
*The infamous {{Tt|-G}} suffix has no | *The infamous {{Tt|-G}} suffix is used to distinguish global ({{Ini|ai}}) ScriptTypes from local (map) ones (which have no suffix). It has no effect however. | ||
*Unlike [[TaskForces]], there is no effect to prefixing a ScriptType's ID with a hexadecimal prefix. | *Unlike [[TaskForces]], there is no effect to prefixing a ScriptType's ID with a hexadecimal prefix. |
Latest revision as of 09:33, 7 June 2023
In Tiberian Sun through Yuri's Revenge, this section defines a list of all AI scripts in the game. Scripts define what the AI controlled units actually do, like "attack enemy buildings", "gather just outside our own base", "move to nearest GACNST", and so on. Consider it a primitive programming language which supports two kinds of loops and no conditional statements (the conditions are determined through triggers or AI triggers instead).
Each script type needs its own section in the same file. That section should contain a zero-based list of actual script actions with arguments for the task force to execute. Unlike most other object lists, the list containing the script actions does care about its ordering - it reads the lines indexed from 0 to 49 in ascending order. No other flags are read from that section, so nothing is stopping you from adding stuff like Name= for your own reference, which third party tools such as C&C AI Editor or FinalAlert 2 usually can utilize as well.
Format
[ScriptTypes] 0 = 0438CD41-G 1 = 0438CD42-G [0438CD41-G] Index = action, argument Index = action, argument [0438CD42-G] Index = action, argument Index = action, argument
Both action and argument are numbers, the meaning of arguments is different for each action.
Note again: Index is read from 0 to 49 inclusive in ascending order, unlike other object lists which read the contained items without paying attention to the keys on the left side.
Available Script Actions
List of available script actions
Additional Information
- This section is read from ai(md).ini and the current map file.
- Unlike AITriggerTypes, there is no difference on where a ScriptType is declared, they are compiled into a single list after reading both files. The game does keep track of which ones were declared in the "global" scope (ai(md).ini) and which - in the "local" scope (map itself), but the only usage of that seems to be the unused functions to save them back to the source file.
- The infamous -G suffix is used to distinguish global (ai(md).ini) ScriptTypes from local (map) ones (which have no suffix). It has no effect however.
- Unlike TaskForces, there is no effect to prefixing a ScriptType's ID with a hexadecimal prefix.