• 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.

OsirisReborn

Colonel
6 Badges
Oct 22, 2005
1.049
1
  • Hearts of Iron II: Armageddon
  • Darkest Hour
  • Hearts of Iron III
  • Europa Universalis: Rome
  • Rome: Vae Victis
ok for various reasons i find ways to make the AI stronger or "help it out"
i usually go about this the hard way or mess with its production
it accord to me it might be easier to just edit in "free units" for the AI under special circumstances like :
when the russians lose there whole army due to stupidity
when the uk loses its whole airforce due to events (vichy , denmarksurrender)
usa defending the homeland against huge impending axis invasion
japan (same)

i looked at the save game ...looks liek a pain if i just "create" units for the AI id have to set all thoseparameters and come up with leaders...
i thought maybe i could just copy existing units and just change the name ..again what about the leader ?
i thought maybe i could just add alot of units to the production que due to be completed 1 day later ... would they make it 1 day without all the sliders going red ?
the last one seems easiest and best as it would allow AI to name the units and pick a leader
what do u guys think ?
 

blue emu

GroFAZ
Moderator
8 Badges
Mar 13, 2004
17.503
20.150
  • Crusader Kings II
  • Europa Universalis III
  • Hearts of Iron III
  • Hearts of Iron III Collection
  • Heir to the Throne
  • Europa Universalis: Rome
  • 500k Club
  • Hearts of Iron II: Beta
By far the simplest solution would be to write an event (triggered from the F12 console) to add the units for you.

You could write an event that adds four Air-Wings to Britain, and just trigger it as many times as needed to re-stock their Air-Force.

Similarly, an event that adds nine Infantry units to Russia... triggered by F12 as many times as required.

Check the Russian and Nationalist Chinese "Operation Zet" events, or the Nationalist Spain "German and Italian Intervention" events... they add units to an existing army, and it only requires a couple of lines of code.

Want a rough sample? Another poster (more competent with event writing than I am) could polish them up for you.
 

blue emu

GroFAZ
Moderator
8 Badges
Mar 13, 2004
17.503
20.150
  • Crusader Kings II
  • Europa Universalis III
  • Hearts of Iron III
  • Hearts of Iron III Collection
  • Heir to the Throne
  • Europa Universalis: Rome
  • 500k Club
  • Hearts of Iron II: Beta
Jeandeloch said:
funny thing is blue emu seems to have thought of this already
and i thought i was so clever ! :mad:

Blue Emu is a sly one... :p
 

Permanganate

The Gibrataltor
Nov 29, 2004
4.383
0
If you just want to give them free units, you can use the add_division command in an event, trigger it in the F12 console with event eventnumber countrytag and they'll go into the redeployment pool.

Of course, this won't make the AI fight much better. HSR has been well known for giving the enemy hundreds of free divisions, and they were still not competent.
 

blue emu

GroFAZ
Moderator
8 Badges
Mar 13, 2004
17.503
20.150
  • Crusader Kings II
  • Europa Universalis III
  • Hearts of Iron III
  • Hearts of Iron III Collection
  • Heir to the Throne
  • Europa Universalis: Rome
  • 500k Club
  • Hearts of Iron II: Beta
Try something like this:

Code:
event = {
	id = 98701
	random = no
	ai = yes

	name = "The RAF receives reinforcements"
	desc = "A new wing of Interceptors has joined the RAF"
        picture = "assistance"
	style = 0

	# Triggered by console command : F12 > event 98701 ENG

	action_a = {
		name = "Fine."

		command = { type = add_corps which = "RAF Reinforcements" value = air when = 1 where = 14 } 

# Province #14 is Liverpool

		command = { type = add_division which = "Interceptor Squadron 1" value = interceptor when = 0 }
		command = { type = add_division which = "Interceptor Squadron 2" value = interceptor when = 0 }
		command = { type = add_division which = "Interceptor Squadron 3" value = interceptor when = 0 }
		command = { type = add_division which = "Interceptor Squadron 4" value = interceptor when = 0 }
	}
}
 

OsirisReborn

Colonel
6 Badges
Oct 22, 2005
1.049
1
  • Hearts of Iron II: Armageddon
  • Darkest Hour
  • Hearts of Iron III
  • Europa Universalis: Rome
  • Rome: Vae Victis
definately !
an event like that would fix everything for me
but how do i write it ?
is it easier to just try that 1 day to go production que fix
 

