To fix "No leaders after release bug" for all countries in EIP, I'll use modification of the workaround
I found few months ago. I'm not the only one who found this workaround as it seems from
Kristof73's post
here.
What is this "No leaders after release" bug?
Shortly the bug is that after annex leaders of annexed country remains into game memory until next game restart or save/reload cycle and because of this if we release this country it will be without leaders exept these KIA, slept by events or dormant. For countries that are annexed and released with events we have two possible solutions:
1. Sleep all leaders before annexation - this is used in CDCP
2. Move all leaders temporary to other country before anexation and move them back after release. This way all expirience, new traits and battle history will be preserved. This is used in SIP for Chinese leaders when after release by Japan and for French leaders moved to Vichy.
For all other countries there is only one solution - annex, save, reload, release. This "workaround" isn't very user-friendly and in many cases is not applicable (as multiplayer games, countries released by AI) and even expirienced players can forget to do it, so we have to fix this!
How this will be fixed?
Plan A:
I will create a new CSV file with copies of all leaders, but with different ID so at the begining of the scenario every country will have all leaders x2. I can avoid this by adding all duplicates into "dormant_leaders" list for each country, but I still do not want to change so many vanilla files, so I'll use an event to sleep all duplicates exept 1 - he is special

. Actually there will be 2 special leaders for each country. Their start years will be something like 1999 and they will be used instead of flags. They are needed if someone annex a country, then save, reload and release - in this case that country will have again all leaders x2 (original and duplicates). So I'll check are these 2 special leaders present in the game at the same time - if they do, I'll fire the event that sleeps again all duplicates. The event will be something like this:
Code:
event = {
id = XXXXXXX
random = no
persistent = yes
country = XXX
trigger = {
AND = {
leader = XXXXX1 # "Special" leader 1
leader = XXXXX2 # "Special" leader 2
}
}
name = "AI_EVENT"
style = 0
date = { day = 1 month = january year = 1936 }
offset = 30
deathdate = { day = 29 month = december year = 1999 }
action_a = {
command = { type = sleepleader which = .........} #all duplicates
command = { type = sleepleader which = XXXXX2 } #Special leader 2
}
}
The success of this workaround depends on the functionallity of "leader = xxxx" trigger. If this trigger reads leaders left into game memory after annexation, then this will not work well in case of annex/release in the same game session (it will fire).
I'll test this soon and if I'm not satisfied from the results, I'll use other ways to fix this.
EDIT:
Well, my worse suggestions came true - "leader = XXXX" trigger returns TRUE after annex.
Plan B:
It's time for plan B. I give up the idea to use "leader = XXXX" as trigger for sleepleaders events and will use 3 flags for each country instead - 1 local (which will be automaticaly deleted on annex - I hope) and 2 global - 1 for each of sleepleader events. First event will be called at scenario start to set the flags and to delete duplicates. The second event will fire only if the local_flag is lost (i.e. after annexation), will delete original leaders and will reset flags so first event to be able to fire again (but only if local_flag is lost, so first this country must be annexed again). This should work in any situation even on multiple annex/release cycles. Downside of this solution is that I will use a lot of new events (2 for each country) and this may slow down game speed. To resolve this I'll use bigger offset (like 45-60 days) between every event check. Actually there is no need for smaller offset because after release countries are without armies, so these duplicated leaders have no impact in the game.
************************************************
Plan B works perfectly!
After 10 annex/release cycles with and without save/reload my test country always has its leaders. It's time to implement it in the EIP.
This is an example of my new events:
Code:
event = {
id = 10000002
random = no
country = CGX
persistent = no
date = { day = 1 month = january year = 1936 }
offset = 1
deathdate = { day = 29 month = december year = 1999 }
name = "set flag 2"
style = 0
date = { day = 1 month = january year = 1936 }
offset = 1
deathdate = { day = 29 month = december year = 1999 }
name = "set flag 2"
desc = "set flag 2"
style = 0
picture = "set flag 2"
action_a = {
name = "set flag 2"
command = { type = setflag which = 2 }
}
}
event = {
id = 950000
random = no
country = CGX
persistent =yes
trigger = {
not = {local_flag = active}
flag = 2
}
name = "Duplicates"
style = 0
date = { day = 3 month = january year = 1936 }
offset = [COLOR=DarkOrange]60[/COLOR] # I think that this value is good
deathdate = { day = 29 month = december year = 1999 }
action_a = {
command = { type = setflag which = 1 }
command = { type = clrflag which = 2 }
command = { type = local_setflag which = active }
command = { type = sleepleader which = 502100 }
command = { type = sleepleader which = 502101 }
command = { type = sleepleader which = 502102 }
command = { type = sleepleader which = 502103 }
command = { type = sleepleader which = 502104 }
command = { type = sleepleader which = 502105 }
command = { type = sleepleader which = 502106 }
command = { type = sleepleader which = 502107 }
command = { type = sleepleader which = 502108 }
command = { type = sleepleader which = 502109 }
command = { type = sleepleader which = 502110 }
command = { type = sleepleader which = 502111 }
command = { type = sleepleader which = 502112 }
command = { type = sleepleader which = 502113 }
command = { type = sleepleader which = 502114 }
command = { type = sleepleader which = 502115 }
command = { type = sleepleader which = 502116 }
command = { type = sleepleader which = 502117 }
command = { type = sleepleader which = 502118 }
command = { type = sleepleader which = 502119 }
command = { type = sleepleader which = 502120 }
command = { type = sleepleader which = 502121 }
}
}
event = {
id = 950001
random = no
country = CGX
persistent =yes
trigger = {
not = {local_flag = active}
flag = 1
}
name = "Original"
style = 0
date = { day = 3 month = january year = 1936 }
offset = 60
deathdate = { day = 29 month = december year = 1999 }
action_a = {
command = { type = setflag which = 2 }
command = { type = clrflag which = 1 }
command = { type = local_setflag which = active }
command = { type = sleepleader which = 502000 }
command = { type = sleepleader which = 502001 }
command = { type = sleepleader which = 502002 }
command = { type = sleepleader which = 502003 }
command = { type = sleepleader which = 502004 }
command = { type = sleepleader which = 502005 }
command = { type = sleepleader which = 502006 }
command = { type = sleepleader which = 502007 }
command = { type = sleepleader which = 502008 }
command = { type = sleepleader which = 502009 }
command = { type = sleepleader which = 502010 }
command = { type = sleepleader which = 502011 }
command = { type = sleepleader which = 502012 }
command = { type = sleepleader which = 502013 }
command = { type = sleepleader which = 502014 }
command = { type = sleepleader which = 502015 }
command = { type = sleepleader which = 502016 }
command = { type = sleepleader which = 502017 }
command = { type = sleepleader which = 502018 }
command = { type = sleepleader which = 502019 }
command = { type = sleepleader which = 502020 }
command = { type = sleepleader which = 502021 }
}
}
And this is my new leaders file:
Code:
Belov;502100;CGX;1930;1990;1990;1990;3;2;256;0;0;5;0;L502000;1930;1960;x
Chen Jitang;502101;CGX;1930;1930;1930;1938;0;2;513;1;0;1;0;L50031;1930;1944;x
Kravelkin;502102;CGX;1930;1990;1990;1990;3;2;4;0;0;5;0;L502002;1930;1960;x
Li Jishen;502103;CGX;1930;1930;1930;1990;1;3;16;1;0;5;0;L502003;1930;1960;x
Li Zongren;502104;CGX;1930;1939;1941;1944;1;4;4;3;0;4;0;L50186;1930;1960;x
Golukjin;502105;CGX;1930;1930;1990;1990;2;2;0;0;0;5;0;L502005;1930;1960;x
Bai Chongxi;502106;CGX;1930;1939;1941;1990;1;4;16;2;0;3;0;L50247;1930;1960;x
Shermentcheff;502107;CGX;1930;1930;1990;1990;2;2;4;0;0;4;0;L502007;1930;1960;x
Tschevelkov;502108;CGX;1930;1990;1990;1990;3;2;0;0;0;5;0;L502008;1930;1960;x
von Appel;502109;CGX;1930;1942;1990;1990;3;3;128;1;0;5;0;L502009;1930;1960;x
Yu Hanmou;502110;CGX;1930;1939;1990;1990;2;2;0;1;0;4;0;L502010;1930;1960;x
Belov;502111;CGX;1930;1990;1990;1990;3;2;0;0;0;5;1;L502000;1930;1960;x
Dranilov;502112;CGX;1930;1990;1990;1990;3;2;0;0;0;5;1;L502012;1930;1960;x
Ertelkin;502113;CGX;1930;1930;1990;1990;2;3;8192;1;0;5;1;L502013;1930;1960;x
Bai Chongxi;502114;CGX;1930;1939;1941;1990;1;2;0;1;0;3;1;L50247;1930;1960;x
Kulchin;502115;CGX;1930;1990;1990;1990;3;2;0;0;0;5;1;L502015;1930;1960;x
Beryakin;502116;CGX;1930;1990;1990;1990;3;2;0;0;0;5;2;L502016;1930;1960;x
Khripin;502117;CGX;1930;1990;1990;1990;3;2;4096;0;0;5;2;L502017;1930;1960;x
Li Zongren;502118;CGX;1930;1930;1941;1990;1;2;0;1;0;4;2;L50186;1930;1960;x
Lindemann;502119;CGX;1930;1930;1990;1990;2;4;10;0;0;5;0;L502019;1930;1940;x
Hoffmann;502120;CGX;1940;1940;1990;1990;2;4;516;1;0;5;0;L502020;1930;1944;x
Vorbrugg;502121;CGX;1930;1930;1990;1990;2;4;129;1;0;5;0;L502021;1930;1960;x
There are couple of ways to implement it in the game and some comments will be highly appreciated:
I. Minimal changes to other files - one new and one modified file:
1. Create e new .csv file with duplicated leaders for all countries
2. Copy all new events needed for sleep duplicated leaders in one existing vanilla events file (like japanese_fascism.txt for example)
3. Create an event that will fire on the 1st day of the campain to initialize all needed flags
II. 2 new files, some changes to all scenario files
1. Create e new .csv file with duplicated leaders for all countries
2. Create a separate file for new events
3. Include my new events file in all scenario files along with initial flags
III. Many files with minimal changes + 1(2) new files
1. Create e new .csv file with duplicated leaders for all countries
2. Create a separate file for new events
or
2. Copy all new events needed for sleep duplicated leaders in one existing vanilla events file (like japanese_fascism.txt for example)
3. Edit some (or all?) inc files to add in dormant_leaders list all duplicates
IV. Combination of the above. In my personal mod I'll go with dormant_leaders option for the countries I play most (majors and some interesting minors) to avoid numerious "Our leader has died" messages when first event fires. I preffer to use separate file for my events and will include it in all scenario files + the initial flags.
There is one problem - in some original events are used sleep leader commands. I can ignore them completely (most of these events are not so important or are for majors which rarely get released), can add linies with duplicated leaders into (some or in all of) these events, or can make duplicated events with both leaders (original and duplicate) + an event that will sleep all original events at scenario start.
What do you think? Which option is most acceptable for you guys?
**********************************************************
Because of the many responces in this tread

