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"

Ai turret attacking AI

Hello, I have been working on a turret blueprint that attacks Ai Zombies that run past it. I have made it target the zombies via a operlap event however, when the first target is dead it ignores the AI already in the area and waits for a new zombie to enter. How would I go about having the turret attack anything already in the area? I'm using Blueprint for this as I'm not a coder.

Thanks in advance.

Product Version: Not Selected
more ▼

asked Jan 24 '17 at 07:57 PM in Blueprint Scripting

avatar image

1 1 4 4

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

2 answers: sort voted first

I was going to type it all out but it seemed like a lot of work. I am basically checking which one is closest and setting that distance. I am also checking to see if they have a tag of "Target". Then I just added in some check variables, Target is the closest actor with the tag of "Target". "Closest" is the distance to the "Target". "Has Target" just makes sure that there is a target in range. My max range is 3500 and is set to tell the "Has Target" whether it is true or false depending on the closest target. Then I just do a "Is Valid" to make sure the target isn't dead. The other "Get Distance To" is actually to keep the turret from targeting outside the range I want. Otherwise it would literally fire until the target was dead. I chose to use the distance instead of a collider but you could always use a collider. The two other scripts are special for my turret. I don't have a skeleton on it and Rotate Turret just rotates the actor. Turret Targetting The Aim will independently aim the Turret Muzzles and adjust the Turret Base. Aim Turret This is just a "Patrol" Function. It basically just rotates the turret when no targets are present. Rotate Turret

I really hope this helps. It was a pain in my back side for a while. If you need to see how I did firing just let me know.

2017-10-07-28.png (436.3 kB)
2017-10-07-29.png (359.1 kB)
2017-10-07-30.png (294.5 kB)
more ▼

answered Oct 08 '17 at 03:28 AM

avatar image

13 1 4

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

You should add a pawn sensing component configure it and rely on its callbacks to notify you of the AI.

This will remove the requirement of the overlap event being your notify system. Which as you have discovered is not reliable in this configuration.

Pawn Sensing should get you started.

more ▼

answered Jan 24 '17 at 08:56 PM

avatar image

154 3 3 9

avatar image MaxNellist Jan 25 '17 at 09:13 PM

Ah thanks very much. The asset is currently set as character, using the 'Character movement' componenet, what would be the closet to this node in pawn?.

Thanks :)

(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