Author Topic: LUA Mapgen Problems  (Read 626 times)

Offline Zhilkin

  • NPC
  • **
  • Posts: 167
    • View Profile
Re: LUA Mapgen Problems
« Reply #15 on: September 07, 2017, 11:07:21 AM »
There is no such string on line 50 in the file you provided. Probably you provided wrong or incomplete code. Try to make lua file as simple as possible (remove all comments and empty lines) - that way you will know certain line number which fails.

Better yet provide archive with all of the files you've changed. There are should be ate least Log.lua and MapGen.lua from the `lua` folder.

Offline Catasteroid

  • Zombie Food
  • *
  • Posts: 10
    • View Profile
Re: LUA Mapgen Problems
« Reply #16 on: September 07, 2017, 02:06:42 PM »
A few minor syntax errors later (turns out the copy of the prochouse.lua I posted wasn't the one being run and didn't have the pair of spurious ' ", ' strings) and it spawns fine using the lua console, I haven't seen it spawn in the wild yet but that might be down to the game being funny with me trying to force it to be a house_north. It's rough but it should shape up nicely and I'll look for a solution to the rotation later.
Ultimately I'm hoping to make some kind of trade post/bunker with a merchant npc that totally flushes and updates their stock every 1-3 days and the only straightforward solution to that I've thought of is to simply delete the NPC and respawn them after checking how long it's been.
(click to show/hide)

Offline Zhilkin

  • NPC
  • **
  • Posts: 167
    • View Profile
Re: LUA Mapgen Problems
« Reply #17 on: September 08, 2017, 03:35:32 PM »
A few minor syntax errors later (turns out the copy of the prochouse.lua I posted wasn't the one being run and didn't have the pair of spurious ' ", ' strings) and it spawns fine using the lua console, I haven't seen it spawn in the wild yet but that might be down to the game being funny with me trying to force it to be a house_north. It's rough but it should shape up nicely and I'll look for a solution to the rotation later.
Ultimately I'm hoping to make some kind of trade post/bunker with a merchant npc that totally flushes and updates their stock every 1-3 days and the only straightforward solution to that I've thought of is to simply delete the NPC and respawn them after checking how long it's been.
(click to show/hide)
There is little of npc-related function in lua. I believe exposing more npc-related functions to lua is required to make this happen.

Offline NuG

  • NPC
  • **
  • Posts: 230
    • View Profile
Re: LUA Mapgen Problems
« Reply #18 on: September 08, 2017, 05:46:15 PM »
I am getting a "there are too many mandatory overmap specials" error. (https://imgur.com/a4QQbM4)

Also the game keeps crashing/freezing when I get to this one area. I'm thinking that because I added urban development mod AND the building pack, and in the patch notes I saw buildings 11-20 added.. is that maybe what is causing this?

I hope this is the correct thread to post this. I am using tiles and 32bit, instead of 64bit and tiles like usual, since x64 isn't updating for me.

Offline Zhilkin

  • NPC
  • **
  • Posts: 167
    • View Profile
Re: LUA Mapgen Problems
« Reply #19 on: September 09, 2017, 06:58:16 PM »
I am getting a "there are too many mandatory overmap specials" error. (https://imgur.com/a4QQbM4)

Also the game keeps crashing/freezing when I get to this one area. I'm thinking that because I added urban development mod AND the building pack, and in the patch notes I saw buildings 11-20 added.. is that maybe what is causing this?

I hope this is the correct thread to post this. I am using tiles and 32bit, instead of 64bit and tiles like usual, since x64 isn't updating for me.
That issue doesn't belong in here. The error you mentioned doesn't related to LUA mapgen code.

Offline NuG

  • NPC
  • **
  • Posts: 230
    • View Profile
Re: LUA Mapgen Problems
« Reply #20 on: September 09, 2017, 11:48:22 PM »
Sorry about that :(.

Offline Catasteroid

  • Zombie Food
  • *
  • Posts: 10
    • View Profile
Re: LUA Mapgen Problems
« Reply #21 on: September 10, 2017, 05:39:46 AM »
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.

Offline Zhilkin

  • NPC
  • **
  • Posts: 167
    • View Profile
Re: LUA Mapgen Problems
« Reply #22 on: September 10, 2017, 09:18:15 AM »
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 https://github.com/CleverRaven/Cataclysm-DDA/issues/21738.
« Last Edit: September 10, 2017, 09:26:04 AM by Zhilkin »