KnightHawk75
Posts: 1450
Joined: 11/15/2018 Status: offline
|
Yes once stored at a base you can't select the unit to make modifications, so either add the customization via Lua (ScenEdit_UpdateUnit), or edit them before placing them into their hosting units during development. For example adding a searchlight to 10 choppers with similar names who are sitting in a base:
local function addSpotlight(unitbasename,sidename,start,stop)
local arcT={'PB1','PB2','SB1','SB2','SMF1','SMF2','SMA1','SMA2','SS1','SS2','PS1','PS2','PMA1','PMA2','PMF1','PMF2'};
local arcD={'PB1','PB2','SB1','SB2','SMF1','SMF2','SMA1','SMA2','SS1','SS2','PS1','PS2','PMA1','PMA2','PMF1','PMF2'};
local arcM={'360'};
for i = start,stop do
local u = ScenEdit_GetUnit({side=sidename,name=unitbasename..i});
ScenEdit_UpdateUnit({guid=u.guid,mode="add_sensor",dbid=1080,arc_detect=arcD,arc_track=arcT, arc_mount=arcM}) --Generic spotlight 360 view
end
end
addSpotlight("Chopper #","Red",1,10) --- add a spotlight to 'Chopper #1' through 'Chopper #10';
If customizing manually and you're just asking how to shove a unit into a base when done adding and customizing it: You can call ScenEdit_HostUnitToParent({HostedUnitNameOrID='GUIDOF-THEUNITHEREXX',SelectedHostNameOrID='GUIDOF-THEBASEHEREXX'}) on each unit to insert them to a base\hosting unit. You can easily get the guid of a unit in the editor by pressing ctrl-c and pasting into the console. You could use names as well but they'll have to be globally unique names as there is no side specifier.
local function insertUnitsIntoBase(unitbasename,sidename,destinationGuid,start,stop)
for i = start,stop do
local u = ScenEdit_GetUnit({side=sidename,name=unitbasename..i});
ScenEdit_HostUnitToParent({HostedUnitNameOrID=u.guid,SelectedHostNameOrID=destinationGuid})
end
end
insertUnitsIntoBase("Chopper #","Red","GUIDOF-BASEHERE",1,10)
Or do it all at once create, add the sensor and insert in one go.
local function addMyCustomChoppersToBase(unitbasename,type,sidename,number,dbid,loadout,baseguid)
local arcT={'PB1','PB2','SB1','SB2','SMF1','SMF2','SMA1','SMA2','SS1','SS2','PS1','PS2','PMA1','PMA2','PMF1','PMF2'};
local arcD={'PB1','PB2','SB1','SB2','SMF1','SMF2','SMA1','SMA2','SS1','SS2','PS1','PS2','PMA1','PMA2','PMF1','PMF2'};
local arcM={'360'};
for i = 1,number do
local u = ScenEdit_AddUnit({side=sidename,type=type,name=unitbasename..i,dbid=dbid,loadoutID=loadout,latitude=0.0,longitude=0.0,altitude=0}); -- create unit.
u = ScenEdit_UpdateUnit({guid=u.guid,mode="add_sensor",dbid=1080,arc_detect=arcD,arc_track=arcT, arc_mount=arcM}); --Generic spotlight 360 view
ScenEdit_HostUnitToParent({HostedUnitNameOrID=u.guid,SelectedHostNameOrID=baseguid}); --insert into base
end
end
addMyCustomChoppersToBase("GlobalRanger #","Aircraft","Red",10,4848,26432,'4FH7PU-0HMFB711P8969'); --add 10, with customization to base specified.
< Message edited by KnightHawk75 -- 2/8/2022 6:34:00 PM >
|