"A better AI landing script that waits for the flyer to land before forcing everybody out, as well as a flyerpath toggle to stop double landings. It's only simple and works for a singular region, but can easily be adapted to use multiple regions and paths"
Follow the tutorial found here: https://gametoast.com/viewtopic.php?f=27&t=32640 then use the following code instead of the tutorial's
Happy modding
Code: Select all
function LandingStuff()
ActivateRegion("uwing-land")
local isInRegion
OnEnterRegionTeam(
function(region, character)
local characterVehicle = GetCharacterVehicle(character)
if GetEntityClass(characterVehicle) == FindEntityClass("all_fly_uwing_sc") then -- checks if the characters vehicle matches a specific class
local boardingShip = characterVehicle
EntityFlyerLand(boardingShip) -- forces the flyer to land
end
end,
"uwing-land", 1 -- region name and entering team used for the check
)
OnCharacterLandedFlyerClass(
function (character, flyer)
if IsCharacterInRegion(character, "uwing-land") then -- checks the vehicle pilot character is in the required region
SetProperty(flyer, "DisableTime", 0.05) -- forces everybody out with no effect played
isInRegion = 1
end
end,
"all_fly_uwing_sc" -- the flyer class (odf) name
)
OnObjectKillClass(
function(object, killer)
if isInRegion == 1 then
EnableFlyerPath("landingpath", 1) -- re-enables the landing flyer path upon object death
isInRegion = 0
end
end,
"all_fly_uwing_sc" -- the flyer class (odf) name
)
end