ID8879488948574 Posted March 17, 2020 Share Posted March 17, 2020 (edited) I saved a plugin which has multiple masters (several ESM and one ESP). And then I discovered that for whatever reason it just removed the ESP from the master list and changed form IDs from the master ESP to itself (i.e. now the FormID of the saved ESP has the same index as the one of the previous master). So of course all the references are broken. Fixing it manually doesn't seem to be a great idea as there are thousands of records. I tried adding a master back via F4Edit - of course, it can be added but since the references are now pointing the the file itself, adding a master does nothing and F4Edit shows failure in resolution for all the records from the master. Is it all lost and there is no way of restoring the file? Or is there a clever way to restore this now? I mean, the references are still there and correct, but I somehow need to restore the master index in them (I guess) On a side note, why the heck CK even did that? It retained the ESM masters but dropped the ESP one. I'm aware about multiple plugins options in the .ini and that is set correctly (else it refuses to even open the plugin) Edited March 17, 2020 by Dellecross Link to comment Share on other sites More sharing options...
Deleted33156511User Posted March 17, 2020 Share Posted March 17, 2020 What master files that lost to be specific ? Link to comment Share on other sites More sharing options...
ID8879488948574 Posted March 17, 2020 Author Share Posted March 17, 2020 What master files that lost to be specific ?You mean, the ESP? So the structure is like this: Fallout4.esm+---- MasterFile.esp DLCRobot.esmDLCWorkshop.esmDLCCoast.esmDLCNukaWorld.esmMasterFile.esp+---- ModFile.esp Both MasterFile.esp and ModFile.esp are my mods I created originally in F4edit, ModFile refers a lot of records from MasterFile (I was wrong - not thousands, but I've run an error check in F4Edit now and it's 675 - still not something I want to fix manually) Link to comment Share on other sites More sharing options...
niston Posted March 17, 2020 Share Posted March 17, 2020 CK always strips ESPs from the master list. Link to comment Share on other sites More sharing options...
ID8879488948574 Posted March 17, 2020 Author Share Posted March 17, 2020 CK always strips ESPs from the master list.Great. I got my answer as to "why did it happen", thanks. Any words on fixing it now or a no-go? Link to comment Share on other sites More sharing options...
niston Posted March 17, 2020 Share Posted March 17, 2020 There is a boatload of similarly borked REFRs in Nuka World Glory. I fixed them manually in xedit cause I couldn't find a better way (then again I totally suck at xedit scripting). Link to comment Share on other sites More sharing options...
ID8879488948574 Posted March 17, 2020 Author Share Posted March 17, 2020 There is a boatload of similarly borked REFRs in Nuka World Glory. I fixed them manually cause I couldn't find a better way (then again I totally suck at xedit scripting).Eh.. so how am I supposed to use CK if I need to have custom ESP as masters? I can't attach / edit scripts in F4Edit, so I have no choice but to use CK for that. Back to my original question - luckily, F4Edit isn't as messed up as CK and provides an opportunity to run custom scripts. With a bit of reading their API I just wrote a script to fix the problem { New script template, only shows processed records Assigning any nonzero value to Result will terminate script } unit userscript; var oldPrefix : String; newPrefix : String; function Initialize: integer; begin Result := 0; oldPrefix := InputBox('Enter', 'Old Master Index', ''); newPrefix := InputBox('Enter', 'New Master Index', ''); end; function Process(e: IInterface): integer; var index : Integer; child : IwbElement; editValue : String; begin Result := 0; //AddMessage('Attempted Value: ' + GetEditValue(e)); editValue := FixValue(GetEditValue(e)); if (editValue <> '') then begin AddMessage(BaseName(e) + ' : Setting New Edit Value: ' + editValue); SetEditValue(e, editValue); end; for index := ElementCount(e) - 1 downto 0 do begin child := ElementByIndex(e, index); Result := Result + Process(child); end; end; function FixValue(editValue: String) : String; var refPrefix : String; begin // Stuff looks something like this: // [08000850] < Error: Could not be resolved > if (Copy(editValue, 0, 1) = '[') and (Copy(editValue, 2, 2) = oldPrefix) then begin AddMessage('Found value for: ' + editValue); Result := '[' + newPrefix + Copy(editValue, 4, 6) + ']'; end else begin Result := ''; end; end; // Called after processing // You can remove it if script doesn't require finalization code function Finalize: integer; begin Result := 0; end; end. Which will work for my case - but will cause issues if you have valid references from the current ESP and invalid ones from master ESP. I guess it's possible to add a condition there to check if the targeted reference actually exists, but then it will probably require some additional checks and validation etc - so I left this simple. Link to comment Share on other sites More sharing options...
Elsidia1 Posted March 18, 2020 Share Posted March 18, 2020 (edited) Deleted Edited March 18, 2020 by Elsidia1 Link to comment Share on other sites More sharing options...
VIitS Posted March 21, 2020 Share Posted March 21, 2020 If you haven't done anything with your plugin since the CK broke it (and that includes saving it in xEdit), it is possible to fix it in xEdit using some very careful editing and advanced features (check the What's New). PM me if you have any questions, as misusing the advanced features tends to result in very broken plugins. If you have already saved it in xEdit, then it is too late to fix it other than manually or trying your script. If you have backups enabled in xEdit (they are enabled by default), you could try seeing if the first backup from after the CK broke it is still good. Edit: Also, if you need to edit a plugin in the CK and it has a .esp master, you need to use xEdit to flag it as ESM first. Once you are done in the CK you can then remove the flag from the master .esp. Link to comment Share on other sites More sharing options...
Recommended Posts