Call Custom Event By Name

Hey all,

So I am trying to find a way call an event from another BP by a specific name in a specific blueprint I mean like this:

193642-default.png

which will then trigger the event in the ‘PawnBP or whatever the developer has decided to call’

193643-customevent.png

This is tricky business. There is a way to do this with console commands but it’s kind of crazy practice but instead of a half-hearted speech about “best practices” I will just lay it out.

You can call any custom event using an odd console command called “ke”

ke actorNameHere eventNameHere Param Param Param

You can call it on all actors it exists on by doing:

ke * eventNameHere

So just build a string with the target name and the event name and fill that into an ExecuteConsoleCommand node.

As a note, “ce” will call an event in the level blueprint and will even autopopulate it in the in-game console.

This works pretty good if I use the ''ke * Eventname"
however it doesnt work for “ke actorNameHere eventNameHere” the event doesnt execute
Any idea why?

hmm, not really certain, been a long time since i’ve used it specfically, be sure you have the real actor name and that you have spaces before and after it (sometimes it’s easy forget if you are appending strings together). I will try it out a bit later when i am home.

This is the setup Im using

I tried replacing Get Display name with Get Object Name and ToString(object)

I got the same results

I also added Print String to see the command, it said ke PortalBP OpenPortal

Have you found out why?

ke actorNameHere eventName is working in Standalone Mode not in PIE. In PIE ke * eventName is Working :slight_smile:

Hello, there is a UObject::CallFunctionByNameWithArguments(), have a try.

how can i call event with params

What kind of params?

this is an incorrect setup.

correct way: Ke [Space] * [Space] {Event-Name}

this will run properly on both the player and owned components

i don’t think you will create hundrets of custom events with fancy names…

so… for a shooter example,… your AddAmmo…

Use a Blueprint Interface…
With an interface, you can call the interface function sended to an Actor. If the Actor has the interface and the event imolemented, the event gets called… if not… nothing happens…
And you can implement the interface and event in every actor of your project you like… You can even just implement the interface… but leave some events unimplemented to hide function calls from them…

you just call it from another actor via:

AActor->Interface->CallEvent(Message)

See: Blueprint Interfaces Tutorial Example