boogabooga
Posts: 457
Joined: 7/18/2018 Status: offline
|
High spartan. Here is a LUA code to do weather-dependent bolters. It should be the action that fires if an aircraft enters a rectangle behind you A/C carrier with its RPs moving relative to said A/C carrier (bearing dependent). Makes carrier landing easy on a good day, but carrier ops basically get shut down by a "hurricane". So, yes, IMHO there is some value to this even in an "operational" context as it makes weather a factor to consider beyond just a sensor distorter. This code was only made possible by the LUA API's "hard" Unassign feature that came out a few patches ago. Code is even smart enough to remember what mission your planes were on :) Comment out the ScenEdit_MsgBox calls if they get annoying. Enjoy. local approachAC = UnitX()
math.randomseed( os.time() )
local weather = ScenEdit_GetWeather()
local bolterChance = 10+10*weather.seastate
local roll = math.random(0,100)
local missionTemp = approachAC.mission
if approachAC.condition == "On final approach" and roll <= bolterChance then
ScenEdit_SetUnit({side = approachAC.side, unitname = approachAC.name, unassign = true})
ScenEdit_SetUnit({side = approachAC.side, unitname = approachAC.name, RTB = true, mission = missionTemp.guid })
ScenEdit_MsgBox (approachAC.name.." waves off".." "..roll,1)
else
ScenEdit_MsgBox (approachAC.name.." good approach".." "..roll,1)
end
|