[WIPz] HUD Widget Framework

Post » Sun Jun 24, 2012 5:54 am

Mardoxx and I are currently working on a general-purpose widget framework for SkyUI. It will allow other mods to add custom elements to the HUD via Papyrus.

We already made good progress and I think it's time to ask some other modders for feature suggestions comments.


I'll also give some more details on how the framework is organized, and how it works:

The basic idea for adding custom widgets is to utilize the loadMovie ActionScript function. It allows loading of an external .swf from the Data/Interface folder into the current movie (menu) at runtime.
So we added a widget loader to the HUDMenu, which is sent SWF names from Papyrus, loads them and adds them to the HUD.
Examples for widgets are labels, a meters, and icons. But it can basically be anything, with the restriction that they can not receive input (because no HUD element can).
They are just there to display information.
The first benefit of this is that it's no longer necessary to modify HUDMenu directly if you want to add something. Instead you can add a standalone .SWF and include it with our loader,
so there will be no potential conflicts with other mods that do the same.

The next step is to create several general-purpose widgets that can be parametrized from Papyrus. This is one of the things we could use some input on.
As mentioned, currently planned is default stuff like labels, meters, icons etc.

Our current progress is that the loader and the Papyrus infrastructure for the framework are pretty much done.
In Papyrus, a widget will be represented by a custom quest you create in your mod. Based on the widget type, you assign the appropriate script to your quest, and then you can interact with it by
setting properties or calling functions on it.

What's working so far is a generic base widget, which has the functionality all other specific widgets will extend later - position, visiblity, alpha value, scale etc.

A screenshot of what that looks like in the editor:
http://i.imgur.com/kX5M7.jpg (type = test means, it will load test.swf from Data/interface, which is just a simple red square)

And in-game:
http://i.imgur.com/IvVze.jpg (as you can see, I set different horizontal positions and alpha values for each test widget).

So while these are just useless red squares for now, they have been added without writing any code. Just creating the 3 quests, adding the script and setting the properties made them appear.

Of course these properties can be updated as well. So if you set SKI_ExampleWidget.Y = 500 in another script, the widget would move accordingly. The widget state is saved and restored on reload.


Alright, so if you want a certain HUD element for your mod, feel free to make a request.
Or if you want to ask for some more information on how to create your own custom widgets, or maybe even help out others, or just ask some general questions - you can do that in this thread as well.
User avatar
maddison
 
Posts: 3498
Joined: Sat Mar 10, 2007 9:22 pm

Post » Sun Jun 24, 2012 12:42 pm

Nice! Thanks much to you and Mardoxx, for the thought and work you've put into this!

One natural application would be info about followers/PlayerTeammates, although thought would need to be put into how such information should be displayed. Some sort of block with their name and a health bar, with an icon to indicate essential status, maybe. Not sure if that would best be a single widget or a several working together. And some mods allow players to have 10, 20, 100 followers, so a method of cycling through sets of followers would likely be called for...
User avatar
flora
 
Posts: 3479
Joined: Fri Jun 23, 2006 1:48 am

Post » Sun Jun 24, 2012 3:29 pm

Would this allow the possibility of buff/summon countdown timers?
User avatar
Melanie Steinberg
 
Posts: 3365
Joined: Fri Apr 20, 2007 11:25 pm

Post » Sun Jun 24, 2012 4:31 pm

One natural application would be info about followers/PlayerTeammates, although thought would need to be put into how such information should be displayed. Some sort of block with their name and a health bar, with an icon to indicate essential status, maybe. Not sure if that would best be a single widget or a several working together. And some mods allow players to have 10, 20, 100 followers, so a method of cycling through sets of followers would likely be called for...
I think it would best be implemented with a single "FollowerStatusPanel" widget. Having one widget per follower would work too, but since each widget requires a quest, the number would be fixed. Having a single widget that can dynamically manage several health bars sounds better.

So as an example how you'd go ahead to implement something like that:
1. Create the status panel in Flash. You define some functions in AS that will be called from papyrus later to update the data. Like setFollowerHealth(int followerIndex, int healthPercent) etc.
2. Create a new papyrus script for your custom widget: MyFollowerStatusPanelWidget extends SKI_WidgetBase. WidgetBase contains all the basic functions for setting position, registering the widget etc. You have to define additional properties and functions specific to your new widget, and these pass on the data to the UI by calling the functions you set up in step 1.

Then you add the logic to monitor the follower information. This would probably already be part of a larger follower mod anyway. Whenever you detect that the health changed, you do StatusPanelWidget.SetHealth(123, 50).

Would this allow the possibility of buff/summon countdown timers?
Yes. Some procedure as described above.
User avatar
Brittany Abner
 
Posts: 3401
Joined: Wed Oct 24, 2007 10:48 pm

Post » Sun Jun 24, 2012 3:27 am

Already plan to utilize the widgets for my follower mod :)
http://skyrim.nexusmods.com/mods/12933
User avatar
Dewayne Quattlebaum
 
Posts: 3529
Joined: Thu Aug 30, 2007 12:29 pm


Return to V - Skyrim