How to create Waves with AI Enemys?

Hi @8trix , in a situation like this, it is typical to have an actor which acts as a manager for your enemy waves. In it’s simplest form (I will not go over basic optimizations like pre-spawning and reusing a pool of enemies, but you can research that independently) it will consist of an array of enemy actors, a float number to set your wave timer, and some algorithm which will help determine how many enemies of each type to spawn depending on which wave the player is on. It will also require functions to determine when to initiate a spawning sequence and the spawning sequence itself.

This actor will then be put in your level, and the level blueprint can activate it when on BeginPlay. I can’t blueprint the class for you at this time, but I can pseudo code it for you to use as reference.

class EnemyWaveManager
	// Class variables
	// Seconds between waves
	float WaveTimer = 10;
	// Currently active enemies
	TArray<AActor*> EnemyList;
	// Count of the current wave the player is on
	int Wave = 0;
	// Number of enemies in each wave
	int NumEnemies = 10;
	// Checking for enemies in Tick 
	// (would be better to make an event on enemy death)
	void Tick(float dt)
			if(EnemyList.Length <= 0)
	// Spawn wave function
	void SpawnWave()
		for (NumEnemies)
			// Here is where you need an algorithm 
			// to figure out which type of enemy to spawn 
			MyEnemy* newEnemy = SpawnActorOfClass(MyEnemy);
	// Spawns a new wave when timer is complete
	void WaveComplete()
		// Increment your wave
		Wave = Wave + 1;
		// Set your blueprint delay
		// When the timer is complete spawn the next wave
	// Removes the enemy from your list and destroys it
	void EnemyKilled(AActor* Enemy)
		// Make sure you remove the enemy first
		// Destroy it

I know you said you were a beginner so sorry for the C++ markup… it’s just faster for me to answer that way; and this is just pseudo so it doesn’t compile in native. The basic idea is that when the level starts, you will call WaveComplete, which will start the process. Then after a delay, the first spawn will occur. When the player shoots an enemy, call the enemy killed function, which removes it from the list and destroys the enemy. As your manager checks to see if the list is empty, it will call wave complete, and the process cycles again.

Yep, as @ said, in your manager blueprint, you can change the NumEnemies value at any time, and the logic should handle increasing the number of enemies spawned in the for-loop. I only set it to 10 there to stay in line with your example. =]

Create a new blueprint called WaveManager (or whatever you want to call it). Based on Actor. Then you will need to implement the functionality in that blueprint. Once implemented, you’ll need to place the actor in your level. If you drag that object form the world outliner onto your level blueprint, you can get a reference to it to start the sequence on the begin play event.

It’s okay. Everybody has to start somewhere. I can’t directly help you implement it at this time or I would have done so. But I can try to point you in the right direction.

Have you done any of the blueprinting tutorials? Such as the ones on the bottom of this page?

Before you can implement any functional game logic you will have to learn how the basics of the blueprint system work. After you are comfortable adding variables and functions then we can help you with more specific questions.

Hello Guys Iam new to UE4, so please write your answer as beginner friendly as possible.
Heres my situation i have 3 types of enemy 1st easy 2nd medium 3rd hard.
I want that in the first wave spawn something like 10 easy in the second wave 9easy 1mediumin the third wave 8easy 2medium and so on. If the player reaches a wave with 10hard ones every round another one spawns so there are 11,12,13…so that there are infinite waves. A New wave only starts when all Enemys oft this wave are dead.In the best case a Countdown shoud appear bevor every round

In line 17 is written that the max enemys are 10 could i change this somehow in higher waves so for example wave 1 10 enemys but wave 20 15enemys

just change int NumEnemies at runtime
like when you remove the enemies of the previous wave
and remember to approve the answer of @ZeroParadigm, wich is correct and detailed =)

@ZeroParadigm and where do I implement this in ue4?

@ZeroParadigm sorry for being such a big noob but how do i implement it?