-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoveOwnership.pas
More file actions
52 lines (42 loc) · 1.37 KB
/
RemoveOwnership.pas
File metadata and controls
52 lines (42 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
Purpose: Remove ownership from flora
Game: The Elder Scrolls V: Skyrim
Author: Ryan ryan.a.piper@gmail.com
after: dalen <erik.gustav.dalen@gmail.com>
https://github.com/dalen/xedit-scripts.git
Version: 1
}
unit userscript;
procedure RemoveOwnership(e: IInterface);
var
ownerElement: IInterface;
begin
ownerElement := ElementByPath(e, 'Ownership');
RemoveElement(e, ownerElement);
end;
// called for every record selected in xEdit
function Process(e: IInterface): integer;
var
val: integer;
ParentCell, Worldspace, PlacedObject, owner: IInterface;
WorldspaceName: string;
begin
Result := 0;
// Skip if not a REFR
if Signature(e) <> 'REFR' then exit;
PlacedObject := LinksTo(ElementByName(e, 'NAME - Base'));
// Skip if placed object type is not TreeFlora*
//if not StrPos(EditorID(PlacedObject), 'TreeFlora') then exit;
if not StartsStr('USKPTreeFlora', EditorID(PlacedObject)) then exit;
// Skip items that already don't have owners
owner := ElementByPath(e, 'Ownership');
if not (owner <> nil) then exit;
ParentCell := LinksTo(ElementByName(e, 'Cell'));
Worldspace := LinksTo(ElementByName(ParentCell, 'Worldspace'));
WorldspaceName := EditorID(Worldspace);
AddMessage('Processing: ' + FullPath(e));
AddMessage('Object: ' + EditorID(PlacedObject));
AddMessage('Worldspace: ' + WorldspaceName);
RemoveOwnership(e)
end;
end.