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"

Turret attack specified target?

Hello again. I have made a turret and it gets its tracking infomation from "Get player pawn" now that is 0 so my question is how do I set my AI to have an index of say 1 and it will track and attack that corrisponding index instead of me? Also how would I set that index in the relevant agressor?

Many thanks

Product Version: Not Selected
Tags:
more ▼

asked Aug 12 '14 at 07:23 PM in Blueprint Scripting

avatar image

Blakey876
40 16 18 22

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

3 answers: sort voted first

Hi Blakey876,

What you want to do is use cast to nodes to see if the trace hit specific objects/enemies. If you cast to "enemyAI" for example, but it doesn't see any, it will move on to the next cast, for instance "pawn". However, if the trace first returns an "enemyAI" cast, then it will ignore your pawn and do whatever actions you tell it to specifically in regards to the AI. I am attaching an image of my example for you to look at:

alt text

casting_example.png (132.0 kB)
more ▼

answered Aug 12 '14 at 08:57 PM

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

GetPlayerPawn retrieves only player pawns, and in this sense AIs are not players.

The quickest solution for you would be to implement your own AIController class or Pawn class to have it store an unique ID in its BeginPlay event, and then use GetAllActorsOfClass with your class as a parameter and iterate on the resulting array looking for the ID you wish.

Cheers,

--mieszko

more ▼

answered Aug 12 '14 at 09:12 PM

avatar image

MieszkoZ STAFF
7.4k 225 57 415

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

Ok thanks for the reply. I get my rotation vector based on "Player Pawn" then "Single line trace by channel" checks that the target is Pawn and not a wall or something. How could I change that to track other pawns? Also is there any tutorials on AIController or where I will find my AIController as I am hopeless at C++ and prefer to do all my work via bluprint.

Thanks for your help guys :)

more ▼

answered Aug 13 '14 at 08:29 AM

avatar image

Blakey876
40 16 18 22

avatar image Adam Davis STAFF Aug 13 '14 at 04:14 PM

If you are doing trace you can set your AI to a specific channel and place that channel in the array. Then when your trace hits you do a cast-to AIController. If it picks up AI controller it will activate that set of functions, if not it will activate another set or do nothing.

avatar image Blakey876 Aug 14 '14 at 07:09 PM

Ok all sorted now thank you very much for your help guys :)

(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