Guest User

Untitled

a guest
Jun 28th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. unit UserScript;
  2.  
  3. var
  4. RefCount: integer;
  5.  
  6.  
  7. function Process(e: IInterface): integer;
  8. var
  9. s: string;
  10.  
  11. var
  12. edid: String;
  13.  
  14. begin
  15. RefCount := 0;
  16. s := Signature(e);
  17.  
  18. if (s <> 'REFR') and (s <> 'ACHR') then
  19. Exit;
  20.  
  21. if GetIsDeleted(e) then
  22. Exit;
  23.  
  24. edid := EditorID(LinksTo(ElementBySignature(e, 'NAME')));
  25.  
  26.  
  27. // This is the important part.
  28. if edid = 'A' then SetElementEditValues(e, 'NAME', 'B');
  29. // A -> EditorID of the base object you want to replace.
  30. // B -> FormID number of the base object you want to replace it with. (Make sure load order is correct!
  31. // e.g.: if edid = 'ArmorElvenShield' then SetElementEditValues(e, 'NAME', '000139A1');
  32. // This will replace all elven shield with elven swords (000139A1).
  33.  
  34.  
  35. if not ElementExists(e, 'DATA') then
  36. Exit;
  37.  
  38. Inc(RefCount);
  39. end;
  40.  
  41. function Finalize: integer;
  42. begin
  43. AddMessage(Format('Done, updated %d reference(s)', [RefCount]));
  44. end;
  45.  
  46. end.
Advertisement
Add Comment
Please, Sign In to add comment