Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

add mount with Lua

 
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 >> add mount with Lua Page: [1]
Login
Message << Older Topic   Newer Topic >>
add mount with Lua - 10/4/2019 2:57:54 AM   
orca

 

Posts: 401
Joined: 11/6/2013
Status: offline
I am trying to add a mount to a unit with LUA.

I am trying to add the NSM quad mount (which I think is dbid 1380) to a unit.

I tried this:
ScenEdit_UpdateUnit({guid='05b2534e-2888-4e54-a6fe-bb50320ca736',mode='add_mount',dbid=1380})
but got an error saying unknown mount

I would also like to make the mount firing arcs to be the 2 front arcs (which I think are PB2 and SB1) but I don't know how to do this.

Does anyone know how I can can make this work? Is the mount ID I am using for the NSM not correct?

Thanks


Post #: 1
RE: add mount with Lua - 10/5/2019 11:57:26 PM   
Whicker

 

Posts: 635
Joined: 6/20/2018
Status: offline
not sure about your issue - what DB? DB3000? I am in CWDB or I would test it. Maybe later.

I am trying to do something similar, I would like to add a sensor - binoculars (seems like they would be standard issue on ships?) and I think i have done it, the only issue is that it seems to be requiring a tracking arc as well as a detection arc, so I am passing one in.

Here is what I have that seems to work - I can't test the arc on the binoculars though - the only way I can see to show a sensor arc is to turn it on, but binos are always on apparently. I added a radar this way and I can see its arc so I believer I have the arc correct for what I want - 360 degrees.
I thinkif you wan the 2 forward facing ones it is PB2 and SB1.

quote:


local u = ScenEdit_GetUnit({name='3M Bison B', guid='18066936-0723-4f60-886e-2173db3e7085'})
ScenEdit_UpdateUnit({guid=u.guid,mode='add_sensor',dbid=971, arc_detect ={'PB1','PB2','PMF2','PMF1','PMA2','PMA1','PS2','PS1','SS1','SS2','SMA2','SMA1','SMF2','SMF1','SB1','SB2' },arc_track={'PB1'}})

(in reply to orca)
Post #: 2
RE: add mount with Lua - 10/6/2019 2:37:31 AM   
KnightHawk75

 

Posts: 171
Joined: 11/15/2018
Status: offline
Btw if you want a shortcut when you do want 360degress, you can just use {'360'}

For mounts, I think he needs arc_mount, ie arc_mount={'360'} or arc_mount={..whatever}.


< Message edited by KnightHawk75 -- 10/6/2019 2:45:07 AM >

(in reply to Whicker)
Post #: 3
RE: add mount with Lua - 10/6/2019 3:02:29 AM   
Whicker

 

Posts: 635
Joined: 6/20/2018
Status: offline
ah, and maybe '0' for the tracking arc?

(in reply to KnightHawk75)
Post #: 4
RE: add mount with Lua - 10/6/2019 10:00:13 AM   
KnightHawk75

 

Posts: 171
Joined: 11/15/2018
Status: offline
quote:

ORIGINAL: Whicker

ah, and maybe '0' for the tracking arc?


Yeah I would feed it no-nil values for the others even if not used.
So the part of the wrapper I have for this looks like...
...
retval = ScenEdit_UpdateUnit( { guid = theUnitobj.guid, mode = 'add_mount', dbid = v.dbid, arc_detect = arcD,
 arc_track = arcT, arc_mount = arcM } ); --use arcs, send arcT arcD too even though mount.
...

arcD, arcT, and arcM are all initialized if nil prior to the above cal to { '360' } or equivalent long form even though it's a add_mount and only arc_mount is used, I still feed non-nil data for the others, i forget if that was habit, or cause things were wonky without it.

< Message edited by KnightHawk75 -- 10/6/2019 10:01:02 AM >

(in reply to Whicker)
Post #: 5
RE: add mount with Lua - 11/3/2019 12:10:44 AM   
orca

 

Posts: 401
Joined: 11/6/2013
Status: offline
Thanks for help.

I used this to add a amount and it worked

local u = ScenEdit_GetUnit({guid='bf61e98a-06cd-4597-8dd8-16f6a01b2d03'})
ScenEdit_UpdateUnit({guid=u.guid,mode='add_mount',dbid=3061, arc_mount ={'PB2','SB1'}})



But now what I want to do is to remove the weapons (the YJ-12) from the mount and add different weapons (AGM-88E AARGM) to that same mount. I tried this but couldn't get it to work.

local u = ScenEdit_GetUnit({guid='bf61e98a-06cd-4597-8dd8-16f6a01b2d03'})
ScenEdit_UpdateUnit({guid='bf61e98a-06cd-4597-8dd8-16f6a01b2d03', 'mount_guid=3061','w_dbid=2863', remove=true, number=2})

