Here is the basic code without the pop cap in there the pop cap seems to work fine:
function CustomStartingResources_Init()
--[[
CustomStartingResource System created by Janne252. Visit COH2.ORG for more. Please do not remove this note.
Some information about income_modifier table and how to use it:
- All resource income modifiers affect the # per minute value.
- By default all resource income modifiers are set to 1 (value = 1, math_type = MUT_Multiplication). As you know, anything * 1 is the same value.
- MUT_Multiplication multiplies the income rate and MUT_Addition adds to it. Here are some examples of that:
- Let's say manpower income is 294 manpower per minute. With value = 10, math_type = MUT_Multiplication we will get 2940 manpower per minute,
since 294 * 10 = 2940.
Let's say manpower income is still 294 manpower per minute. With value = 10, math_type = MUT_Addition, we will get 304 manpower per minute,
since 294 + 10 = 304.
- How to add 50 extra munition income?
{type = RT_Munition, value = 50, math_type = MUT_Addition}
- How to remove 100 from manpower income?
{type = RT_Manpower, value = -100, math_type = MUT_Addition}
- How to double manpower income?
{type = RT_Manpower, value = 2, math_type = MUT_Multiplication}
]]
local ResourceSets = {
standard = {
--german:
[0] = {
manpower = 490,
fuel = 20,
munition = 0,
action = 0,
command = 1,
},
--soviet:
[1] = {
manpower = 490,
fuel = 50,
munition = 0,
action = 0,
command = 1,
},
--Obercommando west:
[2] = {
manpower = 240,
fuel = 40,
munition = 0,
action = 0,
command = 1,
},
--us forces:
[3] = {
manpower = 400,
fuel = 15,
munition = 0,
action = 0,
command = 1,
},
income_modifier = {
{type = RT_Manpower, value = 1, math_type = MUT_Multiplication}, -- manpower. math_type = MUT_Multiplication OR MUT_Addition
{type = RT_Munition, value = 1, math_type = MUT_Multiplication}, -- munition. math_type = MUT_Multiplication OR MUT_Addition
{type = RT_Fuel, value = 1, math_type = MUT_Multiplication}, -- fuel. math_type = MUT_Multiplication OR MUT_Addition
{type = RT_Action, value = 1, math_type = MUT_Multiplication}, -- action/xp. math_type = MUT_Multiplication OR MUT_Addition
},
},
highResources = {
--german:
[0] = {
manpower = 1390,
fuel = 50,
munition = 50,
action = 0,
command = 2,
},
--soviet:
[1] = {
manpower = 1390,
fuel = 80,
munition = 50,
action = 0,
command = 2,
},
--Obercommando west:
[2] = {
manpower = 1140,
fuel = 70,
munition = 50,
action = 0,
command = 2,
},
--us forces:
[3] = {
manpower = 1300,
fuel = 45,
munition = 50,
action = 0,
command = 2,
},
income_modifier = {
{type = RT_Manpower, value = 1, math_type = MUT_Multiplication}, -- manpower. math_type = MUT_Multiplication OR MUT_Addition
{type = RT_Munition, value = 1, math_type = MUT_Multiplication}, -- munition. math_type = MUT_Multiplication OR MUT_Addition
{type = RT_Fuel, value = 1, math_type = MUT_Multiplication}, -- fuel. math_type = MUT_Multiplication OR MUT_Addition
{type = RT_Action, value = 1, math_type = MUT_Multiplication}, -- action/xp. math_type = MUT_Multiplication OR MUT_Addition
},
},
customSet_01 = {
--german:
[0] = {
manpower = 2000,
fuel = 80,
munition = 100,
action = 0,
command = 2,
},
--soviet:
[1] = {
manpower = 2000,
fuel = 100,
munition = 100,
action = 0,
command = 2,
},
--Obercommando west:
[2] = {
manpower = 2000,
fuel = 80,
munition = 100,
action = 0,
command = 2,
},
--us forces:
[3] = {
manpower = 2000,
fuel = 80,
munition = 100,
action = 0,
command = 2,
},
income_modifier = {
{type = RT_Manpower, value = 1, math_type = MUT_Multiplication}, -- manpower. math_type = MUT_Multiplication OR MUT_Addition
{type = RT_Munition, value = 1, math_type = MUT_Multiplication}, -- munition. math_type = MUT_Multiplication OR MUT_Addition
{type = RT_Fuel, value = 1, math_type = MUT_Multiplication}, -- fuel. math_type = MUT_Multiplication OR MUT_Addition
{type = RT_Action, value = 1, math_type = MUT_Multiplication}, -- action/xp. math_type = MUT_Multiplication OR MUT_Addition
},
},
customSet_02 = {
--german:
[0] = {
manpower = 0,
fuel = 0,
munition = 0,
action = 0,
command = 0,
},
--soviet:
[1] = {
manpower = 0,
fuel = 0,
munition = 0,
action = 0,
command = 0,
},
--Obercommando west:
[2] = {
manpower = 0,
fuel = 0,
munition = 0,
action = 0,
command = 0,
},
--us forces:
[3] = {
manpower = 0,
fuel = 0,
munition = 0,
action = 0,
command = 0,
},
income_modifier = {
{type = RT_Manpower, value = 1, math_type = MUT_Multiplication}, -- manpower. math_type = MUT_Multiplication OR MUT_Addition
{type = RT_Munition, value = 1, math_type = MUT_Multiplication}, -- munition. math_type = MUT_Multiplication OR MUT_Addition
{type = RT_Fuel, value = 1, math_type = MUT_Multiplication}, -- fuel. math_type = MUT_Multiplication OR MUT_Addition
{type = RT_Action, value = 1, math_type = MUT_Multiplication}, -- action/xp. math_type = MUT_Multiplication OR MUT_Addition
},
},
}
--This will set the resource set to use in-game
local g_ResourceSet = ResourceSets.customSet_01
local Player_ApplyResourceSet = function(player, resourceSet)
Player_SetResource(player, RT_Manpower, resourceSet.manpower)
Player_SetResource(player, RT_Fuel, resourceSet.fuel)
Player_SetResource(player, RT_Munition, resourceSet.munition)
Player_SetResource(player, RT_Action, resourceSet.action)
Player_SetResource(player, RT_Command, resourceSet.command)
end
for i = 1, World_GetPlayerCount() do
local player = World_GetPlayerAt(i)
local resource_set = g_ResourceSet[Player_GetRace(player)]
Player_ApplyResourceSet(player, resource_set)
for key, resource in ipairs(g_ResourceSet.income_modifier) do
local _value = resource.value
if resource.math_type == MUT_Addition then
_value = _value / (60 * 8)
end
Modify_PlayerResourceRate(player, resource.type, _value, resource.math_type)
end
end
end
Scar_AddInit(CustomStartingResources_Init)
|