Can’t figure out if I’m blind or just dumb at the moment, but can’t get a variable to update and pass to another BP through Interface. Reduced it to the minimum of just print strings.
Intended flow is player is unable to interact with something without item X → player picks up item (remote) → Variable ‘HasRemote’ gets updated → passed to Interface → Call that Interface on Character BP to get variable and make new interactions possible.
In this very example, there’s no need for a 2-way interface (you may need it for other reasons, of course - do tell). Here, the interface is only implemented in the BP_Remote.
When you press X, you must decide which actor you wish to interact with. How would you like it done? It’s usually a trace (look at something), an overlap (proximity) or a mouse click (widget click).
Essentially I have a general interaction in my character BP set up with a line trace that interacts with actors having a certain tag. It’s connected with actor BPs via another interface. That all works so far.
The player press x was just a simple interface test setup.
The idea for this interface is a sort of inventory. I have a list of boolians in it ‘has_item_xyz’ that gets updated when character BP interacts with/picks up item_xyz. Then I can access/update those boolians in other BPs, unlocking new interactions.
So the testing method is the culprit. You’d need to send the message to the actor you wish to interact with. Currently the player is calling it for Self. Unless the implementation of Character Pickup in the player does the tracing. We can’t see that here, though.
Yes, that was it! I’m so stupid lol
Got it all working as intended, though ran into another snag:
Right now I can get the variable (HasRemote) from the interface, but as soon as I interact with another pickup tagged actor, it gets overwritten. Is there a way to only update the bool in this BP once? Like once it changes to true, stay that way. Sort of like this mockup (HasKey is only there as mockup in the screenshot). Tried with a DoOnce and DoOnceMulti, but couldn’t get it to stick.
Exactly. Have the interface work as a simple inventory list that “stores” the bools and can then be called and updated whether player currently has item x and can thus interact with certain BPs or not.
Don’t know if there are better ways to do this. So far I’ve been doing archviz with only simple interactions, and just started experimenting more with blueprints and interactions to try my hands on a simple walking simulator/escape room kind of project.
And here’s the kicker. Let’s say that you already have a remote and you’re attempting to collect another one. You can send your Item List to the Item by reference:
This way you do not need to complicate things with a 2-way interface. The items do not need to call the player. And you do not need to track variables in multiple blueprints. Previously you were updating bools in the player and in each item. With this approach there’s only one variable updated once - in the player.
I can’t say I 100% understand everything that’s happening, but it seems like a more elegant solution to what I’ve been trying to do. Especially since it looks very scalable - for now I’m only trying to get it working with a handful of items, and then expand from there.
Definitely have to try implementing and toying with it a bit, but I think this is what I’ve been looking for. Thank you so much.