blue emu

GroFAZ
Moderator
8 Badges
Mar 13, 2004
17.503
20.150
  • Crusader Kings II
  • Europa Universalis III
  • Hearts of Iron III
  • Hearts of Iron III Collection
  • Heir to the Throne
  • Europa Universalis: Rome
  • 500k Club
  • Hearts of Iron II: Beta
Jeandeloch said:
but how do i write it ?

Use your mouse to highlight everything that I put inside that code box.

Press <control>-c to copy it.

Start up Notepad... a new (empty) document.

Click into the blank Notepad page.

Press <control>-v to paste my code into it.

Save that into: My Computer > Local Disk / Program Files / Paradox Interactive / Hearts of Iron 2 / db / events

... using the name "more_events.txt"

Now back up one directory to /db and open (double-click on) the file called "events.txt"

Right down at the bottom, under the section that starts:

# New 1.3 Events

... add a new section:

Code:
# Custom Events

event = "db\events\more_events.txt"

Save the file. That should do it. Any new events you want can be added to that new "more_events.txt" file.

You should have Permanganate or someone check my code first, though... I'm not really an expert at coding events. Possibly PM him and ask him to look it over.
 

vimhawk

24526479
16 Badges
Apr 18, 2002
667
4
  • Darkest Hour
  • Europa Universalis III
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Heir to the Throne
  • Europa Universalis III Complete
  • Iron Cross
  • Europa Universalis III Complete
  • Victoria 2
  • Victoria 2: A House Divided
  • 500k Club
  • Cities: Skylines
  • Stellaris
  • Knights of Honor
  • Age of Wonders III
Alternative Suggestion: Act with restraint

Not made as a specific point against you, but one way of helping the AI is not to use any of the well-known exploits/gamey strategies against it. For example, as Germany don't build naval bombers or assemble massive sub stacks to sink the RN. Don't run up unrest that you know a forthcoming event will cure etc. By not using these methods of maximising your own strength, you make the AI effectiveness greater.

[Again, I wasn't making any allegations about any particular players here. It's just a bit frustrating that a lot of people are criticising the strength of the AI while at the same time crushing it with ahistorical strategies.]
 

blue emu

GroFAZ
Moderator
8 Badges
Mar 13, 2004
17.503
20.150
  • Crusader Kings II
  • Europa Universalis III
  • Hearts of Iron III
  • Hearts of Iron III Collection
  • Heir to the Throne
  • Europa Universalis: Rome
  • 500k Club
  • Hearts of Iron II: Beta
vimhawk said:
Not made as a specific point against you, but one way of helping the AI is not to use any of the well-known exploits/gamey strategies against it.

Unfortunately, there's no way to restrain the AI from re-basing it's air-wings into terrain that's about to be annexed... such as Denmark.

That's what we are trying to compensate for... not for gamey tactics.
 

OsirisReborn

Colonel
6 Badges
Oct 22, 2005
1.049
1
  • Hearts of Iron II: Armageddon
  • Darkest Hour
  • Hearts of Iron III
  • Europa Universalis: Rome
  • Rome: Vae Victis
well the main thing im trying to do is solve the problem that when u take denmark via event the royal airforce will lose a dozen or more air wings ....every time !

i wish it came naturally for me , im going to have to look at that text , try to do what is written and hope it works hope i dont screw the game up .... this game already takes up so much time !

i need : an event so i can type faster too
 

blue emu

GroFAZ
Moderator
8 Badges
Mar 13, 2004
17.503
20.150
  • Crusader Kings II
  • Europa Universalis III
  • Hearts of Iron III
  • Hearts of Iron III Collection
  • Heir to the Throne
  • Europa Universalis: Rome
  • 500k Club
  • Hearts of Iron II: Beta
Jeandeloch said:
i wish it came naturally for me , im going to have to look at that text , try to do what is written and hope it works hope i dont screw the game up .... this game already takes up so much time !

You might want to copy-and-paste a spare copy of /db/events.txt onto your desk-top before changing it... that way if you screw it up, you can just throw away the editted copy and put the backup back in it's place.
 

OsirisReborn

Colonel
6 Badges
Oct 22, 2005
1.049
1
  • Hearts of Iron II: Armageddon
  • Darkest Hour
  • Hearts of Iron III
  • Europa Universalis: Rome
  • Rome: Vae Victis
