» Current News
» Archive News
» View All Tips
13. Always try to use the waypoint paths as attack paths - instead of just setting a team to hunt. There are usually three waypoint paths for you to use : Center, Flank and Backdoor
» Contact Us
» Atomic Wiener Dog
» CNC Reneclips
» Project Perfect Mod
» The Finest Hour
» Warhammer40k: DoW SDI
» YR Argentina
Adding new factions - for Easy difficulty
Title: Adding new factions - for Easy difficulty
Difficulty: Basic AI Scripter
Author(s): SDI Team
Game Type: Regular Generals
Don't worry if you do not understand any of this immediately. Take your time and wait till you get a better access to it. If you encounter problems, ask for help at our forum.
Because you should be using the original scripts for this, I suggest you first import the scripts as usual once you have added the skirmish players, then rename one of the player's name to what your new faction is called. If you are not doing a TC, you can always add the original player and import his scripts again.
Once you have a new faction folder with original scripts, copy your faction name. Every script has its faction name before its actual description, like "USA Define Object Lists", if you are doing UK this should of course be called "UK Define Object Lists".
If you have your faction name copied, rename all script folders to start with it. Now the fun part can begin. First deactivate (by right clicking and then unchecking "Activated") the following folders:
You will of course first do the "Easy" difficulty setting. Now that those folders are deactivated, open the Paper Work folder. Rename all scripts there and open up the "Define Object Lists" one.
- Base expansion
- Base expansion 2-4
- Defcon conditions - Hard
- Defcon conditions - Medium
- Build conditions - Hard
- Build conditions - Medium
- Build conditions - alerts hard
- Emergency behavior
- Tech buildings
- Generals powers
- Garrison builds
- Garrison orders
- Final Rush
- Base Defenses
Now an object list is basically a set of classified buildable objects so that you can apply behavior to them later. For example, for the missile defender's priority, you want it to attack 'Tanks' first and then other stuff in the area.
So now define all buildable objects and be sure to put them into the correct category. Once you have done that you are done with the paper works folder as the rest is not faction specific. Next open up "World State Detection" and rename all folders and variables there to start with your faction name again. Now comes the tedious, Attack Priority bit. Open up the folder and rename all the scripts, AND the all those priority sets in the "Actions if true" tab. This may not look necessary but it will be in case you add other factions later, even if you are sure you won't, you should still rename them.
Once you have done that open up "Generic Attack" and rename all scripts again, and modify the ones that are faction specific (for example USA Guard Base Outer with Drones is not needed for a faction that does not have drones).
Done that? Move on. The same procedure as every year, James. Do the same renaming and removing faction specific stuff to Generic Behavior and Generic Route. Then you get to Base Building - the evil bit. In this folder you have to specify the sequence with which the AI is supposed to build its base up - for easy first. The ZH AI has independent folders for this but this also works fine. Script your base building sequence taking care of power supply and prerequisites. If you are done, make a list of what you have told the AI to build - in the proper sequence.
Now that you have your base building sequence scripted you can move on to rename and remove faction specific stuff again in these folders: Defcon conditions - Easy and Build Conditions Easy.
The Build Conditions Easy are the build conditions for the teams. Note that you have to keep in mind that the scripts do not tell the AI which teams to build, they simply set templates and conditions like these, and if they evaluate to the "Actions if ture" tab, the team will be built because they have that scripted in their "Build condition" box which is in the Teams Editor.
The Defcon conditions are explained in the "Adding new units" tutorial, the rest is pretty obvious. They set the AI's expansive behavior.
Anyway once you have renamed all folders, deactivated the ones in the list and removed and changed faction specific stuff in the other folders and have scripted your base building sequence, export your work to some new folder. You should always export as something else when you have done some work - this allows you to go back if you made some serious senseless stuff.
Now that you have done all that, click "OK" and click the build list tool.
The build list is what tells the AI where to build the buildings which you have told it to do in the build sequence scripts.
Select your faction,
.. and on the left you'll see another window labelled "Pick A Unit" which is a paradoxon because we want structures! Anyway first of all, scroll all the way back on the main World Builder window so that you can see the entire map (which should be ~100x100 in size for build lists).
Place your initial starting building, usually a Command Center. Then refer to the list you have (or should have!) made earlier which contains what you have told the AI to build and in which sequence - follow that list strictly but keep in mind that you have to have the command center as your first building.
Select structures and place them somewhere, just as you would if you are playing a normal generals game, but don't place the structures at odd places otherwise the AI will try to reposition them and reposition them again and never actually build it. Note that you will almost never get the AI to build the stuff exactly where you want it to.
Once you have placed every single building in the proper sequence and placed the command center (or the substitute to that) at the start, hit the "Export" button.
Don't worry if nothing happens, click it again if you are not sure that you have actually clicked it, and open a file manager or something similar. Then go to your Command and Conquer Generals\ directory and find the file "Skirmish[YourFaction]_BuildList.ini".
Copy all the contents of that file, from top to bottom, and place it at the bottom of your "AIData.ini" which is extracted from INI.big, but be sure that there is an "End" at the very bottom. (One "End" that ends your build list block and one "End" that ends the file)
Now your AI should build the build sequence that you have specified - assuming you have modified a map for it!
Let's put it this way: the regular generals maps have three players in their Player List: SkirmishAmerica, SkirmishChina and SkirmishGLA. If you have added a player to the list when you did your AI earlier on, you must also modify the maps to have the new player in their Player List - else the game will think that the side does not exist for this map.
Now the procedure for the two other difficulty levels is almost the same - only that you have to activate the old folders again and modify their contents accordingly. The "Brutal" difficulty should only be scripted once you have most of your units and structures and superweapons (or similar items) completely INI coded. Making major changes to the INI and having things scripted at the same time may cause the AI to go berserk.