Modding Tutorials

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

Re: Modding Tutorials

Post by mikeprichard » Sat Mar 09, 2019 12:27 am

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: 1249
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Modding Tutorials

Post by Hazelnut » Tue Mar 12, 2019 7:27 pm

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. :)

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

Re: Modding Tutorials

Post by mikeprichard » Tue Mar 12, 2019 8:01 pm

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

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

Re: Modding Tutorials

Post by mikeprichard » Thu Mar 14, 2019 10:39 pm

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).

CHAPPJO
Posts: 24
Joined: Fri Sep 22, 2017 12:54 am

Re: Modding Tutorials

Post by CHAPPJO » Sat Jun 15, 2019 4:18 am

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,

Post Reply