Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Group

 
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 >> Lua Legion >> Group Page: [1]
Login
Message << Older Topic   Newer Topic >>
Group - 10/1/2020 8:22:43 AM   
Parel803

 

Posts: 172
Joined: 10/10/2019
From: Netherlands
Status: offline
Is it possible to make a group of ship from lua or change the formation/leader of a existing group? If so could someone please point me in the right direction. Haven't found other threads with search on it.
with regards

_____________________________

Post #: 1
RE: Group - 10/1/2020 11:36:03 PM   
KnightHawk75

 

Posts: 646
Joined: 11/15/2018
Status: offline
http://www.matrixgames.com/forums/fb.asp?m=4824759

Prior example I posted for adding bunch of ships that are grouped (you can ignore the associated aircraft portions to the carrier if it doesn't apply)

As for the formation\leader it can be done by setting the lead property (http://commandlua.github.io/#wrapper_Group) on the group wrapper I believe with the guid of the unit you want to be lead, the formation aspects like relativity, position,etc can be modified on the specific member unit wrapper for each member in the member unit's .formation properties\table.

http://www.matrixgames.com/forums/fb.asp?m=4825664

Let me know if you still get stumped trying to do something.



< Message edited by KnightHawk75 -- 10/1/2020 11:51:45 PM >

(in reply to Parel803)
Post #: 2
RE: Group - 10/2/2020 7:42:08 AM   
Parel803

 

Posts: 172
Joined: 10/10/2019
From: Netherlands
Status: offline
thank you for you're time and help. I'm gonna try it.
with regards

(in reply to KnightHawk75)
Post #: 3
RE: Group - 10/2/2020 11:26:36 AM   
Parel803

 

Posts: 172
Joined: 10/10/2019
From: Netherlands
Status: offline
Thx again. Got some stuff working but not all I like to. I'm no prorgrammer or something like that just try to copy-paste and trial-error stuff.

local u1, u2, u3, u4;
local grpName = 'TG 10.1'
u1 = ScenEdit_AddUnit({type = 'Ship', name = 'RDAM', dbid = 825, side = 'Blue', Latitude="N9.30.00",Longitude="E109.30.00", heading=090, speed=12});
u1.group = grpName;
u2 = ScenEdit_AddUnit({type = 'Ship', name = 'TRMP', dbid = 891, side = 'Blue', Latitude="N9.31.00",Longitude="E109.31.00", heading=090, speed=12});
u2.group = grpName;
u3 = ScenEdit_AddUnit({type = 'Ship', name = 'ZLND', dbid = 2496, side = 'Blue', Latitude="N9.30.00",Longitude="E109.29.00", heading=090, speed=12});
u3.group = grpName;
u4 = ScenEdit_AddUnit({type = 'Ship', name = 'VSPK', dbid = 2522, side = 'Blue', Latitude="N9.29.00",Longitude="E109.31.00", heading=090, speed=12});
u4.group = grpName;

u2.formation = {type='fixed', bearing=040, distance=4, sprint='false'}
u3.formation = {type='fixed', bearing=270, distance=2, sprint='false'}
u4.formation = {type='fixed', bearing=105, distance=2, sprint='false'}

Don't understnad how to use the group wrapper and change the lead unit.
If you you something stupid, let me know. I can handle that as an ex navy chief :-)
with regards

(in reply to Parel803)
Post #: 4
RE: Group - 10/2/2020 1:48:01 PM   
KnightHawk75

 

Posts: 646
Joined: 11/15/2018
Status: offline
Nope, nothing stupid. I've added an example that shows changing the lead from the default of u1 to u4.
The print statements aren't needed they are just to help you when playing around to see the change.

local u1, u2, u3, u4;
local grpName = 'TG 10.1'
u1 = ScenEdit_AddUnit({type = 'Ship', name = 'RDAM', dbid = 825, side = 'Blue', Latitude="N9.30.00",Longitude="E109.30.00", heading=090, speed=12});
u1.group = grpName;
u2 = ScenEdit_AddUnit({type = 'Ship', name = 'TRMP', dbid = 891, side = 'Blue', Latitude="N9.31.00",Longitude="E109.31.00", heading=090, speed=12});
u2.group = grpName;
u3 = ScenEdit_AddUnit({type = 'Ship', name = 'ZLND', dbid = 2496, side = 'Blue', Latitude="N9.30.00",Longitude="E109.29.00", heading=090, speed=12});
u3.group = grpName;
u4 = ScenEdit_AddUnit({type = 'Ship', name = 'VSPK', dbid = 2522, side = 'Blue', Latitude="N9.29.00",Longitude="E109.31.00", heading=090, speed=12});
u4.group = grpName;


local g = ScenEdit_GetUnit({guid=u1.group.guid}); --get the group object wrapper using guid obtained from one of the member units group properties.
--local g = ScenEdit_GetUnit({side="Blue", name=grpName}); --alternate way but I use the above when I can. 
--print(g.group); --dump the basic group objects properties. (there are more than what gets listed but they are in fields that dont print)
--print(g.group.unitlist); --dump the list of unit guids that are members of this group. (ie the 4 above created units) 
print('current lead: ' .. g.group.lead); --list the guid of the current group lead which likley is first member or u1 in this case.
g.group.lead = u4.guid --operating on the group object's lead field (not shown in dump) set the group lead to the guid of ship 4. 
print('new lead: ' .. g.group.lead); --show guid of the new lead (should see change).

--probably best to set the formations after the lead is changed.
u1.formation = {type='fixed', bearing=040, distance=4, sprint='false'}
u2.formation = {type='fixed', bearing=270, distance=2, sprint='false'}
u3.formation = {type='fixed', bearing=105, distance=2, sprint='false'} 


< Message edited by KnightHawk75 -- 10/2/2020 1:56:18 PM >

(in reply to Parel803)
Post #: 5
RE: Group - 10/2/2020 2:33:03 PM   
Parel803

 

Posts: 172
Joined: 10/10/2019
From: Netherlands
Status: offline
Great thank you very much,
with regards

(in reply to KnightHawk75)
Post #: 6
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Group 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

0.118