Hi, I’m currently making a third person action RPG and have an issue. I need NPC’s names to appear above each NPC only after first encounter/dialogue with player character was finished. How can I make it?
Right now, I manage to make it so, that name is shown only when Player Character looks at NPC, but the name is shown no matter if there was any encounter or not. Then I tried to update logic but only manage to hide name of NPC permanently instead of hiding it until the first encounter/dialogue…
Here is my NPC logic description and screens.
In my project all encounters including dialogues with NPC are made through Interaction system. I have a BP_NPC_base containing everything that is needed for any NPC in game and BP_NPC_Mouse (child NPC blueprint) with specific information, dialogue tree, name etc. In order to check if there was an encounter or not, I add HasSpokenToPlayer Boolean to BP_NPC_Base, with default value of False.
Default logic of showing NPC name when player character looks at NPC is in BP_NPC_Base Event Graph (EventSetOutlineState) and in BP_NPC_Base Construction Script.
Update logic of showing NPC name after the first encounter is in BP_NPC_Mouse Event Graph EventInteract and BP_NPC_Mouse Construction Script.
Hello there! As I was trying to solve the issue I’ve made some changes (see below) with Construction Script of BP_NPC_Mouse which doesn’t help, though.
One simple approach would be to create a save game object for this character, and save a boolean var which says “FirstInteraction” and then you can get that var in the runtime and display the name if its value is false, otherwise don’t display the name.
Hello, thank you for reply. I’m noob in UE5, so maybe I’m getting something wrong from your reply or I’m not explaining correctly.
The first issue is that boolean HasSpokenToPlayer (analogue of FirstIneraction of yours) is not registering that dialogue/encounter happened. So, when the first interaction ends the name is not changing from false value to true. So, I cannot save anything for it is not registered.
The second issue to save boolean value changed from false to true. It seems that you are speaking about this issue. The save game object is needed to save data inside the blueprint for the next loads, I guess… Or I’m missing something?