I would like to cause a fixed manpower increase each turn per nation. Would this be possible to mod?
Thanks!
Increase Manpower per turn
Moderators: Slitherine Core, The Lordz
-
- Lance Corporal - SdKfz 222
- Posts: 21
- Joined: Fri Aug 03, 2007 6:05 pm
Re: Increase Manpower per turn
Adding ManPower is no problem but adding a UI-feature which shows the rate at which MP increases will be more difficult.
Define a new function :
and add it in file "game_resources.lua".
In this file the function ManageFinances does allocate ressources and pays maintenance for the active alliance at the start of each turn. Call the new function before the MPLevel is checked :
Define a new function :
Code: Select all
function DoMPIncome(faction)
local growthrate = 2 -- 0.002 -- Growthrate 5% of MPmax per year => ca 0.2 % per turn (when ca 25 turns = 1 year)
local MPIncome = math.ceil(growthrate * data.factions[faction.id+1].manpowerMax / 1000) -- small factions get +1 MP per turn due to rounding up
faction:ConsumeManpower(-MPIncome)
end
In this file the function ManageFinances does allocate ressources and pays maintenance for the active alliance at the start of each turn. Call the new function before the MPLevel is checked :
Code: Select all
function ManageFinances(alliance)
if alliance.id ~= 0 then
for faction in alliance.factions do
-- Check if Manpower reserve drops below a certain %
DoMPIncome(faction) --- <--Our new function !!!
CheckManpowerLevel(faction)
PayFactionIncome(faction)
-- Extra income for AI on highest difficulty level
if game.type == Game.TYPE_SINGLE and alliance.id ~= playerAlliance.id then
local percentage = 50
-- start with lower bonuses first 5 turns
if game.turn <= 5 then
percentage = percentage - percentage / game.turn
end
if game:GetAlliancePlayer(alliance).difficulty == 3 then
GiveExtraIncome(faction, percentage)
elseif game:GetAlliancePlayer(alliance).difficulty == 1 then
GiveExtraIncome(faction, -percentage*2/3)
end
end
SpendFactionResearchUpkeep(faction)
SpendFactionUpkeep(faction)
CheckDebtMoraleEffect(faction)
ProduceAmmunition(faction)
RepairConstructions(faction)
end
end
end
-
- Lance Corporal - SdKfz 222
- Posts: 21
- Joined: Fri Aug 03, 2007 6:05 pm
Re: Increase Manpower per turn
You are such a kind man! This made my day! Thank you. 

Re: Increase Manpower per turn
How to add more moderate growthrate, lets say 2% per year? Should making the line like this work:
local growthrate = 2 -- 0.0008 -- Growthrate 5% of MPmax per year => ca 0.2 % per turn (when ca 25 turns = 1 year)
local growthrate = 2 -- 0.0008 -- Growthrate 5% of MPmax per year => ca 0.2 % per turn (when ca 25 turns = 1 year)