Not sure how much Lua you’ve done and remember I’m an old dog as well – happy birthday btw.
You should have a text editor, I use Notepad++. Its free and makes things a bit easier. I keep a separate file with all the lua script for each of my scenarios. At least I lose them in an organized sort of way…
This site really helps:
Lua Docs
First thing you need to do is identify the unit: Select the unit, right click/scenario editor/copy unit ID to clipboard. (you can do the same with Ctl+C)
Paste this value into your text editor, you have the name and the GUID. You only need one of them so use the GUID as it is guaranteed to be unique.
{name='HMS Northumberland (F238)', guid='XMJRWB-0HM45FODO2HGL'}
Next make your script
Local u = ScenEdit_GetUnit({guid='XMJRWB-0HM45FODO2HGL'})
So this identifies the unit you want to modify, the local bit is to make sure this function doesn’t linger in the memory of the game file (I think…)
Local fuel = u.fuel
This makes a value for the fuel you’re going to modify. Each fuel type has a code and unhelpfully I cannot find the table anymore but it is in one of the threads in
Lua Legion:
So we know that HMS Northumberland uses Diesel so that is 3001, and her max is 800 tons so lets cut that in half (need to experiment to get the values right:
Fuel[3001].current = 400000
Then we apply the fuel to the unit:
u.fuel = fuel
Open up your Lua Console in game add the script and hit run
local u = ScenEdit_GetUnit({guid='XMJRWB-0HM45FODO2HGL'})
local fuel = u.fuel
fuel[3001].current = 400000
u.fuel = fuel
Change up the GUID, fuel type and level as you need to get all your ships.
B