I lag a little behind in EIP schedule. Nevertheless version 0.01 of EIP is very close!
I'm ready with duplicate leaders file (it's HUGE

) and with all events that sleep leaders to avoid duplicates and original to be active at the same time (more then 300 events in 1.6 MB TXT file :rofl: ) in the game. Last night I ran a couple of test to find out is there any serious slow-down of the game because of these new events and I'm very optimistic from the results. There is slow down, but not so huge as I expected. IIRC on my ancient computer 6 game months takes ~ 20 seconds more when offset is 60 days and ~ 40 seconds more when offset is 1 day compared with no EIP. This is in 1936 GC arm. 1.2 + CDCP 0.53, extreme game speed.
Taking in consideration all posts and opinions from future EIP users in this thread so far :rofl:, I decide to do it my way

:
1. New file - Duplicate leaders.csv (~900KB)
2. One replaced file - ai_revolters.txt ; I'll incorporate all bonuces from this file into my already created events for each country, so these bonuses to be given even after multiple annex/releases (currently they are applied only once - I didn't know about this bug before Kristof73's post in CDCP thread where he posted and a workaround)
This version of EIP should be compatible with most of the mods out there. What is left to do before release is to incorporate ai_revolters.txt events into mine and to do some more testing.
Here is a game log from one of my tests as Albania:
Code:
[COLOR=DarkOrange]name = "0:00 January 2, 1936 : Germany had Flag initializations ." [/COLOR] - This event sets a flag for all countries to enable "Delete duplicate leaders." events to each of them.
name = "0:00 January 4, 1936 : Republican Spain had Delete duplicate leaders ."
name = "0:00 January 4, 1936 : Iraq had Delete duplicate leaders ."
name = "0:00 January 4, 1936 : Honduras had Delete duplicate leaders ."
name = "0:00 January 7, 1936 : Norway had Delete duplicate leaders ."
name = "0:00 January 8, 1936 : France had Delete duplicate leaders ."
name = "0:00 January 10, 1936 : USA had Delete duplicate leaders ."
name = "0:00 January 11, 1936 : Xibei San Ma had Delete duplicate leaders ."
name = "0:00 January 12, 1936 : Austria had Delete duplicate leaders ."
name = "0:00 January 12, 1936 : Denmark had Delete duplicate leaders ."
name = "0:00 January 13, 1936 : El Salvador had Delete duplicate leaders ."
name = "0:00 January 14, 1936 : Nicaragua had Delete duplicate leaders ."
name = "0:00 January 14, 1936 : Afghanistan had Delete duplicate leaders ."
name = "0:00 January 15, 1936 : Cuba had Delete duplicate leaders ."
name = "0:00 January 16, 1936 : Sweden had Delete duplicate leaders ."
name = "0:00 January 17, 1936 : Shanxi had Delete duplicate leaders ."
name = "0:00 January 18, 1936 : Hungary had Delete duplicate leaders ."
name = "0:00 January 18, 1936 : Dominican Republic had Delete duplicate leaders ."
name = "0:00 January 19, 1936 : Brazil had Delete duplicate leaders ."
name = "0:00 January 21, 1936 : Ireland had Delete duplicate leaders ."
name = "0:00 January 21, 1936 : South Africa had Delete duplicate leaders ."
name = "0:00 January 22, 1936 : Bulgaria had Delete duplicate leaders ."
name = "0:00 January 22, 1936 : Paraguay had Delete duplicate leaders ."
name = "0:00 January 24, 1936 : New Zealand had Delete duplicate leaders ."
name = "0:00 January 24, 1936 : Guatemala had Delete duplicate leaders ."
name = "0:00 January 25, 1936 : Yugoslavia had Delete duplicate leaders ."
name = "0:00 January 26, 1936 : Ethiopia had Delete duplicate leaders ."
name = "0:00 January 27, 1936 : Portugal had Delete duplicate leaders ."
name = "0:00 January 28, 1936 : Haiti had Delete duplicate leaders ."
name = "0:00 January 28, 1936 : Peru had Delete duplicate leaders ."
name = "0:00 January 30, 1936 : Italy had Delete duplicate leaders ."
name = "0:00 January 30, 1936 : Oman had Delete duplicate leaders ."
name = "0:00 February 1, 1936 : Colombia had Delete duplicate leaders ."
name = "0:00 February 2, 1936 : Costa Rica had Delete duplicate leaders ."
name = "0:00 February 3, 1936 : Canada had Delete duplicate leaders ."
name = "0:00 February 3, 1936 : Guangxi Clique had Delete duplicate leaders ."
name = "0:00 February 4, 1936 : Bhutan had Delete duplicate leaders ."
name = "0:00 February 5, 1936 : Netherlands had Delete duplicate leaders ."
name = "0:00 February 5, 1936 : Greece had Delete duplicate leaders ."
name = "0:00 February 6, 1936 : Switzerland had Delete duplicate leaders ."
name = "0:00 February 7, 1936 : Japan had Delete duplicate leaders ."
name = "0:00 February 8, 1936 : United Kingdom had Delete duplicate leaders ."
name = "0:00 February 9, 1936 : Venezuela had Delete duplicate leaders ."
name = "0:00 February 12, 1936 : Uruguay had Delete duplicate leaders ."
name = "0:00 February 12, 1936 : Delete duplicate leaders happened to us."
name = "0:00 February 12, 1936 : Agimi has died."
name = "0:00 February 12, 1936 : Agolli has died."
name = "0:00 February 12, 1936 : Bicaku has died."
name = "0:00 February 12, 1936 : Musai has died."
name = "0:00 February 12, 1936 : Bushati has died."
name = "0:00 February 12, 1936 : Cajupi has died."
name = "0:00 February 12, 1936 : Floxhi has died."
name = "0:00 February 12, 1936 : Frashлri has died."
name = "0:00 February 12, 1936 : Hoxha has died."
name = "0:00 February 12, 1936 : Jaxha has died."
name = "0:00 February 12, 1936 : Komani has died."
name = "0:00 February 12, 1936 : Zog I has died."
name = "0:00 February 12, 1936 : Kristo has died."
name = "0:00 February 12, 1936 : Malлshova has died."
name = "0:00 February 12, 1936 : Moisiu has died."
name = "0:00 February 12, 1936 : Mori has died."
name = "0:00 February 12, 1936 : Musai has died."
name = "0:00 February 12, 1936 : Nergutti has died."
name = "0:00 February 12, 1936 : Percy has died."
name = "0:00 February 12, 1936 : Pervizi has died."
name = "0:00 February 12, 1936 : Shatun has died."
name = "0:00 February 12, 1936 : Shehu has died."
name = "0:00 February 12, 1936 : Trajce has died."
name = "0:00 February 12, 1936 : Ypi has died."
name = "0:00 February 12, 1936 : Delvinл has died."
name = "0:00 February 12, 1936 : Ghaxa has died."
name = "0:00 February 12, 1936 : Kristo has died."
name = "0:00 February 12, 1936 : Pakazi has died."
name = "0:00 February 12, 1936 : Agolli has died."
name = "0:00 February 12, 1936 : Delvinл has died."
name = "0:00 February 12, 1936 : Floxhi has died."
name = "0:00 February 12, 1936 : Pervizi has died."
name = "0:00 February 13, 1936 : Yunnan had Delete duplicate leaders ."
name = "0:00 February 14, 1936 : Germany had Delete duplicate leaders ."
name = "0:00 February 14, 1936 : Belgium had Delete duplicate leaders ."
name = "0:00 February 15, 1936 : Mexico had Delete duplicate leaders ."
name = "0:00 February 15, 1936 : Turkey had Delete duplicate leaders ."
name = "0:00 February 15, 1936 : Lithuania had Delete duplicate leaders ."
name = "0:00 February 15, 1936 : Nepal had Delete duplicate leaders ."
name = "0:00 February 16, 1936 : Soviet Union had Delete duplicate leaders ."
name = "0:00 February 17, 1936 : Mongolia had Delete duplicate leaders ."
name = "0:00 February 19, 1936 : Communist China had Delete duplicate leaders ."
name = "0:00 February 20, 1936 : Tannu Tuva had Delete duplicate leaders ."
name = "0:00 February 21, 1936 : Australia had Delete duplicate leaders ."
name = "0:00 February 22, 1936 : Finland had Delete duplicate leaders ."
name = "0:00 February 22, 1936 : Latvia had Delete duplicate leaders ."
name = "0:00 February 22, 1936 : Chile had Delete duplicate leaders ."
name = "0:00 February 24, 1936 : Ecuador had Delete duplicate leaders ."
name = "0:00 February 24, 1936 : Luxemburg had Delete duplicate leaders ."
name = "0:00 February 24, 1936 : Persia had Delete duplicate leaders ."
name = "0:00 February 25, 1936 : Tibet had Delete duplicate leaders ."
name = "0:00 February 25, 1936 : Yemen had Delete duplicate leaders ."
name = "0:00 February 26, 1936 : Sinkiang had Delete duplicate leaders ."
name = "0:00 February 26, 1936 : Philippines had Delete duplicate leaders ."
name = "0:00 February 28, 1936 : Nationalist China had Delete duplicate leaders ."
name = "0:00 February 28, 1936 : Saudi Arabia had Delete duplicate leaders ."
name = "0:00 February 29, 1936 : Poland had Delete duplicate leaders ."
name = "0:00 February 29, 1936 : Argentina had Delete duplicate leaders ."
name = "0:00 February 29, 1936 : Panama had Delete duplicate leaders ."
name = "0:00 February 30, 1936 : Romania had Delete duplicate leaders ."
name = "0:00 February 30, 1936 : Siam had Delete duplicate leaders ."
name = "0:00 February 30, 1936 : Manchukuo had Delete duplicate leaders ."
name = "0:00 March 1, 1936 : Bolivia had Delete duplicate leaders ."
name = "0:00 March 3, 1936 : Estonia had Delete duplicate leaders ."
name = "0:00 March 3, 1936 : Liberia had Delete duplicate leaders ."
It was strange for me that these events (same conditions) were not ran in at the same day but executed by the game engine in 2 months. Actually this is good, because do not make a huge load to the system at the same time.
EDIT:
May be I found a way to remove the need of first flag initialization event, but I'll have to check if it will work. My idea is to change trigger conditions for "Delete duplicates" event from:
Code:
trigger = {
not = {local_flag = active}
flag = GER2
}
TO
trigger = {
not = {local_flag = active}
not= {flag = GER2}
}
And actions in this event from:
Code:
command = { type = setflag which = GER1 }
command = { type = clrflag which = GER2 }
command = { type = local_setflag which = active }
TO
command = { type = setflag which = GER1 }
command = { type = setflag which = GER2 }
command = { type = local_setflag which = active }
The second event (delete original leaders) actions will be changed from:
Code:
command = { type = setflag which = GER2 }
command = { type = clrflag which = GER1 }
command = { type = local_setflag which = active }
TO
command = { type = [COLOR=DarkOrange]clrflag[/COLOR] which = GER2 }
command = { type = clrflag which = GER1 }
command = { type = local_setflag which = active }
Trigger conditions for it will remain unchanged:
Code:
trigger = {
not = {local_flag = active}
flag = GER1
}
Looks good "on paper", will see if it will work.