Download

Is 'Hit' possible with 'Multi Line Trace ' ?

I am sure it is but its just me doing it wrong.

This is my ‘Character’ blueprint at the moment. A right mouse button fires the ‘Multi Line Trace’ and it all seems to work. However after watching a tutorial video i found for ‘Ray Trace Shooting’, i tried to get it so that when a trace hits my ‘AI’ actor, it destroys the actor (which i plan to change to damage hits later).

**Can anyone see what i might be doing wrong? **

Thanks in advance.

Hi Lawrie,

Try dragging the Hit Actor return pin to the Destroy Actor target. It is currently being fed a variable for a blueprint of the BasicAI2 type, but that will not specify which exact actor to destroy. By connecting the Hit Actor to the destroy, you are telling the BP what to destroy specifically.

Also, you may wish to look into Timers, as the Retriggerable Delay method that you are using for a looping call is not a performance-friendly way of accomplishing an auto-fire gun.

Let me know if that works for you.

Thanks a lot for the response!

However i still cant seem to get it right, or maybe i am following your advice incorrectly. Maybe could it be a setting to do with collision that i changed and is causing it not to work?
Also i tried to change the actor for the ‘==’ which outputs the bool with my ‘AI’ static Mesh body, but that still did not work. Again i did mess around with some collision settings, so i don`t know if that could be a cause. I can post the settings if i makes any difference. When i look at the debug filter for my blueprint, it show that it executes up to the branch, but no further.

Also, thanks a lot for the advice on the timers! I did notice big performance hits with the previous setup. I tried to set it up and it appears to work perfectly! But does it matter using a ‘Pause Timer’ or ‘Clear Timer’? Does it matter? Last question, are ‘Delay’ nodes a bad idea for rapid executions generally? as i currently have a delay involved in the spawning of my AI, however the delay is set to every 6 seconds so i am hoping that ok and isnt going to affect performance too much correct? Thanks for the advice!

Here is my blueprint now.

I decided to start from scratch and this is what I came up with:

&d=1407259591

I condensed everything into a function of “Fire Gun” so that I could reuse it for other things too. I took out a lot of flow control, since it was no longer doing anything. I also removed the first For Each Loop, since it was a bit redundant. I added in the animation for effect, but it wasn’t needed. The first “Fire Gun” that is called before the Timer is because I found that it wouldn’t fire if I just tapped the shoot button. It needs a little tweaking since I can just spam tap faster than the rapidfire, but that is easy to fix with something like a “Can Fire” bool.

Another issue was that the “==” is not looking for the specific instance of the actor. I decided that using a Cast To was more efficient. To get the Cast To node, you will have to drag from “Hit Actors” and search since it is context sensitive. The destroy now knows exactly what it is talking to.

To answer you questions:

  1. But does it matter using a ‘Pause Timer’ or ‘Clear Timer’?

Clear Timer resets the timer to 0, Pause Timer tells it to stop at whatever number it is on. I’m using both in my example because of the way a real gun’s rapid fire would work; It is no longer moving bullets (Pause Timer) and will settle on the next bullet in line (Clear Timer). If I was doing something like filling a room with water over time, I would just use Pause so that I could pick up where I left off if I turned the water flow on or off.

  1. Are ‘Delay’ nodes a bad idea for rapid executions generally?

No, they’re fine for fast executions. The problem I was pointing out was that the Delay was being used to have the execution fire repeatedly; Timers are way better at repeating executions.

  1. I currently have a delay involved in the spawning of my AI, however the delay is set to every 6 seconds so I am hoping that ok and isn’t going to affect performance too much correct?

That’s fine. I don’t know how intense the AIs are, but having something spawn every few seconds is safe. Again, a Delay will work, but a Timer is more efficient/performance-friendly at repeating execution.

If you have any other questions, feel free to ask.

-Alexander

Hello,

Thank you so much for your detailed response! With this i have managed to get it all completely working as i wanted. Thanks for answering the questions as well, previously when i was working with the ‘Delay’ nodes i was noticing ridiculous frame rate drops, but i was just assuming maybe it was the debug trace lines, and i never would have thought the delay caused the performance issues. With the ‘Timer’ setup it works perfectly and it seems there is no performance hit at all.

Thank you so much!

Lawrie

No problem, I’m here to help :slight_smile:

Uh, not to bother you but I’m ( Stupid Me ) trying to put in a CanFire bool to fix that “mouse clicking faster than automatic fire” problem and I was just wondering if you could show me? ( Sorry if this is necroing ) *Sweat Sweat

I think my problems lie in the fact that I need to put in a variable to determine whether it is the first shot or not?

Bump: So far it looks like this 377dc53eb48d08ac833ccf2f7b241abcbc9142c1.png

Hi mechron,

Try assigning a value to the target of your firegun. Some nodes do not like “Target:Self” without an actual reference to self or a reference to character/controller.

Thanks, I’ll give it a try once I get home :slight_smile:

EDIT: Sorry for being stupid, but what do I set as the target?