Why isnt my BPI event (Blueprint Interface) firing/triggering? How to pass a Bool?

Can someone please show me why my BPI event is not running, when triggered (called) in another linked BP? Both have the BPI added. Thank you.

  1. I have Character BP, Spline BP, and BPI_Movement.
  2. This is a SideScroller Character. I want to use a Spline BP with trigger boxes, to turn on/off the Planar restriction as SS character travels in/out of the Spline Actor’s influence. I.e. the Spline Actor has 2 boxes at each end of the line.

3. So SS player enters the Exit box first (code fires to Set Plane Constraint Enabled = true, which does nothing because the SS player is locked by default. But this Exit box is for when the Player reverses course and needs to get locked before leaving the Spline Actor influence).

  1. Then I have the Enter Path box (code: Set Plane Constraint Enabled = false, so SS player can travel in 3d on the 3d line).

  2. Then at the other end of the Spline, I repeat the 2 boxes in reverse, so when player Overlaps the 2nd Enter Path box (code does nothing); and he exists the last box (Exit), he gets locked to the Plane as normal.

  3. So the lock to Plane code is in the Spline BP (because I will have Character BPs other than human player, that I want the Spline to work on - why I dont want to use Cast To).

  4. But the code to follow the Spline and Movement control is in the SS character BP (because Input Action Event needed). And dont forget the Event begin Play in SS BP - which sets the Spline Actor to use (add code later to get the nearest).

The code in Orange is not working:

  1. I want a common BPI to send the bool value from the Spline BP to the SS character BP. But my Event in SS player is not firing. Why?

Question 2: What is the correct way to pass a variable between two BPs using a BPI? I am confused if I need to set an input and output in the BPI. Because if I do, then I cant add it as an Event in one of the graphs.

But if I dont have an output, then that means I have to create a variable in the receiver BP, and have a BPI event that Sets it, correct? (I was trying to not add anymore declared variables. I thought I could use a BPI to pass an instant variable/message that way.)

Solved by @BIGTIMEMASTER : If the “Target” pin in a BPI Message is a Component, then that Component also needs to implement the BPI. (I only had the Parent BP implementing the BPI.)
So here is the corrected code (yellow comment) > to use a Component as the Overlap trigger in BP1 > then get its Owner (which is SS character BP) > and send the BPI message to SS character (so that I don’t need to add the BPI to the Component).

  1. Why isn’t the Event in orange (BP2 = SS character) firing from the Message trigger in BP1 (Spline)?

  2. Is my 2-part BPI event node correct (correct as a trigger & receiver, or do I need a Delegate)?

  3. And is it correct that BPI is supposed to send the input variable from BP1 to the matching node in BP2 (both with same Interface added)?

  4. Does Target (in BP1’s BPI Message node) have to be correct to match SS character?
    (See pics in post 1: Target is Movement component of SS character that triggers the Overlap event in BP 1. It’s Valid and is triggering with Print. But Event in SS BP2 is not triggering.)

Is the interface implemented on the component, or the parent actor?

If you are directing an interface event/function to an actor component, the component has to implement the interface.

Only the receiver has to implement the interface. Anybody can call any interface, but only a class that implements the interface will receive the call.

An interface event and an interface function can both pass in an input. Only a function can return an output.

So if an Actor wants to pass a bool as an input argument, then the receiver gets that bool and can do what they want with it.

If the sender needs to ask a question and get an answer back (get a result back), then you add an output and the interface will automatically convert it to a function.

You implement a function the same way as an event, just right click and open it up, add the code you want.

It’s a little confusing to me who is trying to talk to who. Are you trying to talk with an actor, it’s actor component, or both?

1 Like

Ah. The BPI is not implemented on the SS character Movement component. Only the SS character BP.

I only need to send a message from the BP1 (Spline Actor) to BP2 (my Character BP). But in BP1, I used the Character’s Movement component as the triggering detection. Perhaps that is wrong?
Do I need to > Trigger overlap is Character’s Movement component > Get Parent > and connect that as the Target in the BPI message node (so that the BPI is talking to the SS BP and not the SS’s Movement component)? Thank you :slight_smile:

whereever the code lives that you want to activate when the trigger is overlapped, that is where you should implement the interface event.

if the character overlaps a trigger and you want to tell the characters component to do something, you can grab the “other” actor reference and check “get components by interface”, then send your interface call to the component which implements the interface you are interested in.

it will help you a lot to make a clean project and run some test where you just practice sending and receiving signals between actors and actor components via interface. I think you are missing some fundamental understanding, and it takes a million words to describe and sounds confusing, but if you test things out a bit in a less-complex environment it will become more clear and intuitive for you.

Just make sure you can answer question of, “who am i trying to communicate with, and why?” If you are sending a signal, does the target receive it? Try to break it down to just one step at a time.

Example of getting a component via its implemented interface:

(you would just do that on the “other actor” reference that is supplied from the overlap event.

1 Like

Thanks for that picture to help. Your first post answered it for me, so I gave you credit.

  1. In the yellow box below, is it correct that that Class Node is a wildcard for any Character Movement component that Overlaps? (Meaning only Character BPs with Movement Comps can trigger the Overlap, but not Bullets. And I am using a semi-wildcard so that I dont need to use Cast To.)
  2. And is it performant? (Meaning I only want to check for Characters/AIs that may pass thru the Navigation box of the Spline BP, which should be under 20 at a time. And I can further refine by checking if the Character/AI even has the BPI implemented.)

what you’ve done here is checking that the other actor has a component of that class. If the component exist (is valid), then you proceed.

You have not filtered the class of the actor at all, you are only checking that it has a certain class of component.

If you wanted to be more explicit, you might add a tag to the actor like “player” and check for that. Or you could check if it == the player character.

As for performance, I dunno. I wouldn’t worry about it. If it matters, I think it would be a micro-optimization, so no use slowing yourself down over a guess.

1 Like

heres some ways you could filter for a specific actor type:

of course you can check for the actors class as well, but the problem there is that then you create a hard reference to the class, which forces it to be loaded (and you might not desire that).

So using these other methods to identify some actor without knowing about its class is generally better.

1 Like

Thanks. I had that check in a prior version. But does [== the player character] include AI characters? Or just human player, index 0? (I want the AI character to trigger too. So let me know, and ill use tags instead.)

I understand what you say. But technically, only Character type BPs should have the Character Movement component, correct? So that is what I want, a mild filtering if I dont need to get so specific when 1 check works good enough.

that would check specifically for a player controlled character/pawn.

If you want to check for a broader category, you just got to think about how you want to define such a category.

Can it be described by a tag? “Humanoids”. Do they all share an interface? Do they all share a component?

I think a tag is probably your simplest and most performant sort of check that you can do. It is just comparing a Name which is a fast operation and also it is pretty easy for you, the developer, to add and remove tags as your project changes.

You might also look into the gameplay tag system - it is a little bit more robust than the basic tagging system, but it allows you to use a hierarchy, which might be the perfect choice for what you want to do here. I don’t know it well enough to give instructions, i just know what it can do.

1 Like

yeah if anybody who uses that component is the sort of category you want to filter for, that is fine. Always good to kill two birds with one stone

1 Like