SDI title

  Current News
  Archive News



  Random Tip:
24.World Builder will read a .big file if its name starts with "Expand" before its actual name. For Zero Hour it must be placed in the Data\Ini\ folder, otherwise it can be placed in the main game directory. World Builder will only read one .big file though.
  View All Tips

  Contact Us

  Atomic Wiener Dog
  CNC Reneclips
  Project Perfect Mod
  The Finest Hour
  Warhammer40k: DoW SDI
  YR Argentina

Adding New Units

Difficulty: Novice AI Scripter
Author(s): SDI Team
Game Type: Regular Generals

For this scenario, we will assume that we want to add a new unit to America, the Patriot Tank.

What is a Team?

The AI in Generals uses its units by the use of Teams. A "Team" in World Builder is basically one or more
units that have been assigned specific behavior.
This behavior is, of course, defined by faction scripts.

Let's get started - run World Builder.

Go to Edit > Player List. In the new window, locate the "Add Skirmish Players" button and click it.
Click "OK" and go to Edit > Scripts. Find the "Import Scripts" button, and import the
(usually located in your Command and Conquer Generals\Data\Scripts\ directory).

After a few seconds you will possibly see that the three faction folders have a question mark next to them.
This means that the scripts cannot find an item - don't worry though, it's only the waypoints, trigger areas and civilian buildings that it can't find.

Now that you have imported the scripts (the teams import with the scripts), click "Ok" and go to Edit > Edit Teams.

Click "Skirmish America", and you'll see a big list of teams.

This is where the AI gets all the team data from. Here is a list of things that the Teams Editor defines :

  • Build Conditions

  • On Create Behavior (what the team is supposed to do once it is created)

  • Magnitude of teams (which unit(s), and how many of them)

  • Build Priority (sets whether this team is to be built before any others or not)

  • On Destroyed Behavior (what the team is supposed to do when it is destroyed, the percentage value next to it defines
    when it should consider itself "destroyed"

  • Generic Scripts (you can attach any scripts here, the most used ones are the Apply Priorities and Attack Hunt)

Now, to add the Patriot Tank to the USA AI, we need to choose specific teams.

Note the "D" followed by a number and then another letter in the team's name.

The "D" stands for "Defcon". The defcon counter is governed by death counters. it determines when and how much bonus cash it will recieve and also which teams to build.
It rotates from 1 to 5 and back again over and over depending on the battle.
(Look at the "USA Defcon Conditions - Easy Normal or Hard" folders)

The number next to the "D" in the team's name determines the defcon's value. The next letter (can be either an E, M or H)
stands for difficulty settings, Easy, Medium or Hard.

Since we want to make the USA use the Patriot Tank early, we will choose higher defcon teams to add our Patriot Tank to -
otherwise the AI will only build it later on in the game, and not at the start.

For now, double click "USA D5H Tank Rush".
Stay with me now while you wait for your brain to make sense of it:

1) The Team's name, the "D5H" is discussed above

2) How many instances of this team can exist simultaneously

3) The Owner, which is defined by the players in the Player List

4) Mainly used for map missions, this sets where the team is initially, waypoints must be chosen

5) The Build Condition. The "USA Build D5H Tank Rush" is a simple script which sets a flag to "True" when its conditions are
true, and our team is built when that flag is "True"

6) Execute the actions in the "Actions if true" tab in the Scripts editor - will get to that later

7) Build priority, 1000 is pretty high so this will be built first of all - if one or more teams have the same priority and
build conditions then they will be built randomly.

8) Increase this team's priority if they succeed in their orders, (On Create, will get to that)

9) Build for this many frames, after that, start executing your initial orders. Note that the Skirmish AI does not recognize this - the AIData.ini handles that. This is only for singleplayer.

10) Value by which the team's priority will be decreased if they fail with their orders - so they won't be built again

11) The unit list. Any units can go there, they do not necessarily have to be in a specific faction.

12) Automatically build reinforcement teams, defined in the Reinforcement tab. This function reinforces the team on a unit only doesn't replace the entire team. It also has the nasty habit of robbing units from one team that has the AIRecuitable box checked, causing that team to be broken

13) This team can be recruited from another team when the "Recruit a team" script command is used

14) This team can only be created once, will never be rebuilt even if the build conditions allow that.

Now, the Reinforcement tab is mostly used on map missions, the only "interesting" ones at this time are the other
two: Behavior and Generic.

Behavior first:

1) "USA Attack Sequence Center" is a sequential script that tells this team to follow the "Center" path in the map and
attack any enemies there

2) Execute this script when you see an enemy, the sight distance is defined in the object INI "VisionRange" line

3) Execute this script when you see no enemies

4) Execute this script when the team has been destroyed. The box with the percentage next to it defines when a team should
consider itself "destroyed"

5) Execute this script when you are idle

6) Execute this script when this team has lost a unit

7) and 8) These seem to have been disabled

9) Sets the attitude of the team. "Aggressive" is often the most effective. NOTE: If the team is to load into a transport DO NOT set it to AGGRESSIVE...they won't load

10) Focus fire, pretty obvious I think.

Now lets move on to Generic:

Note: The number of scripts you can add will change when you add them

1) USA Attack Hunt makes the team attack enemy target along the way, when they follow the "Center" path of the map as
defined by the On Create behavior
2) USA Base Invaded Hunt will make this team retreat to their base if it is attacked, to defend it.

3) USA Apply Tank Priority will make this team use the Tank Priority as defined in the scripts.

Now that you know more about the teams tabs, lets get back to our original scenario.

Go back to the "Identity" tab, and in the Unit List, (below AmericaVehicleHUmvee), add the Patriot Tank (or your new unit)
and set the minimum and maximum numbers both to 1.

Now set it's Priority to 9000 for this scenario.

Note that the build condition of our team (USA Build D5H Tank Rush) states that the AI's enemy must have less than or equal
to 4 rocket guy's..
and less than or equal to 3 units of type "Anti Air" (look at the script itself in the Script Editor)

If you just want the AI to build those units now so that you can see it, take those above states conditions off the build
condition. (The USA Build D5H Tank Rush script is located in SkirmishAmerica\Build Conditions - Hard)

Fire up the game and see if it works. (playing on Brutal difficulty level of course)

Note that the more teams you add the unit to, the higher is the chance of that unit being built.
If you have started the game and played a bit, yet the AI did not build it, try adding it to more teams.

Also note that the new unit must be in the faction's building commandset somewhere, else the AI won't "find" it
(for example, if you take off the ChinaTankGattling from the Chinese Warfactory, the AI will not build the Gattling
Tank anymore, so the AI needs the CommandSet and CommandButton entries)

Thats it, you're done.

SDI is part of the Revora Creative Network.
Orange Block design created by Detail 2004 Revora Creative Network.
Content Revora Creative Network 2004 - 2008