Modding Tutorials

Discuss modding questions and implementation details.
Modmannextdoor
Posts: 3
Joined: Thu Dec 01, 2022 11:52 am

Re: Modding Tutorials

Post by Modmannextdoor »

LypyL wrote: Sat Jun 18, 2016 7:52 am In this thread is some information and a few basic examples about how to use the new modding system. Keep in mind it's still very much a work in progress :) Feel free to post any questions!

Overview

Here's a very shallow look at how the modding system works.

Creating mods is all done in the Unity Editor, with the help of a simple editor window. Anything that Unity recognizes as an asset can be included into mods.

The mods are represented by a single file (a unity asset bundle) with a .dfmod extension.

During the setup scene, any Mod Files in the Mod Directory (currently the Streaming Assets Path) are detected by the ModManager and partially loaded. During this stage you can set the load priority for each mod, and also chose to disable Mods that you don't want to run (these will be unloaded completely and unavailable during the game).

Once the main game scene is loaded, the ModManager will go through all the mods, compile any scripts, and then invoke special functions to begin the setup process. How exactly each mod is setup is currently left entirely for you to decide at this point.

The tutorials will include a few different examples of varying degrees of complexity from a simple "hello world" to loading assets from the mod package and setting them up in the scene, and assume basic knowledge of both Unity and Daggerfall Unity.

For the purposes of these tutorials, please make sure you're starting with the Setup scene, and the ModManager object is in the scene. If you don't have the ModManager in the scene, create a new game object and add the ModManager as a component to it.

Known Issues

enums - scripts with enum types defined will fail to compile. You can still use any of the enum types already in the project. This is an issue with the mcs compiler.

generic functions / classes - similar to the above, due to an issue with the compiler scripts that try to define generic functions will not compile.

Unity Versions - mods created in newer versions of unity might not be compatible with older versions of unity. This is noticeable if the mod is in the mod directory, but doesn't show up in the list of mods.
Hi, could you please help me with getting started in Unity Editor? I've got a version of Unity Editor, but how do I get DF Unity in there all set up to be able to do mods?

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Modding Tutorials

Post by Ralzar »

Modmannextdoor wrote: Fri Dec 02, 2022 12:37 am
Hi, could you please help me with getting started in Unity Editor? I've got a version of Unity Editor, but how do I get DF Unity in there all set up to be able to do mods?
I would suggest joining the Lysandus Tomb discord. Most of the mod creators are active there and can give some guidence on the fly.

But your first steps should be installing Unity Hub, then adding the DFU files as a project. The hub will then show you what version of Unity the project uses and gives you a link to download it.

Modmannextdoor
Posts: 3
Joined: Thu Dec 01, 2022 11:52 am

Re: Modding Tutorials

Post by Modmannextdoor »

LypyL wrote: Sat Jun 18, 2016 7:52 am Part 1

FILES

This example will show the basics on using the mod builder and loader window.

1. If you don't already have one, create a StreamingAssets directory inside your project's assets path (Assets->Create->Folder and name it StreamingAssets).

1. In the Unity Editor, open the mod builder window (Daggerfall Tools -> Mod Builder) and select "Create New Mod"

Image


2. A simple window with some text fields and buttons will open. Before you can build your mod, you must fill in the Mod Name & title fields (the rest are optional, but recommended). The name field is really just for the file name, while the title is used in game.

For this example type "emptyexample" in the name field, and "Example Mod" in the title field without quotations. Fill in the rest of the fields as you prefer.

Image


3. click the Save Mod File button, and then expand the Files drop down - you should see one file listed, something like Assets\ModBuilder\emptyexample.dfmod.json - these file stores all the information used to build your mod, and can be used by the mod builder window to update or change existing mods.

4. Click the "Build Mod" Button, and then select a directory outside of your assets folder.

5. Browse to the location you selected, find the directory for your operating system type (linux, windows or osx), and then locate the .dfmod file in that folder, and move it into /Assets/StreamingAssets/ in your project.

Image

6. Launch the startup scene. At the options panel, click the Mods button to open the mods loader window. You should see "emptyexample" (or whatever the file name is sans extension) listed one the left side.

Image

Most of the functionality here is fairly self explanatory.
  • The higher a mod is in the list (conversely, the lower it's load priority #), the sooner it will be loaded.
  • If the Enabled checkbox is unchecked, the mod will be unloaded as mentioned previously.
  • Hitting the refresh button will look for changes in the modding directory.
  • The Extract Files button will extract text assets from the mod asset bundle file to a sub-directory of the mod directory.
Currently changes made in the mod loader window aren't saved between sessions, this will be added in the future.
Hello, please advise, I want to start right at the very beginning with modding DFU in Unity. So I have a version of Unity on my PC, when I open it, there is nothing in there for Dagerfall Unity. There is also nothing set up in there to enable me to do the part: open the mod builder window (Daggerfall Tools -> Mod Builder) and select "Create New Mod" Please can you help me get started setting up Unity editor so that I can follow this guide? Thanks

User avatar
PRAEst76
Posts: 27
Joined: Fri May 27, 2022 7:19 pm
Location: Suomi
Contact:

Re: Modding Tutorials

Post by PRAEst76 »

Modmannextdoor wrote: Fri Dec 02, 2022 6:47 pm Hello, please advise, I want to start right at the very beginning with modding DFU in Unity. So I have a version of Unity on my PC, when I open it, there is nothing in there for Dagerfall Unity. There is also nothing set up in there to enable me to do the part: open the mod builder window (Daggerfall Tools -> Mod Builder) and select "Create New Mod" Please can you help me get started setting up Unity editor so that I can follow this guide? Thanks
You need to download the Daggerfall Unity source and open it in Unity Hub as a project.

https://github.com/Interkarma/daggerfal ... .14.5-beta

User avatar
harbinger451
Posts: 183
Joined: Mon Apr 13, 2020 4:08 pm
Contact:

Re: Modding Tutorials

Post by harbinger451 »

I have just added a fresh install of the Unity Editor on my new computer and I'm trying to make a dfmod for my Background Question And History Fixes mod that requires a script to make various edits to the relevant background and history text strings. I can get as far as opening the mod builder, filling in the various fields like title, version number and the like. I then "Save Mod Settings to File" and go to "Add Selected Asset(s)", but there's nothing in the drop down file list ... not even the mod settings file, let alone the C# script I want to package. They're there in file explorer, but not in the mod builder. Anybody got any idea what's wrong? Am I missing something obvious?
Screenshot (22).png
Screenshot (22).png (192.73 KiB) Viewed 8902 times
Image

User avatar
Magicono43
Posts: 1139
Joined: Tue Nov 06, 2018 7:06 am

Re: Modding Tutorials

Post by Magicono43 »

You need to select the files/assets you want to add in the Unity Editor folder structure list, then while those are selected goto the mod-builder window and press "add selected assets."

User avatar
harbinger451
Posts: 183
Joined: Mon Apr 13, 2020 4:08 pm
Contact:

Re: Modding Tutorials

Post by harbinger451 »

Thanks ... I knew it'd be something simple I forgot ... it's been a couple of years since I last made a dfmod.
Image

User avatar
Magicono43
Posts: 1139
Joined: Tue Nov 06, 2018 7:06 am

Re: Modding Tutorials

Post by Magicono43 »

I've been slowly working on this wiki-page that is meant to be a more "step-by-step" tutorial for how to start modding DFU.

Doubt this will be found buried so far down this thread, but somebody might find it useful:

Tutorial Page

AlfaceAssasino
Posts: 2
Joined: Thu Jul 13, 2023 10:42 pm

Re: Modding Tutorials

Post by AlfaceAssasino »

Hey, i'm sorry if this is a dumb question, or the wrong place to post one, but how do i add an armor piece to the game? I already have the textures, and know how to create texture replacers. I want to create a new armor piece. Thanks!

User avatar
Magicono43
Posts: 1139
Joined: Tue Nov 06, 2018 7:06 am

Re: Modding Tutorials

Post by Magicono43 »

AlfaceAssasino wrote: Thu Jul 20, 2023 2:46 am Hey, i'm sorry if this is a dumb question, or the wrong place to post one, but how do i add an armor piece to the game? I already have the textures, and know how to create texture replacers. I want to create a new armor piece. Thanks!
It's kind of a complicated answer, I'd suggest joining the unofficial Discord channel and asking there, for something like that it's easier to discuss a something more specific like that I suppose: Discord Invite

Post Reply