Download

UI Help Needed - Trying to make a codex

(Hello! This is my first time posting in the forums so I apologize if this isn’t in the right spot.)

I’m working on a 2D sidescroller-type game as part of a project for school, using Unreal Engine 4, and I’m currently working on implementing our UI. I’m more of a designer/writer, so a lot of this doesn’t come super naturally to me but my team is small and we’re all wearing multiple hats. Right now, I have a pause menu, and I’ve found tutorials for a main menu as well. However, the thing I need the most advice on, that I don’t really know how to implement, is a codex system (in the style of, say, Dragon Age or Bioshock, where you find notes in the environment and those things are then logged in a menu somewhere that you can access any time, generally used for backstory or flavortext).

The functionality that I would like it to have is:

  1. Access to a list of entries from the Pause Menu. (ex: Pause Menu —> Codex —> Entry 001/002/003 etc)
  2. Entries that are somehow inaccessible until you encounter that note in the environment, but then become active and can be accessed any time.
  3. When you encounter a new entry for the first time and activate it, that entry pops up and can be read and closed without going through the pause menu.

Scenario 1:
Player comes across an interactable object (Codex Entry 001) in the environment. The player uses the ‘interact’ input option (in this case, ‘E’), and there is a popup with

Scenario 2:
The player wants to re-read a previously discovered Codex Entry, so they go to the Pause Menu, then click on the Codex button. It then takes them to a list of discovered entries, where they can select the specific entry they are looking for. (I feel like the undiscovered ones would be grayed-out/present but inactive, or simply wouldn’t be part of the list yet, whichever is easier.)

What I have so far:
Like I said, I have a simple pause menu working. I have a Codex button on the pause menu that goes to a page with a list of buttons that would ideally lead to entries (however, it was suggested to me by someone else that I change this to a Widget Switcher, so people can tab between entries and the whole thing has fewer moving parts).

I’m sorry if I’ve misused terminology, and if anything I’ve said is unclear I would be happy to clarify. Again, I know this is a lot to ask, but if anyone has any suggestions for how to do something like this, I would hugely appreciate it!

I’m going to be doing something similar and just haven’t started on it yet. But I think I know how to do it, just probably more difficult to explain from the top of my head. I’ll start on it when I get home tonight, and if I get it figured out before anyone else posts a solution, then I’ll post a tutorial on how I manage it.

Many ways to go about this but here is the most simple way that I can think of:

Create a “PlaceableNote” blueprint.
This blueprint is what you will place into the level and it can contain an entry number (integer), a text (or string) variable and some kind of static mesh so the player can see it in the world (for example).
(If you want to, you could also create a custom struct with an int and text variables so you can a bit more easily store/read the data later on.)

Now when the player presses the ‘E’ button you can do a trace, if the trace hits a “PlaceableNote” object then you can read the text from it and from there you can spawn a custom UMG widget that will show that text to the player (you can stylize the UMG widget to look however you want) and then destroy the “PlaceableNote” from the world.

Then you can save the entry and text values to the player character which then can be accessed by the pause menu later.
You should probably also look into SaveGame stuff if you need to permanently save that data.

Advanced:
If you want to take it a step further then you can create some kind of a database blueprint that will hold a list with all the notes and their entry numbers.
That way all you need to set into “PlaceableNote” object is the entry number, then you simply retrieve the text that corresponds to that entry number from the database.

The advantages of having a database blueprint would be…
You only need to save a list of entry numbers (integer array) into the character save file (so you save some MB, but it depends).
You can easily add (and/or edit) note entries right from the database blueprint instead of the “PlaceableNote” (which might be scattered all over the map or multiple maps).