rassy7 Posted June 17, 2018 Posted June 17, 2018 Working out a proof of concept, template mission, trying to make troops unboard a helicopter when it lands in a zone. Everything works except the speed and altitude conditions. For some reason, the game believes the helicopter is constantly flying slower and lower than it is and troops unboard while helicopter is still in the air. How have I messed this up? Thanks for your help! LUA and MIZ file are attached and code is here: DEBUG = GROUP:FindByName("DEBUG") -- Cargo Creation and Loading InfantryGroup = GROUP:FindByName("Assault Troops") InfantryCargo = CARGO_GROUP:New(InfantryGroup, "Assault Troops", "Assault Alpha", 2000) CargoCarrier = UNIT:FindByName("Assault Helo 1") InfantryCargo:Load(CargoCarrier) -- Zone Creation LZ = ZONE:New("LZ") -- Create Variables for Helo Speed and Altitude HeloSpeed = UNIT:FindByName("Assault Helo 1"):GetVelocityKMH() HeloAlt = UNIT:FindByName("Assault Helo 1"):GetAltitude() -- Zone, Speed and Altitude Checks ZoneCheck = SCHEDULER:New(nil, function() if GROUP:FindByName("Assault Helos"):IsCompletelyInZone(LZ) then DEBUG:MessageToAll("Helo in Zone", 5, "DEBUG") end end, {}, 1, 10) Gauges = SCHEDULER:New(nil, function() if (HeloSpeed < 2) then DEBUG:MessageToAll("Helo Slow Speed", 5, "DEBUG") end if (HeloSpeed > 2) then DEBUG:MessageToAll("Helo High Speed", 5, "DEBUG") end if (HeloAlt < 75) then DEBUG:MessageToAll("Helo Low Alt", 5, "DEBUG") end if (HeloAlt > 75) then DEBUG:MessageToAll("Helo High Alt", 5, "DEBUG") end if (HeloSpeed < 2) and (HeloAlt < 75) then DEBUG:MessageToAll("HELO LOW AND SLOW", 5, "DEBUG") end if (HeloSpeed > 2) and (HeloAlt > 75) then DEBUG:MessageToAll("HELO HIGH AND FAST", 5, "DEBUG") end end, {}, 1, 10) UnboardCheck = SCHEDULER:New(nil, function() if GROUP:FindByName("Assault Helos"):IsCompletelyInZone(LZ) and (HeloSpeed < 2) and (HeloAlt < 75) then -- This will Unboard the Cargo from the Carrier. InfantryCargo:UnBoard() DEBUG:MessageToAll("UNBOARD", 5, "DEBUG") UnboardCheck:Stop() DEBUG:MessageToAll("Schedule Stopped", 5, "DEBUG") end end, {}, 1, 10) Cargo Unboarding Helo.mizCargo Unboarding Helo.lua The State Military (MAG 13) [sIGPIC][/sIGPIC] SHEEP WE-01 AV-8B BuNo 164553 VMA-214 Col J. “Poe” Rasmussen http://www.statelyfe.com Specs: Gigabyte Z390 Pro Wifi; i9-9900K; EVGA 2080 Ti Black; 32GB Corsair Vengeance LPX DDR4; Samsung 970 EVO Series M.2 SSD; WIN10; ASUS VG248QE; CV-1 and Index Modules: A-10C; AV8B; CA; FC3; F-5; F-14; F-18; F-86; HAWK; L-39; P-51; UH1H; NTTR; Normandy; Persian Gulf
Delta99 Posted June 17, 2018 Posted June 17, 2018 You are only querying the speed and altitude ONCE. You need to get those every time your scheduler runs. Working out a proof of concept, template mission, trying to make troops unboard a helicopter when it lands in a zone. Everything works except the speed and altitude conditions. For some reason, the game believes the helicopter is constantly flying slower and lower than it is and troops unboard while helicopter is still in the air. How have I messed this up? Thanks for your help! LUA and MIZ file are attached and code is here: DEBUG = GROUP:FindByName("DEBUG") -- Cargo Creation and Loading InfantryGroup = GROUP:FindByName("Assault Troops") InfantryCargo = CARGO_GROUP:New(InfantryGroup, "Assault Troops", "Assault Alpha", 2000) CargoCarrier = UNIT:FindByName("Assault Helo 1") InfantryCargo:Load(CargoCarrier) -- Zone Creation LZ = ZONE:New("LZ") -- Create Variables for Helo Speed and Altitude HeloSpeed = UNIT:FindByName("Assault Helo 1"):GetVelocityKMH() HeloAlt = UNIT:FindByName("Assault Helo 1"):GetAltitude() -- Zone, Speed and Altitude Checks ZoneCheck = SCHEDULER:New(nil, function() if GROUP:FindByName("Assault Helos"):IsCompletelyInZone(LZ) then DEBUG:MessageToAll("Helo in Zone", 5, "DEBUG") end end, {}, 1, 10) Gauges = SCHEDULER:New(nil, function() if (HeloSpeed < 2) then DEBUG:MessageToAll("Helo Slow Speed", 5, "DEBUG") end if (HeloSpeed > 2) then DEBUG:MessageToAll("Helo High Speed", 5, "DEBUG") end if (HeloAlt < 75) then DEBUG:MessageToAll("Helo Low Alt", 5, "DEBUG") end if (HeloAlt > 75) then DEBUG:MessageToAll("Helo High Alt", 5, "DEBUG") end if (HeloSpeed < 2) and (HeloAlt < 75) then DEBUG:MessageToAll("HELO LOW AND SLOW", 5, "DEBUG") end if (HeloSpeed > 2) and (HeloAlt > 75) then DEBUG:MessageToAll("HELO HIGH AND FAST", 5, "DEBUG") end end, {}, 1, 10) UnboardCheck = SCHEDULER:New(nil, function() if GROUP:FindByName("Assault Helos"):IsCompletelyInZone(LZ) and (HeloSpeed < 2) and (HeloAlt < 75) then -- This will Unboard the Cargo from the Carrier. InfantryCargo:UnBoard() DEBUG:MessageToAll("UNBOARD", 5, "DEBUG") UnboardCheck:Stop() DEBUG:MessageToAll("Schedule Stopped", 5, "DEBUG") end end, {}, 1, 10) My Missions: Valley Patrol Mission :: Valley Escort Mission :: A2A Engagements
rassy7 Posted June 17, 2018 Author Posted June 17, 2018 You are only querying the speed and altitude ONCE. You need to get those every time your scheduler runs.Oh my gosh. You're right. I'm an idiot. The actual number is never changing. Ugh. Thanks! The State Military (MAG 13) [sIGPIC][/sIGPIC] SHEEP WE-01 AV-8B BuNo 164553 VMA-214 Col J. “Poe” Rasmussen http://www.statelyfe.com Specs: Gigabyte Z390 Pro Wifi; i9-9900K; EVGA 2080 Ti Black; 32GB Corsair Vengeance LPX DDR4; Samsung 970 EVO Series M.2 SSD; WIN10; ASUS VG248QE; CV-1 and Index Modules: A-10C; AV8B; CA; FC3; F-5; F-14; F-18; F-86; HAWK; L-39; P-51; UH1H; NTTR; Normandy; Persian Gulf
Recommended Posts