Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- NPC Facegen Patcher for Skyrim
- Scans NPC records of the selected race and creates Facegeoms in the specified directory with
- updated texture paths. Designed to be used alongside mods that allow races to have body
- textures unique to a race e.g.:
- - Unique Everything
- - Unique Bodies by Race
- - VTF- Vampire Texture Framework
- Using those mods without this patcher will cause NPCs to have body/face texture mismatch.
- Run this script on entire load order (Ctrl+A then right click -> Apply script...). If you
- want to run it on a single esp then load only that plugin (and Dawnguard for vampire face
- texture resources) in xEdit. The head meshes generated by this patcher should then override
- all other. I advise to pack them into an archive format and load the archive as mod with a
- mod manager. This will allow for a clean way to remove them - which should be done before
- you use this script again (like after adding new mods with NPCs in them).
- }
- unit userscript;
- //used throughout the script
- const
- SavedPrefs = ScriptsPath + 'Skyrim - NPC Facegen Patcher.txt';
- sOutputPath = '';
- cb1 = 0;
- cb2 = 0;
- cb3 = 0;
- cb4 = 0;
- cb5 = 0;
- cb6 = 0;
- cb7 = 0;
- cb8 = 0;
- cb9 = 0;
- cb10 = 0;
- cb11 = 0;
- cb12 = 0;
- cb13 = 0;
- cb14 = 0;
- cb15 = 0;
- cb16 = 0;
- cb17 = 0;
- cb18 = 0;
- cb19 = 0;
- cb20 = 0;
- cb21 = 0;
- cb22 = 0;
- //called to check whether npc's race was selected for patching, note: BRACKETS ARE IMPORTANT.
- function IsSupportedRace(f: IInterface): boolean;
- var
- race: string;
- begin
- Result := false;
- race := EditorID(LinksTo(ElementByPath(f, 'RNAM')));
- if (
- ((race = 'ArgonianRace') and (cb1 = 1)) or //ArgonianRace
- ((race = 'ArgonianRaceVampire') and (cb2 = 1)) or //ArgonianRaceVampire
- ((race = 'BretonRace') and (cb3 = 1)) or //BretonRace
- ((race = 'BretonRaceVampire') and (cb4 = 1)) or //BretonRaceVampire
- ((race = 'DarkElfRace') and (cb5 = 1)) or //DarkElfRace
- ((race = 'DarkElfRaceVampire') and (cb6 = 1)) or //DarkElfRaceVampire
- ((race = 'ElderRace') and (cb7 = 1)) or //ElderRace
- ((race = 'ElderRaceVampire') and (cb8 = 1)) or //ElderRaceVampire
- ((race = 'HighElfRace') and (cb9 = 1)) or //HighElfRace
- ((race = 'HighElfRaceVampire') and (cb10 = 1)) or //HighElfRaceVampire
- ((race = 'ImperialRace') and (cb11 = 1)) or //ImperialRace
- ((race = 'ImperialRaceVampire') and (cb12 = 1)) or //ImperialRaceVampire
- ((race = 'KhajiitRace') and (cb13 = 1)) or //KhajiitRace
- ((race = 'KhajiitRaceVampire') and (cb14 = 1)) or //KhajiitRaceVampire
- ((race = 'NordRace') and (cb15 = 1)) or //NordRace
- ((race = 'NordRaceVampire') and (cb16 = 1)) or //NordRaceVampire
- ((race = 'OrcRace') and (cb17 = 1)) or //OrcRace
- ((race = 'OrcRaceVampire') and (cb18 = 1)) or //OrcRaceVampire
- ((race = 'RedguardRace') and (cb19 = 1)) or //RedguardRace
- ((race = 'RedguardRaceVampire') and (cb20 = 1)) or //RedguardRaceVampire
- ((race = 'WoodElfRace') and (cb21 = 1)) or //WoodElfRace
- ((race = 'WoodElfRaceVampire') and (cb22 = 1)) //WoodElfRaceVampire
- ) then Result := true; //race is supported
- end;
- //main process - scanning records and doing the patching here, first thing is to declare all the variables we will use
- function Process(e: IInterface): integer;
- var
- e2: IInterface;
- el: TdfElement;
- ncnt, j, fti: integer;
- Elements: TList;
- Nif: TwbNifFile;
- Block: TwbNifBlock;
- slResList: TStringList;
- s: WideString;
- race: string;
- aContainerName, string_id, string_fp, file_source, file_path, r_tx00, r_tx01, r_tx03, r_tx04, r_tx07, s2, n, n2: string;
- begin
- Result := 0; //will terminate script when changed
- //skipping all non-NPC records
- if(Signature(WinningOverride(e)) <> 'NPC_') then
- Exit;
- //skipping record if it is overriden by another record in loard order, that way we will only copy each nif once, so it is important to select all plugins in load order
- if not IsWinningOverride(e) then begin
- // AddMessage('Skipping: ' + Name(e) + ' --> Overriden by load order.');
- Exit;
- end;
- //skip if npc race is not one of the selected races, call function for that
- if not IsSupportedRace(WinningOverride(e)) then begin
- // AddMessage('Skipping: ' + Name(WinningOverride(e)) + ' --> Unsupported race.');
- Exit;
- end;
- //if npc record has assigned skin skip it, means it uses a custom skin, so we want to preserve its look
- if (ElementExists(WinningOverride(e), 'WNAM - Worn Armor')) then begin
- // AddMessage('Skipping: ' + Name(WinningOverride(e)) + ' --> Uses custom skin.');
- Exit;
- end;
- //find default head textureset based on race and gender
- if (GetElementNativeValues(WinningOverride(e), 'ACBS\Flags') and 1 > 0) then
- e2 := LinksTo(ElementByPath(WinningOverride(LinksTo(ElementByPath(WinningOverride(e), 'RNAM'))), 'Head Data\Female Head Data\DFTF - Default Face Texture Female'))
- else
- e2 := LinksTo(ElementByPath(WinningOverride(LinksTo(ElementByPath(WinningOverride(e), 'RNAM'))), 'Head Data\Male Head Data\DFTM - Default Face Texture Male'));
- //if npc has a head textureset assigned in its record use that instead
- if (ElementExists(WinningOverride(e), 'FTST - Head texture')) then
- e2 := LinksTo(ElementByPath(WinningOverride(e), 'FTST - Head texture'));
- //if not found a head textureset record in the two previous attempts assign vanilla defaults based on race and gender
- if (not Assigned(e2)) then begin
- race := EditorID(LinksTo(ElementByPath(WinningOverride(e), 'RNAM')));
- if (GetFileName(FileByLoadOrder(2)) = 'Dawnguard.esm') then begin //Dawnguard detected
- if (GetElementNativeValues(WinningOverride(e), 'ACBS\Flags') and 1 = 0) then begin
- if (race = 'ArgonianRace') then e2 := RecordByFormID(FileByIndex(0), $00069CDD, True);//ArgonianRace
- if (race = 'ArgonianRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $000B3047, True);//ArgonianRaceVampire
- if (race = 'BretonRace') then e2 := RecordByFormID(FileByIndex(0), $0005164A, True);//BretonRace
- if (race = 'BretonRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F83, True);//BretonRaceVampire
- if (race = 'DarkElfRace') then e2 := RecordByFormID(FileByIndex(0), $0001938E, True);//DarkElfRace
- if (race = 'DarkElfRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F83, True);//DarkElfRaceVampire
- if (race = 'ElderRace') then e2 := RecordByFormID(FileByIndex(0), $00067CDC, True);//ElderRace
- if (race = 'ElderRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $00067CDC, True);//ElderRaceVampire
- if (race = 'HighElfRace') then e2 := RecordByFormID(FileByIndex(0), $00038A60, True);//HighElfRace
- if (race = 'HighElfRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F83, True);//HighElfRaceVampire
- if (race = 'ImperialRace') then e2 := RecordByFormID(FileByIndex(0), $00051646, True);//ImperialRace
- if (race = 'ImperialRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F83, True);//ImperialRaceVampire
- if (race = 'KhajiitRace') then e2 := RecordByFormID(FileByIndex(0), $00081BA1, True);//KhajiitRace
- if (race = 'KhajiitRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $000F123A, True);//KhajiitRaceVampire
- if (race = 'NordRace') then e2 := RecordByFormID(FileByIndex(0), $0003B521, True);//NordRace
- if (race = 'NordRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F83, True);//NordRaceVampire
- if (race = 'OrcRace') then e2 := RecordByFormID(FileByIndex(0), $0007A5FF, True);//OrcRace
- if (race = 'OrcRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F83, True);//OrcRaceVampire
- if (race = 'RedguardRace') then e2 := RecordByFormID(FileByIndex(0), $0005164B, True);//RedguardRace
- if (race = 'RedguardRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F83, True);//RedguardRaceVampire
- if (race = 'WoodElfRace') then e2 := RecordByFormID(FileByIndex(0), $0003D2AB, True);//WoodElfRace
- if (race = 'WoodElfRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F83, True);//WoodElfRaceVampire
- end;
- if (GetElementNativeValues(WinningOverride(e), 'ACBS\Flags') and 1 > 0) then begin
- if (race = 'ArgonianRace') then e2 := RecordByFormID(FileByIndex(0), $00069CE0, True);//ArgonianRace
- if (race = 'ArgonianRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $000B30F2, True);//ArgonianRaceVampire
- if (race = 'BretonRace') then e2 := RecordByFormID(FileByIndex(0), $00051647, True);//BretonRace
- if (race = 'BretonRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F9C, True);//BretonRaceVampire
- if (race = 'DarkElfRace') then e2 := RecordByFormID(FileByIndex(0), $00019390, True);//DarkElfRace
- if (race = 'DarkElfRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F9C, True);//DarkElfRaceVampire
- if (race = 'ElderRace') then e2 := RecordByFormID(FileByIndex(0), $00068390, True);//ElderRace
- if (race = 'ElderRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $00068390, True);//ElderRaceVampire
- if (race = 'HighElfRace') then e2 := RecordByFormID(FileByIndex(0), $00038A5F, True);//HighElfRace
- if (race = 'HighElfRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F9C, True);//HighElfRaceVampire
- if (race = 'ImperialRace') then e2 := RecordByFormID(FileByIndex(0), $00051648, True);//ImperialRace
- if (race = 'ImperialRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F9C, True);//ImperialRaceVampire
- if (race = 'KhajiitRace') then e2 := RecordByFormID(FileByIndex(0), $000B79B6, True);//KhajiitRace
- if (race = 'KhajiitRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $000F1239, True);//KhajiitRaceVampire
- if (race = 'NordRace') then e2 := RecordByFormID(FileByIndex(0), $0003B522, True);//NordRace
- if (race = 'NordRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F9C, True);//NordRaceVampire
- if (race = 'OrcRace') then e2 := RecordByFormID(FileByIndex(0), $00093150, True);//OrcRace
- if (race = 'OrcRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F9C, True);//OrcRaceVampire
- if (race = 'RedguardRace') then e2 := RecordByFormID(FileByIndex(0), $00051649, True);//RedguardRace
- if (race = 'RedguardRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F9C, True);//RedguardRaceVampire
- if (race = 'WoodElfRace') then e2 := RecordByFormID(FileByIndex(0), $0003D2AC, True);//WoodElfRace
- if (race = 'WoodElfRaceVampire') then e2 := RecordByFormID(FileByLoadOrder(2), $02006F9C, True);//WoodElfRaceVampire
- end;
- end;
- if (not (GetFileName(FileByLoadOrder(2)) = 'Dawnguard.esm')) then begin //no Dawnguard
- if (GetElementNativeValues(WinningOverride(e), 'ACBS\Flags') and 1 = 0) then begin
- if (race = 'ArgonianRace') then e2 := RecordByFormID(FileByIndex(0), $00069CDD, True);//ArgonianRace
- if (race = 'ArgonianRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $000B3047, True);//ArgonianRaceVampire
- if (race = 'BretonRace') then e2 := RecordByFormID(FileByIndex(0), $0005164A, True);//BretonRace
- if (race = 'BretonRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $0005164A, True);//BretonRaceVampire
- if (race = 'DarkElfRace') then e2 := RecordByFormID(FileByIndex(0), $0001938E, True);//DarkElfRace
- if (race = 'DarkElfRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $0001938E, True);//DarkElfRaceVampire
- if (race = 'ElderRace') then e2 := RecordByFormID(FileByIndex(0), $00067CDC, True);//ElderRace
- if (race = 'ElderRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $00067CDC, True);//ElderRaceVampire
- if (race = 'HighElfRace') then e2 := RecordByFormID(FileByIndex(0), $00038A60, True);//HighElfRace
- if (race = 'HighElfRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $00038A60, True);//HighElfRaceVampire
- if (race = 'ImperialRace') then e2 := RecordByFormID(FileByIndex(0), $00051646, True);//ImperialRace
- if (race = 'ImperialRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $00051646, True);//ImperialRaceVampire
- if (race = 'KhajiitRace') then e2 := RecordByFormID(FileByIndex(0), $00081BA1, True);//KhajiitRace
- if (race = 'KhajiitRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $000F123A, True);//KhajiitRaceVampire
- if (race = 'NordRace') then e2 := RecordByFormID(FileByIndex(0), $0003B521, True);//NordRace
- if (race = 'NordRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $0003B521, True);//NordRaceVampire
- if (race = 'OrcRace') then e2 := RecordByFormID(FileByIndex(0), $0007A5FF, True);//OrcRace
- if (race = 'OrcRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $0007A5FF, True);//OrcRaceVampire
- if (race = 'RedguardRace') then e2 := RecordByFormID(FileByIndex(0), $0005164B, True);//RedguardRace
- if (race = 'RedguardRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $0005164B, True);//RedguardRaceVampire
- if (race = 'WoodElfRace') then e2 := RecordByFormID(FileByIndex(0), $0003D2AB, True);//WoodElfRace
- if (race = 'WoodElfRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $0003D2AB, True);//WoodElfRaceVampire
- end;
- if (GetElementNativeValues(WinningOverride(e), 'ACBS\Flags') and 1 > 0) then begin
- if (race = 'ArgonianRace') then e2 := RecordByFormID(FileByIndex(0), $00069CE0, True);//ArgonianRace
- if (race = 'ArgonianRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $000B30F2, True);//ArgonianRaceVampire
- if (race = 'BretonRace') then e2 := RecordByFormID(FileByIndex(0), $00051647, True);//BretonRace
- if (race = 'BretonRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $00051647, True);//BretonRaceVampire
- if (race = 'DarkElfRace') then e2 := RecordByFormID(FileByIndex(0), $00019390, True);//DarkElfRace
- if (race = 'DarkElfRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $00019390, True);//DarkElfRaceVampire
- if (race = 'ElderRace') then e2 := RecordByFormID(FileByIndex(0), $00068390, True);//ElderRace
- if (race = 'ElderRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $00068390, True);//ElderRaceVampire
- if (race = 'HighElfRace') then e2 := RecordByFormID(FileByIndex(0), $00038A5F, True);//HighElfRace
- if (race = 'HighElfRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $00038A5F, True);//HighElfRaceVampire
- if (race = 'ImperialRace') then e2 := RecordByFormID(FileByIndex(0), $00051648, True);//ImperialRace
- if (race = 'ImperialRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $00051648, True);//ImperialRaceVampire
- if (race = 'KhajiitRace') then e2 := RecordByFormID(FileByIndex(0), $000B79B6, True);//KhajiitRace
- if (race = 'KhajiitRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $000F1239, True);//KhajiitRaceVampire
- if (race = 'NordRace') then e2 := RecordByFormID(FileByIndex(0), $0003B522, True);//NordRace
- if (race = 'NordRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $0003B522, True);//NordRaceVampire
- if (race = 'OrcRace') then e2 := RecordByFormID(FileByIndex(0), $00093150, True);//OrcRace
- if (race = 'OrcRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $00093150, True);//OrcRaceVampire
- if (race = 'RedguardRace') then e2 := RecordByFormID(FileByIndex(0), $00051649, True);//RedguardRace
- if (race = 'RedguardRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $00051649, True);//RedguardRaceVampire
- if (race = 'WoodElfRace') then e2 := RecordByFormID(FileByIndex(0), $0003D2AC, True);//WoodElfRace
- if (race = 'WoodElfRaceVampire') then e2 := RecordByFormID(FileByIndex(0), $0003D2AC, True);//WoodElfRaceVampire
- end;
- end;
- end;
- //if all attempts to find the head textureset failed give up on this record
- if (not Assigned(e2)) then begin
- // AddMessage('Skipping ' + Name(WinningOverride(e)) + ' -> ' + 'face texture not assigned.');
- Exit;
- end;
- //make sure we are looking for texture paths in the latest TXST record
- e2 := WinningOverride(e2);
- el := ElementBySignature(e2, 'TX00');
- //write paths for textures from the textureset record to strings, we'll use them for patching the nif
- r_tx00 := GetEditValue(ElementBySignature(el, 'TX00'));
- r_tx01 := GetEditValue(ElementBySignature(el, 'TX01'));
- r_tx03 := GetEditValue(ElementBySignature(el, 'TX03'));
- r_tx04 := GetEditValue(ElementBySignature(el, 'TX04'));
- r_tx07 := GetEditValue(ElementBySignature(el, 'TX07'));
- // find the path to where the FaceGen nif is located and its name
- string_id := IntToHex(FixedFormID(WinningOverride(e)) and $00FFFFFF, 8);
- string_fp := GetFileName(GetFile(MasterOrSelf(WinningOverride(e))));
- file_source := 'meshes\actors\character\FaceGenData\FaceGeom\' + string_fp + '\' + string_id + '.nif';
- file_path := sOutputPath + 'meshes\actors\character\FaceGenData\FaceGeom\' + string_fp + '\' + string_id + '.nif';
- // extract the FaceGen nif, find all files containing it to use the latest one
- slResList := TStringList.Create;
- ncnt:= ResourceCount(file_source, slResList);
- if ncnt = 0 then begin
- Result := false;
- // AddMessage('Skipping ' + Name(WinningOverride(e)) + ' -> ' + file_source + ' does not exist.');
- Exit;
- end;
- aContainerName := slResList[slResList.Count - 1];
- slResList.Free;
- if ResourceExists(file_source) then begin
- AddMessage('Looking in ' + aContainerName + ' for ' + file_source);
- AddMessage('Copying ' + file_source + ' -> ' + file_path);
- ResourceCopy(aContainerName,file_source,file_path);
- end;
- //begin work on NIF
- fti := 0; //face texture index - this will identify the block that stores head textures inside nif
- n := '\' + string_id + '.dds'; //name of tintmask file for this npc, this will be used to find the block inside nif that stores textures for face/head
- //make sure the nif file was extracted before we proceed, some npcs use templates and do not possess a facegen
- if FileExists(file_path) then
- AddMessage('Processing ' + Name(WinningOverride(e)) + ' -> ' + file_path)
- else begin
- // AddMessage('Skipping ' + Name(WinningOverride(e)) + ' -> ' + file_path + ' does not exist.');
- Exit;
- end;
- try
- // collecting elements with textures
- // *.NIF file
- Elements := TList.Create;
- Nif := TwbNifFile.Create;
- Nif.LoadFromFile(file_path);
- // iterate over all blocks in a nif file and locate elements holding textures, first we will collect all the texture paths before we find the proper ones
- for j := 0 to Pred(Nif.BlocksCount) do begin
- Block := Nif.Blocks[j];
- if Block.BlockType = 'BSShaderTextureSet' then begin
- el := Block.Elements['Textures'];
- for j := 0 to Pred(el.Count) do
- Elements.Add(el[j]);
- end
- end;
- // iterate thorugh all collected stuff and do text replacement in selected parts
- for j := 0 to Pred(Elements.Count) do begin
- if not Assigned(Elements[j]) then
- Continue
- else begin
- el := TdfElement(Elements[j]);
- // getting the texture name stored into a string we'll use for comparison
- s := el.EditValue;
- // compare if texture name contains the path for the tintmask texture, if so we have found the block we are looking for
- if pos(LowerCase(n), LowerCase(s)) > 0 then
- fti := j //marks the position of the tintmask texture string
- else begin
- n2 := LowerCase(n); //just abbreviation
- s2 := LowerCase(s);
- //finding a tintmask texture which path points to a different dds file, this probably won't be happening because we skipped records with custom skin
- if (pos('.esm', s2) > 0) or (pos('.esp', s2) > 0) and (pos('facetint', s2) > 0) and (copy(s2, Length(s2) - 4, 4) = '.dds') then begin
- fti := j; //marks the position of the tintmask texture string
- AddMessage('--> WARNING: CharGen texture block detected but FaceTint used points to a different file.');
- end
- end
- end
- end;
- //if the block conaining Tintmask texture was found use its position as a reference for which strings to replace with our corrected texture paths
- if fti = 0 then
- AddMessage('--> NIF has no CharGen texture block');
- if fti <> 0 then begin
- TdfElement(Elements[fti-6]).EditValue := r_tx00;
- TdfElement(Elements[fti-5]).EditValue := r_tx01;
- TdfElement(Elements[fti-4]).EditValue := r_tx03;
- TdfElement(Elements[fti-3]).EditValue := r_tx04;
- TdfElement(Elements[fti+1]).EditValue := r_tx07;
- el.Root.SaveToFile(file_path);
- end;
- finally
- Elements.Free;
- Nif.Free;
- end;
- end;
- // On starting the script
- function Initialize: Integer;
- var
- frm: TForm;
- clb: TCheckListBox;
- slPreferences: TStringList;
- begin
- Result := 0; //will terminate script when changed
- if not (GetFileName(FileByLoadOrder(2)) = 'Dawnguard.esm') then begin
- AddMessage('-->WARNING: Dawnguard.esm was not found. Check if its the third plugin (after Skyrim.esm and Update.esm) in your load order.');
- end;
- frm := frmFileSelect;
- frm.Caption := 'Select races to scan:';
- clb := TCheckListBox(frm.FindComponent('CheckListBox1'));
- clb.Items.Append('Argonian');
- clb.Items.Append('Argonian (Vampire)');
- clb.Items.Append('Breton');
- clb.Items.Append('Breton (Vampire)');
- clb.Items.Append('Dark Elf');
- clb.Items.Append('Dark Elf (Vampire)');
- clb.Items.Append('Old People');
- clb.Items.Append('Old People (Vampire)');
- clb.Items.Append('High Elf');
- clb.Items.Append('High Elf (Vampire)');
- clb.Items.Append('Imperial');
- clb.Items.Append('Imperial (Vampire)');
- clb.Items.Append('Khajit');
- clb.Items.Append('Khajit (Vampire)');
- clb.Items.Append('Nord');
- clb.Items.Append('Nord (Vampire)');
- clb.Items.Append('Orc');
- clb.Items.Append('Orc (Vampire)');
- clb.Items.Append('Redguard');
- clb.Items.Append('Redguard (Vampire)');
- clb.Items.Append('Wood Elf');
- clb.Items.Append('Wood Elf (Vampire)');
- if frm.ShowModal <> mrOk then begin
- Result := 1;
- Exit;
- end;
- if clb.Checked[0] then cb1 := 1;
- if clb.Checked[1] then cb2 := 1;
- if clb.Checked[2] then cb3 := 1;
- if clb.Checked[3] then cb4 := 1;
- if clb.Checked[4] then cb5 := 1;
- if clb.Checked[5] then cb6 := 1;
- if clb.Checked[6] then cb7 := 1;
- if clb.Checked[7] then cb8 := 1;
- if clb.Checked[8] then cb9 := 1;
- if clb.Checked[9] then cb10 := 1;
- if clb.Checked[10] then cb11 := 1;
- if clb.Checked[11] then cb12 := 1;
- if clb.Checked[12] then cb13 := 1;
- if clb.Checked[13] then cb14 := 1;
- if clb.Checked[14] then cb15 := 1;
- if clb.Checked[15] then cb16 := 1;
- if clb.Checked[16] then cb17 := 1;
- if clb.Checked[17] then cb18 := 1;
- if clb.Checked[18] then cb19 := 1;
- if clb.Checked[19] then cb20 := 1;
- if clb.Checked[20] then cb21 := 1;
- if clb.Checked[21] then cb22 := 1;
- clb.Free;
- frm.Free;
- if (cb1+cb2+cb3+cb4+cb5+cb6+cb7+cb8+cb9+cb10+cb11+cb12+cb13+cb14+cb15+cb16+cb17+cb18+cb19+cb20+cb21+cb22=0) then begin
- Result := 1;
- Exit;
- end;
- slPreferences := TStringList.Create;
- if FileExists(SavedPrefs) then begin
- slPreferences.LoadFromFile(SavedPrefs);
- sOutputPath := slPreferences[0];
- end;
- if not InputQuery('NPC Facegen Patcher', 'Directory to extract files to:', sOutputPath) then begin
- Result := 1;
- Exit;
- end;
- if sOutputPath = '' then begin
- Result := 1;
- Exit;
- end;
- sOutputPath := IncludeTrailingBackslash(sOutputPath);
- if sOutputPath = DataPath then begin
- AddMessage('-->ERROR: Output directory should not be the Skyrim Data folder i.e. ' +DataPath);
- Result := 1;
- Exit;
- end;
- if not ForceDirectories(sOutputPath) then begin
- AddMessage('-->ERROR: Invalid directory: ' +sOutputPath);
- Result := 1;
- Exit;
- end;
- if not FileExists(SavedPrefs) then
- slPreferences.Add(sOutputPath)
- else
- slPreferences[0] := sOutputPath;
- slPreferences.SaveToFile(SavedPrefs);
- slPreferences.Free;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement