As a wee bit of background on my conundrum, I'm making a script that generates all possible armour combinations for a few base NPC "types", for Oblivion. I'm able to generate all accumulative combinations, but not all possible combinations.
Here's the script:
unit userscript;
var
fileFranLite: IInterface;
strGoblinPath: string;
tstrlistGoblinHead, tstrlistGoblinShoulders: TStringList;
procedure GenerateGoblinVariables;
begin
//Begin Goblin
strGoblinPath := ProgramPath + 'Edit Scripts\FyTy\Fran Variants\Goblin02\';
tstrlistGoblinHead := TStringList.Create;
tstrlistGoblinHead.LoadFromFile(strGoblinPath + 'Head.txt');
tstrlistGoblinShoulders := TStringList.Create;
tstrlistGoblinShoulders.LoadFromFile(strGoblinPath + 'Shoulders.txt');
//End Goblin
end;
function Initialize: integer;
begin
GenerateGoblinVariables;
end;
procedure GenerateGoblinVariants(eGoblinBase: IInterface);
var
iCounterSuper, iCounterSub: Byte;
iEDIDSuffix: integer;
eGoblinNew, eAdded: IInterface;
strEDID, strNewEDID: string;
begin
strEDID := GetEditValue(ElementBySignature(eGoblinBase, 'EDID'));
//Generate combinations with head armour
for iCounterSuper := 0 to tstrlistGoblinHead.Count - 1 do begin
inc(iEDIDSuffix);
eGoblinNew := wbCopyElementToFile(eGoblinBase, fileFranLite, true, true);
eAdded := ElementAssign(ElementBySignature(eGoblinNew, 'NIFZ'), HighInteger, nil, false);
SetEditValue(eAdded, tstrlistGoblinHead[iCounterSuper]);
strNewEDID := strEDID + '_' + IntToStr( Format('%.3d', [iEDIDSuffix]) );
SetElementEditValues(eGoblinNew, 'EDID', strNewEDID);
for iCounterSub := 0 to tstrlistGoblinShoulders.Count - 1 do begin
inc(iEDIDSuffix);
eGoblinNew := wbCopyElementToFile(eGoblinNew, fileFranLite, true, true);
eAdded := ElementAssign(ElementBySignature(eGoblinNew, 'NIFZ'), HighInteger, nil, false);
SetEditValue(eAdded, tstrlistGoblinShoulders[iCounterSub]);
strNewEDID := strEDID + '_' + IntToStr( Format('%.3d', [iEDIDSuffix]) );
SetElementEditValues(eGoblinNew, 'EDID', strNewEDID);
end;
end;
end;
function Process(e: IInterface): integer;
var
strName: string;
begin
if Signature(e) <> 'CREA' then
exit;
AddMessage('Processing: ' + FullPath(e));
fileFranLite := GetFile(e);
strName := GetElementEditValues(e, 'FULL - Name');
//Begin creature name check
if strName = 'Goblin' then
GenerateGoblinVariants(e);
//End creature name check
end;
function Finalize: integer;
begin
Result := 0;
end;
end.
It works, in so far that it creates the following:
Goblin - Helmet01
Goblin - Helmet01 + R Shoulder
Goblin - Helmet01 + R Shoulder + L Shoulder
Goblin - Helmet 01 + R Shoulder + L Shoulder + R Leg
Goblin - Helmet 02
Goblin - Helmet 02 + R Shoulder
...
But I want to generate combinations such as:
Goblin - Helmet01
Goblin - Helmet01 + L Shoulder
Goblin - Helmet01 + R Leg + R Shoulder
Goblin - Helmet01 + R Shoulder + L Leg
...
How would I do this?