Jump to content

IIJG77_Kieran310

Members
  • Posts

    5
  • Joined

  • Last visited

  1. In the DCS mission editor trigger section exists an option to stop the smoke effect. Smoke can be triggered through LUA as such, trigger.action.effectSmokeBig(table vec3 , enum smoke preset , number density ) Does anyone know how to stop it from LUA? Or perhaps where I might find the files that list which functions the trigger editor accesses? Thanks
  2. No, it is also a unit name. I have named it as such specifically. The code runs fine - until Huey3 disappears (I missed this from the original post). The error is because the function Unit.getByName is being run on a non-existent value. Hence, ideally I would like the script to stop when Huey3 dies, for example. I am quite new to Lua coding. Is there perhaps some way to stop error messages from popping up when an item is 'nil'? To get the game to just ignore it? Thanks for the reply.
  3. Actually, the script also leads to error when the Lancer-6 group is missing (once it gets deleted by the script). Same style of error.
  4. Specifically with regards to Unit.getByName("Huey3") Huey3 is the unit (and group) name, of the helicopter that is crashed by a player. The error messages continue until the player respawns. The script works as intended, until the destruction of a unit referenced in it. The script: local flagValue = trigger.misc.getUserFlag("52") local LockFlag = trigger.misc.getUserFlag("53") -- to stop infinite loops and 9999+ F10 options local TransGroup = Group.getByName("Lancer-6") local TransUnit = Unit.getByName("Lancer-6") local TransUnitPos = TransUnit:getPosition() local InitUnit = Unit.getByName("Huey3") local InitUnitPos = InitUnit:getPosition() local InitUnitAGL = InitUnitPos.p.y - land.getHeight({x=InitUnitPos.p.x, y = InitUnitPos.p.z}) local InitGroup = Group.getByName("Huey3") local InitID = Group.getID(InitGroup) local InitTransDis = mist.vec.sub(InitUnitPos.p, TransUnitPos.p) if ((InitTransDis.x <= 50 and InitTransDis.x > 0) or (InitTransDis.x < 0 and InitTransDis.x >= -50)) and ((InitTransDis.z <= 50 and InitTransDis.z > 0) or (InitTransDis.z < 0 and InitTransDis.z >= -50)) -- If distance between transporter (helo) and transportable (ground unit) is within a 100m flat radius and LockFlag == 0 and InitUnitAGL <= 15 and InitUnit:getVelocity().x <= 5.55555 and InitUnit:getVelocity().y <=10 and InitUnit:getVelocity().y >= -10 then trigger.action.addOtherCommandForGroup(InitID,"Pick up LANCER-6 (HMMWV-TOW)","52","1") trigger.action.setUserFlag("53",1) -- lock flag for antispam elseif not (((InitTransDis.x <= 50 and InitTransDis.x > 0) or (InitTransDis.x < 0 and InitTransDis.x >= -50)) or ((InitTransDis.z <= 50 and InitTransDis.z > 0) or (InitTransDis.z < 0 and InitTransDis.z >= -50))) then trigger.action.removeOtherCommandForGroup(InitID,"Pick up LANCER-6 (HMMWV-TOW)") -- trigger.action.outText("FALSE",20) -- debug line trigger.action.setUserFlag("53",0) end -- lock disable if flagValue == 1 then -- This is the pickup process of Lancer-6 by Huey3 TransGroup:destroy() trigger.action.setUserFlag("52",2) trigger.action.removeOtherCommandForGroup(InitID,"Pick up LANCER-6 (HMMWV-TOW)") trigger.action.setUnitInternalCargo("Huey3",900) trigger.action.outTextForGroup(InitID,"LANCER-6 (HMMWV-TOW) LOADED",10) end if flagValue == 2 and LockFlag == 0 and InitUnitAGL <= 15 and InitUnit:getVelocity().x <= 5.55555 and InitUnit:getVelocity().y <=10 and InitUnit:getVelocity().y >= -10 then -- This gives the dropoff option if parameters are met, or disables it if not trigger.action.addOtherCommandForGroup(InitID,"Drop off LANCER-6 (HMMWV-TOW)","52","3") trigger.action.setUserFlag("53",1) -- lock flag for antispam elseif flagValue == 2 and (InitUnitAGL >= 15 or InitUnit:getVelocity().x >= 5.55555 or (InitUnit:getVelocity().y >=10 and InitUnit:getVelocity().y <= -10)) then -- This removes the dropoff option if parameters are not met trigger.action.removeOtherCommandForGroup(InitID,"Drop off LANCER-6 (HMMWV-TOW)") trigger.action.setUserFlag("53",0) end -- lock disable if flagValue == 3 then -- Drop off execution mist.respawnGroup("Lancer-6", true) local InitUnitLoc = InitUnit:getPosition().p local InitUnitDir = InitUnit:getPosition().z local InitSPWN = mist.vec.add(InitUnitLoc, mist.vec.scalar_mult(InitUnitDir, 7)) mist.teleportToPoint({gpName="Lancer-6", point=InitSPWN, action="teleport"}) trigger.action.removeOtherCommandForGroup(InitID,"Drop off LANCER-6 (HMMWV-TOW)") trigger.action.outTextForGroup(InitID,"LANCER-6 (HMMWV-TOW) UNLOADED",10) trigger.action.setUnitInternalCargo("Huey3",0) trigger.action.setUserFlag("52",0) end -- resets loop In the editor, this script in run in a (continous trigger) > (2 seconds) and (Group Exists "Huey3") > (The script) After some testing, trying other ways of stopping script execution on death, I have discovered that even though the (Group Exists) condition is no longer met, the script continues executing, and I can't figure out why. This leads to pop-up error messages, repeatedly. As seen in picture below. My DCS log file is attatched. dcs.log
×
×
  • Create New...