I’m currently working on a new, smoother, version of the scripts for the fuel and ammunition management in my mod that would be centered in a single ship controlling everything rather than having each ship update its own custom code. The idea is to set up a few tables to get a table of ammunition and fuel for every affected ship (strike crafts) controlled by the player and update the whole thing with a lot less loops and functions than if everything had to be done individually. If I get something to work reliably, it could be a better and simpler way to implement these features into future mods.
I’m pretty sure that the tables as managed in LUA would allow the whole thing, but I’m currently having an issue: the CustomGroup argument seems to only contain the relevant ship when you reach the Update part of the custom code, and the whole idea behind the new version would be to eliminate this Update part in my ships. I would want to do either one of these two options:
- Being able to make and refresh the individual selection of every ship from a SobGroup. For example, if I had 5 flights of Interceptors, I would want to be able, after making a SobGroup with all the Interceptors, to make five SobGroups with one of the flights in each. And, of course, update this every cycle so I could get for every run of the Update, that would come from the Mothership, the individual SobGroups.
- Have each relevant unit create its own SobGroup with only itself included in the SobGroup, in the Create part of the custom code.
I tried creating yet another SobGroup including all the Interceptors that have already been listed and then removing said SobGroup from a SobGroup including all the Interceptors, period. However, the SobGroup_FillShipsByType function doesn’t include the docked ships, which prevents the system from working properly.
Any ideas for an algorithm I could use to solve that problem? Thanks!