Modding Tutorials

Discuss modding questions and implementation details.
Post Reply
User avatar
mikeprichard
Posts: 1037
Joined: Sun Feb 19, 2017 6:49 pm

Re: Modding Tutorials

Post by mikeprichard »

UserOfThisSite wrote: Sat Mar 09, 2019 12:11 am It's very easy, someone simply need to change those values to public, it's few seconds work. For example I can do that for my own Daggerfall, but then it won't be a mod any longer, but a hack. If DFU devs change those values to public on some newer version, then I'll update my mod.
Ah, in that case, I hope they do. (hint hint) Thanks again for this - when you think it's ready, would be great to see this in the "Released Mods" forum.

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

Re: Modding Tutorials

Post by Hazelnut »

Generally if something is not exposed to mods and someone needs it for something, I or one of the other devs have done the work to expose it. That's how the formula can be overridden - it was requested and I implemented it.

I don't think I'd want to simply make it public in this case, but the bonusPool calculation could easily be moved into a formula that can be overridden by a mod. Unless anyone has objections to it...?

i think we're quite offtopic for this pinned thread so please post a request in work requests forum. :)
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
mikeprichard
Posts: 1037
Joined: Sun Feb 19, 2017 6:49 pm

Re: Modding Tutorials

Post by mikeprichard »

Thanks, Hazelnut! I just created a new topic for this in the Work Requests forum.

User avatar
mikeprichard
Posts: 1037
Joined: Sun Feb 19, 2017 6:49 pm

Re: Modding Tutorials

Post by mikeprichard »

Looks like the Work Requests forum's been removed - my separate topic on this is now in the General forum (viewtopic.php?f=4&t=1893).

chtujo
Posts: 67
Joined: Fri Sep 22, 2017 12:54 am
Location: Yeorth Burrowland

Re: Modding Tutorials

Post by chtujo »

Edit: looks like this formula just wasn't implemented in the build I was testing with, it seems to work with the new one, I'll try releasing this soon.


Recently I wanted to have a go at modding something, and since no one seems to had made even a partial replacement mod for dfskills, I though I would have a go at it. Unfortunately I know very very little C#, and probably even less Unity. I basically "adapted" (copied) most of it from UserOfThisSite's 'consistent HP at level up' scripts he posted here. This is what I have so far, and it's not working.

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DaggerfallWorkshop.Game.Utility.ModSupport; // Do I need this?
using DaggerfallWorkshop.Game.Formulas; // I do need this right?

public class UpTo200Attributes : MonoBehaviour
{
    void Start()
    {
        FormulaHelper.formula_noparams.Add("MaxStatValue", () => // No idea how this part works, or how a dictionary works or whatever else...
           {
               return 200; // AFAIK this should return back into the del, which will then return as the max attribute value.
           });
    }
}
The script is call "UpTo200Attributes.cs". It tries to overwrite(?) the method in the "FormulaHelper.cs" file called "MaxStatValue" which looks like this:

Code: Select all

        public static int MaxStatValue()
        {
            Formula_NoParams del;
            if (formula_noparams.TryGetValue("MaxStatValue", out del))
                return del();
            else
                return 100;
        }
Both scripts are in the same folder.

One last thing; I was wondering if the bottom bit in UserOfThisSite's code, or something similar is required, I tried adding it in (with some changes), and it did nothing. However I probably messed something up, because I don't really know what any of it means. The code looks like this:

Code: Select all

[Invoke (StateManager.StateTypes.Game, 0)]
	public static void Init (InitParams initParams)
	{
		GameObject GO = new GameObject ("MaxHPperLevel");
		MaxHPperLevel go = GO.AddComponent<MaxHPperLevel> ();
		ModManager.Instance.GetMod (initParams.ModTitle).IsReady = true;
	}
Any help would be appreciated,

Asesino
Posts: 66
Joined: Fri Aug 16, 2019 3:14 am

Re: Modding Tutorials

Post by Asesino »

Hi,
I wanted to play around with Modding on Daggerfall Unity. I was able to create simple mod to increase my carry capacity.
Scripting works for me but adding assets does not.
To try to get a grasp of adding assets, I thought i would try to create a dfmod from Kamer's excellent mod: warm ashes.

Following the readme in Game/Mods, I did the following:

I created a folder in Assets/Game/Mods called WarmAshes. In WarmAshes, I created a folder called Assets, and then a folder in Assets called QuestPacks. Here I dropped the Kamer folder.
I then created my mod, and then clicked on each subfolder in Kamer, selected all and clicked "Add Selected Asset(s).

It created the dfmod correctly (i.e., no errors) but it doesn't work in game. What am I missing?

thanks in advance for any advice or help,
A

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

Re: Modding Tutorials

Post by TheLacus »

Quests can only be automatically imported from loose files; you can manually register a quest pack with QuestListsManager.RegisterQuestList instead.

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

Re: Modding Tutorials

Post by Hazelnut »

Have a read of viewtopic.php?f=22&t=901

Also, I suggest looking at the code of existing mods and figuring out how they work, experiment etc.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Modding Tutorials

Post by Jay_H »

There are some loose file mods that you could package up for practice. Mine is one I'd give permission to be zipped up into a dfmod: https://www.nexusmods.com/daggerfallunity/mods/3

Asesino
Posts: 66
Joined: Fri Aug 16, 2019 3:14 am

Re: Modding Tutorials

Post by Asesino »

Thank you so much everyone. I was able to package other objects like textures. I truly appreciate all the quick responses.

Thanks all,
A

Post Reply