panzer corps 2 scenario: visualization of limited supplies
Posted: Wed Mar 19, 2025 10:58 am
Hello,
I'm preparing a scenario (Italian Alpine Corps retreat at Nikolajevka) and I'd like to add some limitations (ammo, fuel, elite replacements and prestige).
I solve the problem of the prestige starting with 0 prestige and improve it conquering Soviet flags.
For ammo, fuel and elite replacement limits, I add them in the scenario parameters, but I'm not able to write a LUA with the correct lines to visualize on the screen the amount remaining available during the battle (like air transports or navy).
I wrote this lua:
function OnMapStart()
local player = world:GetPlayer(0)
player.resource1_icon = "/Game/Gui/GameplayUI/hud_ammo_icon"
player.resource1 = AmmoPool
player.resource1_tooltip = NSLOCTEXT("common", "ammo.pool", "Ammo Pool")
UpdateAmmoPool()
player.resource2_icon = "/Game/Gui/GameplayUI/hud_fuel_pool_icon"
player.resource2 = FuelPool
player.resource2_tooltip = NSLOCTEXT("common", "fuel.pool", "Fuel Pool")
UpdateFuelPool()
player.resource3_icon = "/Game/Gui/GameplayUI/hud_elite_pool_icon"
player.resource3 = ElitePool
player.resource3_tooltip = NSLOCTEXT("common", "elite.pool", "ElitePool")
UpdateElitePool()
end
function elite_start()
local player = world:GetPlayer(0)
player.fuel = 10000
player.ammo = 700
player.elite = 70
end
function fuel_ammoupdate()
if world.round < 1 then return end
local player = world:GetPlayer(0)
player.resource1 = player.ammo
player.resource2 = player.fuel
player.resource2 = player.elite
end
I add the triggers, and only the ammo icon appears, but with the wrong amount (sometime 5, sometime 0).
Someone could help me?
Thanks
Silnac
I'm preparing a scenario (Italian Alpine Corps retreat at Nikolajevka) and I'd like to add some limitations (ammo, fuel, elite replacements and prestige).
I solve the problem of the prestige starting with 0 prestige and improve it conquering Soviet flags.
For ammo, fuel and elite replacement limits, I add them in the scenario parameters, but I'm not able to write a LUA with the correct lines to visualize on the screen the amount remaining available during the battle (like air transports or navy).
I wrote this lua:
function OnMapStart()
local player = world:GetPlayer(0)
player.resource1_icon = "/Game/Gui/GameplayUI/hud_ammo_icon"
player.resource1 = AmmoPool
player.resource1_tooltip = NSLOCTEXT("common", "ammo.pool", "Ammo Pool")
UpdateAmmoPool()
player.resource2_icon = "/Game/Gui/GameplayUI/hud_fuel_pool_icon"
player.resource2 = FuelPool
player.resource2_tooltip = NSLOCTEXT("common", "fuel.pool", "Fuel Pool")
UpdateFuelPool()
player.resource3_icon = "/Game/Gui/GameplayUI/hud_elite_pool_icon"
player.resource3 = ElitePool
player.resource3_tooltip = NSLOCTEXT("common", "elite.pool", "ElitePool")
UpdateElitePool()
end
function elite_start()
local player = world:GetPlayer(0)
player.fuel = 10000
player.ammo = 700
player.elite = 70
end
function fuel_ammoupdate()
if world.round < 1 then return end
local player = world:GetPlayer(0)
player.resource1 = player.ammo
player.resource2 = player.fuel
player.resource2 = player.elite
end
I add the triggers, and only the ammo icon appears, but with the wrong amount (sometime 5, sometime 0).
Someone could help me?
Thanks
Silnac