Lineaxe Posted September 13, 2021 Share Posted September 13, 2021 (edited) 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 September 13, 2021 by Lineaxe Link to comment Share on other sites More sharing options...
Grimes Posted September 13, 2021 Share Posted September 13, 2021 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 Server, Scripting 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 More sharing options...
Lineaxe Posted September 13, 2021 Author Share Posted September 13, 2021 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 More sharing options...
Lineaxe Posted November 14, 2021 Author Share Posted November 14, 2021 I found that the Rats are too hard to predict and control & they affect the resources at each airfield. So no luck with creating any useful classes up in lua ... Link to comment Share on other sites More sharing options...
Das Feuer Posted November 16, 2021 Share Posted November 16, 2021 (edited) 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 November 16, 2021 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 More sharing options...
boyington2 Posted November 29, 2021 Share Posted November 29, 2021 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 More sharing options...
Recommended Posts