(in reply to KnightHawk75)
Post #: 6
RE: add mount with Lua - 11/3/2019 7:08:55 AM   
KnightHawk75

 

Posts: 171
Joined: 11/15/2018
Status: offline
quote:

ORIGINAL: orca

Thanks for help.

I used this to add a amount and it worked

local u = ScenEdit_GetUnit({guid='bf61e98a-06cd-4597-8dd8-16f6a01b2d03'})
ScenEdit_UpdateUnit({guid=u.guid,mode='add_mount',dbid=3061, arc_mount ={'PB2','SB1'}})



But now what I want to do is to remove the weapons (the YJ-12) from the mount and add different weapons (AGM-88E AARGM) to that same mount. I tried this but couldn't get it to work.

local u = ScenEdit_GetUnit({guid='bf61e98a-06cd-4597-8dd8-16f6a01b2d03'})
ScenEdit_UpdateUnit({guid='bf61e98a-06cd-4597-8dd8-16f6a01b2d03', 'mount_guid=3061','w_dbid=2863', remove=true, number=2})


You'll need to feed it the mount guid as mountid you're removing from.
Looks something like this, course you'll have to loop though the mounts and wpn entries to grab the exact mount guids you want to work with first. (if you want a sample 'finding' routine for that I could provide)
retval = ScenEdit_UpdateUnit({guid=theUnitobj.guid, mode='remove_weapon', dbid=Thedbid,mountid=TheMountGuid,weaponid=TheWpnEntryGuid});



< Message edited by KnightHawk75 -- 11/3/2019 7:15:16 AM >

(in reply to orca)
Post #: 7
RE: add mount with Lua - 11/3/2019 11:29:46 PM   
orca

 

Posts: 401
Joined: 11/6/2013
Status: offline

quote:

ORIGINAL: KnightHawk75

quote:

ORIGINAL: orca

Thanks for help.

I used this to add a amount and it worked

local u = ScenEdit_GetUnit({guid='bf61e98a-06cd-4597-8dd8-16f6a01b2d03'})
ScenEdit_UpdateUnit({guid=u.guid,mode='add_mount',dbid=3061, arc_mount ={'PB2','SB1'}})



But now what I want to do is to remove the weapons (the YJ-12) from the mount and add different weapons (AGM-88E AARGM) to that same mount. I tried this but couldn't get it to work.

local u = ScenEdit_GetUnit({guid='bf61e98a-06cd-4597-8dd8-16f6a01b2d03'})
ScenEdit_UpdateUnit({guid='bf61e98a-06cd-4597-8dd8-16f6a01b2d03', 'mount_guid=3061','w_dbid=2863', remove=true, number=2})


You'll need to feed it the mount guid as mountid you're removing from.
Looks something like this, course you'll have to loop though the mounts and wpn entries to grab the exact mount guids you want to work with first. (if you want a sample 'finding' routine for that I could provide)
retval = ScenEdit_UpdateUnit({guid=theUnitobj.guid, mode='remove_weapon', dbid=Thedbid,mountid=TheMountGuid,weaponid=TheWpnEntryGuid});




Yes can you please show me a sample "finding' routine for the mount and weapon?

(in reply to KnightHawk75)
Post #: 8
RE: add mount with Lua - 11/9/2019 1:27:40 AM   
KnightHawk75

 

Posts: 171
Joined: 11/15/2018
Status: offline
Sure,

Sorry for late replay I forgot to check the site this week.

Two text files are in the attached orca_notes.zip.


First one is fnSpawnUnit_WIP_v0_079.txt feb-23 2019 (998.20\476 timeframe)
- Its a mega-uber ridiculous unitspawner script with more customization options than anyone other than I will probably use and requires it's own manual basically to use, and isn't for public consumption yet. BUT contained inside it one of the options while creating units is customizing the hell out of them after auto-creation. Namely there are routines that apply for your purpose that deal with grabbing weaponguids and mountguids for weapon removal (and other) operations, both singular, or multiple matching.

Second is OrcaNotes.txt
- It attempts to explain how different option inputs passed to the 2 different but related functions operate so you can follow the logic, and adapt to your own needs.

Namely:
line ~1264 [ action= 'remove_weapon' else ]
fnModExistingUnitKH - 'remove_weapon' section wraps the two below and scene updateunit calls

line ~944 [func begin]
fnsubModExistingTryTofindMountWeaponIDs - core of what you need for basic 'find first and only match' lookup returning wpnguid and mntguids needed for a updateunit call.

line ~881 [ comptype= 'weapon' else ]
fnRemoveAllComponentsWithDBID (if you want to get fancy, need to find and remove more than one entry while also being specific)


Hope it's clear enough, if not just ask. ;)




Attachment (1)

(in reply to orca)
Post #: 9
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> add mount with Lua 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.133