Jump to content

Question

Posted (edited)

ReLinker

Hishy had the idea of making a little tool to allow us to merge mods with scripts - it takes the merge maps that are produced when you merge something, grabs all the scripts and LODGen files from you active mod list (BSAs included) and replaces the old plugin name and formIDs with the new plugin name and formIDs.

We all know what a fantastic tool Merge Plugins is. However there are certain mods which cannot be merged due to the use of certain scripting functions which are called on the original plugin name. Functions including GetFormFromFile, GetModByName, checkModPresence, and IsPluginLoaded look for specific .esp names. When you create a merge the original .esp name(s) no longer exists (unless you rename the merged plugin back to one of the original plugin names but this in itself can cause problems including broken MCM menus and is therefore not ideal) and therefore any function call looking for them will no longer trigger. These functions can be called by one of the scripts included in the mod being merged, or by scripts from other mods outside the merge.

A prime example of this is how the 'self-patching' in Legacy of the Dragonborn works by looking for the existence of a whole host of plugin names and activating the various additional displays if the mods are loaded. ReLinker actually came about out of a conversation regarding merging the four BadGremlins treasure hunt mods and patching the LotD activator script to make sure all four displays were still activated.

ReLinker is run outside ModOrganizer and runs on whichever profile you last had open before closing out of MO. It scans your load order looking for merges, and for every merge it finds it reads the contents of plugins and map .txt files and creates a reference list of the original plugin names and the new merged plugin name, along with the original and renumbered FormIDs. It then scans every script in your load order looking for any of those functions mentioned above and editing the scripts to reflect the new plugin names and formIDs. So in the example above once we've merged all four treasure hunts into Treasure Hunts.esp and run ReLinker, the DBM script will now look for Treasure Hunts.esp four times and activate all four displays. Likewise if you were to merge a mod like Sneak Tools whose scripts contain numerous Sneak Tools.esp lookups, ReLinker would then edit all of the Sneak Tools scripts in the merge itself to ensure they now look for the new merged plugin name and renumbered formIDs instead.

ReLinker works on both loose files (if you unpack your BSAs) and on scripts within BSAs. It directly edits the .pex files, doing away with the need to decompile and recompile the scripts which has greatly sped up the process over in the release version.

Instructions:

  1. Make sure you have the profile you want to ReLink active in Mod Organizer and that you have completed and activated all of your merges.
  2. Exit Mod Organizer
  3. Run ReLinker and follow the on screen instructions to specify the required paths.
  4. Check on screen output to ensure ReLinker has completed successfully.
  5. Close the ReLinker window and open Mod Organizer.
  6. Scroll to the bottom of the left pane and locate the new ReLinker Output mod.
  7. Activate ReLinker Output and leave it at the bottom of the left pane to ensure the new ReLinked scripts have priority over the originals.
  8. That's it, there is no 8

If you add/remove/update any mods or create any new merges and want to ReLink again then simply remove the existing ReLinker Output mod completely, exit MO and repeat the process again.

Prerequisites:

  • Mod Organizer - does not work with other managers;
  • Do not remove the merge folder after completing a merge.

Download it here. The tool will ask you for some things and will try to guess them properly. If the values between square brackets are correct, simply press ENTER without inputting any value. The output scripts and LODGen files will be stored in a new mod folder named "ReLinker Output". To revert the changes from this tool simply disable or delete the folder.
 
Good Practices:

  • ReLinker will run with the latest profile used in MO;
  • Close MO before running it.

By default, the following BSA's are ignored to speed up the process and because they don't contain any scripts with the functions that are affected:

  • Skyrim - Misc.bsa
  • Skyrim - Shaders.bsa
  • Skyrim - Textures.bsa
  • Skyrim - Interface.bsa
  • Skyrim - Animations.bsa
  • Skyrim - Meshes.bsa
  • Skyrim - Sounds.bsa
  • Skyrim - Voices.bsa
  • Skyrim - VoicesExtra.bsa
  • Update.bsa
  • Dawnguard.bsa
  • HearthFires.bsa
  • Dragonborn.bsa
  • HighResTexturePack01.bsa
  • HighResTexturePack02.bsa
  • HighResTexturePack03.bsa
  • Unofficial Skyrim Legendary Edition Patch.bsa
  • Falskaar.bsa
  • Wyrmstooth.bsa

If you have specific issues or suggestions post it directly to the this topic. I'm always happy to receive questions and feedback. Happy merging!

 

EDIT: Thanks dunc for the much better description!

Edited by hishutup
  • +1 2

Recommended Posts

  • 0
Posted

Hey! I'm using wrye bash, how do I manually do this? If you could link me to the needed reading, it would help.

 

I don't have many mergers with scripts involved (one counted, so far). If nothing helps, I could leave the scripted mod out of the merge (even if the guide I'm following tells me to merge and then run relinker, the guide assumes mod organizer).

 

Thanks!

  • 0
Posted

The integration is not there when using wb. The current method could only be easily applied to mo, sorry.

In wb the installer files are not the ones that actually get loaded into the game. I wonder if this could run in the data folder? Maybe generate a list of changed files so you could manually pick them and add them as a mod to wrye bash, overriding the originals (or disable them if there are changes to plugins) and thus maintain coherence? 

 

If not, is there a hard way? Can you do these edits manually?

  • 0
Posted

The integration is not there when using wb. The current method could only be easily applied to mo, sorry.

From what Darth_mathias told me, I infer the following (this is my interpretation, not his words): relinker generates a patch and if a file is patched, you should not merge it if you can't use relinker. If I can view a patch made for the full mod list with mod organizer (which I have, on my laptop) I simply don't merge the affected files. Would that work? I'm new to this and got the impression from the gamerpoets video that you should avoid merging scripted mods. But apparently, not all scripted mods will have problems with merging, if relinker fixes only some of those.

  • 0
