Hey all, so i haven't touched Lua for around 13 years (Zygor's for WoW) and i have only been poking around MOOSE for a few days so please bare with my noobish questions as i have a feeling that the problems i have are probably very simple for some people to solve.
So I'm building a very simple CV training mission to practice some Case III Manoeuvre's and timings (for myself) with some AI traffic to actually have stacks waiting to land, Im looking to have the AI have a delayed start, I can do this with flags in the ME but not with MOOSE (yet) this is just so i can stagger the first spawn on the full deck and not have them block each other, then they are to proceed to basic waypoints defined in the ME until they land again, once landed they will despawn/respawn with a delay and then run the same thing again.
I'm having luck using :InitRepeatOnEngineShutDown however in a flight of two when the lead plane lands and shuts down it respawns both planes immediately and usually with the 2nd still in the air on final.
The extremely basic line I'm using is;
Spawn_ASM1 = SPAWN:New( "ASM1" ):InitKeepUnitNames():InitLimit(2, 0):InitRepeatOnEngineShutDown():Spawn()
This works, they spawn, take-off, land, park and respawn, but the timing is all instant, this will cause a problem with the 10+ aircraft that will be running on this at some point as having a flooded deck of things appearing and disappearing into different places, especially when the rear starboard elevator spawns use the front cats instead of 3 and 4, I'm already imagining the traffic jams on the deck.
So now for my questions;
- Is there a way to initiate a delay after the engine shuts down but before respawn? or when the plane respawns but before it starts? (similar to ME uncontrolled method)
I'm guessing that :SpawnScheduled() along with it's delay functions can do this but after hours of headache induced trying i can't find the correct Syntax for it to work, whenever i add it to the line, the line no longer works, i'm guessing this is a conflict with one of the other :Init parameters. (again it's been 13 years since I've even looked at anything Lua)
- Is there a way in MOOSE to have all of a group landed and shutdown before the group respawns?
The only way i can see to do this (with my experience) is in the ME to trigger the respawn script from a flag that is activated when the last plane of the group has an altitude of lower than 'x' value (74(3) for cv i think) and a speed of <1 with a 'Time Since Flag' to delay the script long enough for both planes to land and shutdown before respawning however i think that would conflict with :InitRepeatOnEngineShutDown and also it doesn't seem to work with the above line as the script would need to be at the mission start in order to clone the group and to my knowledge when that happens the ME triggers don't respond to the new clone group as the group technically never spawned, i know there is a way to call the groups new name and then have that assigned to a trigger in MOOSE but i haven't gotten that far into it yet.
- :OnSpawnGroup, any help, greatly appreciated.
So i have been looking and reading through GitHub as well as posts here and it seems this little guy is a versatile little beast but i have 0 idea how he works, i am assuming it could fix my MOOSE delayed start problem as i believe i could start my planes Late Activated in ME so MOOSE can clone them and then use :OnSpawnGroup to set them into the UnControlled state (purely guessing here) and then time their starts from a control flag that would deactivate after around 15 minutes, enough time for everyone to start, taxi and take-off and then have the respawn script set to only work if that flag is false, this, in my mind anyway, would mean that the respawn script could not interfere with the initial spawn/delayed start and would then only come into play after that 15 minute flag is deactivated and set to false.
Anyway it's been a long few days of trying to learn something new and i'm probably over-complicating things so any help from you guys would be greatly received, i can add Miz and Lua files if needed but the 1 line of code is here and the mission is 1 cv and 2 f18's so nothing special so far, still early days
Thanks in advance.