LUA = alter fuel & ammo ?

A forum to discuss custom scenarios, campaigns and modding in general.

Moderator: Panzer Corps 2 Moderators

Post Reply
NETSCAPE
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 127
Joined: Wed Apr 15, 2020 8:43 pm

LUA = alter fuel & ammo ?

Post by NETSCAPE »

I can set a max value for both ammo and fuel pools in the mission editor as well as how much per turn each player gets. Typically all vanilla and 3rd party missions leave these fields blank and magically the Reich has endless amounts of supplies... I don't want that in a certain campaign/mod I am working on. :)

But I can't seem to find any examples of a LUA script altering either of these values.

All sorts of interesting stuff could happen to your supply depots or supply lines if some simple LUA scripts could be provided by big brained modders or the devs themselves... for example, you could delete the players entire supply pool if the enemy kills your supply depot/occupies the hex. ...you could "capture" enemy fuel. Your ammo/fuel per turn could be increased or decreased based on strategic hexes being taken/lost. ect ect.

Another question:
Does anyone know the logic behind what units get ammo/fuel first? how is the order determined? for example, in my missions, sometimes I will be forcing the player to stop an advance and to regroup (or retreat) to build up ammo/fuel again. BUT - there might be some units that you'd want to have ammo/fuel as a priority over others... is there any way to overcome this?

Thanks for any help.
terminator
Field Marshal - Gustav
Field Marshal - Gustav
Posts: 6093
Joined: Mon Aug 15, 2011 12:48 pm
Location: the land of freedom

Re: LUA = alter fuel & ammo ?

Post by terminator »

Rzhev1942 ?

Capture d’écran 2021-11-08 091414.jpg
Capture d’écran 2021-11-08 091414.jpg (25.77 KiB) Viewed 1639 times
NETSCAPE
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 127
Joined: Wed Apr 15, 2020 8:43 pm

Re: LUA = alter fuel & ammo ?

Post by NETSCAPE »

terminator wrote: Mon Nov 08, 2021 8:15 am Rzhev1942 ?


Capture d’écran 2021-11-08 091414.jpg
unit.ammo or unit.fuel would imply it's for the unit itself not the players main ammo/unit pool, I think?
terminator
Field Marshal - Gustav
Field Marshal - Gustav
Posts: 6093
Joined: Mon Aug 15, 2011 12:48 pm
Location: the land of freedom

Re: LUA = alter fuel & ammo ?

Post by terminator »

This is valid for all units of the player placed in the defined area as "zero_area" :

Capture d’écran (581).jpg
Capture d’écran (581).jpg (821.72 KiB) Viewed 1632 times
NETSCAPE
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 127
Joined: Wed Apr 15, 2020 8:43 pm

Re: LUA = alter fuel & ammo ?

Post by NETSCAPE »

The example you gave was for units, checking the LUA manual under the Player section I found these, so it should be possible:

Player
- (enum Player::Control) control
- (FPlayerColor) custom_color --read-only
- (int) side_id
- (vector<Faction>) factions
- (vector<Faction>) core_factions
- (int) prestige
- (int) fuel
- (int) ammo

- (int) elites
- (bool) infinite_fuel
- (bool) infinite_ammo
- (bool) infinite_elites
- (bool) deployment_phase
- (int) prestige_income
- (int) fuel_income
- (int) ammo_income

- (int) elites_income
- (int) core_slots
- (int) aux_slots
- (int) max_core_slots
- (int) max_aux_slots
- (int) selected_unit
- (string) custom_purchase_list
- (vector<int>) weather_forecast_chances
- (vector<WeatherForecast>) weather_forecast --read-only
- (bool) iseeyou
+ void AddTransport(UnitType,int)
+ void Victory(int)
+ vector<Unit> GetDeploymentList(void)
terminator
Field Marshal - Gustav
Field Marshal - Gustav
Posts: 6093
Joined: Mon Aug 15, 2011 12:48 pm
Location: the land of freedom

Re: LUA = alter fuel & ammo ?

Post by terminator »

I don’t think I understood what you wanted...
NETSCAPE
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 127
Joined: Wed Apr 15, 2020 8:43 pm

Re: LUA = alter fuel & ammo ?

Post by NETSCAPE »

terminator wrote: Mon Nov 08, 2021 9:16 am I don’t think I understood what you wanted...
The players ammo and fuel pool, which gets X amount per turn set via the mission editor. I'd like to add, subtract from main pools, and/or change the amount per turn.
ammofuelui.png
ammofuelui.png (67.77 KiB) Viewed 1620 times
terminator
Field Marshal - Gustav
Field Marshal - Gustav
Posts: 6093
Joined: Mon Aug 15, 2011 12:48 pm
Location: the land of freedom

Re: LUA = alter fuel & ammo ?

Post by terminator »

NETSCAPE wrote: Mon Nov 08, 2021 9:25 am
terminator wrote: Mon Nov 08, 2021 9:16 am I don’t think I understood what you wanted...
The players ammo and fuel pool, which gets X amount per turn set via the mission editor. I'd like to add, subtract from main pools, and/or change the amount per turn.
ammofuelui.png
Is this an optional rule ? I don’t see these indicators playing the Rzhev 1942 scenario.

Rzhev.jpg
Rzhev.jpg (49.55 KiB) Viewed 1617 times
NETSCAPE
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 127
Joined: Wed Apr 15, 2020 8:43 pm

Re: LUA = alter fuel & ammo ?

Post by NETSCAPE »

Edit > Scenario Params > Players > under resource pools you will find empty fields for fuel, ammo and elite pool values as well as "per turn".

No one ever uses them. But if you actually enter in values the UI at the top will reflect the changes (like the picture previously I uploaded of a test mission)

Hopefully this makes sense... and why I want to adjust these values mid-game via LUA. ...would make for interesting gameplay.
terminator
Field Marshal - Gustav
Field Marshal - Gustav
Posts: 6093
Joined: Mon Aug 15, 2011 12:48 pm
Location: the land of freedom

Re: LUA = alter fuel & ammo ?

Post by terminator »

Maybe something still experimental ?
NETSCAPE
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 127
Joined: Wed Apr 15, 2020 8:43 pm

Re: LUA = alter fuel & ammo ?

Post by NETSCAPE »

no, actually the values punched in the editor all work. I was just testing them. It's interesting finding a balance between a surplus and drought of fuel. I achieved it to where, eventually, your whole force will run dry of fuel if you just drive max distance X amount of turns... then the player is forced to regroup for a few turns to regain fuel (or ammo if needed). It makes it feel like a new game almost.
Post Reply

Return to “Panzer Corps 2 Scenario Design”