Not working BPI event.

Hi, I have a problem with BPI and custom events. Creating right now a battery which is loading after clicking a button. (For tests I’m using Event Begin Play, but after that I’ll use BeginOnOverlap due to the fact that it’s going to be for VR.



Problem is the fact that BPI is not working. When I start simulation it’s stopping on “cast”.

I also tried to use “Cast failed” just to see if the rest will work but unfortunetly it looks like this:


On another BP nth happens

Thx for help!

How did you reference the Other Actor in the first pic? If the variable is null, it will not work; it needs value - an existing instance of an actor that has the interface implemented. That’s why the cast fails. This has nothing to do with an interface.


but after that I’ll use BeginOnOverlap due to the fact that it’s going to be for VR.

I’d try this first - I sense the test returns a false negative.

I reference the Other Actor as a VRPawn. Also tried with ‘Character’ once

Judging by the script above, you do not. If you do, show us how. Because creating a variable is just that - an empty variable, so to speak. You must give it value.

Ok so, I had to read again to understand it a bit more. Now I’m testing that with using Print string to see what is ‘hidden’ under “Other Actor”

The answer from print “VRPawn”.

The colliding actor is the VR pawn, not the battery. The cast should fail.

Ok, so how can I run the Charge event? Do I need this “Cast” here or should I change the target?

We do not know what is going on - you never explained. All we know is that the actor whose script we see is colliding with the VR Pawn and you’re trying to convince the editor that the VR Pawn IS the Battery - which it is not, I assume. This is what casting it - take something and attempt to treat it as something else.


I assume

And you should assume we know absolutely nothing about what you’re doing :innocent:. Perhaps explain what the end goal is:

  • the VR pawn has a battery actor (how did they get it?)
  • the VR pawn collides with the charger
  • the VR pawn’s battery gets a notification it needs to start charging

Is this what we’re doing?

I have 2 actors. One is a “charger” (In project for now it’s just a cube with collision box and in the future it suppose to be a button).
The other one is battery.
And of course ‘player’.

When player press the button (In this situation just walk inside the collision box), the battery should start charging (In my project for visual effect it’s just 4 plates that will change color to red)

So summary:
Player press the button, battery start charging

1 Like

And those 2 actors - how do they make it into the world? Placed manually in the scene? Imagine you have 3 chargers and 3 batteries - how do we know which charger charges which battery? What is the logic behind it?

When player press the button (In this situation just walk inside the collision box)

So pressing a button is essentially the equivalent of overlapping the charger?

They already are in the world, placed manually as a BP actors.
I can also give you how I want final effect looks like


(Of course button will be smaller. It’s just for test)

There is one button, and one battery (at least for now cuz I want to learn on simple examples first).

Makes sense.

  • I’ve got these two BPs:

image

And I’ve placed both in the level.

  • in the charger, create a variable that can reference a battery:

  • tell the charger which battery instance you want it to charge:

No need for an interface, this is direct communication.


Edited the pic, hopefully made it clearer.

1 Like

Let me then try to remake it on my project, and I’ll be back in a moment :smiley:

1 Like

It’s working! Take a bit longer cuz I didn’t set the default one :sweat_smile:

Thank you very much for help!

1 Like

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