Page 11 of 21

Re: Modding Tutorials

Posted: Sat Nov 09, 2019 12:39 pm
by Narf the Mouse
How do you load a multiple-choice value from a ModSettings object?

Re: Modding Tutorials

Posted: Sat Nov 09, 2019 12:50 pm
by BadLuckBurt
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:

Re: Modding Tutorials

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

...Or maybe it's something else. Something is crashing the Unity editor.

Re: Modding Tutorials

Posted: Sat Nov 09, 2019 1:04 pm
by BadLuckBurt
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.

Re: Modding Tutorials

Posted: Sat Nov 09, 2019 1:08 pm
by TheLacus
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 4205 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. ;)

Re: Modding Tutorials

Posted: Sat Nov 09, 2019 1:13 pm
by Narf the Mouse
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. ;)

Re: Modding Tutorials

Posted: Sat Nov 09, 2019 1:27 pm
by BadLuckBurt
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()

Re: Modding Tutorials

Posted: Sat Nov 09, 2019 1:44 pm
by Narf the Mouse
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.

Re: Modding Tutorials

Posted: Sat Nov 09, 2019 1:50 pm
by BadLuckBurt
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.

Re: Modding Tutorials

Posted: Sat Nov 09, 2019 1:54 pm
by Narf the Mouse
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. :)