# LUA Mapgen Problems

**URL:** <https://discourse.cataclysmdda.org/t/lua-mapgen-problems/13515>\
**Category:** The Toolbox\
**Created:** [March 10, 2017, 11:30pm UTC](https://discourse.cataclysmdda.org/t/lua-mapgen-problems/13515 "2017-03-10T23:30:30Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![NuG](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/nug/32/7057_2.png) [@NuG](https://discourse.cataclysmdda.org/u/NuG)\
**Post date:** [September 9, 2017, 10:48pm UTC](https://discourse.cataclysmdda.org/t/lua-mapgen-problems/13515/21 "2017-09-09T22:48:22Z")

</div>

Sorry about that :(.

---

<div class="post-metadata">

**Author:** ![Catasteroid](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@Catasteroid](https://discourse.cataclysmdda.org/u/Catasteroid)\
**Post date:** [September 10, 2017, 4:39am UTC](https://discourse.cataclysmdda.org/t/lua-mapgen-problems/13515/22 "2017-09-10T04:39:46Z")

</div>

Actually I think it might be down to there not being a rotated version of the LUA generated overmap tiles since it only occurs when I’ve got one loaded up, I’ll slap NO\_ROTATE in somewhere and report back if it makes a difference.

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [September 10, 2017, 8:18am UTC](https://discourse.cataclysmdda.org/t/lua-mapgen-problems/13515/23 "2017-09-10T08:18:15Z")

</div>

> [@Catasteroid](#):
>
> Actually I think it might be down to there not being a rotated version of the LUA generated overmap tiles since it only occurs when I’ve got one loaded up, I’ll slap NO\_ROTATE in somewhere and report back if it makes a difference.

I believe LUA mapgen should work as follows:

1. Pseudo-draw to array using custom mapgen functions.
2. Get overmap tile direction and rotate array according to this direction.
3. Actually draw rotated array tiles to game using game mapgen function.

You can get current overmap tile name and direction using `_G.tertype` and `_G.turn variables`during lua mapgen - see [Exposing id of `om_terrain`/`overmap_special` to LUA · Issue #21738 · CleverRaven/Cataclysm-DDA · GitHub](https://github.com/CleverRaven/Cataclysm-DDA/issues/21738).

---

<div class="post-metadata">

**Author:** ![Catasteroid](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@Catasteroid](https://discourse.cataclysmdda.org/u/Catasteroid)\
**Post date:** [September 24, 2017, 10:44pm UTC](https://discourse.cataclysmdda.org/t/lua-mapgen-problems/13515/24 "2017-09-24T22:44:03Z")

</div>

Perhaps I could just have an NPC with a few conversation lines and use a reinforced or a custom ultra-strong vending machine and regularly delete all the items in it and add new ones from an itemgroup, do you think that’s achievable using LUA alone?

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [September 27, 2017, 11:57am UTC](https://discourse.cataclysmdda.org/t/lua-mapgen-problems/13515/25 "2017-09-27T11:57:56Z")

</div>

> [@Catasteroid](#):
>
> Perhaps I could just have an NPC with a few conversation lines and use a reinforced or a custom ultra-strong vending machine and regularly delete all the items in it and add new ones from an itemgroup, do you think that’s achievable using LUA alone?

You can try running `place_vending` once a day using `on_day_passed` callback

[Previous page](https://discourse.cataclysmdda.org/t/lua-mapgen-problems/13515.md?page=1)
