Hi all,
I’m making a small hack and slash game and was hoping somebody could point me in the right direction. This is the working camera lock on an emenies direction so far -
So far I have a targeting system which will target the closest enemy, this only works on one enemy type at the minute. As soon as I introduce a different enemy AI, I cannot seem to work out how to find the closest enemy out of a a selection of enemies.
First of all, I started looking into using parents on the blueprint. Unfortunately I didn’t realise I could do this at the start from a template enemy AI. (I wish I did!) Although, when I try and now reparent the all the enemy AIs together, they all get eachothers weapons, and so forth kick out quite a few errors, as they have different blueprint attacks. I thought this would be the best way to do it, only if I was creating the enemy from scratch again.
I’ve tried to add a tag to the enemy AI, which seems like a great idea. But I can’t seem to cast “Get all actors of class” more than once. As the ForEachLoop array can only have one input. So I’m only actually able to cast to one actor type, which makes the tag abit useless.
I think the best way would be to limit everything to go under one array like you suggested, so I created a “AllEnemyCombination” blueprint interface, and add the all the other blueprints into this, which seems to work. But this seems to break down as soon as I have to start calling the variables I’m using to calculate the closest distance.
I’ve attached a image of the targeting system which I’m using, also a copy of the project file if you would like to look