Variable will only sometimes set in HUD

I’m making a quest system where when you click on a quest it will show it on the side fully. Basically what is happening is that the first time I use the quest system, it works. When I keep on playing, then go back in, the quests are there but when I click on them it doesn’t work. I’ve done some debugging, and I found that as soon as the variable is set, it gets set back to null.

Appreciate all help,

DETERMINATOR20

It’s impossible to help you with no screenshots or more info.

I found that as soon as the variable
is set, it gets set back to null.

Sounds like something else is setting it on Tick.

Sorry about that, thought I had uploaded some.
link:Setting the text
link:Setting text box

Can you provide some more images with actual logic behind it? You can upload images directly from your computer on to the answer hub. It’s the icon next to the paperclip.

thought I had uploaded some

This is not helping. This, on its own, would, of course, work - clearly indicating that the issue lays elsewhere.

What is firing that event and when? How do you know the value is not set? Do you use the variable anywhere else? Is the widget on screen? How is it created? I could ask 100s of questions and list twice as many reasons as to why it may not work. It’s the same as saying, “Print String is not printing, why?”

Consider describing what you’re trying to do and how you’re approaching it.

Agreed, more screen shots.

I completely understand. Hope these will help (they are in order of how they will run)

NOTE - If you are experiencing the same problem, go down to where DonBusso sends an image

This code always works, as creates the quest widgets depending on the amount of quests.

This code also always runs, and makes the quest box have text on it.

This one also always runs, when the quest widget is clicked on.

This one does run, but for some reason the moment it is set, it gets set to nothing (only when you continue playing then go back in to the quest system)

This one does always run, but as shown previously, on the second time of running all this code, it does not set to anything.

Thanks for all your help,
DETERMINATOR20

Soo, this is a really weird setup. I am having trouble figuring out what exactly is going on. You use “get all actors of class” twice to pull the same data First in the initial widget construct, the at each iteration of your for loop. You could easily pass in both this reference and the “quest names” array to the function that is supposed to be setting the variable “OG Text”. Second, I am assuming you only have one “quest and inventory” actor. It would be helpful to see inside that as well to see exactly how you are creating this quest name array. Also, the widget could likely be given a reference to this actor without using “get all actors” node but that is a separate issue entirely. Also, just realizing this…is the “quest and inventory” actor also a widget? I have never used “get all actors” to find widgets…certainly there is a better way to do that. I see you use “get all actors” initially, then in another screen shot (on clicked one) you are using “get all widgets of class” to pull the same widget?? Just not sure you are going about this system properly…it is very hard to figure out where you are creating, receiving and transmitting your text data. And unfortunately, you didn’t tell us what blueprints these functions are part of although I think I can piece most of it together but still, just makes troubleshooting this issue all the more challenging. Can you tell us where these screen shots are pulled from and also show us the quest and inventory blueprint?

Hope this helps. Just saying, the only thing that happens related to the quest and inventory blueprint is calling it for a reference from the code I use, and storing a text array. Also, every time the ‘Selected Quest Title’ variable does set, as I tested it with string printing. Only, the moment it sets, it insets once all the code is run.

  1. If “Quest and Inventory” is a child component of the third person character, simplify this code by using the following method: cast to third person character → quest and inventory → text array…instead of “get all actors”
  2. Is your text using a binding? If so this is set on tick and likely is causing the issue. I would suggest removing the binding and creating a function to “set text”. This way it only gets called after a click on a quest sub widget and it will only be called once (until another quest/widget is selected)

Thanks for that, I followed step 1. The only thing is that it is not the text box causing the problem, it is when I set Selected Quest Title. (Image 4)

Also, I did some more testing/debugging and it turns out that it is actually something related to the text box (the one that does its stuff in the last picture). I found that that text box actually sets itself to null and what ever it trying to set it. e.g. sets itself to null when ‘Hello World’ is trying to set it to ‘Hello World’, and sets the input to null. This I found was incredibly strange

Any way you can share the project files? I feel like this bug runs deeper than I can see or understand based on screen shots. And if not can you recreate just the inventory system in a blank project and share that?

I’ve made a small duplicate project. How can I send this to you? The project file is bigger than 5.2MB.
Also, the glitch is still happening in both projects so it must be an actual bug.

You will need to upload it somewhere where you can place bigger files, maybe google drive or just google a random site. You can package your project like this:

Here is the link
https://drive.google.com/drive/folders/1GhTPX7j3_Ax-uG76iHE8S3GHzaKZpvCT?usp=sharing

Note - the file may not have fully uploaded yet, though it is uploading now.

Is it still uploading? There are no files under this link.

Might want to double check this upload. It has been 3 hrs and still no files.

Sorry, my computer decided to shut down. I should be up in roughly 15-25min

EDIT - Uploaded now
https://drive.google.com/drive/folders/1GhTPX7j3_Ax-uG76iHE8S3GHzaKZpvCT?usp=sharing

Your setup looks okay. I made small changes, images below.

I’m not 100% sure but I don’t believe you want to create and destroy your widget every time you use it, instead just hide it and bring it back on screen later. It’s good practice to set a reference to your widget as variable, that way you can check if it’s already valid (widget already exists in the game). If it’s not then you create widget (1st time you open the quest widget) and then you just toggle visibility.