Branch not working in sequence node

Hello. I have made a sequence to spawn enemies first and then when they are completed, so spawn the boss. But I don’t know why boss doesn’t spawn at all…

The boolean remains false all the time.

Here’s the pic for sequence, the branch in 2nd pin don’t work

Here is the pic for enemy spawn event:

It came to my mind as well, Let me see if i can try it on event tick.

Hi, your spawn enemy function takes 1.3s to start so it’s too late because the event begin play will be finished before the setting of the lvl1 bool. In fact the sequence continues the pin execution even the previous pin isn’t finished. You could make a custom event for spawn boss instead of use a bool variable. You call it when the branch of the spawn enemy function is true.

Are you stop the enemy function loop when the lvl1 finished bool is true?

How do I do it? I tried pause timer, but it didn’t work

It may be because the sequence is only being fired once on event begin play, so as soon as you start your game the lvl1 finished bool will be false as you’re still spawning enemies, it’s then not being checked again.

You could try checking the branch in the sequence every tick/frame instead.

I’ve made a custom event for spawn boss, but the thing is that it is called directly after pin 1, I want it to stop until all level 1 enemies are spawned, for which I am using the bool…

you can use clear timer by function name.

After the call of your custom event you add a clear timer by function name

And you can add a delay before the call if you want beacuase the enemies and the boss will spawn almost at the same time.

Where do i add the clear timer function? After the end of “Update enemy Count” in the custom event of SpawnEnemy?

You call your boss custom event instead of the set enemy lvl1 finished bool and just after you add the clear timer in order to not call indefinitely the boss event.

But i have unchecked the looping, so boss would spawn only once. The thing i want to achieve is that I want to spawn boss when all enemies are spawned. Not before that.

I got it. Nevermind, I got your point!

I have one more question. I’ve spawned the boss by “Spawn actor from class” but now I want to set up like when the boss is destroyed then spawn Lvl1 enemies again. I want to repeat the process. I can’t get it to work. Whenever I connect it with the previous event, the enemies spawn directly after the boss. I want to spawn enemies after boss is destroyed.
I have used “isvalid” too but it didn’t work out.

You can test if the boss is destroyed with the ‘get all actors of a class’ node that you connect with an event tick: if the length of the result array is equal to 0, you call the event witch spawn your enemies. But you have to test if you have spawned the boss with a bool variable that you set true after the spawn actor node. So you have to add a branch between the event tick and the get all actors node. At last you have to set the bool variable to false after the call of the spawn of the enemies event.

An other solution is to use the event dispatcher that you create in the boss blueprint.