# Stand and fight!

**URL:** <https://discourse.cataclysmdda.org/t/stand-and-fight/15720>\
**Category:** The Garage\
**Created:** [June 17, 2018, 4:53pm UTC](https://discourse.cataclysmdda.org/t/stand-and-fight/15720 "2018-06-17T16:53:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![latogato](https://avatars.discourse-cdn.com/v4/letter/l/b9bd4f/32.png) [@latogato](https://discourse.cataclysmdda.org/u/latogato)\
**Post date:** [June 17, 2018, 4:53pm UTC](https://discourse.cataclysmdda.org/t/stand-and-fight/15720/1 "2018-06-17T16:53:12Z")

</div>

I would like a don’t move key, so i can stand and kill the zombies when they steps into the doorway. Now i can accidently step into it and get grabbed, beated etc.

---

<div class="post-metadata">

**Author:** ![Shard](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/shard/32/2139_2.png) [@Shard](https://discourse.cataclysmdda.org/u/Shard)\
**Post date:** [June 17, 2018, 5:06pm UTC](https://discourse.cataclysmdda.org/t/stand-and-fight/15720/2 "2018-06-17T17:06:34Z")

</div>

Try using tab, it automatically attacks a nearby enemy, or waits a turn if nothing is nearby.

---

<div class="post-metadata">

**Author:** ![latogato](https://avatars.discourse-cdn.com/v4/letter/l/b9bd4f/32.png) [@latogato](https://discourse.cataclysmdda.org/u/latogato)\
**Post date:** [June 17, 2018, 5:41pm UTC](https://discourse.cataclysmdda.org/t/stand-and-fight/15720/3 "2018-06-17T17:41:26Z")

</div>

I can’t believe i didn’t know that! 🤦‍♂️  
Thank you!

Edit: now i would mark this as answered, but i don’t see the solution icon at Shard’s comment, so i can’t. Interesting.

---

<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:** [June 17, 2018, 11:01pm UTC](https://discourse.cataclysmdda.org/t/stand-and-fight/15720/4 "2018-06-17T23:01:18Z")

</div>

I would like to have an instruction I could give to an NPC that told them to move toward me if I was being attacked, but then not move away. The current AI has “only attack foes you can reach without moving” or “attack nearby foes.” The first will prevent the NPC from moving a single tile to defend my survivor from attackers; the second will cause the NPC to climb out of windows to attack the zombie that is two tiles away. I want an NPC that will move to defend me, but won’t go chasing after zombies. Is that too much to ask?

---

<div class="post-metadata">

**Author:** ![Shard](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/shard/32/2139_2.png) [@Shard](https://discourse.cataclysmdda.org/u/Shard)\
**Post date:** [June 17, 2018, 11:09pm UTC](https://discourse.cataclysmdda.org/t/stand-and-fight/15720/5 "2018-06-17T23:09:19Z")

</div>

Unfortunately, that is a lot harder to do than it sounds. Additionally, AI code is a nightmare that almost no one wants to touch.

---

<div class="post-metadata">

**Author:** ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)\
**Post date:** [June 17, 2018, 11:17pm UTC](https://discourse.cataclysmdda.org/t/stand-and-fight/15720/6 "2018-06-17T23:17:36Z")

</div>

That feature is only enabled in q&a oriented subforums (e.g. the garage). It doesn’t really make sense to “answer” a design discussion.

---

<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:** [June 18, 2018, 2:58am UTC](https://discourse.cataclysmdda.org/t/stand-and-fight/15720/7 "2018-06-18T02:58:49Z")

</div>

I had really hoped that I’d bounded it enough to be relatively easy:  
on each turn, the NPC checks to see if a monster has attacked me since the NPC’s last turn. Hopefully that is something can be determined.  
If one or more monster has attacked, the NPC moves toward the closest, lowest move count square that allows the NPC to attack that monster, favoring squares that are adjacent to me. A little more complex but close enough.

I’d be fine with the NPC asking me to get out of the way (the way they already do) if I’m blocking a doorway and the monster is on the other side.

I guess I should go look into the NPC AI code.
