Larian Studios

Merging Mods

Posted By: Arath3l

Merging Mods - 01/03/19 01:40 AM

Hey,

I'm a programmer by trade, but new to Divinity Modding.

After playing through the game, I decided to install some mods, but I found a lot of them conflicted.

So I set out to merge all the conflicts. I worked through all the files in the Public Folder without issue, repackaged the lsb files when needed, etc.

I'm struggling to do the same with the files in the Mods\Story folder, as I'm faced with what looks to me is the entire dump of the modder's version of the story file, and each mod has hundreds of differences, but only a few actually calling the new functionality they supposedly introduce.

I tried generating my own goals and story div, for example, but I found their size was tiny compared to the one included in the mods, and largely incomplete.

Can someone talk me through the process of generating a full story file and goals file, which I can then modify with the changes the modder has made?

Bonus points if there's an easy way to increment the Goals down the list, or if I'm going about it all wrong, and someone can explain a better way.

Thanks guys.

~Arathel
Posted By: LarIlya

Re: Merging Mods - 01/03/19 12:40 PM

Hi Arathel.

When you say "the story file", are you looking at the raw Story.Div file? This is indeed a text version of the entire Story code of the mod, and reverse engineering it into individual goals is possible but seems like a very cumbersome procedure. Diffing two mods to see what exactly each of them did seems even more cumbersome.

If you want to merge two mods, you should look at the individual goals supplied with the mod. When opening your Story editor, the ones specific to the mod have a white background whereas the ones that are inherited from a different mod have a grey one. Goals that exists both in the parent mod and the active mod are shown with a white background, and only the contents of the mod's goals are used.

So the simplest way for me seems to be to, firstly, make sure your compound mod has all the same inheritances at the two mods you're merging, and then copying the goals (respecting their mutual structure) to your new mods. Any goals with different names you can copy as-is. The only issues you should face are if any goal exists in the both mods (in which case you'll need to look at what specifically is happening), or if the mods use the same function or query for some conflicting purposes.


I'm not sure what you mean by "increment Goals down the list"?


Also it may be helpful if you could provide an example of such a conflict.
Posted By: Arath3l

Re: Merging Mods - 02/03/19 04:42 PM

That's a great reply, thank you so much!

Originally Posted by LarIlya

When you say "the story file", are you looking at the raw Story.Div file? This is indeed a text version of the entire Story code of the mod, and reverse engineering it into individual goals is possible but seems like a very cumbersome procedure. Diffing two mods to see what exactly each of them did seems even more cumbersome.


I was indeed, yes, goals and story files, as well as the ignore list.
Learning how to use the Engine has been a roller-coaster. I've since generated "vanilla" story files, which makes diffing somewhat easier if I have to fall-back to this method.

Originally Posted by LarIlya

If you want to merge two mods, you should look at the individual goals supplied with the mod. When opening your Story editor, the ones specific to the mod have a white background whereas the ones that are inherited from a different mod have a grey one. Goals that exists both in the parent mod and the active mod are shown with a white background, and only the contents of the mod's goals are used.

So the simplest way for me seems to be to, firstly, make sure your compound mod has all the same inheritances at the two mods you're merging, and then copying the goals (respecting their mutual structure) to your new mods. Any goals with different names you can copy as-is. The only issues you should face are if any goal exists in the both mods (in which case you'll need to look at what specifically is happening), or if the mods use the same function or query for some conflicting purposes.


The white background tip for the story is really helpful, but I haven't been able to figure out how to copy the goals (nor do I understand what you mean by respecting their mutual structure), unless you mean copy them out somewhere, and then add them back? Is there a way to do it inside the Engine itself? I'm happy to solve conflicts as they arise.

Originally Posted by LarIlya

I'm not sure what you mean by "increment Goals down the list"?


Ah, I meant when looking in goals.div, they are numbered, from top to bottom. But I now realise they're generated automatically by the Editor, which means I don't have to worry about them... Once I figure out how to copy goals across!

Code
Goal(99).Title("ARX_HuntingForDallis");


Originally Posted by LarIlya

Also it may be helpful if you could provide an example of such a conflict.


Currently starting with merging - Party Size Evolved: (https://steamcommunity.com/sharedfiles/filedetails/?id=1503849808)
And - Black Cat Plus (https://steamcommunity.com/sharedfiles/filedetails/?id=1503849808)
Posted By: Arath3l

Re: Merging Mods - 03/03/19 02:13 AM

Small Update: Finally managed to do it for some of the mods I'm trying to merge, including the ones mentioned above!

I followed this guide: http://larian.com/forums/ubbthreads.php?ubb=showflat&Number=620801#Post620801 for loading third party mods on my machine.

Then I opened the Story Editor on that project, changed project to my mod-merge project, and right-clicked the white fields, selecting the option to add to my mod, which I assume is what you meant before?

A few of the mods, though, I seem to be unable to load following the method above. LeaderLib, for example. When trying to open the project, it says it is unable to do so, but the meta.lsx on the Mods folder for it shows no dependencies which I may be missing. Any thoughts on why that might be? Final piece of the puzzle for me here, I think!
Posted By: Arath3l

Re: Merging Mods - 03/03/19 10:15 PM

Update 2: Finished merging the rest!

I realised that if I copy the Goals into the Raw Goals folder and rebuild the story, they are incorporated. Everything else was easy beyond that.

Thanks for all your help!
Posted By: Norbyte

Re: Merging Mods - 04/03/19 09:09 PM

Looks like you already figured it out, though I hope this'll be helpful to others:

Most of the files generated by the editor (story.div, goals.div, goals.raw, story_ac.dat, ...) are completely useless and are not loaded by the game. They're intermediate files that are not supposed to be packaged at all. (I believe the latest DE editor fixes this issue?)

story.div.osi is the story file compiled from the mod and its direct dependencies. As long as the list of loaded mods and the list of mod dependencies matches, the game loads story.div.osi directly. If there is a mismatch, it'll take all goal files (found in RawFiles) from all mods, merges them into one single story script file, and compiles that file.
In practice, this means that if you use more than one mod it'll almost always trigger a story merge, so you don't have to update story.div.osi at all.
© 2020 Larian Studios forums