Component specific message from line trace?

I have a line trace that sends a message to another blueprint when it hits any one of three components in that blueprint. The line trace already distinguishes between each component but I don’t know how to make it send a message that is component specific. ie. if trace hits ‘component 1’ send ‘message 1’, if it hits ‘component 2’ send ‘message 2’, if it hits ‘component 3’ send ‘message 3’. Any ideas would be appreciated.

So, cast to the Blueprint with my components in it ? Then I will out from the blue pin, and yes, I can access the components. But it won’t compile telling me I need to connect something to the object pin ?

I ended up using tags earlier today. It worked pretty well, but is a little buggy. Think I will stick to the tag method for now. If I can’t get it working to my liking i’ll give casting a go. I did do a quick casting test and yes I could access the components, but what goes into the object pin of the Cast to…node?

This is what I did today. It works but i’m thinking there must be a much more efficient way to do this. Like a node that holds all my tags, maybe ?

To access specific components within the Hit Actor you need to use the “Cast to” node, casting to the type of that actor. The output of the correct cast node will give you access to the components, variables and functions within that actor type.

You could give the component a “tag” and use that tag to switch between which message to send to the actor, negating the need to reference the actor directly.

You can make this much tidier by dragging off the hit component → Component Tags → Get(0) → Switch On Name

I have tried doing what you suggested, ‘…dragging off hit component…etc’. But am unable to understand it. I think this should be simple, but would you be able to explain it again.

Hopefully this image will help :slight_smile:

You can add the extra options by clicking on the “Switch on Name” node and looking at the top-right panel under “Pin Options”

Images are good. Much appreciated. Got it working and I guess that’s going to be pretty handy for a lot of things.