Enemy Spawn (with specific demand)

Hi :smiling_face_with_three_hearts:, recently I am designing a Zombie game(FPS), I wish to spawn my Zombies at random places& random time. I hope the zombies are all inside this NavMesh as shown below


PS: I create a Navmesh so Zombie won’t bump into objects.
I don’t want them to spawn outside the NavMesh otherwise they will get lost.
Thanks a lot for helping me. :kissing_heart:

When the zombie first spawns, it can move itself to the random point

image

And make a zombie spawner BP, that just does

1 Like

I works!
Thanks A Lot mate :kissing_heart: :kissing_heart:

2 Likes

Still One problem. :thinking:
How can I set a maximum number of enemy in my map so there won’t be too many zombies filled my level.
Thanks. :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

1 Like

Hi, thanks for answering. :smiling_face_with_three_hearts:
I understand that I should set Max variable to the maximum number I want.
However, it would be really great if you explain the N variable to me. At first, I leave its value at default but it doesn’t seem to work properly. So would you like to describe it in detail (about what exactly I should do)?

Also, I’ve tried GetAllActorOfClass blueprint. It works well at the beginning and successfully limits the number of Zombie to 5(My maximum value).
However, when I shoot and destroy Zoombies. It just stop spawning! :face_with_raised_eyebrow:
Here is my blueprint and do you know why?

N is just a counter. It starts at 0.

1 Like

You are moving the goalposts
 :slight_smile:

This should do it

1 Like

I get what all this is about. But when I am testing the program, the N value stops at 5. I think it’s because that I have to -1 for N value after I destroy the Zombie. But I don’t know how to make such blueprint.
By the way, what does “GoalPost” mean?
Thank you :smile:

1 Like

Correct.

But my destroy blueprint is in the Zombie character blueprint, as shown below


How can I use this N variable in another blueprint?

Direct blueprint communication.

In the zombie do

1 Like

It works!
Thanks A lot! :grin: :grin:

1 Like