XS Script¶
For an introduction to the XS scripting language itself, you can check out the UGC Guide.
Support¶
Since the introduction of the XS manager, there have been some improvements to the game supporting XS in multiplayer. Age of Empires 2 Definitive Edition is able to transfer manually referenced XS files (through the XS file field) to other players within your lobby. Unfortunately this support does not stretch to spectators. They will not be able to watch your games.
To get around this, you can add your XS script to a Script Call
effect. When you add the XS to such an effect, it
will, when loading the scenario, move all scripts from those calls to the default0.xs
file. This does work in
multiplayer because it happens on every machine separately.
So the XS support for the parser works with a dedicated trigger and a Script Call
effect. In the in-game editor the
amount of text in a Script Call
effect is limited to a certain number of characters. This limitation can be bypassed
using the parser.
Initialising XS Trigger¶
You can use the XS manager to add XS to your scenarios. All these XS calls do indeed transfer in multiplayer lobbies as is explained above. You can use the XS manager like so:
1 2 3 4 5 6 7 8 9 10 |
|
Because the XS Manager
uses a trigger with a Script Call
in the background, it needs to place the trigger somewhere.
You can call the function below to create the trigger. You can also give it an index to insert it somewhere in the
scenario. Not adding an index to the call just adds the trigger at the end of the list.
Warning
Placing the trigger at the top of all triggers (insert_index=0
) can take quite a lot of time if the map already
has a lot of triggers (For example over 1000 triggers).
1 2 3 |
|
You don't have to initialise the trigger
Whenever you call the add_script()
function (more about this below),
it will automatically initialise the trigger if it hasn't been already.
The use of the initialise_xs_trigger()
function is purely to control where the trigger is placed.
Adding XS¶
You can add scripts to the trigger using the add_script
function. This function accepts a path to an XS file and a
direct XS script string.
1 2 3 4 5 6 7 8 9 10 |
|
xs_file_path=...
and xs_string=...
in the same add_script
call too.