Mikematotski

Colonel
7 Badges
Jan 20, 2003
833
10
Visit site
  • Arsenal of Democracy
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Semper Fi
  • 500k Club
  • Hearts of Iron IV: Cadet
The below script in making officers doesn't seem to work. Though a nation max out to 110% of offficers (which is the maximum possible) the nation still put about 30% in making officers instad of put this into the research. This is a breaking feature that destroy a nations progress.
Anyone know the problem here.

-- Officer ratio.
local liCurrentOfficeRatio = StandardDataObject.Country:GetOfficerRatio():Get()
local liMaxOfficeRatio = defines.military.MAX_OFFICERS

-- Checks to see if you are loosing officers
-- if so take them from espionage and diplomacy
if liCurrentOfficeRatio < (liMaxOfficeRatio * 0.70) then
-- Move the Espionage into the NCO and set it to 0 since we are short
Leadership.Percent_NCO = 0.5 + Leadership.Percent_Espionage
Leadership.Percent_Espionage = 0.0
Leadership.NCONeeded = true
elseif liCurrentOfficeRatio < (liMaxOfficeRatio * 0.75) then
Leadership.Percent_NCO = 0.4
elseif liCurrentOfficeRatio < (liMaxOfficeRatio * 0.85) then
Leadership.Percent_NCO = 0.3
elseif liCurrentOfficeRatio < (liMaxOfficeRatio * 0.92) then
Leadership.Percent_NCO = 0.2

-- Check to see if you have to many officers
-- if so increase research
elseif liCurrentOfficeRatio > (liMaxOfficeRatio * 0.99) then
Leadership.Percent_NCO = 0.0
end

Thanks in advance.

Cheers
Captain Jack
 

Paglia

a.k.a. Asafetida & Otto Steiner (WoT)
34 Badges
Dec 29, 2010
6.457
757
forum.paradoxplaza.com
  • Crusader Kings II
  • Semper Fi
  • Magicka
  • Heir to the Throne
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Divine Wind
  • Europa Universalis III Complete
  • Europa Universalis III: Chronicles
  • Europa Universalis III
  • Dungeonland
  • Deus Vult
  • Cities in Motion
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Death or Dishonor
  • Steel Division: Normand 44 Sign-up
  • Imperator: Rome Sign Up
  • Steel Division: Normandy 44
  • Hearts of Iron IV: Field Marshal
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Magicka: Wizard Wars Founder Wizard
  • Crusader Kings II: Holy Knight (pre-order)
  • 500k Club
  • Victoria 2
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
The below script in making officers doesn't seem to work. Though a nation max out to 110% of offficers (which is the maximum possible) the nation still put about 30% in making officers instad of put this into the research. This is a breaking feature that destroy a nations progress.
Anyone know the problem here.

-- Officer ratio.
local liCurrentOfficeRatio = StandardDataObject.Country:GetOfficerRatio():Get()
local liMaxOfficeRatio = defines.military.MAX_OFFICERS

-- Checks to see if you are loosing officers
-- if so take them from espionage and diplomacy
if liCurrentOfficeRatio < (liMaxOfficeRatio * 0.70) then
-- Move the Espionage into the NCO and set it to 0 since we are short
Leadership.Percent_NCO = 0.5 + Leadership.Percent_Espionage
Leadership.Percent_Espionage = 0.0
Leadership.NCONeeded = true
elseif liCurrentOfficeRatio < (liMaxOfficeRatio * 0.75) then
Leadership.Percent_NCO = 0.4
elseif liCurrentOfficeRatio < (liMaxOfficeRatio * 0.85) then
Leadership.Percent_NCO = 0.3
elseif liCurrentOfficeRatio < (liMaxOfficeRatio * 0.92) then
Leadership.Percent_NCO = 0.2

-- Check to see if you have to many officers
-- if so increase research
elseif liCurrentOfficeRatio > (liMaxOfficeRatio * 0.99) then
Leadership.Percent_NCO = 0.0
end

Thanks in advance.

Cheers
Captain Jack


I'm not sure I follow what you intend to do

I may be wrong in my understanding of your work

----------

Is it a country specific script or a ai_tech_minister script ?

Seems like a country script, since you have local blablabla = blablabla

So you seem to be trying to put in a country script the lua code of a tech_minister... but if the ai_tech_minister isn't told to take that into account, it won't

Take a look at the ai_tech_minister script : the basic reference to a country specific function is the latter :

Code:
    if Utils.HasCountryAIFunction(TechnologyData.ministerTag, "BalanceSliders") then
            Leadership = Utils.CallCountryAI(TechnologyData.ministerTag, "BalanceSliders", Leadership)
    end

So it is looking for that function, if it doesn't find it, it processes the standard script, which looks like this :

