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"

auto turret cant use target array

im kind of an idiot when it comes to using arrays but here goes.

i have an auto turret and two aircraft in my scene and the turret gets all actors of class (the aircraft) but only ever shoots at one (im guessing index 0)

it uses a visibility (linetrace) and a range check (get distance to) so im guessing i need to use the range check to identify if the target is integer 0 or 1 in the target array but i have no idea how.

any help appreciated.

Product Version: UE 4.21
Tags:
more ▼

asked Mar 30 '19 at 05:08 PM in Blueprint Scripting

avatar image

phaeton1911
11 3 9 13

avatar image ThompsonN13 Mar 30 '19 at 07:48 PM

what does your code look like. also what are you using the array for? you never really explain that bit.

im guessing that your looking to get all actors then go through them and decide which one to attack and which can be attacked. if thats the case then you need to create a loop which gets a index and then performs the checks needed (in range? if yes attack), then if all the checks fail then you increment the index and loop again.

something like the below example should work.

alt text

capture.png (226.6 kB)
avatar image phaeton1911 Apr 02 '19 at 03:05 PM

excellent, yeah this sounds about right. i was trying to get some kind of integer increment but could figure out where to place it. ill reproduce this and see if i can integrate it to my setup.

would you recommend this method for creating a universal targeting system?

avatar image Nebula Games Inc Apr 02 '19 at 04:21 PM

For targeting systems you can also follow this tutorial to add a node that will do all the "distance" check heavy lifting for you and output a sorted array. You can then easily select the nearest "actor" to attack. Below is a screen shot of the node and the struct is passes out along with a link to the tutorial. Hope it helps.

https://youtu.be/cWesVY0zF0U

alt text

distance-sort.jpg (87.7 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

yeah ThompsonN13, that worked. sorry it took me ages to get around to trying it out.

i had to switch the NOT boolean to false other wise it didnt work and oddly enough its preventing my visibility linetrace from working but ill figure that out in time.

thanks man

more ▼

answered Apr 14 '19 at 08:41 PM

avatar image

phaeton1911
11 3 9 13

avatar image ThompsonN13 Apr 14 '19 at 09:46 PM

the linetrace in the example i made was to see if there was anything between the turret and the potential target. so if there was something in the way then the trace would return true then the not would make it false. honestly its not really needed and i dont know why i bothered put in the not, you could just leave it out and attach the set to the false pin.

(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