AI Weapon firing

Hi all,

I wanted to know if there is any “proper” way to have AI fire a gun?

So far, I have made a weapon BP, that uses a fire event. I have to cast to the gun to call the event.
Is there a better way to call an event, something along the lines of Unity’s SendMessage function?
For those who don’t know, SendMessage looks for a function by name, in the scripts attached to the gameObject(a.k.a. actor).
Similarly, BP would have to look for BPs on the actor, find the event and call it.

Any suggestion would be greatly appreciated.

Thank you

Have a look for “Blueprint interface”, it allows you to call a method on another actor as long as it implements the interface. There’s also a “does implement interface” method to check if the actor in question does indeed have the interface before you call it.

Thank you for that.