# NPC Lumber Disaster

**URL:** https://discourse.cataclysmdda.org/t/npc-lumber-disaster/21259
**Category:** The Garage
**Created:** [September 5, 2019, 7:47pm UTC](https://discourse.cataclysmdda.org/t/npc-lumber-disaster/21259 "2019-09-05T19:47:20Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![DrakeDragon8](https://avatars.discourse-cdn.com/v4/letter/d/9fc29f/32.png) [@DrakeDragon8](https://discourse.cataclysmdda.org/u/DrakeDragon8)
#### Post date: [September 5, 2019, 7:47pm UTC](https://discourse.cataclysmdda.org/t/npc-lumber-disaster/21259/1 "2019-09-05T19:47:20Z")

</div>

So I set 2 NPCs to cut down trees for about 1 day and I come back to check on them

 ![Lumber%20gone%20Wrong](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/0/0285bb030994bf0e9ca84f3fe7862c1e7aafb927.jpeg)  
It said something of an infinite loop and turned debug on for me.

---

<div class="post-metadata">

### Author: ![dpwb](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/dpwb/32/2609_2.png) [@dpwb](https://discourse.cataclysmdda.org/u/dpwb)
#### Post date: [September 5, 2019, 10:06pm UTC](https://discourse.cataclysmdda.org/t/npc-lumber-disaster/21259/2 "2019-09-05T22:06:57Z")

</div>

Did the deaths / infinite loop occur, the moment they became visible and re-entered the reality bubble?

---

<div class="post-metadata">

### Author: ![DrakeDragon8](https://avatars.discourse-cdn.com/v4/letter/d/9fc29f/32.png) [@DrakeDragon8](https://discourse.cataclysmdda.org/u/DrakeDragon8)
#### Post date: [September 5, 2019, 11:10pm UTC](https://discourse.cataclysmdda.org/t/npc-lumber-disaster/21259/3 "2019-09-05T23:10:48Z")

</div>

Not Visible but upon bubble re-entry

---

<div class="post-metadata">

### Author: ![dpwb](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/dpwb/32/2609_2.png) [@dpwb](https://discourse.cataclysmdda.org/u/dpwb)
#### Post date: [September 6, 2019, 9:43am UTC](https://discourse.cataclysmdda.org/t/npc-lumber-disaster/21259/4 "2019-09-06T09:43:09Z")

</div>

Yeah this is a wider problem with NPC activities, that are gonna need some clever workarounds.

Depending on what direction you approach from, there is one turn where the NPC is in the reality bubble, but the thing they are working on, is not yet there.

They try to continue their activity, but the thing they want to work on dostn exist, I need to find a way for them to handle this gracefully and wait a few turns to resume activity, instead of exploding their heads.

This will be the same with other activities too.

---

<div class="post-metadata">

### Author: ![Vastin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/vastin/32/9912_2.png) [@Vastin](https://discourse.cataclysmdda.org/u/Vastin)
#### Post date: [September 6, 2019, 6:25pm UTC](https://discourse.cataclysmdda.org/t/npc-lumber-disaster/21259/5 "2019-09-06T18:25:19Z")

</div>

Can an NPC simply force the tile they want to operate on to load into the reality bubble when they go to act?

That could be a fairly generic function where anytime entity X is trying to do something outside the reality bubble, they force load that tile.

---

<div class="post-metadata">

### Author: ![mlangsdorf](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/mlangsdorf/32/2462_2.png) [@mlangsdorf](https://discourse.cataclysmdda.org/u/mlangsdorf)
#### Post date: [September 6, 2019, 7:50pm UTC](https://discourse.cataclysmdda.org/t/npc-lumber-disaster/21259/6 "2019-09-06T19:50:05Z")

</div>

It’s not a great idea for them to load a tinymap that’s partially inside the reality bubble. Things get strange because the reality bubble map and the tinymap have separate caches.

---

<div class="post-metadata">

### Author: ![Fris0uman](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/fris0uman/32/8607_2.png) [@Fris0uman](https://discourse.cataclysmdda.org/u/Fris0uman)
#### Post date: [September 15, 2019, 9:04am UTC](https://discourse.cataclysmdda.org/t/npc-lumber-disaster/21259/7 "2019-09-15T09:04:43Z")

</div>

I ve had the same problem with surgery on NPCs, the autodoc would leave the map before them, which would lead to them being butchered by the desapearance of the autodoc mid operation, and “solved it” by adding a check for being deep enough in the bubble. It’s in operation\_do\_turn I think, maybe you can use something line this, and have them just wait a few turn if they are too close to the edge.
