Arma Reforger

Arma Reforger

Not enough ratings
How to create HUD/UI/GUI Addons
By Miijuki
This is a simple guide on how to create GUI/UI/HUD addon's for Arma Reforger.
Hello there.

Are YOU wondering how you actually use the Arma Reforger Tools, in order to create HUD or UI specific stuff?

You did your layout, or even created a simple little script, but you just cannot get it to work, don't you?

Well, look no further. Here is a simple tutorial in order to create UI/HUD/GUI specific stuff.
First step
First of all, you need to create a layout.

For this example, I created a Button Widget, it could be anything. Images, Text's, Buttons, whatever suits your needs.

Second step
The second step is actually creating a script, which calls this layout in order to let it show up on start.

The script would be created within the same folder, but doesn't really matter actually. Make yourself a structure you can get along with. The script can be called anything.

Within the script you should have this as first:

private ButtonWidget TestButton;

With this code you are defining your Widget. As I said, it could be anything. For example a Text Widget would be:

private TextWidget TestButton;

TestButton is actually the name you set the TextWidget to right now. So you can call it later in the script.

The next step is overriding the already created variable OnStartDraw.

Like this:

override event void OnStartDraw(IEntity owner) { super.OnStartDraw(owner); if (!TestButton) TestButton = ButtonWidget.Cast(m_wRoot.FindAnyWidget("TestButton")); }

As you can probably tell, you are calling the named private with the !TestButton and after the = you are telling the script, what kind of Widget it is and what to search for. The last "TestButton" is the name of the Widget in the layout. In this example, it would be TestButton again. Maybe a bit confusing cause I use TestButton for literally everything. But it's not about how to script, more like how to actually let your GUI/UI/HUD stuff show up.

The total code should look like this:

class Menu: SCR_InfoDisplay { private ButtonWidget TestButton; override event void OnStartDraw(IEntity owner) { super.OnStartDraw(owner); if (!TestButton) TestButton = ButtonWidget.Cast(m_wRoot.FindAnyWidget("TestButton")); } }
Last step
The last step is the most crucial one, since your stuff won't show up if you do not do this. And that's something that has not been noted before or even documented.

You need to go to ArmaReforge/Prefabs/Characters/core/ and right click/override in your Addon.

If you did this, open the created DefaultPlayerController and search on the right site for Edit Prefab. Click that.

Now you need to search for "SCR_HUDManagerComponent". Click on it and scroll down. The last thing you should see is "SCR_ChatHud". Right click on it and insert after. Search for your created script. If it does not show up, restart the editor because it has not loaded your script yet.

After that you need to expand your created point and add the layout you created. It should look like this now:

And if you did this, you can actually publish your addon. It should work now like this if you did everything right:

Awesome, your GUI/HUD/UI modification is now showing. You can now start creating awesome stuff with this.

Thanks for reading and sorry, if there are some misspells.

Have a great day!
Tonic Jun 4, 2023 @ 2:06am 
it works; but I don´t understand why the defined class is going to be instanciated. There is no relation to the configured Layout. Is it because of the inherited type? I don´t see the mechanism behind that.