In which files is coded the turn manpower income?
Moderators: Slitherine Core, The Lordz
In which files is coded the turn manpower income?
Hi, I'm trying to modify the turn manpower income, but I can't find where it is coded. I know where is coded the initial manpower for each country, but not the turn income. Can anyone help me?
Re: In which files is coded the turn manpower income?
There is no such thing in the basic game but I modded it into Potzblitz.
The code was designed by a fellow forum user called Hyperion back in the days.
It's found in game_resources.lua under the function called DoMPIncome(faction)
Change the number value in:
The value 2 equals 0,2% manpower gain per turn.
Consider that in 1914 a turn covers two weeks, while after 1914 a turn covers a whole month.
For this reason I doubled the manpower gain per turn after 1914.
and even raised it, if "Volunteer Recruits" were played with a 33% chance per turn
Hope you can make sense of that.
If not, just ask.
The code was designed by a fellow forum user called Hyperion back in the days.
It's found in game_resources.lua under the function called DoMPIncome(faction)
Change the number value in:
Code: Select all
local growthrate = 2
Consider that in 1914 a turn covers two weeks, while after 1914 a turn covers a whole month.
For this reason I doubled the manpower gain per turn after 1914.
Code: Select all
if game.date.year == 1914 then
faction:ConsumeManpower(-MPIncome)
elseif game.date.year >= 1915 then
faction:ConsumeManpower(-MPIncome *2)
Code: Select all
if faction.alliance.id == 1 and GetEvent("MPBonusEnt") >0 and math.random(1,6) >= 5 then
faction:ConsumeManpower(-MPIncome)
end
if faction.alliance.id == 2 and GetEvent("MPBonus") >0 and math.random(1,6) >= 5 then
faction:ConsumeManpower(-MPIncome)
end
end
If not, just ask.
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
Re: In which files is coded the turn manpower income?
Great job Robotron I only don't understand where is specified in "MPBonusEnt" the bonus for MP income. I understand the chance is "math.random(1,6) >= 5", but where is specified the bonus?Robotron wrote: ↑Thu Aug 23, 2018 11:12 pm There is no such thing in the basic game but I modded it into Potzblitz.
The code was designed by a fellow forum user called Hyperion back in the days.
It's found in game_resources.lua under the function called DoMPIncome(faction)
Change the number value in:
The value 2 equals 0,2% manpower gain per turn.Code: Select all
local growthrate = 2
Consider that in 1914 a turn covers two weeks, while after 1914 a turn covers a whole month.
For this reason I doubled the manpower gain per turn after 1914.
and even raised it, if "Volunteer Recruits" were played with a 33% chance per turnCode: Select all
if game.date.year == 1914 then faction:ConsumeManpower(-MPIncome) elseif game.date.year >= 1915 then faction:ConsumeManpower(-MPIncome *2)
Hope you can make sense of that.Code: Select all
if faction.alliance.id == 1 and GetEvent("MPBonusEnt") >0 and math.random(1,6) >= 5 then faction:ConsumeManpower(-MPIncome) end if faction.alliance.id == 2 and GetEvent("MPBonus") >0 and math.random(1,6) >= 5 then faction:ConsumeManpower(-MPIncome) end end
If not, just ask.
Re: In which files is coded the turn manpower income?
The bonus comes from:
ConsumeManpower is a sub-function that consumes manpower.
HOWEVER: if we give it a negative value, it adds a bonus (as in: if you subtract a negative value, you in fact add a positive value)
faction is any given nation in the game.
Every faction will go through the process of getting a manpower bonus at the start of the turn.
MPIncome is a variable, it contains a number value that was created at the start of the function in
Instead of using a variable you can be more specific too, for example:
which will have Italy consume 5 manpower or
which will have Britian add 20 manpower (-20 = add 20)
Of course in the above two cases you will first have to tell the game, who the hell "italy" and "britain" are.
So in case you did not already know, do this by assigning a faction id to the name of the nation
or
See, any nation in the game has a number ID
France is 0, Britain is 1, Germany is 2, Austria is 3, Russia is 4, Turkey is 5, Belgium is 6, Serbia is 7, Italy is 8 etc. (see factions.lua for more info)
And then finally there are also
anynationnamehere:ConsumeProductionPoints(insert value here) ---- to add/consume production
and
anynationnamehere:ConsumeAmmo(insert value here) ---- to add/consume ammo
Code: Select all
faction:ConsumeManpower(-MPIncome)
HOWEVER: if we give it a negative value, it adds a bonus (as in: if you subtract a negative value, you in fact add a positive value)
faction is any given nation in the game.
Every faction will go through the process of getting a manpower bonus at the start of the turn.
MPIncome is a variable, it contains a number value that was created at the start of the function in
Code: Select all
local MPIncome = math.ceil(growthrate * data.factions[faction.id+1].manpowerMax / 1000) -- small factions get +1 MP per turn due to rounding up
Code: Select all
italy:ConsumeManpower(5)
Code: Select all
britain:ConsumeManpower(-20)
Of course in the above two cases you will first have to tell the game, who the hell "italy" and "britain" are.
So in case you did not already know, do this by assigning a faction id to the name of the nation
Code: Select all
local italy = game:GetFactionById(8)
Code: Select all
local britain= game:GetFactionById(1)
France is 0, Britain is 1, Germany is 2, Austria is 3, Russia is 4, Turkey is 5, Belgium is 6, Serbia is 7, Italy is 8 etc. (see factions.lua for more info)
And then finally there are also
anynationnamehere:ConsumeProductionPoints(insert value here) ---- to add/consume production
and
anynationnamehere:ConsumeAmmo(insert value here) ---- to add/consume ammo
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
Re: In which files is coded the turn manpower income?
Ok, great, this was what I'd like to change. I don't like this "+1" for small factions. Do you know if decimal values are cummulative or they are lost every turn?Robotron wrote: ↑Fri Aug 24, 2018 10:49 amCode: Select all
local MPIncome = math.ceil(growthrate * data.factions[faction.id+1].manpowerMax / 1000) -- small factions get +1 MP per turn due to rounding up
Re: In which files is coded the turn manpower income?
They will be rounded up because of math.ceil (there is also math.floor for rounding down btw.)
However since most minors have maximum manpower below 1000 and the manpower per turn is divided by 1000 at the end of the function even rounding up will still produce only 1.
However since most minors have maximum manpower below 1000 and the manpower per turn is divided by 1000 at the end of the function even rounding up will still produce only 1.
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
Re: In which files is coded the turn manpower income?
Thanks very much Robotron
Re: In which files is coded the turn manpower income?
Always happy to help.
So what did you do? Did you give Serbia a per turn manpower bonus of 10?
So what did you do? Did you give Serbia a per turn manpower bonus of 10?
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
Re: In which files is coded the turn manpower income?
No, no, just the opposite. I think I'll remove this "+1" for minor countries. The modifications I do are focused on population weight and industrial capacities of each country in order to improve the historical simulation. So, for example, Serbia has only 14PP and 225MP. I know it seems too low but, in my opinion, after all the changes I have done the game is as balanced as WWI was
Re: In which files is coded the turn manpower income?
Historical correctness applied to CTGW will often lead to totally non-historical results because of the way the game was designed.
This I can tell you from my experience.
This I can tell you from my experience.
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610