Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Modifying A/C in Airbases

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Modifying A/C in Airbases Page: [1]
Login
Message << Older Topic   Newer Topic >>
Modifying A/C in Airbases - 7/8/2021 12:49:26 AM   
Shkval25

 

Posts: 22
Joined: 3/29/2019
Status: offline
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.
Post #: 1
RE: Modifying A/C in Airbases - 7/8/2021 11:38:02 AM   
KLAB


Posts: 355
Joined: 2/27/2007
Status: offline
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.



< Message edited by KLAB -- 7/8/2021 7:55:44 PM >

(in reply to Shkval25)
Post #: 2
RE: Modifying A/C in Airbases - 7/9/2021 3:32:37 AM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
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



< Message edited by KnightHawk75 -- 7/10/2021 5:19:14 AM >

(in reply to Shkval25)
Post #: 3
RE: Modifying A/C in Airbases - 7/10/2021 1:44:31 AM   
Shkval25

 

Posts: 22
Joined: 3/29/2019
Status: offline
Thanks!

(in reply to KnightHawk75)
Post #: 4
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Modifying A/C in Airbases Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

3.125