Assigning Units Based On Side Posture
Posted: Sat May 01, 2021 10:40 am
Hi folks I wonder if you might be able to help me figure something out, apologies for the long post but its worth explaining what am trying to achieve.
I have a scenario where there are 5 sides, NATO (Always Players Side), WP, Libyia, Syria , Algeria, so I have the scenario set to randomly on each load , NATO and the WP will always be hostile to each other, Libyia , Syria, Algeria declare for NATO, in which case the units deploy to the players side, neutral where they are removed from the scenario or they are allied to the WP where they transfer to the WP side.
So any airbases that were Libyian ect are now on the WP side.
As the scenario progresses there are reinforcements for the WP side that are Soviet forces, (Think 6th Guards Aviation Regiment ect deploying from far east to the med), in the case of further air reinforcements, I want to know if theres a way I can script CMO to check a side posture and allocate the forces dependent on that, so for example
local a = Side Posture Libyia to WP
local b = Side Posture Algeria to WP
local c = Side Posture Syria to WP
if a= F then
ScenEdit_HostUnitToParent({HostedUnitNameOrID='Aircraft #1 ',SelectedHostNameOrID='Benghazi'}
ScenEdit_AssignUnitToMission('Aircraft', 'Benghazi Air Intercept Mission XXX')
This would mean that if WP and Lib are friendly that aircraft will transfer to the Benghazi
elseif b= F Then
ScenEdit_HostUnitToParent({HostedUnitNameOrID='Aircraft #1 ',SelectedHostNameOrID='Sidi Ahmed Airbasei'})
ScenEdit_AssignUnitToMission('Aircraft', 'Sidi Ahmed Airbasei XXX')
elseif c = F Then
ScenEdit_HostUnitToParent({HostedUnitNameOrID='Aircraft #1 ',SelectedHostNameOrID='Latika'})
ScenEdit_AssignUnitToMission('Aircraft', 'Latika XXX')
end
And so on and so forth, so in effect the WP reinforcements can only transfer closer to allied countries, but because of the random nature of the allies in each run through I dont know which airfields will be open to the WP side.
So the script above is written very high level as I think what I want to achieve not in LUA language, so my question is...
Would a similar script work?
And how do I define what local a/b/c is? Is it a case of writing sometihng like
ScenEdit_GetSidePosture('Libyia', 'WP')
That according to the documentation will return F, H, N, A
Oh and my last question is will this mean that it runs through the list of countries Libyia, Syria, Algeria in a set order?
My knowledge is limited in LUA , but I am trying to learn so any explanation needs to be at the most base level lol
Kind Regards All
Butch
I have a scenario where there are 5 sides, NATO (Always Players Side), WP, Libyia, Syria , Algeria, so I have the scenario set to randomly on each load , NATO and the WP will always be hostile to each other, Libyia , Syria, Algeria declare for NATO, in which case the units deploy to the players side, neutral where they are removed from the scenario or they are allied to the WP where they transfer to the WP side.
So any airbases that were Libyian ect are now on the WP side.
As the scenario progresses there are reinforcements for the WP side that are Soviet forces, (Think 6th Guards Aviation Regiment ect deploying from far east to the med), in the case of further air reinforcements, I want to know if theres a way I can script CMO to check a side posture and allocate the forces dependent on that, so for example
local a = Side Posture Libyia to WP
local b = Side Posture Algeria to WP
local c = Side Posture Syria to WP
if a= F then
ScenEdit_HostUnitToParent({HostedUnitNameOrID='Aircraft #1 ',SelectedHostNameOrID='Benghazi'}
ScenEdit_AssignUnitToMission('Aircraft', 'Benghazi Air Intercept Mission XXX')
This would mean that if WP and Lib are friendly that aircraft will transfer to the Benghazi
elseif b= F Then
ScenEdit_HostUnitToParent({HostedUnitNameOrID='Aircraft #1 ',SelectedHostNameOrID='Sidi Ahmed Airbasei'})
ScenEdit_AssignUnitToMission('Aircraft', 'Sidi Ahmed Airbasei XXX')
elseif c = F Then
ScenEdit_HostUnitToParent({HostedUnitNameOrID='Aircraft #1 ',SelectedHostNameOrID='Latika'})
ScenEdit_AssignUnitToMission('Aircraft', 'Latika XXX')
end
And so on and so forth, so in effect the WP reinforcements can only transfer closer to allied countries, but because of the random nature of the allies in each run through I dont know which airfields will be open to the WP side.
So the script above is written very high level as I think what I want to achieve not in LUA language, so my question is...
Would a similar script work?
And how do I define what local a/b/c is? Is it a case of writing sometihng like
ScenEdit_GetSidePosture('Libyia', 'WP')
That according to the documentation will return F, H, N, A
Oh and my last question is will this mean that it runs through the list of countries Libyia, Syria, Algeria in a set order?
My knowledge is limited in LUA , but I am trying to learn so any explanation needs to be at the most base level lol
Kind Regards All
Butch