NPcomplete
Chieftain
- Joined
- Sep 14, 2011
- Messages
- 29
I'm trying to make a mod that lets you switch the ideology without necessarily having a negative public opinion, i.e. you can change it whenever you want.
I saw that there is some code controlling the ideology in ChooseIdeologyPopup.lua and SocialPolicyPopup.lua. The former is called when you choose your ideology for the first time, and the later controls the switch ideology button in the tenets screen. So I modified SocialPolicyPopup.lua: Instead of enabling the change ideology button only if the public opinion is negative (at line 732), I enabled it at all times ("if (true) then..."). I also disabled some code lines related to the preferred ideology (as it doesn't exist if your public opinion is Ok).
The problem is that, right after losing your ideology, a notification makes you assign the free tenets, at the same turn. But you don't have your new ideology yet, so there is no way to assign them, and moving to the next turn is impossible. (Btw, enabling the game option that lets you pick policies in subsequent turns doesn't help).
So I tried this: Right after making the lua code lose your ideology (in code line "Network.SendChangeIdeology()" of function OnChangeIdeologyConfirmYes), I added "UI.incTurnTimerSemaphore()".
In this case the free tenets notification also appears right after losing your ideology, but now you can ignore it and go on to the next turn. The next turn the game notices you don't have ideology, so the standard lua script at ChooseIdeologyPopup.lua makes you choose your ideology as usual, as if you never had one. After you do, you can click at the free tenets notification and you can assign your free tenets to your freely chosen new ideology. So far so good.
However, even after the free tenets notification disappears, the "next turn" button doesn't work. You are stuck forever at that turn. Every time you press it, the Fire Tuner debugger tells you "UI thinks that we can't end turn, but the notification system disagrees", which is sent from ActionInfoPanel.lua. It looks that my "UI.incTurnTimerSemaphore()" instruction made a mess with what has to be done at the turn, and it just delayed the impossibility to move to the next turn... one turn later!
Alternatively, I also tried to directly set the new ideology by calling "Network.SendIdeologyChoice(Game.GetActivePlayer(), g_iChoice)" (as it is done in ChooseIdeologyPopup.lua) instead of calling "Network.SendChangeIdeology()" (as it is done in SocialPolicyPopup.lua). Unfortunately, this cannot reset your ideology when you already have one. Only Network.SendChangeIdeology() can.
Any ideas? Can anybody help me?
I'm attaching my modified version of ChooseIdeologyPopup.lua.
I saw that there is some code controlling the ideology in ChooseIdeologyPopup.lua and SocialPolicyPopup.lua. The former is called when you choose your ideology for the first time, and the later controls the switch ideology button in the tenets screen. So I modified SocialPolicyPopup.lua: Instead of enabling the change ideology button only if the public opinion is negative (at line 732), I enabled it at all times ("if (true) then..."). I also disabled some code lines related to the preferred ideology (as it doesn't exist if your public opinion is Ok).
The problem is that, right after losing your ideology, a notification makes you assign the free tenets, at the same turn. But you don't have your new ideology yet, so there is no way to assign them, and moving to the next turn is impossible. (Btw, enabling the game option that lets you pick policies in subsequent turns doesn't help).
So I tried this: Right after making the lua code lose your ideology (in code line "Network.SendChangeIdeology()" of function OnChangeIdeologyConfirmYes), I added "UI.incTurnTimerSemaphore()".
In this case the free tenets notification also appears right after losing your ideology, but now you can ignore it and go on to the next turn. The next turn the game notices you don't have ideology, so the standard lua script at ChooseIdeologyPopup.lua makes you choose your ideology as usual, as if you never had one. After you do, you can click at the free tenets notification and you can assign your free tenets to your freely chosen new ideology. So far so good.
However, even after the free tenets notification disappears, the "next turn" button doesn't work. You are stuck forever at that turn. Every time you press it, the Fire Tuner debugger tells you "UI thinks that we can't end turn, but the notification system disagrees", which is sent from ActionInfoPanel.lua. It looks that my "UI.incTurnTimerSemaphore()" instruction made a mess with what has to be done at the turn, and it just delayed the impossibility to move to the next turn... one turn later!
Alternatively, I also tried to directly set the new ideology by calling "Network.SendIdeologyChoice(Game.GetActivePlayer(), g_iChoice)" (as it is done in ChooseIdeologyPopup.lua) instead of calling "Network.SendChangeIdeology()" (as it is done in SocialPolicyPopup.lua). Unfortunately, this cannot reset your ideology when you already have one. Only Network.SendChangeIdeology() can.
Any ideas? Can anybody help me?
