Set fuel level (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion



Message


orca -> Set fuel level (2/14/2019 5:55:24 PM)

What is the lua script to set current and max fuel levels for a unit?

Iím attempting to set the max and current fuel level of an aircraft. I hope to be able to make these values to be greater than the regular fuel capacity of the aircraft as stated in the db but canít get it to work.

Thanks




Whicker -> RE: Set fuel level (2/14/2019 6:30:33 PM)

heres one way - I don't think you can get it more than max though. You can only set current.
Fuels have a type. Careful with that.

local a = ScenEdit_GetUnit({guid='1298e86b-a6a8-4bb0-bf94-dd77c6559eaa'})
local fuel = a.fuel
print(fuel) --before change

fuel[2001].current = fuel[2001].max*math.random(600, 800)/1000
a.fuel = fuel
print(fuel) --after change




orca -> RE: Set fuel level (2/14/2019 7:06:26 PM)

Thanks for the reply. In the command lua documentation it talks about the ďmax number-How much can be stored for the typeĒ in regard to the fuel. This is why I was thinking it may be possible to edit this to be higher than in the default db max number.


quote:

ORIGINAL: Whicker

heres one way - I don't think you can get it more than max though. You can only set current.
Fuels have a type. Careful with that.

local a = ScenEdit_GetUnit({guid='1298e86b-a6a8-4bb0-bf94-dd77c6559eaa'})
local fuel = a.fuel
print(fuel) --before change

fuel[2001].current = fuel[2001].max*math.random(600, 800)/1000
a.fuel = fuel
print(fuel) --after change




Primarchx -> RE: Set fuel level (2/14/2019 8:57:20 PM)

Lots of accessible fields are read-only, which I suspect is the case with max fuel for a given fuel type.




KnightHawk75 -> RE: Set fuel level (2/15/2019 1:08:21 AM)

Be aware changes may be on the way so that we can actually fill up all the fuel tanks when there are multiple.

It not so much a read only issue, it's a can't force it to fill up the correct tank of same type usually when more than 1 exists.

http://www.matrixgames.com/forums/tm.asp?m=4577588&mpage=1&key=�




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
1.953125E-02