Posted

It really depends on how the author wrote the code. If an author is using the basic function then relinker will find it, if the author decided to write some custom function that uses a var for a filename then relinker will never see that at this time.

The reason MO was used, is because the way the files are stored. The mod folders are in a way that I can emulate someone installing the mods as if they are being freshly installed. The same cannot be said for WB because the archives are like sub packages which need to be unpacked to see if they are even relevant.

Is it possible to extend this to WB, yes. Is it practical, not really as it would take way too long for the end user.

  • 0
Posted (edited)

Just some tips to anyone that encounters an error with Relinker and needs to troubleshoot the problem. Disabling a mod does not seem to prevent Relinker from looking at it. I was getting an error last night ( something something invalid value something something I believe) because one of my merged plugins had gotten corrupted somehow and could not figure out which plugin was causing the error, because even disabling all of them caused the exact same error to occur. Then I moved the mods out of the mod organizer/mods folder and into a temporary directory, which disabled it for the purposes of Relinker. So, to troubleshoot merged plugins for Relinker:

 

1. Find your merged plugin mods in mod organizer / mods

2. Find your merged plugin mods in mod organizer's left pane

3. Disable your merged plugin mods in the left pane

4. Disable any mods that now have missing masters

5. Close MO

6. Remove the disabled plugin mods from the mod organizer / mods folder and place them into a temporary directory, such as desktop/Temp_Mods

7. Run Relinker (outside of MO, of course). If the error persists, the disabled plugins are not the problem.

8. Copy all OK mods back to mod organizer/mods folder from desktop/Temp_Mods

9. Re-Open MO

10. Re-enable all disabled mods/plugins

11. Repeat until you find the exact plugin(s) causing the problem. 

 

In this case, re-installing the constituent merge mods and then rebuilding the merge solved my problem, and this was how I figured which merge was my issue!

 

Edit: Error code was invalid literal for int() with base 16

Edited by xdarkwind
  • 0
Posted

Hey I had a question I was hoping you guys could answer.

After Running Relinker I get this error before it finishes Applying merge maps
0.76% Done File "<string>", line 346, in <module>
 
<class 'ValueError'>: invalid literal for <int> with base 16: b''
Press Enter to exit...
 
How can I track down what the problem could be?
Thanks.
  • 0
Posted

Ok. I did read that post but I think I had slightly misunderstood. I had thought xdarkwind was talking about several different merges that had been made and checking each of those and not checking on individual plugins belonging to a single merge. If it's just a case of checking each plugin I can do that.

  • 0
Posted (edited)

So, somehow I'm getting CTD at the main menu with relinker's output enabled.

 

I've been running the x64 application outside MO, but when I enable it Skyrim loads to the title screen and crashes before the NEW/LOAD/etc menu appears.

 

Am now trying the x86 version to see if it still happens....

 

Edit: Same problem with 32 bit version. Am now retrying with version 40 instead of v44

 

Edit2: I worked fine with v40 32-bit, not really sure if this is helpful unless anyone else has the problem.

 

 

Hi guys. Have you had a chance to look into the issue with V44? Over on the Legacy page we've had a few users report the same issue.

Edited by Pickysaurus
  • 0
Posted

I know there is an issue with v44, but I dont use the tool anymore, the last version I used was probably v40. 

File handling is a pain especially because authors use symbols that are not valid in the encoding that is used.

  • 0
Posted

When I run Relinker, I always get this error

 

<class 'ValueError'>: invalid literal for <int> with base 16: b''

 

when it gets to Applying Merge Maps: 36.39%.  I tried disabling all of the merges except one, and not matter what that one merge is, the same thing happens.  Could this be a problem with the Mergemods standalone program?  I noticed when I tested the game with Trees and Flora Merged esp, no grass appeared in the game, even though it does appear when the individual esps are used.

  • 0
Posted (edited)

It really depends on how the author wrote the code. If an author is using the basic function then relinker will find it, if the author decided to write some custom function that uses a var for a filename then relinker will never see that at this time.

The reason MO was used, is because the way the files are stored. The mod folders are in a way that I can emulate someone installing the mods as if they are being freshly installed. The same cannot be said for WB because the archives are like sub packages which need to be unpacked to see if they are even relevant.

Is it possible to extend this to WB, yes. Is it practical, not really as it would take way too long for the end user.

Suppose I unpack all my installers in WB as projects. I'd have a WB Installers folder looking exactly like MO's mods folder, with one mod per folder, all files in as if they're being freshly installed. Additionally, I could tell WB to install the "merge" folder which it skips by default, but if it's the installers that get scanned, not the Data folder, this is irrelevant. So, if I simply unpack all my installers in WB, how could I tell relinker to use the bash installers instead of mo's mods, and ignore all the profile thing as in WB I don't use profiles? Although it may take long to unpack a complete mod list, if you do this from the beginning with every mod it just fits into the workflow, I've done it before.

Edited by godescalcus
  • 0
Posted (edited)

So here you go Hishy the problematic scripts from Minty Lighting, again new load order just ran relinker and the game CTD at start, hide the script and no CTD.

 

here is the original version from the mod

and here is the relinker version I've hidden it using mohidden so the extension is changed, just to make it easier to differentiate.

Came here with this same issue.

Minty Lighting is in my wheather pack and after using relinker my game will crash on load.

Caused by mintymcmpatchquestscript.pex

 

Was this fixed?

 

--------EDIT

Did some reading and it might be related to v44.

Using v40 for now on.

Edited by pralima87

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Privacy Policy, and Terms of Use.