Hello world again! In my game, I have a class “FightingCharacter” that is a common parent class for Player and Enemy, and I want to display information about their level and health by clicking. What I have done:
I have set up the following blueprint in the class “FightingCharacter”:
I have set “Enable click events” in the Player Controller to true.
I have changed “Default click trace channel” at the same place to Camera.
I have tried to set the breakpoint on this event. It works even when I click on self, and is filtered only on condition, but when I click on the Enemy, it does not work.
I have tried to set up ActorOnReleased event on a simple Actor, and it, suddenly, works!
It seems it does not work only on Enemies. What the problem can be?
Who doesn’t have a controller, enemies? They have the AIController. I saw that article but for unknown reason pictures aren’t displayed there, maybe they have been lost in history. Can you point what post of that topic is main for me? Maybe that all input must be in the player controller? But what to do if player has to click on the enemy and not on the player controller?
I can get it to work if I put the code inside the AI controller, but that means they all react at once, unless you incorporate a check to see where the mouse click was…
For those who read this: you probably may check the input in the AIController class, but the good way I found is to check the “Left mouse button” event in the PlayerController, get hit result under cursor, break it and cast the hit Actor to necessary type. Here is my blueprint:
a simpler solution would be to check if the hit actor is implementing your “Display Stats” interface and if so send interface message and then handle the display stats in the given actor