KnightHawk75
Posts: 1450
Joined: 11/15/2018 Status: offline
|
Depends on what you're trying to do to the 4000 units. Script the changes or script the application of deltas (done with UpdateUnit() mode=delta). or You can write your own wrappers for making changes and then process them from a table of inputs per unit or per type etc, basically you make your own unit generator that then makes changes associated with the add after it's been added according to your own table of data attached to the basic unit generation data per unit (or per unit type) depending on what you're doing. Take time to write and test upfront but useful when generating basically an entire scene programmatically, or when doing more complex inserts or changes during a scenario. Just give you a sort of example: You have a table of unitgenerationdata.. entries are each a table like.... {type = 'Submarine', name = 'MySub', heading = 0, dbid = 553, side = 'US', latitude="N30.02.51",longitude="W110.55.50", altitude=-105,depth=105, autodetectable="false",holdfire="true",proficiency=4,speed=0, applychanges={ListInOrderofWhatChangesToApply for example [1]=4,[2]=5}}, then you've got the customization table and entries that are linked too be applied in that applychanges list^ like... quote:
{id=4,name='AN/APG-63(V)3 AESA',action='add_sensor', dbid=4478,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil,mountid=nil,commsid=nil,mountidx=nil}, {id=5,name='Sa400 20channel',action='add_comms', dbid=267,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil,mountid=nil,commsid=nil,mountidx=nil}, --{id=6,name='SA-21 a/b site s400',action='add_mount', dbid=2284,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil,mountid=nil,commsid=nil,mountidx=nil} {id=7,name='SA-21 a/b site s400',action='remove_sensor', foreach=true,dbid=4478,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil,mountid=nil,commsid=nil,mountidx=3}, {id=8,name='SA-21 a/b site s400',action='remove_mount', foreach=false,dbid=2284,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil,mountid=nil,commsid=nil,mountidx=nil}, {id=9,name='SA-21 a/b site s400',action='remove_weapon', foreach=false,dbid=2103,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil}, {id=10,name='SA-21 a/b site s400',action='remove_weapon', foreach=false,dbid=2103,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil,mountid=2284,commsid=nil,mountidx=nil}, {id=11,name='SA-21 a/b site s400',action='remove_weapon', foreach=true,dbid=2103,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil,mountid=2284,commsid=nil,mountidx=6}, {id=12,name='SA-21 a/b site s400',action='remove_weapon', foreach=true,dbid=2103,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil,mountid=2284,commsid=nil,mountidx=nil}, --{id=7,name='SA-21 a/b site s400',action='add_weapon', foreach=true,dbid=2104,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil,mountid=2284,commsid=nil,mountidx=nil}, {id=13,name='SA-21 a/b site s400',action='add_weapon', foreach=false,dbid=7716,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil,mountid=2284,commsid=nil,mountidx=5}, {id=14,name='SA-21 a/b site s400',action='add_weapon', foreach=false,dbid=7716,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil,mountid=2284,commsid=nil,mountidx=nil}, {id=15,name='SA-21 a/b site s400',action='add_weapon', foreach=false,dbid=7716,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil,weaponid=nil,mountid=nil,commsid=nil,mountidx=nil}, {id=16,name='SA-21 a/b site s400',action='delta', file='\\KHTests\\inisaves\\MyS400x12Default3.ini',deltaUnitname='My S400x12Default'}, {id=17,name='SA-21 a/b site s400',action='change_munition', foreach=false,dbid=2103,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil, weaponid=nil,mountid=nil,commsid=nil,mountidx=nil,magid=nil,magnew=nil,magidx=nil,number=132,magmaxcap=0}, {id=18,name='SA-21 a/b site s400',action='change_munition', foreach=false,dbid=2103,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil, weaponid=nil,mountid=nil,commsid=nil,mountidx=nil,magid=1185,magnew=nil,magidx=nil,number=200,magmaxcap=0}, {id=19,name='SA-21 a/b site s400',action='change_munition', foreach=false,dbid=2104,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil, weaponid=nil,mountid=nil,commsid=nil,mountidx=nil,magid=1185,magnew=nil,magidx=nil,number=100,magmaxcap=0,remove=true,fillout=false}, {id=20,name='SA-21 a/b site s400',action='change_munition', foreach=false,dbid=2103,arc_track=nil,arc_detect=nil,arc_mount=nil,sensorid=nil, weaponid=nil,mountid=nil,commsid=nil,mountidx=nil,magid=nil,magnew=nil,magidx=nil,number=32,magmaxcap=0,remove=true,fillout=false}, .... yada yada.. this is just sample yanked from how I happen to do it..there are infinite ways, and the above dates back to late CMANO time frame. The harder\labor intensive part is writing all the option code for handling all possible options existing or not etc, and advanced stuff like being able to optionally apply foreach's or not to remove certain things, or to remove things like mounts etc at specfic indexes or different match criteria vs firstmatching dbid etc. That said, once you have it all done you have it for a long while only having to make minor edits as things in the api change or newer easier ways come along to make you go back and revisit how you apply a change. As you might imagine from what all this sounds like I've been down this road because writing delta's for every unitguid just isn't practical, especially when you just want a set of changes replicated on to lots of different units, and said units are dynamically generated units (ie guid are not known so can't be matched to deltas). If you're just trying to swap one set of units for another type in mass (replace all f-15 of dbid X with loadout Y to f-16's of dbid Z with loadout W ) I know I wrote something for doing the basics of swapping one set of unit(s) to another type, but doesn't sound like that's what your doing, sounds like just applying customization to each. https://www.matrixgames.com/forums/tm.asp?m=4908508 (post 6).
< Message edited by KnightHawk75 -- 11/16/2021 2:29:12 AM >
|