Squads Guide - AdrienTD/XXL-Editor GitHub Wiki

XXL1 Squads

A Squad is a group of enemies in the game.

Enemies are grouped to allow them to cooperate with each other and share the same goal.

Squads also are responsible for the placement of its enemies, which are called Choreographies. The Choreographies can be animated with Choreography Keys, meaning you can make enemies do interesting movement such as walking through a path, turn around the hero, approach the hero and flee from the hero periodically, etc.

This guide will show the basic steps needed to create a new squad of enemies in XXL 1.

NOTE: Currently, squads editing works only on XXL1, including the original and Romastered.

Single enemy squad demo

  1. Load a level in the editor. In this guide we will use Greece.
  2. Open the Squads window, by clicking its sword icon in the toolbar.
  3. Click somewhere in the 3D view to place the cursor (small white box) to the place where you would like to place the squad.
  4. In the Squads window, click the New button at the top-left. Now you should see a giant sword appearing at the cursor.

Demo:

Now let's try to add an enemy to the squad:

  1. Click the new sword to select the new squad.
  2. In the Squads window, in the right panel, select the Choreographies tab. You will see that the new squad already has one Choreography and one Choreography Key.
  3. Click the Add spot button at the bottom. This will add a new enemy position in the squad. You will see a red wired square at the sword.
  4. Now select the Pools tab.
  5. Click the Add button. A menu appears letting you choose from which pool of enemies you want to take enemies. Each enemy pool corresponds to a type of enemy (simple roman, centurion, lion, pirate, turtle, ...). Once added, you will see that the red square now will hold an enemy inside.
  6. Save and test the level to see your new enemy alive!

Demo:

More enemies

Of course one enemy is boring. If you need more:

  • You can add more enemy positions by clicking Add spot again.
  • You can also duplicate enemy positions by clicking its box to select it, then press Alt+C and move it.
  • You also need to configure the number of romans that will be spawned. This can be done for every pool in the Pools tab:
    • Enemy Count is the total number of enemies that can be spawned during combat from the pool.
    • U1 and U2 are the maximal of enemies initially spawned and deduced from the Enemy Count, often set to the number of enemy positions using the pool in the first Choreography.
  • Every time you add an enemy spot, remember to update the Enemy Count and U1/U2 !!

It is also possible to use multiple pools in a squad (e.g. you can have a normal Roman and a Centurion in the same squad).

  • Simply add new pools with the Add button in the Pools tab.
  • You can specify for every enemy position from which pool it should spawn the enemy. For this, in the Choreography tab, in the enemy positions list at the bottom, just set the Enemy pool values (0 is the first pool, 1 is second, ..., and -1 is any pool).
  • The enemy positions are rendered red if the Enemy pool index is -1, otherwise it will be white.

Enemy stats

It is possible to set per squad and per pool the stats of the enemies (health, damage, shield points, speed, etc.).

  • You can access them in the Pools tab in the list of values at the bottom.
  • The default stats are often weak enemies with 3 health points and no shield.
  • Because changing the stats for every pool can be tedious, look forward to the Import, Export, Copy and Paste buttons.
  • For example, if you want to reuse the stats of a strong Centurion in a squad:
    • select the squad that contains that strong Centurion,
    • locate its corresponding pool in the Pools tab,
    • click the Copy button,
    • select your new squad,
    • select the new pool,
    • click the Paste button.
  • Use the Import/Export buttons to load/save the stats in a file. This allows you to exchange stats between levels.

MsgAction (Squad scripting)

During combat with a Squad, enemies might respawn or retreat after the hero leaves the current area. The MsgAction is responsible for handling all these types of situations and making the Squad act appropriately.

The MsgAction is divided into a hierarchy:

MsgAction

  • State(s)
    • Message(s)
      • Action(s)

The State of the MsgAction contains all the different Messages a Squad will respond to. The initial State is always 0 (the first one). By using a specific Action the State of the Squad can be changed, which will cause it to respond to different Messages

A Message is either sent through an event to the Squad or by the game itself in form of a callback. Upon receival of the specified Message, a set of Actions will be executed. States can contain any number of Messages, even the same Message twice and both will be executed upon receival of the shared Message.

An Action changes certain parameters of the Squad, like spawning an enemy, changing Choreography or the MsgAction state, as well as making it follow the hero. A Message can contain any number of Actions which will be executed from top to bottom.

After creating our Squad of one enemy, it is time to make him respawn!

  1. First, open the "MsgAction" tab in the Squads window.
  2. Click "New message handler". You will see a new Message pop up at the bottom.
  3. Click the Message dropdown. You will be greeted with a list of all the possible Messages the Squad can respond to. In our example, we want to respawn the enemy once it dies, so choose the "4D09: On enemy death" Message, which will be executed once any enemy dies.

Demo: SquadCreationMsgAction1

Once the Message is selected, it's time to choose what we want to do once it gets triggered. In our example, we want to simply respawn the enemy.

  1. Click the "New action" button. You will see a new Action appear below. Change it to "Respawn enemies until amount reached", which will respawn as many enemies of the specified pool until the Max Count is reached i.e. 3 enemies are alive and the Max Count is 5, so 2 enemies will be respawned.
  2. Change the first parameter, Max Count, to 1, as we only have 1 spot in our Choreography key. If you add more spots to the Choreography, this parameter should be changed accordingly. Leave the "Pool index" parameter as 0 because it corresponds to the pool of our enemy. If more pools were to be added, this parameter can be changed to respawn another enemy type.

Demo: SquadCreationMsgAction2

But not so quick, we still have to change the enemy count!

  1. Go back to the "Pools" tab.
  2. Change the Enemy Count to 10. As U1/U2 is 1, nine enemies will be respawned before the enemy count reaches zero. One enemy will already be spawned once the Squad loads.

Demo: SquadCreationMsgAction3

  1. Save and test the level to see your enemy respawn!

As we have not added any spawn points, the enemy will simply respawn behind the camera. If custom spawn points were to be defined, the enemy would respawn at one of them.