Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Set fuel level

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Air / Naval Operations >> Mods and Scenarios >> Lua Legion >> Set fuel level Page: [1]
Login
Message << Older Topic   Newer Topic >>
Set fuel level - 2/14/2019 5:55:24 PM   
orca

 

Posts: 368
Joined: 11/6/2013
Status: offline
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
Post #: 1
RE: Set fuel level - 2/14/2019 6:30:33 PM   
Whicker

 

Posts: 495
Joined: 6/20/2018
Status: online
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

(in reply to orca)
Post #: 2
RE: Set fuel level - 2/14/2019 7:06:26 PM   
orca

 

Posts: 368
Joined: 11/6/2013
Status: offline
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


< Message edited by orca -- 2/14/2019 7:14:21 PM >

(in reply to Whicker)
Post #: 3
RE: Set fuel level - 2/14/2019 8:57:20 PM   
Primarchx


Posts: 2904
Joined: 1/20/2013
Status: offline
Lots of accessible fields are read-only, which I suspect is the case with max fuel for a given fuel type.

(in reply to orca)
Post #: 4
RE: Set fuel level - 2/15/2019 1:08:21 AM   
KnightHawk75

 

Posts: 113
Joined: 11/15/2018
Status: offline
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=�

< Message edited by KnightHawk75 -- 2/15/2019 1:09:20 AM >

(in reply to Primarchx)
Post #: 5
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Air / Naval Operations >> Mods and Scenarios >> Lua Legion >> Set fuel level Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.094