# Need a way to spawn an npc and despawn them properly ona trigger

**URL:** <https://forums.unrealengine.com/t/need-a-way-to-spawn-an-npc-and-despawn-them-properly-ona-trigger/2662821>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [October 6, 2025, 11:00pm UTC](https://forums.unrealengine.com/t/need-a-way-to-spawn-an-npc-and-despawn-them-properly-ona-trigger/2662821 "2025-10-06T23:00:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fettman89](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fettman89](https://forums.unrealengine.com/u/Fettman89)\
**Post date:** [October 6, 2025, 11:00pm UTC](https://forums.unrealengine.com/t/need-a-way-to-spawn-an-npc-and-despawn-them-properly-ona-trigger/2662821/1 "2025-10-06T23:00:22Z")

</div>

Here’s my problem, I’m making an anomaly game, when a player passes through a trigger, it has a chance to spawn anomalies in the house and sets a variable “ Anomaly active”, currently I have a spawn actor at location when they pass through the trigger and the anomaly active variable is set to true, it’s nothing fancy It just checks if the actor is valid in the world, and if not fires a delay of 75 seconds, then spawn the actor and sets a boolean variable true that is spawned.

In this anomaly game, if anomalies are active, you turn around and go back through the start trigger, which resets the room to a normal state, and gets rid of the monster prowling around, which it does initially, however when the player does this and goes back through the trigger early before the trigger spawns the monster, it will still spawn on the next loop, whether an anomaly is active or not. I know it has something to do with the initial call to spawn the monster, when it checks if it’s valid in the world or not, but beyond that I’m not really sure what else.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/3/b/03b0c73fa135092aae0695f62c6510f813aa9294.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/8/0/b80777f1f9d147cc4554e7694be06dcc86fecb77.png)

---

<div class="post-metadata">

**Author:** ![Ruffhaus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ruffhaus/32/1194663_2.png) [@Ruffhaus](https://forums.unrealengine.com/u/Ruffhaus)\
**Post date:** [October 7, 2025, 12:18am UTC](https://forums.unrealengine.com/t/need-a-way-to-spawn-an-npc-and-despawn-them-properly-ona-trigger/2662821/2 "2025-10-07T00:18:08Z")

</div>

Instead of worrying about the `DoOnce` just put a branch to check if `IsDemonSpawned` false then and only then can it spawn.

 ![Screenshot 2025-10-07 111443](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/9/2/b928ab472c52874eba68e32e362468873b1e4034.png)

The problem is that `DoOnce` is being negated as soon as a demon spawns because it is being reset. Then when you destroy the demon you can set `IsDemonSpawnedFalse` and it will gate properly.

 ![Screenshot 2025-10-07 111750](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/c/3/3c3db1e26999515677f41a1d1e6fea5a4de5fc0f.png)

Also that 75 second delay, should be a timer that way if the room is reset you can nullify the timer so it doesn’t keep running.

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [October 7, 2025, 12:41am UTC](https://forums.unrealengine.com/t/need-a-way-to-spawn-an-npc-and-despawn-them-properly-ona-trigger/2662821/3 "2025-10-07T00:41:10Z")

</div>

On begin Overlap immediately disable the collision on the trigger component. Then call a timer to re-enable some seconds later. Do all your other logic after the timer call.

---

<div class="post-metadata">

**Author:** ![Fettman89](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fettman89](https://forums.unrealengine.com/u/Fettman89)\
**Post date:** [October 7, 2025, 5:14am UTC](https://forums.unrealengine.com/t/need-a-way-to-spawn-an-npc-and-despawn-them-properly-ona-trigger/2662821/4 "2025-10-07T05:14:46Z")

</div>

You mean like a set timer by event or function node?

---

<div class="post-metadata">

**Author:** ![Ruffhaus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ruffhaus/32/1194663_2.png) [@Ruffhaus](https://forums.unrealengine.com/u/Ruffhaus)\
**Post date:** [October 7, 2025, 5:59am UTC](https://forums.unrealengine.com/t/need-a-way-to-spawn-an-npc-and-despawn-them-properly-ona-trigger/2662821/5 "2025-10-07T05:59:05Z")

</div>

Yeah exactly, just so you can call an invalidate if you don’t need it to spawn anymore, harder to do with a delay.

---

<div class="post-metadata">

**Author:** ![Fettman89](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fettman89](https://forums.unrealengine.com/u/Fettman89)\
**Post date:** [October 7, 2025, 6:02am UTC](https://forums.unrealengine.com/t/need-a-way-to-spawn-an-npc-and-despawn-them-properly-ona-trigger/2662821/6 "2025-10-07T06:02:46Z")

</div>

So how would I do that for this, I don’t have a function set up for this line of code or any events besides overlap trigger.

---

<div class="post-metadata">

**Author:** ![Ruffhaus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ruffhaus/32/1194663_2.png) [@Ruffhaus](https://forums.unrealengine.com/u/Ruffhaus)\
**Post date:** [October 7, 2025, 6:11am UTC](https://forums.unrealengine.com/t/need-a-way-to-spawn-an-npc-and-despawn-them-properly-ona-trigger/2662821/7 "2025-10-07T06:11:59Z")

</div>

I’m making some assumptions here but I assume you have something like this?

 ![Screenshot 2025-10-07 170806](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/6/7/56735e9f2bb53493f2b9b2871b5d908ef52b4773.png)

Instead do something like this.

 ![Screenshot 2025-10-07 171004](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/7/f/17ff3fe0b0e286decd7005bb7ddddb3cb3a3dafa.png)

That spawn could be wrapped as a function or event it wouldn’t matter.

---

<div class="post-metadata">

**Author:** ![Fettman89](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fettman89](https://forums.unrealengine.com/u/Fettman89)\
**Post date:** [October 7, 2025, 6:16am UTC](https://forums.unrealengine.com/t/need-a-way-to-spawn-an-npc-and-despawn-them-properly-ona-trigger/2662821/8 "2025-10-07T06:16:05Z")

</div>

Yeah that’s generally what I have, I’ll try that out

---

<div class="post-metadata">

**Author:** ![Fettman89](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fettman89](https://forums.unrealengine.com/u/Fettman89)\
**Post date:** [October 7, 2025, 11:26pm UTC](https://forums.unrealengine.com/t/need-a-way-to-spawn-an-npc-and-despawn-them-properly-ona-trigger/2662821/9 "2025-10-07T23:26:03Z")

</div>

You’re a legend that got everything fixed.
