|
|
|
@ -6,7 +6,7 @@ |
|
|
|
|
This script does not process bi-directional location references. Resave plugin in CK to rebuild them. |
|
|
|
|
Running it on a plugin will set the ESM flag as well. Running it on a node will only attempt to fix broken persistence. |
|
|
|
|
|
|
|
|
|
Normally, NPCs must have assigned Persistent Location. If they don't, their packages will break after conversion to ESM. |
|
|
|
|
Normally, NPCs must have assigned Persistent Location. If they don't, their packages may break after conversion to ESM. |
|
|
|
|
Persistent Location can't be reliably set by a script, so instead we scan NPC attributes and packages, try to determine |
|
|
|
|
if they potentially need persistence, and set the global Persistent flag. This is a band-aid! To fix them properly, |
|
|
|
|
assign valid locations to actors via the Persistent Location field. |
|
|
|
@ -32,7 +32,7 @@ begin |
|
|
|
|
sig := Signature(referencingRecord); |
|
|
|
|
|
|
|
|
|
// Locational links are bi-directional, this script does not process them. To fix them, resave plugin in CK. |
|
|
|
|
// WRLD records may refer to REFRs if they are large references. This does not imply necessity of the persistence flag. |
|
|
|
|
// WRLD records may refer to REFRs if they are large references. Being a large reference does not imply necessity of the persistence flag. |
|
|
|
|
// TES4 may refer to REFRs if they are listed in ONAM. To keep ONAM up to date, enable "Always save ONAM" in xEdit. |
|
|
|
|
|
|
|
|
|
if (sig = 'LCTN') or (sig = 'WRLD') or (sig = 'TES4') then |
|
|
|
@ -105,24 +105,6 @@ begin |
|
|
|
|
result := (coords.x = otherCoords.x) and (coords.y = otherCoords.y); |
|
|
|
|
end; |
|
|
|
|
|
|
|
|
|
function HasScripts(e: IwbMainRecord; targetScripts: string): boolean; |
|
|
|
|
var |
|
|
|
|
scripts, currentItem: IwbElement; |
|
|
|
|
linkedCount, i: integer; |
|
|
|
|
begin |
|
|
|
|
if not ElementExists(e, 'VMAD') then exit; |
|
|
|
|
|
|
|
|
|
scripts := ElementByPath(e, 'VMAD\Scripts'); |
|
|
|
|
for i := 0 to Pred(ElementCount(scripts)) do begin |
|
|
|
|
currentItem := ElementByIndex(scripts, i); |
|
|
|
|
|
|
|
|
|
if Pos(GetElementEditValues(currentItem, 'ScriptName'), targetScripts) <> 0 then begin |
|
|
|
|
result := true; |
|
|
|
|
break; |
|
|
|
|
end; |
|
|
|
|
end; |
|
|
|
|
end; |
|
|
|
|
|
|
|
|
|
function MarkPersistent(e: IwbMainRecord): boolean; |
|
|
|
|
begin |
|
|
|
|
AddMessage(' + Marking as persistent: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')'); |
|
|
|
@ -248,7 +230,7 @@ begin |
|
|
|
|
baseRefRecord := BaseRecord(e); |
|
|
|
|
|
|
|
|
|
if not Assigned(baseRefRecord) then begin |
|
|
|
|
AddMessage(' INVALID RECORD: missing base form: ' + FullPath(e)); |
|
|
|
|
AddMessage(' INVALID RECORD: Missing base form: ' + FullPath(e)); |
|
|
|
|
exit; |
|
|
|
|
end; |
|
|
|
|
|
|
|
|
|