How to play Death Animation whenever the enemies Health is 0? (In Blueprints or C++ and spawn again with the AI Controller)

Good progress.

The spawn position should probably be determined by the spawner itself or set to specific areas.

Basically, before you allow the spawn you check the capsule size with a sweep and test if the object can indeed be spawned where you want it to.
If it can you proceed, if it cannot, you find another spot.

Further development of that would obviously tie into either nav mesh or nav invokers. However it’s likely overkill for your needs.

Keep it simple. Have some components into the level as spawners.
Make the master spawner look up all the elements of that type and select a random number in the range of 1 to the array count.

Then take that transform in world as the spawn transform.

Beware that the spawn transform may be Local and not World aligned - I can’t recall how it solves.
If it’s local, then you need to do math (subtract The spawner BP location? Or just run a transform from world to local on the spawn spot world location which is easier).

Could you show it in the UE4 editor? Like with screenshots and stuff, I’m not really familiar with spawning and stuff.

I don’t have anything I can show (nda prevent it).
If you can be more specific on what part confuses you, maybe I can recreate it and share how it was done.

How do I do this ^

Ok,
I’ll do some stuff tomorrow.

Meanwhile.

To check if the spawn area is free you can do a capsule trace that matches the size of the capsule of the character and the position its in.
Assuming it gets no hits, you are clear to Spawn.

To gather objects and randomly select one for the location, you would use gameplay tags.
Because you can look them up, and get an array of objects to work with, they are particularly good for this use case in a smaller sized project.

Okay thanks :slight_smile:

I hope you will show it today :pleading_face:

Short video is uploading

1 Like

Thank you so much for sending it, I think this is gonna be the solution : )

Make sure you don’t spawn on tick. That’s really just for testing purposes, as I didn’t want to click the bluetility button of the BP to manually spawn things while filming.

Ok

How do you do this?
image

For me it’s coming like this.
image

How do you do this too?
image

For me it’s coming like this.
image

Right click the pins and select split pins. I think that is the name I’m not at my computer so I can’t confirm.

2 Likes

I’m facing this error.
image

You probably forgot to expose it and set it.

It doesn’t need to be an actor variable either, be creative. It can be pretty much anything from an array of soft references to an array of classes, to (as I was using it), a reference to an existing level item.

Ok

A Spawn What? variable is this.
image

What is it that I am doing wrong?

@MostHost_LA I’m sending you some references so that it will be easier for you to solve the problem : )

Spawn Enemy Event:

Aa Spawn Spots:

image

A Current Spawn:

image

V Spawn Loc:

A Spawn What?

image

F Spawn Counter:

image

F Spawn Interval:

image

Also I can’t add the places to spawn in the array because of this.
image

Expose on spawn, then select what it is in the level editor.