A little help with component hit?

I am currently working on a rhythm game for for a college unit but i am confused on how to get my component hits to work. i have created a large blueprint that i thought would work but it turns out it does not. I want the blueprint to make a noise when i shoot the target and then destroy that target however all of the targets are part of this blueprint actor so im not sure how to do this. Any help would be appreciated.

Is this your actual blueprint, or an illustration of your idea for one? All of your branch nodes have no input, so appear (at least in this image) to be functionally useless.

This is what I was working on bit realised that this was not working. Now I’m not sure what to do.

The reason I asked is the switch nodes need to have a binary (yes/no) input in order to do anything. If you manually select a switch to be ‘on’ or ‘off’, it’s basically just a re-route node, with no capacity to change the flow of your graph.

When you have this many switch nodes, though, it’s probably a sign that your script architecture could be a bit more elegant!

You could try:

>Tag your actors with the name of the sound you want to play when you hit it.

>Break out the hit information, and find the name of the actor you hit.

>Find out what tag the actor had. Convert this to a string. Feed the string into the ‘play sound’ node.

>Destroy the actor.

I’m sure I’ve missed something (I’m not in front of unreal), but could probably be less than a dozen or so nodes - much easier to troubleshoot!

I’m sure there are hundreds of other ways, too.

I have opted to use a sequencer and it has made it far easier however there is now something i just can’t figure out. I want it so whan i shoot the target it is destroyed which would be easy but it seams it will not be destroyed because it needs to finish the sequence first. Is there a way to destroy it before the sequence is finished?

Hi @ryancorr,

If I understand what you are trying to do: You have an Actor Blueprint with a bunch of components (targets). When you hit a target, you want to play a sound (per target) and then destroy that specific component, correct?

If this is the case, there is a much easier way of doing this:

Select each component and scroll down the properties panel (usually on the right) and click on “On Hit” button. This will effectively create an OnHit event for that specific component. Then, use this event to play the sound and destroy the component (drag component to graph and from there drag and type “Destroy”).

This way, each component has its own OnHit event and you can choose a specific sound per component.

Another way (my preferred way) is so make each “target” an Actor BP itself and then simply use as many of these BPs as you need in your level. This avoid a lot of duplication.

Im not infront of Unreal, but I think what I described above should work.

I have changed my blueprint from the previous one as i have now decided t use a sequencer to properly line up the music and the targets but the issue i am now having is when the targets are hit they are not getting destroyed. I have compared the blueprint to similar work and cannot find a reason for this. I can only assume that it is because the target is part of a sequence that it can not be destroyed.