Page 1 of 1

LUA = alter fuel & ammo ?

Posted: Mon Nov 08, 2021 4:03 am
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.

Re: LUA = alter fuel & ammo ?

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

Capture d’écran 2021-11-08 091414.jpg
Capture d’écran 2021-11-08 091414.jpg (25.77 KiB) Viewed 2341 times

Re: LUA = alter fuel & ammo ?

Posted: Mon Nov 08, 2021 8:27 am
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?

Re: LUA = alter fuel & ammo ?

Posted: Mon Nov 08, 2021 8:30 am
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 2334 times

Re: LUA = alter fuel & ammo ?

Posted: Mon Nov 08, 2021 8:57 am
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)

Re: LUA = alter fuel & ammo ?

Posted: Mon Nov 08, 2021 9:16 am
by terminator
I don’t think I understood what you wanted...

Re: LUA = alter fuel & ammo ?

Posted: Mon Nov 08, 2021 9:25 am
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 2322 times

Re: LUA = alter fuel & ammo ?

Posted: Mon Nov 08, 2021 9:46 am
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 2319 times

Re: LUA = alter fuel & ammo ?

Posted: Tue Nov 09, 2021 3:15 am
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.

Re: LUA = alter fuel & ammo ?

Posted: Tue Nov 09, 2021 7:32 am
by terminator
Maybe something still experimental ?

Re: LUA = alter fuel & ammo ?

Posted: Tue Nov 09, 2021 8:55 am
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.