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

Mikematotski

Colonel
9 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
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Expansion Pass
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
 
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
 
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:
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:
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:
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?
 
  • 1Like
Reactions:
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:
There isn't a limit to my knowledge unless one gets up to the point of a stack overflow.