Blueprint Glitch - Strange Effect

Okay, this is going to get slightly complicated. I have a blueprint within my player character that controls the way you interact with NPCs. If you hit space bar, it finds the NPC, sees if they have the NPC_Interact interface, then sees if they are marked as “non-discussion.” If they are not “non-discussion,” it begins a dialogue with them. This function works perfectly. If the ARE “non-discussion,” a simple “Interact” command is performed.


With me so far?

If the “Interact” is performed, the NPC has what is called a “Secondary Interaction,” which also comes from another Interface. Essentially this Secondary Interaction is a display message.
image


This calls for them to display a message for a few seconds and then remove it if the Event Interact is triggered.

Still with me?

This works without a hitch as well…except…whenever the Secondary Interaction is triggered, it stops the regular interaction trace I have going on and only displays the Secondary Interaction message, no matter which NPC you try to talk with, even if they are set to “Discussion.” If that made any sense to you, I’d love your thoughts on why this might be happening.

1 Like

You don’t need this at all

because you already have all the NPCs you’re overlapping in the first loop.

You are also interacting with all that support the interface. ( don’t know if that matters ).

You are correct in that I don’t need to check for the interface, except in the cases where I would have an NPC that was not able to be interacted with at all (so I included this to leave that option open in the future).

You do need to check for the interface. What I’m saying is you have a totally redundant loop there.

Oh, I would agree, except that I can’t drag off of Get Overlapping Actors and get the “Non Discussion” boolean. I can only get that if I Get All Actors of Class, but if I don’t specify overlapping actors first, it was start random discussions with other NPCs in the level.

Are you intending to interact with multiple NPCs at the same time?

No, definitely not.

I’d just use a line trace to get reference to the actor you are attempting to send the interface message too, so you don’t need to deal with an array. This also would negate the need to check for the class type, because you simply need to see if it implements the interface. Just use the camera’s/ players’ forward vector * float to get an end location for the trace.

Also, why not have the text message be returned in the initial interact interface message? If the NPC doesn’t have a “secondary interaction,” it should be easy to ignore the blank returned text.

Well, the interaction trace is always going, so an interact message pops up if there is every anything/anyone you can interact with.



The secondary interaction was created specifically to show for NPCs when they were not being used in conversation. So are you suggesting creating a variable to store the “hit actor” in the trace and using that as the reference for conversation as opposed to “overlapping actors?”

Drag off ‘get overlapping’, then do foreach, then cast each to your type :slight_smile:

I’m not understanding. Isn’t that what I’m already doing here?

Perhaps I’m not understanding your goal and I’ve oversimplified it.

Let me see if I understand your post.
-The player hits space bar to find NPC’s that are interactable.
-If it finds one in their vicinity that isn’t marked as “non-discussion,” the player sends a second interface message to the NPC, returning a text message to display

Your issue is whenever execution gets to the “secondary interaction” interface message, it stops the “regular interaction trace” (not sure what this means totally).

I think it makes sense to utilize “get overlapping actors” if you are requesting to get multiple actors to show interaction text (like a popup that says “interact” or something), but if you are looking to interact with a single actor that the player looks at, a line trace is much more simple.

As for the message that is being returned to the player, since you already have reference to the NPC class, why not create a function in that class that returns the message you’d like, then the player can run that function and get the text without having to do a second interface message?

As I said before, I knew I would struggle to explain it. I’ll go step by step.

-The player hits space bar to find NPC’s that are interactable.
-If it finds one in their vicinity that IS NOT marked as “non-discussion,” the NPC begins a dialogue with the player.
-If it finds one in their vicinity that IS marked as “non-discussion,” the NPC displays the secondary message.

My issue is whenever execution gets to the “secondary interaction” interface message, it stops the “regular interaction trace” (the player’s event tick) that sends back a display message of what the interaction trace is looking at.


I don’t know why it does this. It also, then, only displays the NPC’s (the one that first triggered the secondary interaction) secondary interaction message, no matter what NPC you attempt to talk to (hit space near).

Yes, that, and then take out those two nodes I outlined above, and you’re off.

If I remove those two nodes, the Player will not be able to detect if an NPC is non-discussion.

See above…

HOLY MOLY!!! How right you were! That does solve the problem! Honestly, one of my biggest issues with unreal since I started was knowing when what I’m doing is completely redundant. It is especially irksome when it is an issue that only presents itself as an issue days, weeks, or even months later! On top of that, it doesn’t throw any error codes to go by and you’re left scratching your head. Thank you so much!

1 Like

Told ya :wink:

Glad to help :sunglasses:

( Things will improve… )

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.