Targanon Posted December 27, 2020 Posted December 27, 2020 Ok so I'm try to do this is LUA. I have tried a few things .. and All have failed . I'm trying to get the location of a client unit. I have tried MyUnit is supposed to be the client unit I'm in.. but I keep getting an error trying to (a nil Value) so maybe I'm a dumb person but I just don't get that How to return the X,Y location of a player unit. I'm probably doing it all wrong.. I'm trying to learn to do this lua .. I've tried the Hogit wiki found a couple of things that looked promising but I get a similar error MyLocY = MyUnit:GetCoordinate():GetVec2():GetY() --Get the Y Coordinate of my Unit MyLocX = MyUnit:GetCoordinate():GetVec2():GetX() --Get the X Coordinate of my Unit Targs, GTX 1080ti, Asus Hero XI, Intel 9900KF @4.2MHz, 32g DDR4@3200Mhz, 4x 1Tb SSD 1x 400g m.2mvme(boot), 28" Samsung 4k, Saitek X-56 Throttle/Warthog Stick and Saitek Pro Flight Pedals. Moduls All of the NATO jets, and all the choppers.. DEDi MP [62AW] The Blackbirds Brisbane
toutenglisse Posted December 27, 2020 Posted December 27, 2020 Hi, here an exemple (F18 client on caucasus, at 5 seconds in mission a trigger check position and display it). Caucasus-F18client-CheckPosTest.miz
Wrecking Crew Posted December 28, 2020 Posted December 28, 2020 This is from a few years ago. This script is called when a helicopter lands for 2 seconds, and then a MANPADS team is spawned at the location. It uses MIST to get the position and heading info - --- Stinger Drop Vulcans vs Sharks --- triggered by an event that detects landing -- for Clients: -- UH-1H 01 Nalchik Cold Start, BLF VGrp90 Stinger -- UH-1H 02 Nalchik Cold Start -- UH-1H 03 FARP London Cold Start -- UH-1H 04 FARP London Cold Start -- UH-1H 05 FARP London Cold Start -- UH-1H 06 FARP London Cold Start -- UH-1H 11 Stinger Teams Cold Start, BLF VGrp04 MANPADS local grpNameHelicopter = 'UH-1H 11 Stinger Teams Cold Start' local grpNameTeam = 'BLF VGrp04 MANPADS' local unitNameHelicopter = Group.getByName(grpNameHelicopter):getUnit(1):getName() local basePos = mist.getLeadPos(grpNameHelicopter) local baseHeadingRad = mist.getHeading(Unit.getByName(unitNameHelicopter)) local baseHeadingDeg = baseHeadingRad * 180 / math.pi local newGroupTeam = mist.getGroupData(grpNameTeam) local newCoords = { [1] = { x = basePos.x + ((75 * math.cos(baseHeadingDeg)) - (0 * math.sin(baseHeadingDeg))), y = basePos.z + ((75 * math.sin(baseHeadingDeg)) + (0 * math.cos(baseHeadingDeg))), heading = baseHeadingDeg, }, [2] = { x = basePos.x + ((-75 * math.cos(baseHeadingDeg)) - (75 * math.sin(baseHeadingDeg))), y = basePos.z + ((-75 * math.sin(baseHeadingDeg)) + (75 * math.cos(baseHeadingDeg))), heading = baseHeadingDeg + 40, }, [3] = { x = basePos.x + ((-75 * math.cos(baseHeadingDeg)) - (-75 * math.sin(baseHeadingDeg))), y = basePos.z + ((-75 * math.sin(baseHeadingDeg)) + (-75 * math.cos(baseHeadingDeg))), heading = baseHeadingDeg - 40, } } for i = 1, #newGroupTeam.units do newGroupTeam.units[i].x = newCoords[i].x newGroupTeam.units[i].y = newCoords[i].y newGroupTeam.units[i].heading = newCoords[i].heading end newGroupTeam.clone = true mist.dynAdd(newGroupTeam) local unitNameHelicopterPlayer = Group.getByName(grpNameHelicopter):getUnit(1):getPlayerName() trigger.action.outText(unitNameHelicopterPlayer .. ' just dropped off a Stinger team!', 20) --- end of Stinger Drop Vulcans vs Sharks Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.
Recommended Posts