x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Simple Blueprint firing turret

hey all. Im trying to make a basic turret. attached is a sphere collider that when entered, the turret will fire out projectiles directly towards the intruder. now i tried to modify a "fire projectile to mouse location" blueprint using the intruding actors location rather than the mouse however this failed. Does anyone have any help on this, or the best way to achieve it? Thankyou

Product Version: Not Selected
Tags:
more ▼

asked Sep 24 '14 at 08:50 AM in Blueprint Scripting

avatar image

LukeMarkBrady
104 9 10 14

avatar image LukeMarkBrady Sep 25 '14 at 10:57 AM

This works! Thankyou! so it turns out there are two types of overlap event node, by using the same as you it worked fine! one issue i still have is that the bullets are being counted as actors, so when they leave the radius they close the gate regardless if the player is still inside. Ive tried adding tags to the player and using those but no luck

avatar image Singules Mar 02 '17 at 04:40 PM

Hi here is a good tutorial www.vaduunlabs.com/index.php/en/tutorials/29-adv-turret-animation.

"With the help of this tutorial, you will be able to animate turrets in UE4, which are always tracking the target correctly, regardless of their own orientation."

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hi LukeMarkBrady,

This is something that I had been working on in my free time. What I have is when the player overlaps the radius (in my case a cone), it draws the distance between an arrow component in front of the turret and the player. So every second it is checking to see where the player is and fires there, instead of just firing at the initial cross location. alt text

alt text

turret.png (153.5 kB)
turret2.png (233.5 kB)
more ▼

answered Sep 24 '14 at 06:40 PM

avatar image Nemecys Mar 17 '16 at 08:55 PM

Thanks for this, I always find it so difficult starting an Actor/BP but I find it much easier to extend off it.

I have a great turret setup now nice and simple and it aims well too!!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Please what?

Could you post screenshots of your Blueprints? I don't understand what you want to do. Do you have a basic turret by now and you just try to modify it or are you still trying to get the turret to work?

For what do you need the "fire projectile to mouse location" blueprint?

A turret that shoots at the player or intruders could just use the Collider and set the "Other Actor" to the target the tower should aim at. Than you can have a function for the tower to shoot. Since he is already looking at the actor by some function that lets the turret aim at the player, he should now just shoot. :/

Please some more information. :D

more ▼

answered Sep 24 '14 at 11:07 AM

avatar image

eXi
6.8k 332 184 465

avatar image LukeMarkBrady Sep 24 '14 at 11:52 AM

Sure, my bad so right now i have a turret object, attached is a sphere collider which acts as the radius the turret will fire. when an actor goes into the radius, i want the turret to fire. http://i.imgur.com/XqUeBTL.png

during runtime when i or a Ai character walks into the radius http://i.imgur.com/lUk8kuL.png

as you can see it says its spawning the projectile, however nothing is happening on the screen :/

avatar image LukeMarkBrady Sep 24 '14 at 12:34 PM

Ok update.. i managed to get the turret to fire towards the player, but only when the player crosses the collision into the surrounding radius sphere. Is there a way to constantly find the players location on each shot fired? http://i.imgur.com/zjz5L5I.png

avatar image eXi Sep 24 '14 at 03:12 PM

Ehm, the tower is only firing when you enter the Radius? :O Have you watched at your BP at Runtime, checking if something closes the gate?

Normaly you should open the gate when he enters and close it when he leaves. You can also change your setup to something with a bool. Let the Tick check a bool with a branch. Lets say "bSomethingInRange". Change the bool to true if someone begins the overlap and set it to false if he stop overlapping.

avatar image LukeMarkBrady Sep 24 '14 at 03:45 PM

It fires non stop fine when I'm in the radius. The issue is it fire towards the point where I entered. Looking from above, let's say my player enters the radius at the top. The turret fires towards the top but keeps firing towards the top.. Even if I move round the turret to the bottom, it still fires towards that top point where I entered. What I'm after is the turret to update the location of the target before every shot fired. Hope that makes sense lol

avatar image eXi Sep 24 '14 at 06:17 PM

Ah ok, that's because you used the Position to calculate the aiming point only at the Overlap point. Try saving the player inside a variable or better inside a list when he begins the overlap and delete clear the list or the variable if he leaves. Than use the list/variable and get its location. This should always get the current location of the actor and not only the position when he entered.

The thing with the list is: If multiple enemies enter the radius, the turret will only attack the last one i guess.

So you make a list for him and add an actor each time someone enters the radius.

If someone leaves, you search the array(list) for that actor and delete it.

You just need to think about what array element he should attack. I guess you could just take the index 0 of that array, so the first player who entered and than get his location until he leaves. Could be that you need to resize the array each time or the delete item puts something else on index 0 if the actor which left was at index 0. I don't know that right now, so just test it.

I also wouldnt use a gate but a branch. The condition would be that the array is not empty. If its not empty, there is an enemy in range and he should go through the array (or take index 0) and attack that enemy.

I guess this would be the best solution.

avatar image LukeMarkBrady Sep 24 '14 at 09:54 PM

Thankyou for your help :) ive got rid of the gate and used a branch like you said, also tried to do an array however its still not working :S now its back to not firing. well its firing the projectiles somewhere as the object count rises quickly when i enter the area. but i cant see a single bullet. this is what im using now http://i.imgur.com/QT2VRUV.png

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question