• 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.
No, I want to control ROM. It starts a War with the USSR seemingly randomly. I can see no event that would trigger that in its event files and its belligerence is 0.

I had a look at the dh AI events for ROM.
ROM may be picking up belligerence from events, aren't they allied with GER?

The best way to control ROM would be to write a new event, calling a new ROM.ai file, which sets war = 0 and combat = { } as well. Just a couple of lines in the AI file will do it.
 
does anybody knows ow to change an AI file of one country, italy for example, so that they dont declare war against a specific Nation after a specific date?

Better to do it by event.
Use the date of the event, and form a non-aggression pact.
Then also lower belligerence, but that would work for other countries as well.

As an AI file, ALWAYS check the dh ai files first, as you are very likely to find exactly what you want there, ok.

Please see dh/ai/switch/War_Backoff.ai, just substitute your ITA in place of JAP for instance.

To call the AI file in an event:

command = { type = ai which = "switch\War_Backoff.ai" }
 
Better to do it by event.
Use the date of the event, and form a non-aggression pact.
Then also lower belligerence, but that would work for other countries as well.

As an AI file, ALWAYS check the dh ai files first, as you are very likely to find exactly what you want there, ok.

Please see dh/ai/switch/War_Backoff.ai, just substitute your ITA in place of JAP for instance.

To call the AI file in an event:

command = { type = ai which = "switch\War_Backoff.ai" }

ive got the problem, when playingNWO 2 as germany and deafeting Great Britain, italy always declares war after the end of non agression pacts and ceasfires
 
ive got the problem, when playingNWO 2 as germany and deafeting Great Britain, italy always declares war after the end of non agression pacts and ceasfires

Then you need to either change the ITA AI file or make up a new ITA AI file and call that file in an event, or add the call to an event that is there already.

