View Tags

March 24, 2015

Tutorial: Making a Telepath Tactics Campaign, Part 12

<< Continued from Part 11

A. Adding a third army to a battle

So! We know how to make dynamic battles with dialogue, scripted events, and different conditions, but we haven’t discussed how to set up battles with more than 2 armies yet. We’ll do that now!

By default, single-player maps in Telepath Tactics begin with just two armies: army 0 (the player) and army 1 (the enemy). To add another army, you must put a New Army condition on the map:

The New Army condition has three parameters: army name, controller, and army color. “Army name” can be any word or phrase you want that describes the army. “Controller” tells the game whether the computer will control the army or a human player will–thus, this parameter must be set to either Human or CPU. “Army color” tells the game what color the army will be; you must use one of the following 9 colors: Red, Blue, Green, Yellow, Violet, Pink, Orange, White, or Black.

So! Remember the caravan battle from the main campaign where you have to try to recruit Scarlet Etoile and Lakshmi Bana while they fight against the bandits? That was a three-army battle. Army 0 was the player, army 1 was the enemy, and army 2 was the caravan guards. I created army 2 using this condition:

<Condition>New Army,Caravan Guards,CPU,Green</Condition>

This created a new, green-colored, CPU-controlled army named “Caravan Guards.” From there, all I had to do was add characters to the map with Team set to 2. (See: Tutorial 4D.)

(Note: you cannot use ChangeCondition to add a New Army condition to the map. New Army is one of the few conditions that must be present from the moment the map begins to load, or else it won’t work!)

B. Adding a fourth fifth, etc. army to a battle

Telepath Tactics supports battles with up to 6 armies on the field at a time.

To keep adding armies, just keep adding more New Army conditions to the map. Each additional New Army condition creates the next army in numerical order. This, for instance, is how I created armies 2 and 3 in the battle with Ebon Raban:

<Condition>New Army,Civilians,CPU,Green</Condition>
<Condition>New Army,Neutral,CPU,White</Condition>

Army 2 is Civilians, and army 3 is Neutral. If I added another New Army condition below Neutral, that would become army 4–and so on.

C. Setting army alliances

By default, all armies on a battlefield are enemies of every other army, meaning that any fight with three or more armies will–by default–be a giant free-for-all! Maybe that’s what you want, but there are certain occasions where that just won’t do. To make certain armies regard one another as friends, you must create alliances for all the armies on the battlefield.

There’s a particular condition we use to give an army an alliance: Set Army Alliance. It has two parameters: army number and alliance name. The alliance name can be any word or phrase you like, but make sure you use the exact same one for each army that you want to be allies!

This, for example, is how I set up the alliances in the caravan battle:

<Condition>Set Army Alliance,0,Caravan</Condition>
<Condition>Set Army Alliance,1,Bloodbeard</Condition>
<Condition>Set Army Alliance,2,Caravan</Condition>

Notice that army 1’s alliance does not include any other armies. That’s fine–the key thing is just to make sure each army has been assigned an alliance name of some sort. Because the player (army 0) has been assigned the same alliance name as the caravan guards (army 2), that means the player is now considered an ally of the caravan guards.

This makes the caravan guards treat the player’s characters as friendly units–they won’t attack them, and if the guards had healing abilities, it would make the guards consider the player’s characters viable targets for said healing abilities. In addition, this makes it so the player’s victory depends only upon defeating army 1; without that alliance, the player would have to kill the caravan guards as well as army 1 to win the battle!

D. The Defeat Army condition

But what if we want the player to only have to defeat one particular army to win, and we also don’t want the player to be allied to all (or any) of the other armies? There’s a condition for that! It’s called Defeat Army.

Defeat Army has two parameters: the army whose victory condition it affects, and the enemy army that the first army must defeat to win.

In the battle to rescue Sarn Kamina in the main campaign, for example, there are four armies on the map: the player, the enemy, the lissit, and a hostile army of derelict golems. The golem army will attack anyone who wanders near, but its defeat isn’t essential to winning the battle–only army 1’s is. So we use the Defeat Army condition to tell the game that the player (army 0) wins as soon as the main enemy army (army 1) is defeated, regardless of whether any other hostile armies remain on the battlefield:

<Condition>Defeat Army,0,1</Condition>

Simple as that!

E. Creating roaming thieves

Now that we know the basics of creating new armies, it’s time to combine that knowledge with our knowledge of character tags to create roaming thieves that plunder treasure chests on the battlefield! To create thieves who show up and try to steal treasure chests, I first create an army for them:

<Condition>New Army,Thieves,CPU,Violet</Condition>

Next, I tag each thief character so he’s ignored by the enemy and so he ignores all other characters on the battlefield:


Finally, I tag the chests that I want him to go after so our thief sees them as viable attack targets.


Note that I use army 1 and not army 0 for the TreatAsArmy tag here. This makes it so army 1–the main enemy force–ignores the treasure chest. Also note that because the chest is not, in fact, actually a member of army 1, the IgnoreArmy tag on our thief won’t trump the TreatAsArmy tag.

That’s about all–the AI will take care of things from there!

F. Changing army colors

One last thing. What if you won’t want to create a new army, but just want to change the color of an existing army instead? Easy! For that, we use the Set Army Color condition.

Set Army Color has two parameters: army number and the color to change to. The color to change to must be one of the following 9 colors: Red, Blue, Green, Yellow, Violet, Pink, Orange, White, or Black.

This, for example, is how I changed army 1 to black in the battle with Ebon Raban:

<Condition>Set Army Color,1,Black</Condition>

And that’s it.


All right folks! When we return, we’ll learn how to set and use custom variables. Then, we’ll learn more about the SetStat script action. See you next time!

Continued in Part 13 >>