Cpt Black
Posts: 17
Joined: 10/17/2018 Status: offline
|
I was trying to figure out some odd behavior on the Russian side of this scenario. Specifically the attack on the AEGIS Ashore site. The first script that activates the inactive mission is straightforward and works fine. Then there is this. if not ScenEdit_GetSideIsHuman('Russia') then
for i=1,9 do
if ScenEdit_GetUnit({Side='Russia', Name="Cheglokov #"..i,}) ~= nil then
if not ScenEdit_AssignUnitToMission("Cheglokov #"..i, "AEGIS Ashore Strike") then
end
end
end
for i=1,15 do
if ScenEdit_GetUnit({Side='Russia', Name="Drozdov #"..i,}) ~= nil then
if not ScenEdit_AssignUnitToMission("Drozdov #"..i, "AEGIS Ashore Strike") then
end
end
end
end What this is doing assigning units from one mission to the other. Units named "Cheglokov" are assigned, one by one, to the now active mission. They see they now have a mission and execute it. They fire their missiles (they are already in range). This seems to happen within the script loop (for i=1,9). Nothing is done except the missiles are fired to the target, no other mission logic appears to be applied at this time (even automatically programming the missiles in a "spread".) Each unit, most likely because it's still in this scripting loop, doesn't recognize the other unit's existence. The second loop begins. Because, at the beginning of the loop there are now 9 other units on the mission, the behavior is completely different. The other 9 units have already fired 108 missiles at this poor SAM site. Being thrifty Russians the second group decides to wait on the results and not waste their missiles. This may just be normal mission logic, see below. The unexpected results are: 1. The first 9 firing units thinks they are alone at the time the logic to shoot fires because they are still in the scripting loop. They unload all their missiles on a direct bearing to the target. No spread, just 108 missiles straight at the target. It is difficult, but not impossible to stop. 2. The second group of bombers don't fire at all. Because the mission target is still valid but the salvo requirement has been met, they proceed to the target. 15 fat, lumbering bombers wander right over the battlefield and don't stand a chance even though they have a payload with a 1600 mile standoff range. Now for the truly bizarre. When you pause the scenario, after the mission is active, and add in the units you would think they would all fire. But they don't. The first group executes a flawless attack. They fire off all their missiles, programming a proper spread that will be nearly impossible to stop. The second group, once again, turns to the target and begins it's march to oblivion at the hands of the NATO fighters. The units are different types of aircraft with different types of weapons. However, the range and WRA settings on the weapons are identical. It's got to be some weird interaction between the scripting loop in LUA and the logic inside the mission editor.
|