Modding Tutorials

Discuss modding questions and implementation details.
Post Reply
Narf the Mouse
Posts: 839
Joined: Mon Nov 30, 2015 6:32 pm

Re: Modding Tutorials

Post by Narf the Mouse » Sat Nov 09, 2019 12:39 pm

How do you load a multiple-choice value from a ModSettings object?
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

BadLuckBurt
Posts: 296
Joined: Sun Nov 05, 2017 8:30 pm

Re: Modding Tutorials

Post by BadLuckBurt » Sat Nov 09, 2019 12:50 pm

Narf the Mouse wrote:
Sat Nov 09, 2019 12:39 pm
How do you load a multiple-choice value from a ModSettings object?
https://www.dfworkshop.net/projects/dag ... /features/

Image

Going by the example on that Features page, it should be something like:

Code: Select all

var settings = mod.GetSettings();
int number = settings.GetValue<int>("section", "multipleChoiceField");
-edit, damn that image is huge :lol:

Narf the Mouse
Posts: 839
Joined: Mon Nov 30, 2015 6:32 pm

Re: Modding Tutorials

Post by Narf the Mouse » Sat Nov 09, 2019 12:59 pm

GetInt() crashes the Unity editor when I try.

...Or maybe it's something else. Something is crashing the Unity editor.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

BadLuckBurt
Posts: 296
Joined: Sun Nov 05, 2017 8:30 pm

Re: Modding Tutorials

Post by BadLuckBurt » Sat Nov 09, 2019 1:04 pm

Narf the Mouse wrote:
Sat Nov 09, 2019 12:59 pm
GetInt() crashes the Unity editor when I try.

...Or maybe it's something else. Something is crashing the Unity editor.
It's .GetValue<int>, not GetInt(). Check Unity's log or post the lines of code and I may be able to figure it out.

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

Re: Modding Tutorials

Post by TheLacus » Sat Nov 09, 2019 1:08 pm

septua77 wrote:
Sun Nov 03, 2019 10:51 pm
I'm sorry, I'm kinda slow. I can't even figure out how to open the Mod Builder interface.

My Daggerfall Workshop folder does not have that and I can't figure out how to open that window inside the Unity editor.

I was also confused if I need to clone the whole DFU project or just the Daggerfall tools for Unity project, but tried both and still not sure how to even open Mod Builder. <-- Main thing I'm confused about. Thanks for any help.
Daggerfall Tools for Unity is what connects the game to classic data. You need to clone Daggerfall Unity to have all the modding tools inside the Unity Editor.
DaggerfallTools.png
DaggerfallTools.png (35.59 KiB) Viewed 307 times
IAmTheClayman wrote:
Fri Nov 08, 2019 12:44 am
How would you go about making changes to an existing script in DFU? For example, right now HUDVitals.cs has the following code:

Code: Select all

