Custom Books work as loose files, but not in .dfmod (no, not the .bytes issue)

Discuss modding questions and implementation details.
Post Reply
haloterm
Posts: 194
Joined: Sat Feb 16, 2019 5:21 am

Custom Books work as loose files, but not in .dfmod (no, not the .bytes issue)

Post by haloterm »

In the recent days, I made good progress with converting my Black Horse Courier questmod to a real .dfmod, thanks to the help of Hazelnut. My quests and my custom locations are working just fine, but I have problems to get my custom books to work.

The custom books were created in DFBOOEDT and work fine when used as loose files, but they do not work when in the .dfmod.

I have of course a mapping file, and I also made sure that I change the file extension from .txt to .txt.bytes before importing them as assets, but they are not recognized in game. I have no idea what I can do more.

My mod is in a folder "blackhorsecourier" inside daggerfall-unity-master -> Mods.

According to the modding documentation, I have a subfolder "Assets" in my mod folder, and there are the other relevant folders (Books, Quests, Scripts, WorldData).

Here is a screenshot of my folder structure:

Image

And here is a screenshot of my mod builder, showing settings and all added assets:

Image

Maybe a second or third pair of eyes can see something I am too blind now.

User avatar
TheLacus
Posts: 1266
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Re: Custom Books work as loose files, but not in .dfmod (no, not the .bytes issue)

Post by TheLacus »

It might be an issue running mod virtually inside the editor. If you didn't already, can you try to build the mod?
Mod System documentation - Learn how to create mods for Daggerfall Unity.
Modder Discussion - General help and discussion for the mod system.
Github Issues - Submit a bug report for the game, including the mod system.

haloterm
Posts: 194
Joined: Sat Feb 16, 2019 5:21 am

Re: Custom Books work as loose files, but not in .dfmod (no, not the .bytes issue)

Post by haloterm »

TheLacus wrote: Fri Oct 02, 2020 1:52 pm It might be an issue running mod virtually inside the editor. If you didn't already, can you try to build the mod?
I actually did only try the built mod in the actual game so far.

(Because I am not sure how even start the game within the editor... pressing the "Play" button in Unity editor does not do anything...)

User avatar
Hazelnut
Posts: 2501
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Custom Books work as loose files, but not in .dfmod (no, not the .bytes issue)

Post by Hazelnut »

The main difference from my book is the extra Assets folder in the path, but that shouldn't make any difference.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

haloterm
Posts: 194
Joined: Sat Feb 16, 2019 5:21 am

Re: Custom Books work as loose files, but not in .dfmod (no, not the .bytes issue)

Post by haloterm »

Hazelnut wrote: Fri Oct 02, 2020 2:17 pm The main difference from my book is the extra Assets folder in the path, but that shouldn't make any difference.
The "Assets" folder is suggested in the readme file that comes in the "Game/mods" folder in the DFU master branch. I tried both with and without the extra "Assets" folder, but it made no difference.

User avatar
TheLacus
Posts: 1266
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Re: Custom Books work as loose files, but not in .dfmod (no, not the .bytes issue)

Post by TheLacus »

haloterm wrote: Fri Oct 02, 2020 2:05 pm
TheLacus wrote: Fri Oct 02, 2020 1:52 pm It might be an issue running mod virtually inside the editor. If you didn't already, can you try to build the mod?
I actually did only try the built mod in the actual game so far.

(Because I am not sure how even start the game within the editor... pressing the "Play" button in Unity editor does not do anything...)
Ok, they should be seeked automatically when you build a mod but try to define them explicitly and see if it makes any difference. This is an alternative to use standard paths so you can place book files anywhere. You need to open the mod manifest (.dfmod.json file) and add a property named Contributes if missing, with the content shown here:

Code: Select all

{
    // ...
    "Contributes": {
        "BooksMapping": [
            "MDBHCBooksPack"
        ]
    }
}
You can copy paste the snippet above but, if you use VSCode to edit the file, you should also receive completion proposals from json schema (located at Assets/Editor/.Schemas/ModInfo.schema.json).
Mod System documentation - Learn how to create mods for Daggerfall Unity.
Modder Discussion - General help and discussion for the mod system.
Github Issues - Submit a bug report for the game, including the mod system.

haloterm
Posts: 194
Joined: Sat Feb 16, 2019 5:21 am

Re: Custom Books work as loose files, but not in .dfmod (no, not the .bytes issue)

Post by haloterm »

TheLacus wrote: Fri Oct 02, 2020 5:24 pm add a property named Contributes if missing
Thank you! That did the trick, now the books can be accessed :D

User avatar
TheLacus
Posts: 1266
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Re: Custom Books work as loose files, but not in .dfmod (no, not the .bytes issue)

Post by TheLacus »

haloterm wrote: Fri Oct 02, 2020 5:34 pm
TheLacus wrote: Fri Oct 02, 2020 5:24 pm add a property named Contributes if missing
Thank you! That did the trick, now the books can be accessed :D
That's great!
haloterm wrote: Fri Oct 02, 2020 2:05 pm (Because I am not sure how even start the game within the editor... pressing the "Play" button in Unity editor does not do anything...)
You need to drag DaggerfallUnityStartup scene (from Assets/Scenes) to the hierarchy window and make sure is the only scene there. Feel free to ask if you want further help about this. :)
Mod System documentation - Learn how to create mods for Daggerfall Unity.
Modder Discussion - General help and discussion for the mod system.
Github Issues - Submit a bug report for the game, including the mod system.

Post Reply