Code:
    -- get country specific slider informationif available
    if Utils.HasCountryAIFunction(TechnologyData.ministerTag, "BalanceSliders") then
            Leadership = Utils.CallCountryAI(TechnologyData.ministerTag, "BalanceSliders", Leadership)
    end
            
    -- Checks to see if you are loosing officers
    --   if so take them from espionage and diplomacy
    if Leadership.officer_ratio < Leadership.NCO_AlarmRatioThreshold then
        -- Move the Espionage into the NCO and set it to 0 since we are short
        Leadership.Percent_NCO = Leadership.NCO_AlarmRatio + Leadership.Percent_Espionage
        Leadership.Percent_Espionage = 0.0
        Leadership.NCONeeded = true
    elseif Leadership.officer_ratio < Leadership.NCO_LowRatioThreshold then
        Leadership.Percent_NCO = Leadership.NCO_LowRatio
    elseif Leadership.officer_ratio  < Leadership.NCO_MediumRatioThreshold then
        Leadership.Percent_NCO = Leadership.NCO_MediumRatio
    elseif Leadership.officer_ratio  < Leadership.NCO_HighRatioThreshold then
        Leadership.Percent_NCO = Leadership.NCO_HighRatio
    -- Check to see if you have to many officers
    --    if so increase research
    elseif Leadership.officer_ratio > 1.39 then
        Leadership.Percent_NCO = 0.0
    end
 

Mikematotski

Colonel
7 Badges
Jan 20, 2003
833
10
Visit site
  • Arsenal of Democracy
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Semper Fi
  • 500k Club
  • Hearts of Iron IV: Cadet
I'm not sure I follow what you intend to do

I may be wrong in my understanding of your work

----------

Is it a country specific script or a ai_tech_minister script ?

Seems like a country script, since you have local blablabla = blablabla

So you seem to be trying to put in a country script the lua code of a tech_minister... but if the ai_tech_minister isn't told to take that into account, it won't

Take a look at the ai_tech_minister script : the basic reference to a country specific function is the latter :

Code:
    if Utils.HasCountryAIFunction(TechnologyData.ministerTag, "BalanceSliders") then
            Leadership = Utils.CallCountryAI(TechnologyData.ministerTag, "BalanceSliders", Leadership)
    end

So it is looking for that function, if it doesn't find it, it processes the standard script, which looks like this :

Code:
    -- get country specific slider informationif available
    if Utils.HasCountryAIFunction(TechnologyData.ministerTag, "BalanceSliders") then
            Leadership = Utils.CallCountryAI(TechnologyData.ministerTag, "BalanceSliders", Leadership)
    end
           
    -- Checks to see if you are loosing officers
    --   if so take them from espionage and diplomacy
    if Leadership.officer_ratio < Leadership.NCO_AlarmRatioThreshold then
        -- Move the Espionage into the NCO and set it to 0 since we are short
        Leadership.Percent_NCO = Leadership.NCO_AlarmRatio + Leadership.Percent_Espionage
        Leadership.Percent_Espionage = 0.0
        Leadership.NCONeeded = true
    elseif Leadership.officer_ratio < Leadership.NCO_LowRatioThreshold then
        Leadership.Percent_NCO = Leadership.NCO_LowRatio
    elseif Leadership.officer_ratio  < Leadership.NCO_MediumRatioThreshold then
        Leadership.Percent_NCO = Leadership.NCO_MediumRatio
    elseif Leadership.officer_ratio  < Leadership.NCO_HighRatioThreshold then
        Leadership.Percent_NCO = Leadership.NCO_HighRatio
    -- Check to see if you have to many officers
    --    if so increase research
    elseif Leadership.officer_ratio > 1.39 then
        Leadership.Percent_NCO = 0.0
    end
Hi

Thanks for your answer.
Some more info, this is mod from TRP and TFH 4.02 and its the "tech_minister.lua" file and this seems the only way to apoint on recruting officers. Then of corse there are some moddifier in laws etc. What I dont understand is that despite you reached the maximun offiers (110%) it still allocate leadership to recruit more officers which is ofc waste of leadership. The program itself is not that complicated so there shouldn't bee any real problem but still it allocate leadership wrongley.
Any ideas would appricited,

Cheers
Captain Jack
 
  • 1Like
Reactions:

Kovax

Field Marshal
10 Badges
May 13, 2003
8.907
4.890
  • Europa Universalis III Complete
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Semper Fi
  • Victoria 2
  • 500k Club
The 110% limit (140% in the vanilla game) is only for how much effect it has on combat, and anything higher is not displayed, but does exist. You definitely can have more than 110%, and in fact it's a good idea to be slightly over that limit, so when you build a new unit, it doesn't drag down your officer ratio. Of course, beyond some point it is a waste of Leadership, so it pays to take an occasional glance at the tooltip by hovering over your Officer Ratio stat to see the actual number of officers compared to the requirement.
 
  • 1Like
Reactions:

Paglia

