[Tutorial] Clean Server UI via Item

Hey guys, I have seen multiple threads involving unclean use of server UIs for ARK, and I’d thought that I’d write a quick tutorial so new-comers can implement a CLEAN user interface that’s stackable and won’t break your server!

Currently, the thing that most people are getting wrong is overriding the Player Pawn; this means that any of the mods or updates that use the Player Pawn won’t work, and you’ll end up in a nightmare of trying to fix your server. The idea here is to bind the interface to an item, as there are existing clean overrides that we can use. For the sake of beginners to the Dev Kit, I’ve written this tutorial to be as comprehensive as possible. A general tip: NEVER edit files directly; copy the file into your mod directory, then edit it.

I have just released this tutorial, so any feedback would be appreciated! :slight_smile:

1. Getting Started

  • Create a new folder in your mod folder, and navigate to the GenericMod folder.

  • Copy the following files into your new mod folder: Generic Mod, PrimalGameData_BP_GenericMod and TestGameMode_GenericMod.TestGameMode_GenericMod.

  • Rename them appropriately, following the ARK naming conventions.

  • Open the level file, click Settings, World Settings.

  • Delete any default value inside “Force Load Map”, and point the GameData variable to the one you just made.

  • Open up your GameData blueprint and fill in the mod name and description. Point the Default Game Mode to the game mode blueprint you created.

The base mod has now been created, it’s time to start creating the item.

2. The Item
As we’re lazy, we’re not going to bother creating a new item model, texture, ect… Instead, we’re going to base the item from the C4 remote. This means that all animation and configuration is already done for us; we just have to copy and reference it.

  • Copy the following files into your mod folder: EngramEntry_WeaponC4, PrimalItem_WeaponC4 and WeapC4. Rename them appropriately.

  • Open up your GameData and locate the Additional Engram Blueprint Classes array. Add the engram blueprint you just copied.

  • Open up the Engram blueprint and point the Blue Print Entry to your new item. Edit the other variables at your leisure. If you’re making this as a server UI, you should set the required level to 1, and required engram points to 0.

  • Ensure that Give Blueprint to Player Inventory is ticked and delete any Engram Requirement Sets.

  • Open up the item and change the name and description. Delete all the values in Base Crafting Resource Requirements and add something like 1 thatch in order to craft the item. (WARNING: DO NOT SET THE AMOUNT TO 0, IT MUST REQUIRE AT LEAST 1 ITEM TO CRAFT)

  • Change the Weapon Template variable to the new one your just made. Delete anything in Crafting Requires Inventory Component and un-tick Display As Percent and Item Colors. Set Base Crafting XP and Base Repairing XP to 1.

  • Now it’s time to edit the actual item, open up the new “WeapC4” blueprint. Clear every single animation variable you see; these can cause crashes if you’re using custom models and generally makes the item more stable.

  • “Clear Structure To Place”, “Can Detonate Explosives” and “Weapon Item Ammo Template”. Un-tick “Alt Fire Melee attack”, “Can Alt Fire” and “Uses Ammo”.

The item is now complete; if you run the project, you should be able to craft and equip the remote. However, it won’t do anything as we haven’t added the blueprints. Run a quick test of the item, and check that it’s working without crashing. If you are experiencing crashes, you’ve done something wrong, go through the steps again.

3. Item Blueprints
This is the programmatic part; we need to enable input on the Owner Controller, so we can bind the item to some type of user input; such as Fire, or a button on the keyboard. Then, we have to create the Widget and set input and focus to the Widget.

  • Open up the new Weapon blueprint (such as WeapC4) and go to the Graph. Create a new Variable (Boolean) called IsOpen; make it editable.

  • Right click on the graph and type “Event Begin Play”, drag off the node and type “Delay”. Set the Delay to 0.2. Drag off Delay and type “Get Owner Controller”. Finally, drag off the controller and type “Enable Input”. Connect the Return Node of “Get Owner Controller” to the Player Controller of “Enable Input”.

  • Right click anywhere on the graph and add “InputAction Fire”, drag off it and add a “Branch” (Basically an IF statement).

  • Drag off the Condition of the Branch and type “Get IsOpen”. From False, type “Create Widget”, then “Add to Viewport” (connecting the Target to the Widget).

  • From Add to Viewport, connect a “Set IsOpen”. Tick the box so that IsOpen is true. From the Set, type “Set Input Mode UI Only”, and drag the In Widget to Focus to the return value of the Widget.

  • Go back to the Branch, from True, type “Remove from Viewport”, and use another Set IsOpen. This time, leave the variable False and set the Target to the Widget.

  • That’s the base done, now link the “Owning Player” of the Widget to the “Get Owner Controller” you made earlier. Do the same for the “In Widget to Focus” variable node under “Set Input Mode UI Only”.

4. Widget Front-End
Now it’s time to do the actual design of the Graphical User Interface. If you’re good enough with the editor, feel free to create your own. However, we’re lazy. So lets steal one from the ARK assets (to any ARK devs here, thanks! :D).

  • Find and copy the “AllPlayersListUI” to your mod directory and rename appropriately.

  • Open the Widget and delete the content; make sure that you leave the overlays, backgrounds, title text and close button.

  • It’s time to insert your content, such as server rules and general information. You can also add most forms of images by importing them into the Dev Kit.

  • If you’re using the default interfaces, you won’t need to blueprint the close button. However, if you’re using a custom one then see below.

5. Finishing Touches

  • Open up the new Weapon (based off WeapC4) and go to Graph view.

  • Under the “Create Widget” node set the “Class” to your new Widget. Unless you’re implementing additional features, you’re finished! Just upload to Steam, and make sure it’s public, even if it’s for a private server.

Good, however, a couple of issues with this that I see.

  1. The use of a GameMode is not required, and frankly, people need to stop using their own unless they’re modifying it for the use of their mod. Just setting the GameMode override to default is all that is needed, this can be done by selecting TestGameMode or clicking the yellow “return-style” arrow.

  2. There is no distinction between the server and the client from begin play. This fires twice every time it is “triggered”. Once for the server and once for the client - if in replication range. I would suggest a client event called from an Authority Switch after the delay which then handles getting the controller and enabling input(do remember that two controllers exist - one the server keeps track of and one for the client(handles input largely)).

  3. I do not feel it safe to rely on “temporary” references. I am referring to using the returned value of the created widget to handle removing the widget from the viewport, I would suggest promoting this to a variable and use that to remove from the viewport.

  4. Handling input manually is not a wise idea, people keep trying and it screws things up more than anything. A native boolean exists for this on widgets, Capture Mouse Input. It’s enabled by default.

-WM

Hello ,

I am trying to follow your tutorial and am running into a problem. (FYI - I’m using v268.3 of the dev kit.) When I get to the following instruction - Drag off the Condition of the Branch and type “Get IsOpen”. From False, type “Create Widget”,*** then “Add to Viewport” (connecting the Target to the Widget).*** - I assume you mean to drag off the widget and type “Add to Viewport”. However, there is no “Add to Viewport” option. The only options that contain the word ‘viewport’ are “Set Focus to Game Viewport” and “Set Supress Viewport Transition Message”.

If you are not meaning to drag off widget…then what are you meaning? Also, what target am I connecting to the widget?

Any assistance, from anyone who might know, in getting me past this point will be greatly appreciated.

Thanks in advance!