Jump to content

in LUA get airport resources for jet fuel level


Lineaxe

Recommended Posts

Has anyone discovered a way in LUA to search an airports resources for jet fuel level ,etc? I would like to monitor the level and send in jets filled with fuel to refill it when needed . I know resource management does this a different way as well , I am hoping to add this feature into my mission. That is , where it becomes necessary to protect the Jets supplying the fuel into a chain of Airports otherwise they starve of fuel and can't launch anything until another Jet can land to refuel it. 


Edited by Lineaxe
Link to comment
Share on other sites

Only by manually trying to keep track of things. If you know the value the fuel starts at you can use Unit.getFuel() on take-off events along with Unit.getDesc().fuelMassMax to know the amount of fuel they took off with. Basically multiply Unit.getFuel() by Unit.getDesc().fuelMassMax to get the actual amount they took with and subtract it from the known value. Adding the fuel back in is tricky because you will just have to experiment and work out the conditions for whenever players add resources back in. TBH I haven't messed with it in a while so I don't know the specifics, but it should work when they despawn. If you did it with a landing event it might be close enough, though I think there would be some error involved anyway. 

 

Really wish the answer was Warehouse.getByName('whatever'):getFuel() but that doesn't exist. 

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

I wonder if we can massage the data that would come from a function that calculates that into a Warehouse.getByName('whatever'):getEstimateFuel() for someone else to build upon and maybe even refine .

I will fiddle with creating up a function that accepts warehouse name , refueling jet name, as an input parameters and spits out multiple return values that could be used . It will go into ChopU missions and will be well commented out.  

Thanks for that info. I think it is good enuf to send out refueling planes. 

Link to comment
Share on other sites

  • 2 months later...

Yup there is a way,
we do it in XSAF you are welcome to join as and check out the server.

We also do it with ammo and airframes so might be the thing you are looking for. But I'm not a dev so I can't really tell you how it's done, so if you are interested please check as out. 

Cheers,

Das.

 


Edited by Das Feuer

                                                  Looking For A Real Dynamic Campaign?

                                       Come And Check Out XSAF!

           MAKE SURE TO READ THE RULES AND PERSONALY I RECOMMEND CHECKING OUT SOME VIDS ON YOUTUBE.

                                                                Growling Sidewinder's video               Natty Ice's video                              

Link to comment
Share on other sites

  • 2 weeks later...
On 11/16/2021 at 2:34 PM, Das Feuer said:

Yup there is a way,
we do it in XSAF you are welcome to join as and check out the server.

We also do it with ammo and airframes so might be the thing you are looking for. But I'm not a dev so I can't really tell you how it's done, so if you are interested please check as out. 

Cheers,

Das.

 

 

That's really nice that someone finally found a trick to do it ! but after a short discussion with Pravus(the brain behind the XSAF fantastic environment), he doesn't want to share how it did it. I totally understand this (it took time to find a solution) but some help will be really appreciated

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...