Question about BP interface, please help

Hi All, I thinked I understand the BPI but in this case I really not :frowning:
On the screenshot all my BPI function work wihout the last Affecthealth From the BPI Damageable.
The only difference I see Is that the same class but not the same instance. It’s a fire on an other player. What I would is to refill the health of the agressor Player when He shoot another Player.
I don’t understand why this function not work :frowning: (I try already a simple function with a print and that not work too. Exactly if the target are not found, but I know that the Player ID is good and player controler must be the good one.
Many hours yesterday on turn around but nothing :frowning:

If I were you, I would make these functions and use them instead of the GetGameMode and GetPlayerController. Don’t forget to set those functions as pure. If what I imagine is right, you don’t know about the dark side of the pure function yet. Good luck!




Right I don’t know about “pure” I’m a newbee ^^’ I will search in this direction, thank you a lot for your help :slight_smile:

That I don’t say is that the function work for the first ones because the function that I call is the same but to another instance.


1 Like

I recommend using those pure functions only once when you think that you need them, and copy to some variables and use those variables. I’m in bed now, so I can not see the screenshot that you uploaded later. I’m sorry about it. I will see you again when I wake up. I wish you good luck again.

  • I edited some grammar in my English. Communication with not native language is not easy. I think your native language is not English either. But I think we can overcome this. Let’s face the problem positively!

I saw the screenshot that you uploaded later. Frankly speaking, I could not understand the situation and problem you are in. Information is too little. I tried to understand the problem by reading what you wrote first again. If my understanding is right, it is most likely not a problem with BPI. The basis of debugging is to make the scope of the problem small and test it. I recommend: 1. remove all other conditions, and then test by calling only the BPI function from the event, directly. If that works, the possibility that the problem is in the other place.

Ah ok I understand what you mean, I will try to use the pure mode when possible to see if it make it working.
The BPI is not reached I already tryed. the gamemode BPI work but from the playercontroler not.
Thank you a lot

Edit :

in this configuration the TestAffectHeath work only in direct (the character that was hit) but not to the caractere that shot it (via the BPI) This work only on the same instance. Why it is working when I call the BPI from the gamemode and not If I call the same class in another instance ? ^^’

Edit 2

If I take it to the first place the same, in this case I only see the printed ID that are correct.

Edit 3

I Tryed another function test in another BPI (my character use 2 different BPI) and the same, not work. I really have a nocommunication with all BPI from the same class in different instances

The only thing I see is that my GetplayerControler do not give the good reference to reach the instance of my character.

The BPI I try to communicate is seted on my class BP_Hero that are my players characters. This class implement the functions that are in the BPI. I do exactly the same in the BPI of the GameMode and it work perfect. I have to precise that the BPI for my character work the first time I call it.

I recommend using those pure functions only once when you think that you need them, and copy to some variables and use those variables. I’m in bed now, so I can not see the screenshot that you uploaded later. I’m sorry about it. I will see you again when I wake up. I wish you good luck again.

  • I edited some grammar in my English. Communication with not native language is not easy. I think your native language is not English either. But I think we can overcome this. Let’s face the problem positively!

I’m not speaking english too, hopfully I think that english are not too complicated to understand, I think I make many errors too ^^’
I use pure functions for getter only, that not change my issue. I have the same issue for my enemy that are child from the BP_caracter class that are the same parent class of the BP_hero class.
When I want to call the BPI of an other instance this not work. I notice that the communication not work when I call the BPI from the getplayercontroler function (with the ID in selection)

Ah
 I think I can go closer to the goal.

Can you show me the PlayerController BP class that you use?

I want to see these:

  • Where your PlayerController BP implements the function of BPI_Damageabloe.
  • The class setting of your PlayerController BP. I need to see the overall status of your player controller.

I hope I understand what you would see ^^’
Thank you for your help it make me crazy to not understand what I do false.

The playercontroler class is my Character ? are the playercontroler not a big bottle where all what the player interact ?

and where I create the playercontroler for all players

Ok, I think that we are closing to the solution. But I think that I must write some not short descriptions. There are many things that you must know.

Skip this and continue below. After done of writing these, I thought that it would be better to try GetControlledPawn than make some new playercontroller.

My another assumption was that you had some misunderstanding about playercontroller class, or you had some misunderstanding about result that function GetPlayerController function returns.

If you call function “GetPlayerController”, what that function return is, the the object that reference certain instance. that instance is created from some class, and the name of that class is : PlayerController.

I can see the the Blueprint class, name with BP_GameMode, from the screenshot you uploaded. When you created this, you would have select that the BP be derived from the GameMode class.

Like the “GameMode”, There is class that name with “PlayerController”, in Unreal Engine.

You called the function of BPI_Damageable, with target pin connected GetPlayerController. To make this call work right, there are something you must do before it.

As like BP_GameMode, you must have something like BP_PlayerController. It should be Blueprint class, made with derivering from PlayerContoller class, And, It must implement BPI_Damageable.

Or, there is some posibility about that you don’t need PlayerController.

When I said “show me the player controller” to you, you showed me the screenshot of your blueprint class that derivered from character. So, I think that you are thinking the PlayerController is something like PlayerCharacter. No. it is not. Your BP_Hero is derived from BP_Character. I believe BP_Character is derived from Character class. Character is derived from Pawn, and Pawn is derived from Actor.

PlayerController is derived from Controller, Controller is derived from Actor.

But, you seemd that you implemented the BPI_Damageable in BP_Hero, not PlayerController. If so, what you must connect to AffetcHealth of BPI_Damageable, is not GetPlayerContoller. You must get the instance of BP_Hero, and give it to AffetcHealth node as target.

To get BP_Hero instance, there is a way like this.

Use this function to the PlayerController you got from GetPlayerController node. If you do that, you can get the Pawn of Player.

And, there is a posibility that if you give that pawn to node AffetcHealth, as target, this will work. So try it.

If it not work, You sould try to Cast that Pawn to BP_Hero.

I will bet that you don’t know about the Casting. See this: Casting Quick Start Guide | Unreal Engine 4.27 Documentation

Then, you can get the instance of BP_Hero, that you implemented the BPI_Damageable. and give it to node AffetcHealth.

Try aboves. and tell me if it works or not.

1 Like

There remains something I must talk to you: Those could be seems difficult and hard to you. But, believe me. I was in the same situation as you a few years ago when I started learning about this engine. Don’t give up. I think that you can do this.

1 Like

Thank you a lot for your response I think I understand better, I try and let you know ^^ A big thanks to you

Yes that was it !!! I feel me so dumb ^^’ Another big thanks to you I thing I made a really step in better understanding this engine. thank you thank you thank you !

For the other the solution was to register my players reference of BP_hero in a variable (in the gamemode BP) and make a getter in the BPI of the gamemode. From my affecthealth I can get the object reference of my bp_hero and call back my bpi from another instance.

1 Like

Congratulation! I’m happy, too.

You are not dumb. Many names of classes in this engine are so confusing. In fact, so many names in a programming are confusing.

If you can, I recommend to read this: Player Controllers In Unreal Engine | Unreal Engine 5.4 Documentation | Epic Developer Community

This “PlayerController” is some element of Unreal engine, like a GameMode.

1 Like

Yes you say right, I thinked playercontroler was magic :wink: But in fact, this is a simple pointer system :slight_smile: Another big thanks ^^

1 Like