I've taken a look at your code and the mistake that you have made is very common.
You're mistaken in believe that a "typebase" script will actually order units. It will not. It will only grab those units from a base if they are already built. This is where the base_army and base_army_orderers files come in.
When you execute a script here
Code: Select all
ExecuteScript("type1*", "squad.move.typebasetotrail", 1000, 3)
{
Op("%.types", "=", "type1");
Op("%.base", "=", "Tan");
Op("%.trail", "=", "base-base");
Op("%.attack", "=", 1);
Op("%.acceptInsufficient", "=", 1);
}
This tells the AI to "recruit units required for type1 and send them along the base-base trail". It only tells the AI to grab the units that it has, not built anything new. This is the reason for the "acceptInsufficient" flag. This flag, if 1, will tell the AI to send whatever it can grab on startup, rather than wait until it can grab 100% of the required units before starting trail movement.
In order to get an AI to build, you first have to define what base the AI is using.
Code: Select all
AddBase("Tan", "army")
{
Orientation(120);
}
As you can see, this base "Tan" is using the config "army". We define the base config in the base_army.cfg file.
Code: Select all
CreateBase("army")
{
InitialState("army.units");
State("army.units")
{
Orderers()
{
Add("army.units.infantry", 2000);
Add("army.units.vehicles", 1000);
}
}
}
This tells the game what orderers this base wants. Orderers are the actual list of units that this base wants to make. Orderers are then defined in the base_army_orderers.cfg file.
Code: Select all
CreateBase::Orderer("army.units.infantry")
{
Manifest("BaseLevel")
{
Placement("army.units");
Types()
{
}
Random(1);
CanBuild(1);
}
}
CreateBase::Orderer("army.units.vehicles")
{
Manifest("BaseLevel")
{
Placement("army.units");
Types()
{
}
Random(1);
CanBuild(1);
}
}
Here I've taken the file from your map again. You can see that you have zero'd out all of the units, therefore, the base will request these orderers, which are empty, and will build nothing. So in order to get the units you want, you have to add them to these orderers.
Please note though, that an orderer is queued ONCE and maintained from that point onward. This means that if you have multiple scripts running, or random squad arrangements, then your orderer will have to build the units for
ALL of these scripts simultaneously. So for example, if script1 and script2 both use 3 grunts, and script3 uses 5 grunts, then the orderer will need to contain 11 total grunts, otherwise the grunts may not be able to satisfy all scripts. If this is okay, however, feel free to have insufficient units in the order.