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.
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.
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?
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.
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
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.