» Current News
» Archive News
» View All Tips
» 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: Zero Hour
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
- Sell Off
- Build conditions - Hard
- Build conditions - Normal
- Build conditions - Alerts
- Tech buildings
- Generals powers
- Super Weapon Use
- Garrison builds
- Garrison orders
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. Actually these scripts only give the AI cheat money - leave it in for now, you can still take them out later. Now comes the tedious, Attack Priority bit. Open up the Attack Priorities 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. Also adapt the "apply" scripts that are used for teams to actually use the priorities later.
The "Escalation" folder is the equivalent system for the Defcon system in regular Generals. What it will do is basically increase a counter's value every few seconds, (as seen in the Time Escalation - E script).
Most of the other scripts increase the escalation counter when the player has built a tech center or a superweapon (these are object lists). Rename all scripts here too to start with your faction name.
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).
Open up the "Complimentary - General" folder. The Complimentary scripts do jobs such as utilize object-specific upgrades or make a team buildable again after it has been destroyed. Fortunately for you, you only have to rename the scripts, remove\replace faction specific things and tell scripts like "CT-Run Subs" to run the just renamed scripts instead of the old, not existant ones. Use the same technique with the other Complimentary folders.
Done that? Move on. The same procedure as every year, James. Do the same renaming and removing faction specific stuff to Generic Behavior, Generic Route, Combat Zone, Alert Team Attacks, Attack Waves and Generic Route. Then you get to Base Building - Easy, the evil bit. In this folder you have to specify the sequence with which the AI is supposed to build its base up. 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.
The Build Conditions -Easy folder contains scripts that 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.
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.
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 subsitute 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_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 ZH maps have twelve players in their Player List. 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.
The ZH World Builder will only allow you to have a maximum of 13 players. You can get another player by removing the "PlyrCivilian" from all maps and moving the music scripts to the neutral player, but that's it. The SDI is working on a solution for this.
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.