Fallout 4

What do I need to create a HUD widget?

You need:
1. SWF authoring software - I use Adobe Flash CS6 for this purpose.
2. A Papyrus script to control widget registration, loading, and passing information to the UI widget.
3. The HUDFramework Development Kit - this contains the HUDFramework Papyrus API and an AS3 interface file for your widgets.

*** Before you start, download the HUDFramework Sample Widget from the Files tab for a simple widget example! ***

Copy contents of the two folders in the HUDFramework Development Kit into your Papyrus source folder and Flash project folder, respectively.

First, create your HUD widget in Flash. Add text, graphics, etc. as you see fit. Use white color (#000000) for all your UI elements, as your UI widgets will automatically be tinted to the HUD UI color at runtime.

Ensure that the document class of your SWF file implements IHUDWidget, and has a function named processMessage(command:String, params:Array):void. Any messages that you send from Papyrus to the widget will be received in that function.

On the Papyrus end, to load a HUD widget, you need to:
1. Get a reference to HUDFramework by calling HUDFramework hud = HUDFramework.GetInstance(). If HUDFramework is not installed, this returns None.

2. Register your widget. Call hud.RegisterWidget(Self, "MyWidget.swf", afX = 10.0, afY = 10.0, abLoadNow = True, abAutoLoad = True) to register MyWidget.swf and place it at coordinates (10, 10) on the screen. abLoadNow will load the widget immediately after registration, and abAutoLoad will tell HUDFramework to automatically load your widget whenever the game is loaded. Change these parameters as you see fit.

If you are not using autoloading, you can load and unload your widget by calling LoadWidget("MyWidget.swf") and UnloadWidget("MyWidget.swf").

3. Make sure that the Papyrus script that is loading the widget implements the function HUD_WidgetLoaded(string asWidgetID) to be notified when your widget is loaded and ready to receive messages. You should not attempt to communicate with your widget before it is loaded!

Once your HUD_WidgetLoaded(string asWidgetID) is called by HUDFramework, your widget has been loaded and is ready to receive messages. You can call hud.SendMessage("MyWidget.swf", MY_COMMAND_ID, 200) to send a command with the ID MY_COMMAND_ID and the value 200 to your HUD widget. This will be received by your widget's processMessage function with the command ID and value that was sent.


How do I change existing UI elements on the HUD?

You have two options:
1. Use HUDFramework's Eval function to run ActionScript 3.0 code on HUDMenu directly from Papyrus.
2. Write an invisible HUD widget that manipulates UI elements in AS3 from within Scaleform.

If you just want to change the scale, rotation, etc. of existing UI elements, the Eval function will suffice.
When using the Eval function, the variable "hud" will refer to the HUDMenu root.

If you want to change sprites, you will need to create a SWF that contains these new sprites so that you can swap them out at runtime.


Important information on XB1 Deployment

Take note that on the XB1 platform, HUDFramework is an ESP, not an ESM. This is so that XB1 users can re-order HUDFramework to ensure that it takes precedence over other mods that replace HUDMenu.

If HUDFramework has been specified as a masterfile, before you upload your mod to Bethesda.net, ensure that you use FO4Edit to rename the masterfile requirement to HUDFramework.esp instead of HUDFramework.esm.

I recommend that before uploading for XB1, make a copy of your plugin and archive with a recognizable name, e.g. MOD_XB1.esp and make the masterfile change on the copy, as the Creation Kit does not allow ESPs to be specified as masters and will strip the master if the file is subsequently saved in the CK.

Article information

Added on

Edited on

Written by

registrator2000

9 comments

  1. ID8879488948574
    ID8879488948574
    • premium
    • 16 kudos
    Is the SWF the only way? Because with it there are two options as I see it

    1. Go download the Creative Suite from some "third party" web-site and risk infecting my system with various trojans, rootkits or worse
    2. Go to official Adobe and get what nowadays is Creative Suite - only now it's "Creative Cloud" that costs $70 per month. That's a bit pricey for 2-3 sorry SWF files ..

    Or .. any other ways?
    1. dataframe
      dataframe
      • supporter
      • 13 kudos
      Hey, you can use JPEXS Free Flash Decompiler from https://github.com/jindrapetrik/jpexs-decompiler/releases.

      The following article was also pretty insightful for the topic.
      https://www.nexusmods.com/fallout4/articles/10
    2. Giumbus
      Giumbus
      • member
      • 0 kudos
      It seems so: credit is given (see the very last lines of this mod's description) to the RABCDAsm and with a bit of search you'll find https://github.com/CyberShadow/RABCDAsm, a project which seems to be living (got updates a bit over 3 weeks ago). Have a look at that as well !
    3. RozzyRozz
      RozzyRozz
      • supporter
      • 6 kudos
      I've created some small widget adjustments for the default UI using Haxe for my mod. Maybe this helps someone:

      https://www.nexusmods.com/fallout4/articles/4734
  2. solidnorth
    solidnorth
    • member
    • 0 kudos
    i just downloaded the mod but theres a slight problem when i enter vats tjhe enemies name display disappears when you target them.. it only shows the health bars
  3. zafirosbonitos
    zafirosbonitos
    • premium
    • 1 kudos
    Any chance for a tutorial?
    1. SorrelKat
      SorrelKat
      • premium
      • 13 kudos
      Seconded. I'm thinking about getting into Flash (Animate), and I think I'll regret it. A tutorial would be GREATLY appreciated, and I'll even throw in my first-born.

      Edit: Well, first impression of Animate, given the example Widget, is it isn't as daunting as first believed.
    2. Vortetty
      Vortetty
      • member
      • 0 kudos
      i will give you a second second, i would like one too
  4. Vortetty
    Vortetty
    • member
    • 0 kudos
    what is a free alternative to cs6, an cant afford cs6, or any other adobe things for that matter, too expensive. i cant afford to spend $20 a month by making a mod