Just in the diplomacy = {
section of the ITA AI file, add

diplomacy = {
combat = {
ENG = -1
}
}

So here you are saying, I don't want to go to war with ENG.

EDIT: you can have just that short piece of code in an ai file all by itself.
 
Hey guys, I've been working on the AI files for my mod, trying to make one country build IC. Unfortunately, because all of that country's provinces has Infrastructure lower than 40%, it can't build factories, and the AI refuses to produce any Infra of it's own.

Is there some way to edit the AI files to make the AI want to produce Infrastructure? I wasn't able to find anything mentioning it under the construct tab.

Thanks
 
This may not be the place to post but I'm having issues in my mod where Tunisia, UK, and the Russian Empire fight Libya in 2005 just like MDS2 where the USA, UK, and Kuwait fight and when the US invades the territory turns to US color but when I do it on my mod it doesn't turn UK color or say the UK has taken this territory it turns Tunisia's color and says Tunisia has taken this from their owner how do I fix it to where no matter which British ally turns UK color Tunisia is military accessed and puppeted by the UK and the UK is the leader of the alliance.
 
Hey guys, I've been working on the AI files for my mod, trying to make one country build IC. Unfortunately, because all of that country's provinces has Infrastructure lower than 40%, it can't build factories, and the AI refuses to produce any Infra of it's own.

Is there some way to edit the AI files to make the AI want to produce Infrastructure? I wasn't able to find anything mentioning it under the construct tab.

Thanks

OK, well you could just use an event to build some infra?
command = { type = construct which = infrastructure where = -1 value = 10 }
-1 means a random province. Put the province ID there instead for a specific province.

EVERYTHING you want to do with the AI has already been done in DH itself, you just need to look.
So we think about WW2 and we remember that GER starting at 1936 only builds IC and maybe some AA etc.
So we look at the GER1936.ai file.....


###################################
# Construction and Tech Research
###################################
construction = {
max_factor = 0.95............spending 95% of their ic on construction

AA_batteries = atwar..... only when at war
max_AA_level = 6
AA_provs = {
141 # Muenster
145 # Essen
131 # Cologne
127 # Saarbrucken
138 # Frankfurt
177 # Nuremberg
134 # Suttgart
179 # Munich
173 # Dresden
163 # Berlin
152 # Kiel
146 # Hannover
}

coastal_fort = atwar
max_coastal_level = 3
coastal_fort_provs = {
152 # Kiel
}

radar_station = atwar
max_radar = 2
radar_provs = {
145 # Essen
137 # Kassel
147 # Wilhemshafen
163 # Berlin
134 # Stutgart
116 # Brussels
122 # Amsterdam
52 # Lille
55 # Paris
}

air_base = atwar
max_air_base = 3
air_base_provs = {
126 # Aachen
145 # Essen
130 # Mainz
}

naval_base = no
max_naval_base = 5
naval_base_provs = { }

land_fort = no #yes
max_land_level = 6
fort_borders = { }
fort_provs = {
127 # Saarburken
132 # Freiburg
130 # Mainz
}

ic_at_war = no
force_ic_until = 1938......HERE so starting in 1936, build IC until 1938.
ic_end_year = 1941
IC_provs = {
127 # Saarburken
179 # Munchen
163 # Berlin
131 # Cologne
134 # Stuttgart
146 # Hannover
173 # Dresden
}

nuclear_reactor = yes
nuclear_reactor_prov = 163 # Berlin
max_nuclear = 10
}

Best to create your own AI file, put the necessaries into that file and then call that file in an event. Job done.
 
This may not be the place to post but I'm having issues in my mod where Tunisia, UK, and the Russian Empire fight Libya in 2005 just like MDS2 where the USA, UK, and Kuwait fight and when the US invades the territory turns to US color but when I do it on my mod it doesn't turn UK color or say the UK has taken this territory it turns Tunisia's color and says Tunisia has taken this from their owner how do I fix it to where no matter which British ally turns UK color Tunisia is military accessed and puppeted by the UK and the UK is the leader of the alliance.

Gosh I'd hate to think you were using my mds2 mod without my permission? Is it really that hard to ask?

Every command is in the event_commands.txt file in the modding docs folder.

So to make ENG the leader of the alliance:
command = { type = alliance_leader which = ENG where = 0 }

type = alliance_leader [which = TAG] [where = 0(default)/1/2/3] # Sets TAG (or country in question if no which is specified) as the new leader of Axis (where = 1), Allies (where = 2) or Comintern (where = 3) or of its current alliance

..................

You could give ENG military access and make TUN a puppet like this:
command = { type = make_puppet which = TUN }
inside an event for ENG

command = { type = access which = ENG }
this time inside an event for TUN
 
Gosh I'd hate to think you were using my mds2 mod without my permission? Is it really that hard to ask?

Every command is in the event_commands.txt file in the modding docs folder.

So to make ENG the leader of the alliance:
command = { type = alliance_leader which = ENG where = 0 }

type = alliance_leader [which = TAG] [where = 0(default)/1/2/3] # Sets TAG (or country in question if no which is specified) as the new leader of Axis (where = 1), Allies (where = 2) or Comintern (where = 3) or of its current alliance

..................

You could give ENG military access and make TUN a puppet like this:
command = { type = make_puppet which = TUN }
inside an event for ENG

command = { type = access which = ENG }
this time inside an event for TUN
My apologies I should've asked but I had no intention of releasing the mod to the public it's a private mod but for future reference may I use your mod to make a modern day USSA mod and anyothers I plan.
 
My apologies I should've asked but I had no intention of releasing the mod to the public it's a private mod but for future reference may I use your mod to make a modern day USSA mod and anyothers I plan.

Yes, of course. Thanks for asking. I wish you good luck with it.
 
Posted this question in the Modding Questions thread as well. Looking for anyone that is familiar with the naval AI - I'm out of ideas.

How do I encourage the British naval AI to actually use their fleet for naval interdiction? I've been able to make them dock up where I want them to, but they absolutely refuse to intercept enemy SUB or TRA fleets. Command cap is set to 18, so the fleet in question (21 units) is operating at a stacking penalty. Is this the problem? When I load as the UK, the units have no mission set.



AJxGjrU.png




This is my AI switch, the AI is responding correctly to the "base" parameter but doesn't seem to be interested in patrolling the "target" zones:



Code:
# England concentrates naval units on defending home islands

admiral = {

    min_core_attack_fleets  = 2        # Minimum amount of attack fleets to defend CORE provinces (default 0)
    num_attack_fleets        = 4

    min_org        = 40%    # NEW: Percent of org gained back before the unit can leave port #STR/ORG thresholds set quite low for desperate defense situation
    min_dmg        = 20%   # NEW: Percent of dmg gained back before the unit can leave port
    return_org     = 80%     # NEW: PERCENT OF ORG LOST BEFORE RETURNING TO PORT applies to all fleets/ships
    return_dmg     = 80%     # NEW: PERCENT OF DMG LOST BEFORE RETURNING TO PORT for repairs applies to all fleets/ships

    base = {
        25    # Norwich
        26    # Dover
    }
 
    target = {
        2682 = 100
        2683 = 100
        2698 = 100
        2700 = 100
    }
 
    core = {
         2716
         2685
         2683
         2682
         2698
         2700
         2709
         2708
    }
 
    ignore = {
        #Murmansk/Archangel
        "Barents Sea"
        "Arctic Ocean"
      
        #Western Mediterranean
        "Costa del Sol"
        "Gulf of Lyon"
        "Algerian Coast"
      
        #Central Mediterranean
        "Tyrrhenian Sea"
        "Adriatic Sea"
      
        #Eastern Mediterranean
        "Black Sea"
        "Aegean Sea"
        "Egyptian Coast"
      
        #Brazil and Argentina Coast
        "Coast of Guyana"
        "Coast of Recife"
        "Coast of Uruguay"
        "Coast of Brazil"
        "Coast of Argentina"
      
        # West Africa
        "Coast of Africa"
        "Coast of Bissao"
      
        #Equitorial Africa
        "Gulf of Guinea"
        "Coast of Angola-Namibia"
      
        #South Africa
        "Coast of South Africa"
        "Atlantic-Indian Ridge"
      
        #East Africa
        "Red Sea"
        "Horn of Africa"
      
        #Madagascar Coast
        "South Mozambique Channel"
        "North Mozambique Channel"
        "Northeast Coast of Madagascar"
        "Southeast Coast of Madagascar"
      
        #North Indian Ocean (Persian Gulf)
        "Persian Gulf"
        "North Arabian Sea"
        "South Arabian Sea"
        "Coast of Ceylon"
      
        #Central/South Indian Ocean
        "Mascarene Plateau"
        "Mid-Indian Ridge"
        "Ninetyeast Ridge"
        "Southeast Indian Ocean"
        "Southwest Indian Ocean"
      
        #Bay of Bengal & West Indonesia
        "East Bay of Bengal"
        "West Bay of Bengal"
        "Malacca Strait"
        "Java Ridge"
        "Java Trench"
      
        #Indo-China, Borneo, Phillipenes
        "Gulf of Siam"
        "Coast of Indochina"
        "Spratly Sea"
        "Coast of Brunei"
        "Flores Sea"
        "Sulu Sea"
        "Celebes Sea"
        "Luzon Strait"
      
        #China Coast
        "Taiwan Strait"
        "Yellow Sea"
      
        #Japanese Coast
        "Sea of Japan"
        "Ryukyus"
        "Coast of Japan"
        "South Sea of Okhotsk"
        "West Sea of Okhotsk"
        "East Sea of Okhotsk"
      
        #Mariana Basin, Phillipenes
        "Philipine Trench"
        "Central Philippine Sea"
        "Mariana Trench"
        "East Mariana Basin"
        "Mid-Pacific Mountains"
        "North Bismarck Sea"
      
        #New Guinea, East/North Australia and New Zealan
        "Coast of New Guinea"
        "Molucca Sea"
        "Banda Sea"
        "Arafura Sea"
        "South Bismarck Sea"
        "Solomon Sea"
        "West Coral Sea"
        "East Coral Sea"
        "North Tasman Sea"
        "South Tasman Sea"
        "East Cost of New Zealand"
      
        # South and West Australia
        "Timor Sea"
        "West Coast of Australia"
        "East Great Australian Bight"
        "West Great Australian Bight"
      
        #North Pacific
        "Coast of Kamchatka"
        "East Bering Sea"
        "West Bering Sea"
        "Aleutians"
        "Northwest Pacific Basin"
        "North Northeast Pacific Basin"
      
        #Central Pacific
        "Hawaiian Rise"
        "North East Pacific Ocean"
        "Marshalls Sea"
        "South East Pacific Ocean"
        "Marianas"
        "Western Solomons"
        "Eastern Solomons"
        "US Maritimes"
        "Carolines"
      
        #South Pacific
        "Gilberts"
        "Line Islands"
        "Fiji Basin"
        "Southwest Pacific Basin"
      
        # South American West Coast
        "Southeast Pacific Basin"
        "West Coast of Chile"
        "West Coast of Peru"
        "South Southeast Pacific Ocean"
        "North Southeast Pacific Ocean"
      
        # USA West Coast
        "Gulf of Alaska"
        "West Coast of the United States"
      
        #West Coast of Mexico
        "West Coast of Mexico"
        "West Coast of Central America"
    }
}
 
Posted this question in the Modding Questions thread as well. Looking for anyone that is familiar with the naval AI - I'm out of ideas.

How do I encourage the British naval AI to actually use their fleet for naval interdiction? I've been able to make them dock up where I want them to, but they absolutely refuse to intercept enemy SUB or TRA fleets. Command cap is set to 18, so the fleet in question (21 units) is operating at a stacking penalty. Is this the problem? When I load as the UK, the units have no mission set.

This is my AI switch, the AI is responding correctly to the "base" parameter but doesn't seem to be interested in patrolling the "target" zones:

[/SPOILER]

Yeah I saw your earlier post and was thinking and trying to remember what I did in Homeland to get the AI to behave as I wanted. It took me months, if I remember correctly. This is now many years later and I've been looking back on some of the AI files I did at that time. For instance I had Italy invading Spain by naval invasion and I remember the Italian navy had no problems attacking the Spanish navy.

I also had naval invasions of the USA, the USA navy attacking the Jap navy on the West Coast (and trying to get the US navy to stop attacking the japs, so they could invade... )

And yes the ENG navy patrolling off Canada and intercepting the US navy on the east coast. Plus the CAN navy attacking off their own coasts...

So, looking at my files and trying to make sense of them, here is my advice: There is still no guarantee that it will work for you. The main problem with the AI is ensuring that your AI file is the single ai file running at that particular time. But you seem to have overcome that already?

So please look at what I am posting and choose the bits that are useful to you.

......................................................

My targets were much higher:

target = {
1795 = 9000
1812 = 6000
1809 = 6000
1960 = 8000
1963 = 8000
1371 = 1000
1367 = 100

}
So, 1795 was my main target.
....................................................................

Just looking at the ITA ai at that time, for defending Italy and attacking Spain's navy:

invasion = {
invasion = yes
base = 0.1 #Relative modifier. (lower = specific targets much more important.)
random = 10.0 #How big a random range. (1.0 = 1%)
coastal = 0.1 #increase to avoid coastal forts more.
beach = 0.01 #higher, avoid worst beaches.
max_distance = 100.0 #About the distance from Japan to Batavia
max_staging_distance = 100.0 # How far should the staging area be from the target invasion point
distance = 0.01 #higher = avoid long distance.
pocket = 20.0 #prioritise pockets, ie provinces with no adjacent controlled by same.
island = 0.01 #prioritise taking pure islands.
enemy = 2.0 #higher = much more vary of troops in province.
adjacentenemy = 2.0 #higher = much more vary of troops nearby
air_base = 1.5
naval_base = 1.5
air_support = 3.0
redirect = priority
ignore = no
help_allies = yes #[yes/no]

Discussion:
Notice that distance is 0.01.

For the USA 1942 ai and for my ENG ai covering the US East Coast and the Med etc, the distance is:

distance = 1.0 #higher = avoid long distance.

For AST covering an invasion of China, the distance is:

distance = 10.0 #higher = avoid long distance.

So I would suggest setting your distance to 0.01.

................................................................

So this is my ITA.ai for that time, notice you need to tell AGAIN that they are at war. Just remove the .txt and ensure you save it as an ai file. And then call it by event etc etc.

I would suggest you use this flie and adjust for your own bases and target provinces etc etc. I hope it works!
 

Attachments

  • ITA_invadeSPA.ai.txt
    2,2 KB · Views: 200
@novapaddy Thank you, that is an enormous help - I used your invasion settings along with bumping up the "target" priorities to 9000, 8000, 7000, and 6000 for the 4 zones that I want the AI to focus on. The AI is acting much differently now. It's erratic, but the UK Is now actually using its capital fleets to patrol their eastern coast, which is exactly what I wanted. I suspect that the "distance" modifier that you pointed out is what might be affecting this. I've left it at 0.01 for now. I will continue to tweak the values and see how the AI reacts. I also suspect that the min_core_attack_fleets and num_attack_fleets parameters may alter behavior.

With those invasion settings, the AI is now patrolling two large capital fleets in the desired zones for a few days, and then they return to port for a few days, then patrols again:

1T32osN.png
 
  • 1
Reactions:
So, hello there!

So, as everyone that comes here, i need help regarding some AI stuff....

So, i created an event that summon some rebels and switch the allegiance of a corps to the rebel (it is triggered by another event) :

Code:
##################
### Uprising of the NKVD
##################
event = {
    id = 8014222
    country = SOV
   
    name = "Uprising of the NKVD"
    desc = "Now that Beria has made his move, his minions in the NKVD have taken up arms against us, and have risen in the province of Sverdvlovsk."

    style = 2
    picture = ""
   

    action = {
    name = "Damn it!"
    command = { type = revolt which = 1151 when = 0 } #sverdlosk all the way
    command = { type = revolt which = 1151 when = 0 }
    command = { type = revolt which = 1151 when = 0 }
    command = { type = revolt which = 1151 when = 0 }
    command = { type = revolt which = 1151 when = 0 }
    command = { type = revolt which = 1151 when = 0 }
    command = { type = revolt which = 1151 when = 0 }
    command = { type = revolt which = 1151 when = 0 }
    command = { type = revolt which = 1151 when = 0 }
    command = { type = revolt which = 1151 when = 0 }
    command = { type = switch_allegiance which = 10848 value = 2600 where = REB } #need the creation of a NKVD corps with motorised infantry for 'fun' purpose #DONE
    command = { type = unlock_division which = 10848 value = 2601 }
    command = { type = unlock_division which = 10848 value = 2602 }
    command = { type = unlock_division which = 10848 value = 2603 }
    command = { type = unlock_division which = 10848 value = 2604 }
    command = { type = unlock_division which = 10848 value = 2605 }  
    command = { type = event which = 8014223 where = REB when = 0 }
    }
}

And since i want that group of rebels to head off to Omsk, for event and scenario/plot purpose i made this :

Code:
#####################################
# To Omsk
#####################################
event = {
    id = 8014223
    country = REB
   


    name = "To Omsk!"
    desc = "ai_event"

    style = 2
    picture = ""
   
   
    action = {
    name = "To Omsk!! Onwards!"
    command = { type = ai which = "switch/REB_Beria_mutiny_to_omsk.ai" }
    }
}

and the appropriate AI file (the id being either omsk or one of the 3 provinces between Omsk and Sverdlosk :

Code:
# for rebel to take omsk #rebellion of Beria

target = {
1138 = 100
1139 = 100
1136 = 100
1135 = 100
}

And, while testing, it appears that the rebel troops just stand here doing nothing......(there are no troops around whatsoever)

So, i just want to know what i'm doing wrong or just not doing at all......

(also, i'm posting it here, since i'm pretty confident that it's a problem with the AI file...)
 
I apologize for the incredibly late reply, but REB can not use an AI file. As far as I can tell, every single Partisan stack basically has its own AI, presumably something hardcoded. (Or maybe default.ai????)