Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit SetInteriorCellUnknown23_3;
- var
- ToFile: IInterface;
- // Code for SelectFile was borrowed from the "Copy as override.pas" script
- function SelectFile(e: IInterface): Boolean;
- var
- frm: TForm;
- clb: TCheckListBox;
- m, ovr: IInterface;
- i: integer;
- begin
- Result := False;
- if not Assigned(ToFile) then begin
- frm := frmFileSelect;
- try
- frm.Caption := 'Select a plugin';
- clb := TCheckListBox(frm.FindComponent('CheckListBox1'));
- clb.Items.Add('<new file>');
- for i := Pred(FileCount) downto 0 do begin
- clb.Items.InsertObject(1, GetFileName(FileByIndex(i)), FileByIndex(i));
- if GetFileName(e) = GetFileName(FileByIndex(i)) then
- Break;
- end;
- if frm.ShowModal <> mrOk then
- Exit;
- for i := 0 to Pred(clb.Items.Count) do
- if clb.Checked[i] then begin
- if i = 0 then ToFile := AddNewFile else
- ToFile := ObjectToElement(clb.Items.Objects[i]);
- Break;
- end;
- finally
- frm.Free;
- end;
- if Assigned(ToFile) then
- Result := True;
- end;
- end;
- function Process(e: IInterface): Integer;
- var
- e1: IInterface;
- begin
- {B-}
- if (Signature(e) = 'CELL')
- // comment out the following line if you want that the script can modify the flag for Worldspace cells
- and (GetElementNativeValues(e, 'DATA - Flags') and 1 = 1)
- then begin
- if not Assigned(ToFile) and not SelectFile(e) then begin
- Result := 1;
- Exit;
- end;
- AddRequiredElementMasters(e, ToFile, false);
- e1 := wbCopyElementToFile(e, ToFile, false, true);
- SetElementNativeValues(e1, 'Record Header\Record Flags\Unknown 23', 1);
- end;
- end;
- function Finalize: Integer;
- begin
- SortMasters(ToFile);
- CleanMasters(ToFile);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement