AI doesn't recognize new vehicle sizes |
Hi guys, I'm working on a new mod and ran into a problem. I added 2 new types of Vehicle sizes, Corvette (200kt), and Battle Cruiser (800kt). When ever I load my mod, the AI refuses to design anything at all now except Satellites and Weapon Platforms. I checked the scripts, and added the new types to the Script_AI_GlobalConstants_VehicleSizes. I then placed the recompiled files into my mod directories. The only thing I haven't tried yet is disallowing main empires in the Mod_Definition file. I'm not sure what this does yet. Does anyone have any other ideas on how to fix this?

Re: AI doesn't recognize new vehicle sizes
If you have exhausted every possible syntax and variable/constant declaration error then try an #Include statement for the constant data file and global variable data file. I ran into similar problems and couldn't see anything wrong, when I put the includes for the data files it compiled and executed as intended.
Re: AI doesn't recognize new vehicle sizes
Yes, that should be AI_VEHICLE_SIZE_CRYSTALLINE_SMALL_FIGHTER, not AI_VEHICLE_SIZE_CRYSTALLINE_SMALL_FREIGHTER.
HOWEVER...
You also need to add the following:
AI_VEHICLE_SIZE_CRYSTALLINE_SMALL_FIGHTER: string := "Crystalline Small Fighter"
To Script_AI_GlobalConstants_VehicleSizes.txt in order for it to recognize the corrected entry in Script_AI_GlobalSettings.txt. It seems as though someone missed this size.
Each one of those things in all caps is actually a variable, defined somewhere in one of the Script_AI_GlobalConstants files.
I just recently caught this error myself, and worked it in to my mod. Good eyes, CP1985.
"Only by being constantly at war with evil in all things, including yourself, can you truely know peace."
Download my mod here: GidMod




Re: AI doesn't recognize new vehicle sizes
Hello, and welcome to the wacky world of AI scripting. Where some times things just don't work like you think they should!
Alrighty, you are on the right track.
The GlobalConstants files are used by other AI script files to define variables for use by those files. They do not do any actual processing by themselves, but they are still very important. Good work on knowing to modify those, as some people miss them completely at first.
What you want to look in next is the Script_AI_GlobalSettings.txt file. This file uses some of the data in Script_AI_GlobalConstants_VehicleSizes.txt as well as data from other sources.
If you open up this file, at the very beginning you will see the definition of the ship sizes, in the form of a list. Look at it a while, and you should get the gist of how it works (or go mad...whichever). This is list the AI looks through in order to determine what ship sizes to build.
Having said that, the AI may STILL not use your ships. The stock AI builds only the LARGEST ship type available to it. Technically, it doesn't build the largest ship avilable to it, but rather the ship lowest on the list that fills its selection criteria (so it doesn't pick carriers for attack ships, but will NOT pick frigates if it can pick destroyers). So, you need to place your new ship types in this list while keeping in mind what priority the AI gives to that size. Assuming you are using stock ship sizes, your Corvette should be first in the list, while your Battle Cruiser should be inserted between Cruisers and Battleships.
However, please keep in mind that the AI will build the lowest type in the list available to it. That means if it can build your Corvettes (200kt, so the first ship in the list) and can also build Frigates (250kt, and available at the first tech level), then it will build Frigates, and not build or design Corvettes.
If you changed how the tech tree makes ships available, you will want to get in to the Script_AI_Research.txt(governs research during game play) and Script_AI_GlobalResearch.txt(governs how the AI spends tech points before the game starts in a game where the AI begins with some) files. These will need to be adjusted to take in to account any changes you may have made to the tech trees.
See what I mean about going mad?
Anyways, this should get you pointed in the right direction. Good hunting!
"Only by being constantly at war with evil in all things, including yourself, can you truely know peace."
GidMod