How to change production and general behaviour of AI-countries?

  • We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Altruist

Colonel
10 Badges
Sep 13, 2011
817
736
  • Darkest Hour
  • Stellaris
If I would like to change the behaviour of AI-run countries, how do I do it?

In this case they are free allies (=not puppets) of my played country. Sometimes they are as small as having only 3-9 IC and some of them try to produce ridiculous stuff. Ideally they would produce garrisons instead of Inf with weird brigades, Fighters they have good tech in instead of INT they have low tech and can't use anyway due to too long distances in that area. Or even try to produce a Navy but using extremely outdated light cruisers instead of subs which they have good tech in and woud be smarter anyway.

I've tried to change the settings in the corresponding files I have found in the /ai folder.
But it either seems not to change anything or I am doing it wrong. Could anybody give me perhaps a few hints?

Specifically...

These are the first lines for India, and to be honest, I don't know what they do and even when I have an idea then I don't know what the given values mean:

switch = no # [yes/no]
max_front_ratio = 1.2
max_garrison_prop = 0.30
min_garrison_prop = 0.20
neutrality = 130.000
war = 0
reinforcement = 0.000
upgrading = 0.2500
strat_redeploy_threshold = 25
exp_force_ratio = 0.50
exp_force_ratios = { }
no_exp_forces_to = { }

Then this... I was trying to make India build factories but nothing seems to happen):
ic_at_war = yes
force_ic_until = 1941
ic_end_year = 1942
IC_provs = {
1459 # Delhi
1447 # Calcutta
1517 # Bombay
1518 # Ahmedabad
1476 # Ranchi
1472 # Jamshedpur
1521 # Baroda
1480 # Bhopal
1515 # Hubli
1498 # Bezawada
}

And the guidelines to produce military...
no idea what the first lines are about, the ones following "divisions" are giving percentages or ratios?
The idea was to make India produce a few Inf, mainly Gar, no air, some HSubs, no brigades for land but 100% FP for naval units.

military = {
relative_build_scheme = no
max_batch_peace = 680
max_batch_war = 320
max_batch_home_front = 180
extra_convoys_war = 0.0500
extra_convoys_peace = 0.0500

#### Divisions etc...
infantry = 15
cavalry = 0
motorized = 0
mechanized = 0
light_armor = 0
armor = 0
paratrooper = 0
marine = 0
bergsjaeger = 0
garrison = 60
hq = 0
militia = 0
# 75 %
interceptor = 0
multi_role = 0
cas = 0
strategic_bomber = 0
tactical_bomber = 0
naval_bomber = 0
transport_plane = 0
flying_bomb = 0
flying_rocket = 0
# 0 %
battleship = 0
carrier = 0
escort_carrier = 0
destroyer = 0
light_cruiser = 0
heavy_cruiser = 0
battlecruiser = 0
submarine = 0
nuclear_submarine = 25
transports = 0
# 25 %

#### Brigades
artillery = 0
sp_artillery = 0
cavalry_brigade = 0
sp_anti_air = 0
medium_armor = 0
tank_destroyer = 0
light_armor_brigade = 0
heavy_armor = 0
super_heavy_armor = 0
armored_car = 0
anti_air = 0
police = 0
engineer = 0

cag = 100.000
escort = 0.0000

naval_asw = 100.0000
naval_anti_air_s = 0.0000
naval_radar_s = 0.0000
naval_fire_controll_s = 0.0000
naval_improved_hull_s = 0.0000
naval_torpedoes_s = 0.0000
naval_anti_air_l = 0.0000
naval_radar_l = 0.0000
naval_fire_controll_l = 0.0000
naval_improved_hull_l = 0.0000
floatplane = 100.0000
}
 
Last edited:
I know the problem / nuisance! I tried to solve it in a similar way but unfortunately also without any noticeable success ... I hope someone knows a solution! That would also interest me very much!
Maybe a clinical clue - if not known! In DH there are several (two?) directories with * .ai files. Maybe if you are playing a mod you edited the "wrong" * .ai ?! Maybe both have to be edited at the same time?
For example the following paths for me:
Darkest Hour \ ai
Darkest Hour \ Mods \ Darkest Hour Full \ ai
Once I got the message that the value of all units together must / should always be 100 forarmy, navy and air force.
 
Maybe a clinical clue - if not known! In DH there are several (two?) directories with * .ai files. Maybe if you are playing a mod you edited the "wrong" * .ai ?! Maybe both have to be edited at the same time?
For example the following paths for me:
Darkest Hour \ ai
Darkest Hour \ Mods \ Darkest Hour Full \ ai
Once I got the message that the value of all units together must / should always be 100 forarmy, navy and air force.
Rechecked: Yes, I did change the ai-file in the approbiate mod directory... not in the other directories and I am a bit hesitant to do so.
Production also, rather by chance, adds upto 100.

