The scripting mechanism basically functions, I can create a script for a unit, load it and then watch the unit process through the steps sequentially as directed. This involves generating, executing and deleting events for the unit as it processes.
Not too difficult.
Now here is the interesting thing: I have scripts for 7 units, for friendlies and 3 enemies. Each individual script executes correctly when loaded by itself, but if I load several scripts, ONLY the first loaded executes. It does not matter what order I choose to load them, the first, and ONLY the first, whichever of the 7 units I picked, will actually execute its script. The thing is, all the kick-off events for all units are generated. They don't execute. I can manually execute the code that should be triggered by the seven events, and all units will start moving. But let it run by itself, and rely in the events executing, and ONLY the first executes. The others sit idly waiting, with active turned on.
All events have unique names.
All events have their own triggers (uniquely named)
All events have their own actions (uniquely named)
Here is a call to the Script function:
Code: Select all
Script({
[1] = Ground.Order({day=1, step=1, orderType='ATTACK', side = 'USA',
name = '73rd Batallion 2nd Company 1st Platoon (M2A3 Bradley AFV x 4)',
to_rel="yes", to_lat=0.35, to_lon=0, }) ,
[2] = Ground.Order({day=1, step=2, orderType='MOVE', side = 'USA',
name = '73rd Batallion 2nd Company 1st Platoon (M2A3 Bradley AFV x 4)',
to_rel="yes", to_lat=0.70, to_lon=-0.35, }) ,
})
The script function creates a startStep event, along with triggers and conditions from the data in element 1, and pushes the other elements into the Key Value store, for later retrieval. The startStep event will gerneates the subsequent events for the specific order. When the last event for the step executes an advance script function, it calls the advanceScript function that determine if there are more steps and generates the next start Step function call, as needed. The system works flawlessly with a single unit, and each of my test units all function correctly.
If I test with loading scripts for multiple units, while events, trigger,s and actions are generated for all the units, only the first is executed.
I'm trying to brainstorm what could cause this behavior.
Right now, I am clueless.[&:]