Scripting – Creating Scenarios
Scripting allows you a huge amount of control over what exactly happens on the map you are creating. You can restrict what buildings and units the players can use, set up Triggers to lock or unlock them, spawn units or buildings for the players or their enemies. You can send units to attack specific targets and send dialog popups to the player. Everything you need to make your own custom Scenarios.
All of this is stored in XML, not code, so you don’t need any special programming tools or experience to use it. Though, it may be confusing at first and take a while to wrap your head around it. The best advice for seeing what is possible is to look through the \Assets\Campaign\ and \Scenario\ directories and seeing how the existing missions are made. Some examples are also included below.
There are three main elements in Ashes scripting: missions, players and triggers. Missions are the definition or the scenario. Players defines the players that are going to be used in the scenario. Triggers are where all the magic happens. Triggers have a lot of elements and options. There's a lot of terminology to learn for scripting, and not all of them are listed on this page but links are provided throughout to give you the full set of required terms.
Note that all triggers and arguments are case-sensitive.
First, you set up all the menu-related items (what icons/art to use in the Campaign screen, etc) and global settings like enabling/disabling creeps and hiding terrain. Click here to see the full list of what can be configured in mission scripting.
To do much of anything, you'll need to define players next. This is done with individual <Player> tags that enable or disable their AI, sets faction, team, and color, etc.
You'll likely refer to these players later in the script by number, where 0 is the first player defined, 1 is the next, and so on.
Triggers are what control anything you want to happen while the scenario is being played, from spawning starting base to calling waves of attacking enemies or giving players objectives. There are several types of triggers which activate off of different events.
These are the types of triggers you can use in a script, and any specific arguments they support.
These are the commands you can put within a trigger to create gameplay effects.
For detailed information about how to use this, read the main Commands entry.
To view map coordinates, ensure you have opted into to a modding build under steam betas which allows you to open the developer tools. Open up the the map in a skirmish and press the ` or HOME key, then select DebugPlayerPanel and Enable Show Mouse Position.
A single trigger can do any combination of the above options. It can popup some text, spawn some units, set an objective give the player some resources and unlock some new building options. It is up to you how you want to combine and use them. Let’s take a look at some examples.
Send an army to attack
The above trigger is inactive, meaning it needs another trigger to call it before it will activate. Once it does it will spawn 16 units into an army and send them to attack the defined map position. This is a relatively simple trigger, but a common one. With this alone you can create scenarios that spawn waves to attack the player, grant reinforcements to the player or create surprise ambushes.
Reward the player for capturing an area
The above trigger occurs when the player captures the region at the specified position. Notice that the trigger starts inactive, so it would need to be enabled by an earlier trigger before it could occur.
This trigger does the following:
This is a great example of the kind of combinations that can be done with the trigger system. This is a reward to the player for capturing the region. But it could as easily have triggered an escalation for the enemy forces.
Commenting Out Code
Commenting out code is very useful to disable certain lines but without deleting them so you can easily place them back on. This is also useful for leaving notes so you remember what you are trying to do or just making it neater and easier to navigate. I need to use an image to show which characters are used to comment out.
Many things in the Scenario code can cause issues that result a crash or prevent it from working. Here's a list of some common issues that you may encounter and how to fix them.