EnemyAi Help

Hey everybody, I can really use your help, I am in the middle of the game making process, and I have characters, character select screen, level select screen, levels, animations for each character, and menus. So I have completed a lot, but the part I’d like to get to is the enemy spawning, when I look at tutorials, they have a specific enemy, but most games nowadays, have different enemies with different looks. So when I did blueprint it, I can only get this one enemy to fight me back, how can I get that randomized or something, Unreal seems very specific with that stuff anyhelp?

Let me rephrase myself if you didn’t understand. I can select any character, then when the game begins, the same character comes up, is there anyway I can randomize the spawning of characters? (P.S. not multiple characters randomly spawning, but a different character that spawns instead of the same character.)

From the sounds of it all you want to do when spawning enemies is hold all your different enemy types in an array as class types and then use a random range over the array to select one and then use that as the class type to spawn.

Yep that is definitely the simplest way to do it. Personally I like to create all of my enemies within a single blueprint so I actually store their variables in a Data Table using a custom struct.

as other guys said, the best way for this is you create another class for handling spawning enemy characters so you can make a variable for each type and call them in random
Or if just their meshes or animations are different you can make an array for animations and meshes and call them by random.
this is not complicated if you want i can do that for you with team viewer

Vahid, if you could do that, I would very much appreciate it :slight_smile: , and thanks to ZoltanJr and DevilsD for helping!

Create an EnemyTypes variable array that is a Class Type instead of Reference Type.

This array will hold all the different classes that your enemies can be. In my example ive got the variable of type BaseEnemy and i filled it with 3 child classes that inherit from BaseEnemy.


Then use a Random Range with the Length of the Array - 1 to find a random class type to spawn as the new AI.

Thanks DelvisD,

Can you finish it or not ?
send me a PM if you couldn’t

why would you need to take control of his computer to do this . Just make the blueprints copy and paste it into paste bin . He can then just copy paste the nodes straight in .

Because i want to see his classes and use them, not just make empty node for him, as you can see i tell him how he can do it .
Why it’s important for you ?

Its not important to me , im just looking out for the poster. He seems inexperienced. And although youre intentions may be 100% genuine not everyone on these forums are , so letting a complete stranger take control of his system to do something so simple to me doesnt seem like a good idea .