Project Zomboid

Project Zomboid

Monkey's PZ Dungeons Framework
 This topic has been pinned, so it's probably important
Monkey  [developer] 8 Aug, 2023 @ 10:19am
Technical Information
A demo comes with this framework! Refer to it as an example.

If you want a dungeons setup for your server, but don't know where to start, I will offer my services. Just reach out on discord: _mon.key

I'd like to add that this is simpler than it seems, especially if you take a look at the demo sub-mod.
Last edited by Monkey; 9 Aug, 2023 @ 5:37am
< >
Showing 1-4 of 4 comments
Monkey  [developer] 8 Aug, 2023 @ 10:19am 
Map Files
In Project Zomboid, each cell is represented by 3 files:
  • x_y.lotheader
  • chunkdata_x_y.bin
  • world_x_y.lotpack

Changing the x and y values of these files for each cell will move the entire cell to wherever you want it to be on the map, without breaking anything and without the need of any mapping tools.

Before continuing with the setup of dungeons, we need to set up the actual dungeon map itself.
Here is a visual representation of what the map will look like after dungeons are set.[imgur.com]

  1. Find an empty, unused area of cells on the map (where there is a black void.
  2. Create multiple instances of the dungeon in a grid-like manner as shown here[imgur.com], by creating multiple copies of the same cell and renaming the x and y values of the lotheader, bin and lotpack files.
  3. That's basically it, you can automate it with a script if you're tech savvy.
Monkey  [developer] 8 Aug, 2023 @ 10:19am 
LUA
lua/shared/PZD_CONFIG_<name>.lua

require "PZD_CONFIG"

PZD_CONFIG.RegisterDungeon("dungeon1", 1,1,1,80,80,4,4)
  • Registers a new dungeon instance.
  • Refer to this[imgur.com] for a visual representation of the following parameters.
  • Parameter 1: Unique Dungeon ID
  • Parameter 2: East-West cell count of one dungeon map
  • Parameter 3: North-South cell count of one dungeon map
  • Parameter 4: Empty cell padding between each dungeon instance
  • Parameter 5: North Western most X cell coordinate of the first dungeon in the instance grid
  • Parameter 6: North Western most Y coordinate of the first dungeon in the instance grid
  • Parameter 7: Number of dungeon instances in a East-West direction in the instance grid
  • Parameter 8: Number of dungeon instances in a North-South direction in the instance grid

PZD_CONFIG.RegisterGate("dungeon1", "d1_entrance_gate", nil, 184,183,0)
  • Registers a gate for a dungeon that will act as a place to teleport the player to and from the main map.
  • Parameter 1: Unique Dungeon ID
  • Parameter 2: Unique Dungeon Gate ID
  • Parameter 3: {r=0, g=0, b=0} or NIL - Optional world marker at dungeon gate location
  • Parameter 4-6: X,Y,Z coordinates of teleport square location. But the location must be relative from the North Western most cell of the dungeon, starting at 0. Refer to the zero-coordinate system.[imgur.com]
Monkey  [developer] 8 Aug, 2023 @ 10:20am 
lua/client/Teleport/PZD_Teleport_Config_<name>.lua

require "Teleport/PZD_Teleport_Config"

PZD_Teleport.RegisterWorldGate({r=1,g=0,b=0}, "kentucky_dungeon1entrance", 11617, 9296,0)
  • Creates a new world gate.
  • Parameter 1: {r=0, g=0, b=0} or NIL - Optional world marker at world-to-dungeon gate
  • Parameter 2: Unique Gate ID
  • Parameters 3-5: X,Y,Z coordinates of square that will teleport the player.

PZD_Teleport.AddWorldToDungeonGate("kentucky_dungeon1entrance", "dungeon1", "d1_entrance_gate")
  • Adds a connection between a world gate and a dungeon gate.
  • Parameter 1: Unique Gate ID of world gate defined with RegisterWorldGate
  • Parameter 2: Unique Dungeon ID defined in shared/PZD_CONFIG_<name>.lua RegisterDungeon functions
  • Parameters 3: Unique Dungeon Gate ID defined in shared/PZD_CONFIG_<name>.lua RegisterGate functions

PZD_Teleport.AddDungeonToWorldGate("dungeon1", "d1_exit_gate", "kentucky_dungeonsexit")
  • Adds a connection between a teleport dungeon gate and a world gate.
  • Parameter 1: Unique Dungeon ID defined in shared/PZD_CONFIG_<name>.lua RegisterDungeon functions
  • Parameter 2: Unique Dungeon Gate ID defined in shared/PZD_CONFIG_<name>.lua RegisterGate functions
  • Parameter 3: Unique Gate ID of world gate defined with RegisterWorldGate
Monkey  [developer] 8 Aug, 2023 @ 10:20am 
Cleanup
If you run out of dungeon instances you need to do some cleanup.
Head over to your save folder and clear out the respective zpop_x_y.bin, chunkdata_x_y.bin, map_xxx_yyy.bin files and reset the server/save. You need to do some digging yourself as to which files to delete, as these depend on where you set the dungeon instances. You might be able to automate this with FTP if the server host provider allows it.

After that's done, run the server and execute the command with an admin and debug user: PZD_ResetInstances()
< >
Showing 1-4 of 4 comments
Per page: 1530 50