Modifying A/C in Airbases (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios



Message


Shkval25 -> Modifying A/C in Airbases (7/8/2021 12:49:26 AM)

I'd like to add chaff to some aircraft landed at bases. How can I do that? I don't see any mechanism to grab the GUID for units within a base so I can't edit the INI to do what I want.




KLAB -> RE: Modifying A/C in Airbases (7/8/2021 11:38:02 AM)

Ask on the LUA forum as its probably amongst the scenedit LUA functions as an add mount or magazine function.
There are LUA gurus who are expert on this stuff.
https://www.matrixgames.com/forums/tt.asp?forumid=1681
K
quote:

ORIGINAL: Shkval25

I'd like to add chaff to some aircraft landed at bases. How can I do that? I don't see any mechanism to grab the GUID for units within a base so I can't edit the INI to do what I want.





KnightHawk75 -> RE: Modifying A/C in Airbases (7/9/2021 3:32:37 AM)

Chaff\flares etc are almost always on mounts, so you'll be making changes to mounts on the aircraft, and you'll need to grab the mount guids for each aircraft to do that, in addition to yes of course the guids to get the aircraft in the first place.

To that end, to grab guids of units at any given base you can enumerate them via the .embaredUnits.Aircraft|Boats table of the host where they reside, this will pull the units that are present, .assignedUnits will pull all those assigned but not necessarily present. That could be a ship\S-U-A, it could be a singular piece\member of the airbase group, or commonly the AirBase group itself which sounds like your case.

--local retval, mybase = pcall(SE_GetUnit,{guid="GroupsGuidHereIfYouHaveIt"}); --Get the group itself.
--or 
local retval,mybase = pcall(SE_GetUnit,{side="Blue",name="SomeAirbaseGroupName"}); -- Get the group itself.
--Dump hosted Aircraft.
if ((retval ==true and mybase ~=nil) and mybase.embarkedUnits ~=nil) and #mybase.embarkedUnits.Aircraft > 0 then
  print("There are " .. tostring(#mybase.embarkedUnits.Aircraft) .. " aircraft embarked on this unit. They are as follows:")
  for i=1,#mybase.embarkedUnits.Aircraft do
    --if you use a foreach (for k,v in pairs()...) here there are actually 4 entries because the entries are duplicated,
    --one set for numeric keys and then one for string keys for the numeric number. So be careful if deciding to do that.
    --ie mybase.embarkedUnits.Aircraft[1] and mybase.embarkedUnits.Aircraft['1'] are both valid but seperate entries.
    print(string.format("[%s] guid: %s",tostring(i),tostring(mybase.embarkedUnits.Aircraft[i])));
    --local u = SE_GetUnit({guid=mybase.embarkedUnits.Aircraft[i]});
    --if u.something == something and u.somethingelse == somethingelse ... then  
       --call routine to dowhat you want.like lookup it's mounts, find the right one, and mod it, whole other topic.
    --end
  end
else 
  print("Could not obtain the unit or group, or there were no embrakedUnits.");
end





Shkval25 -> RE: Modifying A/C in Airbases (7/10/2021 1:44:31 AM)

Thanks!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
2.140625