How to get bool from struct to update

Hello,

I am trying to get the value of a bool that is declared via struct to update in game from an enemy dying. The struct is set in my quest component and is applied to a UObject called Quest. I turned Quest into a BP and have a method for setting the value of the bool in the object, which works. My issue comes when trying to check that value in my UI to update the conversation for the NPC that gave the quest. My method for trying to get the value in the NPC’s UI is

I get the array of quests and break them to see if it matches the quest ID and if it is completed. Despite the QuestProperties in the UObject itself listing as completed (checked using print text in the object’s tick), I can’t get the updated value using the for loop. Is there a different way of doing this, or did I miss something? I would appreciate any help solving this.

Thanks

That all seems correct, however I cannot see the object reference that you are getting the QuestList from? Is that an instance you have stored earlier as a pointer and is it pointing to the correct quest object?
Have you tried printing out IsQuestCompleted in a string here on it’s own without the other checks to see if there is at least one quest that is completed?
I’d say that the QuestObject you are getting the list from here isn’t the same as the one you are printing out of in the tick, or the other checks such as QuestID are failing here as well.

What is the “Has Accepted” variable? Is it updated during the loop?
If not, you can move it outside the loop and check it once before running the loop and splitting the behavior(s).

You check every quest ID against a static value; is that correct?

Where is the loop breaking down? Is it not matching the Quest ID, is HasAccepted showing up false, or is QuestComplete reading as false?

Are you certain it’s not failing after the conditional branch?

Thanks for the reply. It’s from the player character casting to my third person character. From there, I get the Quest component which has the quest list array. I did try checking against only the QuestCompleted and also checking without QuestCompleted. that one variable seems to be the issue. The QuestID and Name both work by themselves.

Thank you for your response. The Has Accepted variable is separate from the struct, it is set in the conversation. When the player is offered the quest, if they click on the accept text, it sets the variable true so the conversation text is updated accordingly so that if I speak to the innkeeper a second time, he does not re offer the quest. and As stated above in my question, the ID is working, however, the QuestComplete is always reading false, despite, in the actual quest object itself is returning true.I tested this by adding in the quest object to print text if it returns true, which it did. I am also certain that the issue is only the QuestComplete variable in the struct because if I remove that condition and only base it off the ID, the function works as expected and will return true.

I would check your comment as complete because you were indeed correct, but it is a comment lol. The quest in the quest list wasn’t being updated and the tick call I was seeing was not the same quest instance. I had to add in my CompleteQuest function to cast to my Third Person Character and remove the original quest with the same ID and then re add the quest with the updated bool. Thank you so much!

“I am also certain that the issue is only the QuestComplete variable in the struct because if I remove that condition and only base it off the ID, the function works as expected and will return true.”

Okay, that’s what I was asking about - if the error was happening further within the chain. I wanted to narrow it down to be sure the boolean was actually reading improperly.

So now we should check the other direction; where is this QuestList struct coming from?