honestly , im trying to do that units with 1 day left in production since i could do that one time for each circumstance and i dont liek having to type in an event like that say 100 times for the russians
 

OsirisReborn

Colonel
6 Badges
Oct 22, 2005
1.049
1
  • Hearts of Iron II: Armageddon
  • Darkest Hour
  • Hearts of Iron III
  • Europa Universalis: Rome
  • Rome: Vae Victis
is it division_development ???

i could do the event file i specifically want to add
4 int FTR for uk
2 STR bomber for uk
25 INF divisions for ussr
if i could do those commands at will i think i could actually do what i want

but ... and heres the catch as helpful as that post was u gonna have to assume im even dumber , and make it simpler or tell me exactly what i have to type when i right click on "new doc" etc
 
Last edited:

blue emu

GroFAZ
Moderator
8 Badges
Mar 13, 2004
17.503
20.150
  • Crusader Kings II
  • Europa Universalis III
  • Hearts of Iron III
  • Hearts of Iron III Collection
  • Heir to the Throne
  • Europa Universalis: Rome
  • 500k Club
  • Hearts of Iron II: Beta
Do you know how to find the build queue in the save?

It looks like this:

A Multi-Role Fighter under construction:

Code:
    division_development = { 
        id = { type = 4712 id = 255656 } 
        name = "No.9 RAF Fighter Group" 
        progress = 0.0863 
        location = 19 
        cost = 9.3100 
        date = { 
            year = 1940 
            month = february 
            day = 8 
            hour = 0 
            } 
        manpower = 1.0000 
        total_progress = 47.0863 
        size = 1 
        done = 0 
        days = 105 
        days_for_first = 100 
        type = multi_role 
        extra = none 
        model = 0 
        brigade_model = -1 
        }

A TAC Bomber under construction:

Code:
    division_development = { 
        id = { type = 4712 id = 212063 } 
        name = "" 
        progress = 0.2347 
        location = 19 
        cost = 10.5000 
        date = { 
            year = 1940 
            month = january 
            day = 24 
            hour = 0 
            } 
        manpower = 2.0000 
        total_progress = 202.2347 
        size = 2 
        done = 1 
        days = 263 
        days_for_first = 126 
        type = tactical_bomber 
        extra = none 
        model = 2 
        brigade_model = -1 
        }

The only tricky part is the big number in the second line... id = 212063 or whatever... that must be a UNIQUE number, so you will have to start your own series (say, 987654 and higher) and just HOPE that those numbers are unique.

Other than that... change :

cost = 1
size = 1
done = 0
days = 1
days_for_first = 1
progress = 0.0
total_progress = 0.0

Those two air-wings above are building in London (province #19), which has no air-base... so it doesn't seem to be neccessary to assign them to a valid location... province 19 will be fine.
 

Permanganate

The Gibrataltor
Nov 29, 2004
4.383
0
Jeandeloch said:
honestly , im trying to do that units with 1 day left in production since i could do that one time for each circumstance and i dont liek having to type in an event like that say 100 times for the russians

No, adding it into the savegame is much harder. First you have to come up with new, unused IDs, then make up names, then copy-paste lots of times, etc. Your editing skills seem fairly rudimentary so I'm guessing you'll trash the savegame and have to revert to a backup. Just use an event already. Blue Emu's one isn't bad, but it has a bug (ai is not a top level event variable, it's a trigger!) and can be improved (there's no reason to add a corps command or names for each division):

Code:
event = {
	id = 90001
	random = no

	name = "Reinforcements"
	desc = "Do you feel lucky, punk? Well, you are lucky, punk. Have some free units, punk."
        picture = "assistance"
	style = 0

	action_a = {
		name = "I am lucky, but I'm a punk"
		command = { type = add_division value = interceptor when = 0 }
		command = { type = add_division value = interceptor when = 0 }
		command = { type = add_division value = interceptor when = 0 }
		command = { type = add_division value = interceptor when = 0 }
	}
}

Change interceptor to whatever you want (look at the names of the files in \Hearts of Iron 2\db\units\divisions\) and if you want to give 50 units instead of one, simply do that copy-paste thang. Very easy since there's no editing needed, just lots of htting Ctrl-V, followed by using event 90001 sov in the F12 console. This is by far the easiest way of giving large numbers of free units to nations; they'll show up in the redeployment pool, ready for placement, with about half org.