wolle Posted August 31, 2018 Posted August 31, 2018 Sorry if this has been asked before, but I couldn't find anything. Is it possible, using lua scripting, to determine whether a sling load cargo has been picked up or dropped off. E.g. is there a world.event for those events? Or any other method? Many thanks in advance for answers! [sIGPIC][/sIGPIC] Intel Core I7 4820K @4.3 GHz, Asus P9X79 motherboard, 16 GB RAM @ 933 MHz, NVidia GTX 1070 with 8 GB VRAM, Windows 10 Pro
feefifofum Posted August 31, 2018 Posted August 31, 2018 Quick & dirty I believe there is a trigger to check for cargo in a zone; if it's out of the zone it has been picked up, if it's in the next zone it has been dropped off. There's probably a more elegant solution in .lua land but depending on what you're going for that might do the trick. THE GEORGIAN WAR - OFFICIAL F-15C DLC
wolle Posted August 31, 2018 Author Posted August 31, 2018 Quick & dirty I believe there is a trigger to check for cargo in a zone; if it's out of the zone it has been picked up, if it's in the next zone it has been dropped off. There's probably a more elegant solution in .lua land but depending on what you're going for that might do the trick. Thanks, if you have some info on a solution in lua land, that would be what I'm looking for, because I'm scripting a dynamic mission with dynamically generated cargos... [sIGPIC][/sIGPIC] Intel Core I7 4820K @4.3 GHz, Asus P9X79 motherboard, 16 GB RAM @ 933 MHz, NVidia GTX 1070 with 8 GB VRAM, Windows 10 Pro
feefifofum Posted August 31, 2018 Posted August 31, 2018 Here ya go. https://wiki.hoggitworld.com/view/DCS_Class_Static_Object THE GEORGIAN WAR - OFFICIAL F-15C DLC
wolle Posted September 1, 2018 Author Posted September 1, 2018 For all it's worth this is the simplest way I could make it work: checkCargo = function(args) local cargo = args[1] local onGround = args[2] if onGround and cargo:getPosition().p.y-land.getHeight({x = cargo:getPosition().p.x, y = cargo:getPosition().p.z}) > 1 then trigger.action.outText(cargo:getName() .. ' has been picked up!',10) end if not onGround and cargo:getPosition().p.y-land.getHeight({x = cargo:getPosition().p.x, y = cargo:getPosition().p.z}) < 1 then trigger.action.outText(cargo:getName() .. ' has been dropped off!',10) end timer.scheduleFunction(checkCargo,{cargo,cargo:getPosition().p.y-land.getHeight({x = cargo:getPosition().p.x, y = cargo:getPosition().p.z}) < 1},timer.getTime() + 1) end ifFound = function(foundItem, val) local name = foundItem:getName() trigger.action.outText('Found ' .. name, 10) timer.scheduleFunction(checkCargo,{foundItem,foundItem:getPosition().p.y-land.getHeight({x = foundItem:getPosition().p.x, y = foundItem:getPosition().p.z}) < 1},timer.getTime() + 1) end local zone = trigger.misc.getZone('Zone at center of map') if zone then local volS = { id = world.VolumeType.SPHERE, params = { point = zone.point, radius = 500000 } } world.searchObjects(6, volS, ifFound) end [sIGPIC][/sIGPIC] Intel Core I7 4820K @4.3 GHz, Asus P9X79 motherboard, 16 GB RAM @ 933 MHz, NVidia GTX 1070 with 8 GB VRAM, Windows 10 Pro
Recommended Posts