public HUDVitals()
            :base()
{
	playerEntity = GameManager.Instance.PlayerEntity;
	LoadAssets();

	BackgroundColor = Color.clear;
	HorizontalAlignment = HorizontalAlignment.Left;
	VerticalAlignment = VerticalAlignment.Bottom;
	SetMargins(Margins.All, borderSize);
	...
I want to, as a test, have the vitals display horizontally centered. Would the way to do this as a distributable mod be to make the edits directly to HUDVitals.cs and include it in the list under Files in the Mod Builder window?
This is not possible (because C# is a compiled language) and also not ideal because two mods that change the same file would be incompatible. See the tutorials on the first page of this topic for some examples of how to make a 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.

Narf the Mouse
Posts: 839
Joined: Mon Nov 30, 2015 6:32 pm

Re: Modding Tutorials

Post by Narf the Mouse » Sat Nov 09, 2019 1:13 pm

BadLuckBurt wrote:
Sat Nov 09, 2019 1:04 pm
Narf the Mouse wrote:
Sat Nov 09, 2019 12:59 pm
GetInt() crashes the Unity editor when I try.

...Or maybe it's something else. Something is crashing the Unity editor.
It's .GetValue<int>, not GetInt(). Check Unity's log or post the lines of code and I may be able to figure it out.
Thanks.

Right now, it's crashing on this:

Code: Select all

        [Invoke(StateManager.StateTypes.Game, 0)]
        public static void Init(InitParams initParams)
        {
            Debug.Log("magicka regeneration init");

            mod = initParams.Mod;

            mod.IsReady = true;
        }
If you can solve that, I'd love to hear it. ;)
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

BadLuckBurt
Posts: 296
Joined: Sun Nov 05, 2017 8:30 pm

Re: Modding Tutorials

Post by BadLuckBurt » Sat Nov 09, 2019 1:27 pm

Narf the Mouse wrote:
Sat Nov 09, 2019 1:13 pm
Thanks.

Right now, it's crashing on this:

Code: Select all

        [Invoke(StateManager.StateTypes.Game, 0)]
        public static void Init(InitParams initParams)
        {
            Debug.Log("magicka regeneration init");

            mod = initParams.Mod;

            mod.IsReady = true;
        }
If you can solve that, I'd love to hear it. ;)
Are there any error messages in Unity's log or the console? I haven't made a mod myself but looking at the example code on the Mod Features page I linked, aren't you doing

Code: Select all

mod.IsReady = true;
too early? In the example that's done in void Awake()

Narf the Mouse
Posts: 839
Joined: Mon Nov 30, 2015 6:32 pm

Re: Modding Tutorials

Post by Narf the Mouse » Sat Nov 09, 2019 1:44 pm

BadLuckBurt wrote:
Sat Nov 09, 2019 1:27 pm
Narf the Mouse wrote:
Sat Nov 09, 2019 1:13 pm
Thanks.

Right now, it's crashing on this:

Code: Select all

        [Invoke(StateManager.StateTypes.Game, 0)]
        public static void Init(InitParams initParams)
        {
            Debug.Log("magicka regeneration init");

            mod = initParams.Mod;

            mod.IsReady = true;
        }
If you can solve that, I'd love to hear it. ;)
Are there any error messages in Unity's log or the console? I haven't made a mod myself but looking at the example code on the Mod Features page I linked, aren't you doing

Code: Select all

mod.IsReady = true;
too early? In the example that's done in void Awake()
There might be messages in the Unity console, but the editor crashes. ;) As for Unity's log... This is the top of the crash dump:

0x00007FFC1C287985 (mono) [c:\buildslave\mono\build\mono\metadata\object.c:683] compute_class_bitmap

And this seems to be the source:

(Filename: Assets/Game/Addons/ModSupport/Mod.cs Line: 922)

As for too early, the position of mod.IsReady does not seem to have any effect.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

BadLuckBurt
Posts: 296
Joined: Sun Nov 05, 2017 8:30 pm

Re: Modding Tutorials

Post by BadLuckBurt » Sat Nov 09, 2019 1:50 pm

Narf the Mouse wrote:
Sat Nov 09, 2019 1:44 pm
There might be messages in the Unity console, but the editor crashes. ;) As for Unity's log... This is the top of the crash dump:

0x00007FFC1C287985 (mono) [c:\buildslave\mono\build\mono\metadata\object.c:683] compute_class_bitmap

And this seems to be the source:

(Filename: Assets/Game/Addons/ModSupport/Mod.cs Line: 922)

As for too early, the position of mod.IsReady does not seem to have any effect.
Are you on Discord? It might be easier to have a quick back-and-forth there, otherwise this thread is gonna balloon out of control. If we figure out what the problem is, we can always post the solution here.

I can't really say that much with the info so far. The code on that line is a simple return false; I have some stuff to do but should be back in 30 mins.

Narf the Mouse
Posts: 839
Joined: Mon Nov 30, 2015 6:32 pm

Re: Modding Tutorials

Post by Narf the Mouse » Sat Nov 09, 2019 1:54 pm

BadLuckBurt wrote:
Sat Nov 09, 2019 1:50 pm
Narf the Mouse wrote:
Sat Nov 09, 2019 1:44 pm
There might be messages in the Unity console, but the editor crashes. ;) As for Unity's log... This is the top of the crash dump:

0x00007FFC1C287985 (mono) [c:\buildslave\mono\build\mono\metadata\object.c:683] compute_class_bitmap

And this seems to be the source:

(Filename: Assets/Game/Addons/ModSupport/Mod.cs Line: 922)

As for too early, the position of mod.IsReady does not seem to have any effect.
Are you on Discord? It might be easier to have a quick back-and-forth there, otherwise this thread is gonna balloon out of control. If we figure out what the problem is, we can always post the solution here.

I can't really say that much with the info so far. The code on that line is a simple return false; I have some stuff to do but should be back in 30 mins.
Thanks for all your help. However, I did "git checkout ." to fix it. It really seemed borked, and I decided to just give up. ;)

Edit: I should clarify. I haven't given up on the mod. :)
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Post Reply