Problems with the interaction system

Hello) I’m new here)

I’m trying to make an interaction system, but only part of the code works in my project and I don’t understand why.

I wanted the player to be able to interact with the object in different ways:

  • open object in widget, rotate and explore
  • open an object in a widget and get text info (would be used for a book, etc.)
  • interact with the object without opening it in the widget (for example, the player interacts with the picture and the character says something)

I did the first interaction but got stuck on the second one. I’m using a third person character template, but the interaction will switch to the first person camera.

For the second type of interaction, I’m trying to use this code, but apparently I’m doing it wrong and it doesn’t fit with the first part of my code ( Unreal Engine 4 - Item Inspection System - Letters - YouTube ).

What I did for the second type of interaction:

But it doesn’t work, the game doesn’t read the object type “letter” ((((
Can anyone suggest what I am doing wrong and why this part of my code is not working? I would be grateful for any help)

Not sure if I follow but if we’re inspecting an item, it’s probably not the right actor being piped in here:

And should be the first array element with the interface instead; but… the Item pin seems redundant - we already know which actor we mean.

If we’re inspecting Master Item, I’d self this:


I imagine it’s supposed to work like so:

  • the player pushes the button to Inspect their surroundings
  • we check what’s around us and we Inspect the first Master Item found
  • the master item creates and shows the widget with its relevant info

Am I close?

Hello) Thank you very much for your help)

Yes, this is how it should work:

  • the player presses a button to inspect their surroundings
  • we check what surrounds us and inspect the first main item found
  • the main element creates and displays a widget with relevant information

I made corrections to my code, but it doesn’t work again(

I found a problem with the scroll variable in my widget. The variable is not public and I can’t switch it. Maybe that’s the problem?

Corrected code - BP_ThirdPersonCharacter

And MasterItem

Could you clarify which part of the script does not work?

image

Does this actor receive the message? Print a string here. Does it print? If so, does the widget show up? Do tell when it stops working. Do assume I know nothing about what you’re up to :innocent:

I’ve done some tests) The code started working when I took a variable with an item structure, split it and connected it to Select.

Thank you very much for your help)

1 Like