I also rechecked what eg India is doing now: That's really weird. Perhaps my memory fails me from the last look but it looks like they have switched from building INT to building lots of TAC now. I rather guess it is my memory.

Something I must be doing completly wrong... it could also be that I am just not patient enough and need to give it more time until the old production orders are all worked down.
 
Not 100% sure but I begin to suspect that editing the behaviour of countries is done in your own save-file...
They are that big because they seem to include all countries including their behaviour and plan patterns.

In the example of India one can look for (if your trusty asci-editor is familiar with regular expressions):
country = { \n tag = Ind

Now, looking at all those expressions used there, this raises a load of new questions...
I am sure DH being DH there is probably somehwere a good introduction and explanation to all those variables...

YES!
\Darkest Hour\Modding documentation\AI Files Modifiers.txt
 
Yeah, it is one of major issues of DH... can't remember how many times I have freed a country (so no troops) just to see him producing TAT or BB instead of infantry that would be far more useful
 
Rechecked: Yes, I did change the ai-file in the approbiate mod directory... not in the other directories and I am a bit hesitant to do so.
Production also, rather by chance, adds upto 100.

I also rechecked what eg India is doing now: That's really weird. Perhaps my memory fails me from the last look but it looks like they have switched from building INT to building lots of TAC now. I rather guess it is my memory.

Something I must be doing completly wrong... it could also be that I am just not patient enough and need to give it more time until the old production orders are all worked down.
You don't necessarily have to wait for the currently commissioned units to be built! You can delete the construction order list in the savegame! The corresponding file for the full mode is in the directory
Darkest Hour \ Mods \ Darkest Hour Full \ scenarios \ save games
Open the corresponding * .eug file using a word processing program (the file is too big for the editor)
look for the capital of the country you want to edit
capital = .... you can find the province number to be entered here for the full mod under Darkest Hour \ map \ Map_1 \ province_names
Then search for "division_development" and you have the construction list!

One possibility would be to copy the build from a country that builds "more systematically" - if there is such a thing!
 
  • 1
Reactions:
Thanks.
Works fine.

What I couldn't figure out... is there also a way to make a country building infrastructure? Probably similar to how to make them build IC but I can't find the approbiate expressions.
You can order IC in your country in game and then complete it "immediately" by editing the build list in the savegame ... in this case you have to change the corresponding entries in the savegame for your country under the correspondending province_development: progres = 99.9999, total_progress = 99.9999 , days = 1 and days_for_first = 1 and set the end date to the next (game) day ... here is an example for a HQ:

division_development = {
id = {type = 4712 id = 6045}
name = "Army Group"
progress = 99.9999
location = 163
cost = 6.0300
date = {
year = 1941
month = february
day = 3
hour = 23
}
manpower = 5
total_progress = 99.9999
size = 1
done = 1
days = 1
days_for_first = 1
gearing_bonus = 0.0500
upgrade = yes
type = hq
model = 3

if you had the date 02/03/1941 (7:00 p.m.) in the game, a HQ would be completed with these entries on the same day at 11:00 p.m. (but make sure that this only works for a single order, no series production! Entry for "size "must therefore be = 1).
but that is awkward!
You can also generally change the entries in the "Infrastructure" column in the Darkest Hour \ map \ Map_1 \ province (open with a spreadsheet and save "in the same format" you has opened!!)! the percentage of expansion per province is always given! The province names and numbers can be found in the same path in the "province_names" (if you e.g. play the full mod) ... The changes here only affect a new game in one of the scenarios!
 
Sorry, I should had been more specific:
What I meant, how can I make other countries produce infrastructure in a region? I've figured out how to give them general and specific plans to build factories, just the normal way, normal cost etc. Is there a similar way for infra? I discovered the orders and expressions for AA, forts, naval bases etc. but infra seems to be missing?

This is the production plan for India in my save-file. Those orders allows India to build AA-batteries upto 6 in the regions Colombo and Bombay. And produce factories in various provinces for several years. max_facor sets how much of the total available IC India should plan to allocate for province buildings.
Many things I found in the \Modding documentation\AI Files Modifiers.txt, misssing is infra... either because it can't be built or because soembody forgot to document it.
Code:
        construction = {
            max_factor = 0.5000
            transports = -1
            escorts = -1
            AA_batteries = yes
            max_AA_level = 6
            AA_provs = {
                 1511 # Colombo
                 1517 # Bombay           
            }
            coastal_fort = no
            max_coastal_level = 3
            coastal_fort_provs = { }
            radar_station = yes
            max_radar = 1
            radar_provs = {
                 1511 # Colombo
                 1517 # Bombay           
            }
            air_base = yes
            max_air_base = 6
            air_base_provs = {
                 1495 # Trivandrum
                 1511 # Colombo
                 1517 # Bombay           
            }
            naval_base = yes
            max_naval_base = 10
            naval_base_provs = {
                 1511 # Colombo
                 1517 # Bombay               
            }
            land_fort = no
            max_land_level = 10
            fort_borders = { }
            fort_provs = { }
            nuclear_reactor = no
            max_nuclear = 10
            rocket_test = no
            max_rocket = 10
            ic_at_war = yes
            force_ic_until = 1942
            ic_end_year = 1944
            IC_provs = {
                1459 # Delhi
                1447 # Calcutta
                1517 # Bombay
                1518 # Ahmedabad
                1476 # Ranchi
                1472 # Jamshedpur
                1521 # Baroda
                1480 # Bhopal
                1515 # Hubli
                1498 # Bezawada           
            }
            }
 
Sorry, I should had been more specific:
What I meant, how can I make other countries produce infrastructure in a region? I've figured out how to give them general and specific plans to build factories, just the normal way, normal cost etc. Is there a similar way for infra? I discovered the orders and expressions for AA, forts, naval bases etc. but infra seems to be missing?

This is the production plan for India in my save-file. Those orders allows India to build AA-batteries upto 6 in the regions Colombo and Bombay. And produce factories in various provinces for several years. max_facor sets how much of the total available IC India should plan to allocate for province buildings.
Many things I found in the \Modding documentation\AI Files Modifiers.txt, misssing is infra... either because it can't be built or because soembody forgot to document it.
Code:
        construction = {
            max_factor = 0.5000
            transports = -1
            escorts = -1
            AA_batteries = yes
            max_AA_level = 6
            AA_provs = {
                 1511 # Colombo
                 1517 # Bombay          
            }
            coastal_fort = no
            max_coastal_level = 3
            coastal_fort_provs = { }
            radar_station = yes
            max_radar = 1
            radar_provs = {
                 1511 # Colombo
                 1517 # Bombay          
            }
            air_base = yes
            max_air_base = 6
            air_base_provs = {
                 1495 # Trivandrum
                 1511 # Colombo
                 1517 # Bombay          
            }
            naval_base = yes
            max_naval_base = 10
            naval_base_provs = {
                 1511 # Colombo
                 1517 # Bombay              
            }
            land_fort = no
            max_land_level = 10
            fort_borders = { }
            fort_provs = { }
            nuclear_reactor = no
            max_nuclear = 10
            rocket_test = no
            max_rocket = 10
            ic_at_war = yes
            force_ic_until = 1942
            ic_end_year = 1944
            IC_provs = {
                1459 # Delhi
                1447 # Calcutta
                1517 # Bombay
                1518 # Ahmedabad
                1476 # Ranchi
                1472 # Jamshedpur
                1521 # Baroda
                1480 # Bhopal
                1515 # Hubli
                1498 # Bezawada          
            }
            }
Sorry, I should had been more specific:
What I meant, how can I make other countries produce infrastructure in a region? I've figured out how to give them general and specific plans to build factories, just the normal way, normal cost etc. Is there a similar way for infra? I discovered the orders and expressions for AA, forts, naval bases etc. but infra seems to be missing?

This is the production plan for India in my save-file. Those orders allows India to build AA-batteries upto 6 in the regions Colombo and Bombay. And produce factories in various provinces for several years. max_facor sets how much of the total available IC India should plan to allocate for province buildings.
Many things I found in the \Modding documentation\AI Files Modifiers.txt, misssing is infra... either because it can't be built or because soembody forgot to document it.
Code:
        construction = {
            max_factor = 0.5000
            transports = -1
            escorts = -1
            AA_batteries = yes
            max_AA_level = 6
            AA_provs = {
                 1511 # Colombo
                 1517 # Bombay          
            }
            coastal_fort = no
            max_coastal_level = 3
            coastal_fort_provs = { }
            radar_station = yes
            max_radar = 1
            radar_provs = {
                 1511 # Colombo
                 1517 # Bombay          
            }
            air_base = yes
            max_air_base = 6
            air_base_provs = {
                 1495 # Trivandrum
                 1511 # Colombo
                 1517 # Bombay          
            }
            naval_base = yes
            max_naval_base = 10
            naval_base_provs = {
                 1511 # Colombo
                 1517 # Bombay              
            }
            land_fort = no
            max_land_level = 10
            fort_borders = { }
            fort_provs = { }
            nuclear_reactor = no
            max_nuclear = 10
            rocket_test = no
            max_rocket = 10
            ic_at_war = yes
            force_ic_until = 1942
            ic_end_year = 1944
            IC_provs = {
                1459 # Delhi
                1447 # Calcutta
                1517 # Bombay
                1518 # Ahmedabad
                1476 # Ranchi
                1472 # Jamshedpur
                1521 # Baroda
                1480 # Bhopal
                1515 # Hubli
                1498 # Bezawada          
            }
            }
sorry! don´t know! I know only the way I told!