Page 1 of 1

Custom buttons in dialog boxes

Posted: Mon May 20, 2019 3:11 pm
by jayhova
How would one go about substituting custom response buttons in specific dialog boxes? For instance instead of yes/no to the dialog box to access the wagon at the dungeon exit you could substitute exit/wagon.

How difficult would this be to implement on a scale 1-10?

Re: Custom buttons in dialog boxes

Posted: Tue May 21, 2019 10:42 pm
by King of Worms
I can provide the buttons...

Re: Custom buttons in dialog boxes

Posted: Wed May 22, 2019 8:14 am
by pango
I have no direct experience in modding, but I can give some analysis on existing code, and my best guesses about modding... Hopefully some of this will be useful if somebody wants to give it a try.
And from what I understand, the level of difficulty will also depend on how "clean" and "extensible" you want modding to be:

The dialog box you're interested in, is in PlayerActivate.cs, in a long method handling all you can activate.
So I think the first step would be to isolate the creation of that dialog box in its own method so it can be overridden more easily. So that's a modification in Daggerfall Unity itself.

Code already supports using other buttons in dialog boxen, for example MALE / FEMALE buttons during character creation.
Those are identified using an enumeration, that is used as an index for loading their gfxs from BUTTONS.RCI.

So, the shortest route for a mod adding custom buttons would be to provide its own BUTTONS.RCI, with standard buttons and the extra ones; And in the new dialog box code to use extra indices, say (MessageBoxButtons)21 and (MessageBoxButtons)22.
The problem with that approach is that it won't be compatible with any other mod trying to do the same thing for another dialog box, old or new.

A clean solution would be to add some mechanism for a mod to reserve extra MessageBoxButton values (or do C# enumerations provide all what's necessary already?), and then overload buttons gfx loading so that extra values can be mapped to other files. That may be doable without modifying Daggerfall Unity itself by overriding DaggerfallUI.GetTextureFromCifRci(), but it may be cleaner to, again, isolate button gfx loading in its own method.

So, for somebody with modding experience, I'd say:
- some changes to Daggerfall Unity required
- difficulty 2 (dirty implementation) to 4 (clean implementation).

So let's say difficulty 4 for the first mod that will require to mod dialog box buttons.
Until somebody comes with a better estimate...

Re: Custom buttons in dialog boxes

Posted: Wed May 22, 2019 5:41 pm
by jayhova
That's a lot of good information. In a related question, what would it take to animate buttons? Of course the GUI dialog box would need to stay put for long enough to play the button animation.

Re: Custom buttons in dialog boxes

Posted: Mon May 27, 2019 4:53 pm
by Hazelnut
FYI You can now disable the exit dungeon prompt with my latest PR submission.

Re: Custom buttons in dialog boxes

Posted: Wed May 29, 2019 6:40 pm
by jayhova
Joy!

Re: Custom buttons in dialog boxes

Posted: Wed May 29, 2019 7:20 pm
by Hazelnut
Yep joy at being able to mute the most annoying prompt in the game! :D