Advertisement
Guest User

Untitled

a guest
Apr 16th, 2015
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.82 KB | None | 0 0
  1. {
  2.   Add XESP (parent enable) element to the references of specific base object.
  3.   Apply to references (or cell(s)/worldspace(s) they are in).
  4. }
  5. unit AddXESP;
  6.  
  7. const
  8.   sBaseObject = 'CommonChair01FL "Chair" [FURN:0006E7A6]'; // base object for references to add parent
  9.   sParent = '000E52E4'; // parent object
  10.   sRefSignatures = 'REFR,ACHR,PGRE,PMIS,PHZD,PARW,PBAR,PBEA,PCON,PFLA';
  11.  
  12. function Process(e: IInterface): integer;
  13. begin
  14.   if Pos(Signature(e), sRefSignatures) = 0 then
  15.     Exit;
  16.  
  17.   if GetIsDeleted(e) then
  18.     Exit;
  19.  
  20.   if not SameText(GetElementEditValues(e, 'NAME'), sBaseObject) then
  21.     Exit;
  22.  
  23.   if ElementExists(e, 'XESP') then
  24.     AddMessage('Parent already exists on ' + Name(e))
  25.   else begin
  26.     Add(e, 'XESP', True);
  27.     SetElementEditValues(e, 'XESP\Reference', sParent);
  28.   end;
  29. end;
  30.  
  31. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement