Modding Tutorials

Discuss modding questions and implementation details.
Post Reply
User avatar
Shapur
Posts: 154
Joined: Wed Apr 21, 2021 5:11 pm
Location: Czech Republic
Contact:

Re: Modding Tutorials

Post by Shapur »

ChopChop18 wrote: Wed Jul 28, 2021 4:35 pm I do not know how to open daggerfall unity in the unity editor. please help.


Note: instead of opening Unity, open Unity Hub (https://unity.com/download), but the proces is the same. Unity Hub should tell you witch version of Unity to use automatically (after creating a new project in Unity Hub from the DFU source code)

This might also help:
Link to my github here.
And here is my nexus profile.

User avatar
Oblivionaddicted
Posts: 11
Joined: Sat May 21, 2022 4:47 pm

Re: Modding Tutorials

Post by Oblivionaddicted »

Does every registered member need to ask the authorization to download the files on Google drive?

mwitz
Posts: 9
Joined: Mon May 30, 2022 8:17 am

Re: Modding Tutorials

Post by mwitz »

Magicono just recently helped me set up a new mod, and I thought I would put the process here, as I couldn't find a complete tutorial anywhere.

First, let's give a quick overview of the process. The bulk of creating a mod is editing the game files in the Daggerfall Unity repository locally (as if you're making a new version of Daggerfall Unity) in the Unity editor. You can run and test your mod in this state as if it was its own Daggerfall Unity standalone. When you're ready to release a build, you tell the provided mod builder which files you added or edited for your mod. The mod builder then handles the building of your .dfmod file, and voila.

First, you're going to want to download the Daggerfall Unity repository here https://github.com/Interkarma/daggerfall-unity. You're also going to want to download and install Unity 2019.4.28f1 (yes the version does matter), which you can find here https://download.unity3d.com/download_u ... 4.28f1.exe for Windows or here https://download.unity3d.com/download_u ... 4.28f1.dmg for Mac. Don't be daunted if you've never used Unity; Unity is laid out in a very intuitive manner, and modding Daggerfall Unity is a great way to learn how to use. Just stick with it and you'll get it in no time.

Open the Daggerfall Unity project (that you just downloaded from Github) in Unity. Behold; the whole of the Daggerfall Unity project is before you, in all its open-source glory. But before you jump in, let's set up your mod, using the standard conventions. In the project window, go to Assets>Game>Mods, and make a new folder here with the name of your mod. So the hierarchy should look like Assets>Game>Mods>[ModName]. Inside your new mod folder, make two new folders called "Prefabs" and "Scripts." Now, inside your "Scripts" folder, create a new script called "[ModName]Main". Inside "[ModName]Main", paste the following code:

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DaggerfallWorkshop.Game;
using DaggerfallWorkshop.Game.Entity;
using DaggerfallWorkshop.Game.Utility.ModSupport;
using DaggerfallWorkshop.Game.Utility;
using DaggerfallConnect;

namespace ModName
{
    public class ModNameMain : MonoBehaviour
    {

        static ModNameMain instance;

        public static ModNameMain Instance
        {
            get { return instance ?? (instance = FindObjectOfType<ModNameMain>()); }
        }

        static Mod mod;

        [Invoke(StateManager.StateTypes.Start, 0)]
        public static void Init(InitParams initParams)
        {
            mod = initParams.Mod;
            instance = new GameObject("ModName").AddComponent<ModNameMain>(); // Add script to the scene.

            mod.IsReady = true;
        }

        private void Start()
        {
            Debug.Log("Begin mod init: ModName");
            // Initialize your mod here. Usually that means instantiating a GameObject
            Debug.Log("Finished mod init: ModName");
        }
    }
}
Obviously, switch out "ModName" for the name of your mod whenever it occurs in this file. Once you save "[ModName]Main," add it as a component to the "DaggerfallUnity" prefab located at Assets>Prefabs.

"[ModName]Main" will be your mod's "entry" into the game. The "DaggerfallUnity" prefab is instantiated once the game starts, and anything you put in "[ModName]Main" will run right after.

Now you're ready to start modding. Edit and add any prefabs, GameObjects and scripts you desire. I recommend that you place any new prefabs or scripts you create into their respective folder in Assets>Game>Mods>[ModName]. Take note of which files you added or changed, as this will be important later.

To test your mod, open either "DaggerfallUnityGame" or "DaggerfallUnityStartup" in Assets>Scenes. You can simply run the game from either of these scenes, and your mod will be automatically loaded.

To release your mod, you will need to build a .dfmod file. Fortunately, the Daggerfall Tools will do this for you. Click on "Daggerfall Tools" on the Unity toolbar and click on "Mod Builder." Then, click the button "Create New Mod." You will be prompted to create a .dfmod.json file. Save this file as "[ModName].dfmod.json" in your Assets>Game>Mods>[ModName] folder. Then, use the button "Add Selected Asset(s)" to add the files your mod adds or changes. Finish filling out the rest of the relevant information, click "Save Mod Settings to File," and then click "Build Mod." There is no strict convention on where to build your mod files to.

Once your .dfmod file is built, you can drag it to your mods folder in your local Daggerfall Unity game files.

This should enough to get your started on building your own mod. If you think I should change or add anything, please let me know.
Last edited by mwitz on Sun Jun 05, 2022 7:27 am, edited 2 times in total.

mwitz
Posts: 9
Joined: Mon May 30, 2022 8:17 am

Re: Modding Tutorials

Post by mwitz »

Oblivionaddicted wrote: Sat May 21, 2022 5:09 pm Does every registered member need to ask the authorization to download the files on Google drive?
Which files are you looking for? The Daggerfall Unity repo is on GitHub here https://github.com/Interkarma/daggerfall-unity. Am I misunderstanding your question?

User avatar
Oblivionaddicted
Posts: 11
Joined: Sat May 21, 2022 4:47 pm

Re: Modding Tutorials

Post by Oblivionaddicted »

mwitz wrote: Sun Jun 05, 2022 7:10 am
Oblivionaddicted wrote: Sat May 21, 2022 5:09 pm Does every registered member need to ask the authorization to download the files on Google drive?
Which files are you looking for? The Daggerfall Unity repo is on GitHub here https://github.com/Interkarma/daggerfall-unity. Am I misunderstanding your question?
I'm talking about the Google drive URL's in LypyL's messages like this one FILE 1

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: Modding Tutorials

Post by BadLuckBurt »

Oblivionaddicted wrote: Thu Jun 09, 2022 9:30 am I'm talking about the Google drive URL's in LypyL's messages like this one FILE 1
I can confirm that URL says you don't have access when you try to open it (when logged into a Google account). I tried two different account in a private browser window, neither worked. My guess is that the security settings on that file reverted to something 'safe' during a Google Drive update or sth.

If you still need DF files, you can either install them through Steam now since that has been fixed or download from UESP: https://en.uesp.net/wiki/Daggerfall:Files.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

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

Re: Modding Tutorials

Post by Ralzar »

Oblivionaddicted wrote: Thu Jun 09, 2022 9:30 am
mwitz wrote: Sun Jun 05, 2022 7:10 am
Oblivionaddicted wrote: Sat May 21, 2022 5:09 pm Does every registered member need to ask the authorization to download the files on Google drive?
Which files are you looking for? The Daggerfall Unity repo is on GitHub here https://github.com/Interkarma/daggerfall-unity. Am I misunderstanding your question?
I'm talking about the Google drive URL's in LypyL's messages like this one FILE 1
What is that supposed to link to? Because it is not linking to the DaggerfallGameFiles.zip

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: Modding Tutorials

Post by BadLuckBurt »

Hm, I should've read better, I thought it was the DaggerfallGameFiles link. If it's linking to one of those tutorial sample files, there's a good chance they're gone after 5+ years or that Lypyl changed his Drive settings.

@Oblivionaddicted, what exactly are you looking to grab?
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

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

Re: Modding Tutorials

Post by Hazelnut »

Much of this thread is outdated now, but there's still useful info so it's worth keeping around. Maybe the first post should have a warning that it's out of date.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

osman
Posts: 20
Joined: Sat Jun 11, 2022 5:57 pm

Re: Modding Tutorials

Post by osman »

Hi, i wanted to change the textures of some armors and shields, recolored a kite shield to test things but tossed a wall. I'm trying to find a way to import the changes i made into DF, i checked the guides, used the right version of unity and opened DF Project as mentioned above, messed around a bit but couldn't figure it out. I have no experience at modding, is there a simple way to change the textures of items?

Post Reply