KnightHawk75
Posts: 1450
Joined: 11/15/2018 Status: offline
|
Can't spawn weapons via lua unfortunately (that I know of), so option 2 will not work. Option one works in theory, you can use the following as a guide: local myunit = ScenEdit_GetUnit({name='some sample unit with a MALD-J'})
local retval = ScenEdit_AttackContact(myunit.guid,'BOL',
{latitude='N 65.19.14',longitude='E 19.55.43', mode=1, mount=3017,weapon=2442,qty=1}) -- note the special 'BOL' contactname, not sure that's in the docs anywhere.
print(tostring(retval)) -- true\false based on success\failure. Now if you want to set a course of waypoints for the MALD... You in theory can optionally include a course={{subtable}, {of}, {waypoints}, {here}}, in the attack options table, if left out it will just fire it in a relative dogleg + straight line toward the target lat\lon specified. I say "in theory" because in testing BOL with a specific list of waypoints, it has never worked for me, my course gets assigned during the process but overwritten by the time it fires. I don't know if that's a bug, or if I'm doing something wrong. Example with course that should work but doesn't at least with decoys: local retval = ScenEdit_AttackContact(myunit.guid,'BOL', {latitude='N 65.19.14',longitude='E 19.55.43', mode=1,mount=3017,weapon=2442,qty=1,
course={{latitude='N 64.48.00',longitude='E 5.57.43'},{latitude='N 64.28.00',longitude='E 14.58.17'}, {latitude='N 65.15.46',longitude='E 17.58.23'}} })
You can of course set the waypoints after the fact but you'll have to know the name\guid post fire somehow.
< Message edited by KnightHawk75 -- 5/16/2020 4:33:34 PM >
|