a.k.a. Asafetida & Otto Steiner (WoT)
34 Badges
Dec 29, 2010
6.457
757
forum.paradoxplaza.com
  • Crusader Kings II
  • Semper Fi
  • Magicka
  • Heir to the Throne
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Divine Wind
  • Europa Universalis III Complete
  • Europa Universalis III: Chronicles
  • Europa Universalis III
  • Dungeonland
  • Deus Vult
  • Cities in Motion
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Death or Dishonor
  • Steel Division: Normand 44 Sign-up
  • Imperator: Rome Sign Up
  • Steel Division: Normandy 44
  • Hearts of Iron IV: Field Marshal
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Magicka: Wizard Wars Founder Wizard
  • Crusader Kings II: Holy Knight (pre-order)
  • 500k Club
  • Victoria 2
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
The 110% limit (140% in the vanilla game) is only for how much effect it has on combat, and anything higher is not displayed, but does exist. You definitely can have more than 110%, and in fact it's a good idea to be slightly over that limit, so when you build a new unit, it doesn't drag down your officer ratio. Of course, beyond some point it is a waste of Leadership, so it pays to take an occasional glance at the tooltip by hovering over your Officer Ratio stat to see the actual number of officers compared to the requirement.

Couldn't say it better
 
  • 1Like
Reactions:

themousemaster

General
5 Badges
Aug 31, 2009
2.447
46
  • 500k Club
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Semper Fi
I thought
The 110% limit (140% in the vanilla game) is only for how much effect it has on combat, and anything higher is not displayed, but does exist. You definitely can have more than 110%, and in fact it's a good idea to be slightly over that limit, so when you build a new unit, it doesn't drag down your officer ratio. Of course, beyond some point it is a waste of Leadership, so it pays to take an occasional glance at the tooltip by hovering over your Officer Ratio stat to see the actual number of officers compared to the requirement.
I thought it was 200% in vanilla, 140% in FtM, and then 110% in TfH?
 

Paglia

a.k.a. Asafetida & Otto Steiner (WoT)
34 Badges
Dec 29, 2010
6.457
757
forum.paradoxplaza.com
  • Crusader Kings II
  • Semper Fi
  • Magicka
  • Heir to the Throne
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Divine Wind
  • Europa Universalis III Complete
  • Europa Universalis III: Chronicles
  • Europa Universalis III
  • Dungeonland
  • Deus Vult
  • Cities in Motion
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Death or Dishonor
  • Steel Division: Normand 44 Sign-up
  • Imperator: Rome Sign Up
  • Steel Division: Normandy 44
  • Hearts of Iron IV: Field Marshal
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Magicka: Wizard Wars Founder Wizard
  • Crusader Kings II: Holy Knight (pre-order)
  • 500k Club
  • Victoria 2
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
  • 1Like
Reactions:

Kovax

Field Marshal
10 Badges
May 13, 2003
8.907
4.890
  • Europa Universalis III Complete
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Semper Fi
  • Victoria 2
  • 500k Club
I thought

I thought it was 200% in vanilla, 140% in FtM, and then 110% in TfH?
140% in all of the vanilla iterations (base game, SF, FtM, TFH), but several mods have reduced that to 110%, because the AI rarely recruits over 100%, making it just another player advantage over the poor, helpless AI. I seem to recall that the game used to display up to 200% originally, but now cuts off at 140 since one of the early patches, even though you can still recruit more (200% may or may not be an actual limit, but I've had no practical reason to check).
 
  • 2
Reactions:

Wraith11B

Call Kenny Loggins, you're in the DANGER ZONE...
53 Badges
Dec 5, 2008
4.572
2.249
  • Crusader Kings II
  • Victoria 2: A House Divided
  • Sword of the Stars II
  • Sword of the Stars
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Magicka
  • Heir to the Throne
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Wealth of Nations
  • Divine Wind
  • Europa Universalis III Complete
  • Europa Universalis IV: Conquest of Paradise
  • Imperator: Rome
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Crusader Kings II: Reapers Due
  • Stellaris: Leviathans Story Pack
  • Stellaris: Federations
  • Hearts of Iron IV: Together for Victory
  • Hearts of Iron IV: La Resistance
  • Stellaris: Ancient Relics
  • Hearts of Iron IV: Expansion Pass
  • Stellaris - Path to Destruction bundle
  • Stellaris: Megacorp
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Synthetic Dawn
  • Hearts of Iron IV: Expansion Pass
  • Crusader Kings II: Conclave
  • Battle for Bosporus
  • Europa Universalis IV
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Victoria 2
  • Imperator: Rome - Magna Graecia
  • 500k Club
  • Crusader Kings II: Way of Life
  • Stellaris
  • Europa Universalis IV: Call to arms event
  • Darkest Hour
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
There isn't a limit to my knowledge unless one gets up to the point of a stack overflow.