Download

How to call a custom event or function using the tag name of a traced component?

Hi all,

Lets say I have a Custom Event X and a Custom Event Y.

In my map, I have 2 objects, one with a tag name of X and one with Y.

Using a line trace, I get the object I hit and check the Tag name it contains. Based on the tag name, the correct custom event runs.

How can I achieve this?

Please note I cannot use a branch saying if tag name = X run X, if false run Y.
This is because in reality I will have having about 50 different tag names and 50 different custom events and using branch would be a nightmare.

Is there a way to run a custom event (or function) using the tag name I get?

Many thanks

UPDATE:

I now understand I can use execute console command to run custom events by using “ce customeventname”. But this would have to be done inside the level blueprint.

Is it possible to do this inside of other blueprints? (In my case, inside the character’s blueprint)?

I highly assume that you don’t want to use “Cast to” nodes to reach out certain events.

If so, blueprint interfaces might work for you better as just tags are not enough to distinguish blueprints as far as I know. Because you change if a BP contains an interface and use the function accordingly.

Here is another solution, you can use a Timer with 0.0001 delay and not set to loop. The event/function name you enter will be called the next frame. This was problematic for me as Timers with zero timer value does not trigger, and even 0.0001 means event will trigger the next frame (as if there is a 0.016667 min clamp on the timer value).

So I contacted a C++ programmer to make a function that would be exactly a timer but without it’s timer functionality. It’s just a simple function that takes an object value and an event name value, triggering the said even if it exsist in the actor.

That’s all I can say. :slight_smile:

Can you help me with the fighting template?

Actually this might be the better way to go, except you could just have an array of tag names, and check if the array contains that specific tag name.