Adding custom spawnpoints to Project Zomboid is possible by creating your own lua files. This is a complex process and will take some time to do. With this guide you'll be able to add random spawnpoints or specify different locations for players to spawn. You can also select specific spawnpoints based on the player's occupation.
This is an advanced guide. Use at your own risk.
1. Open the File Manager
2. Navigate to /server-files/media/maps/
3. Create a file with the .lua
file extension. For this example the file will be called custom_spawnpoints.lua
4. Right click the file and click Edit
5. Paste in the following code:
function SpawnPoints()
return {
unemployed = {
{ worldX = x, worldY = x, posX = x, posY = x, posZ = 0 },
}
}
end
6. Go to the Project Zomboid Map Project and find a location you want your players to spawn at
7. Click on Map Coordinates. Replace the x's in the code with the Cell and Rel values found at your coordinates. The worldX and worldY are the Cell values and the posX and posY are the Rel values.
8. The corresponding code for these coordinates would be:
function SpawnPoints()
return {
unemployed = {
{ worldX = 33, worldY = 32, posX = 242, posY = 56, posZ = 0 },
}
}
end
9. If you wish to add multiple spawnpoints for one option, you can add more like so:
function SpawnPoints()
return {
unemployed = {
{ worldX = 37, worldY = 23, posX = 276, posY = 28, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 216, posY = 12, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 281, posY = 85, posZ = 0 }
}
}
end
10. If you wish to add multiple options, you can create more spawnpoint files with different names, such as custom2_spawnpoints.lua
11. Specifying unemployed =
will allow any occupation to spawn at the locations. If you wish to add occupation specific spawnpoints, you can use code like so:
function SpawnPoints()
return {
constructionworker = {
{ worldX = 37, worldY = 23, posX = 276, posY = 28, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 216, posY = 12, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 281, posY = 85, posZ = 0 }
},
fireofficer = {
{ worldX = 37, worldY = 23, posX = 276, posY = 28, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 269, posY = 28, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 216, posY = 12, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 281, posY = 85, posZ = 0 }
},
parkranger = {
{ worldX = 37, worldY = 23, posX = 276, posY = 28, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 216, posY = 12, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 54, posY = 113, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 281, posY = 85, posZ = 0 }
},
policeofficer = {
{ worldX = 37, worldY = 23, posX = 276, posY = 28, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 216, posY = 12, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 281, posY = 85, posZ = 0 }
},
securityguard = {
{ worldX = 37, worldY = 23, posX = 276, posY = 28, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 216, posY = 12, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 281, posY = 85, posZ = 0 }
},
unemployed = {
{ worldX = 37, worldY = 23, posX = 276, posY = 28, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 216, posY = 12, posZ = 0 },
{ worldX = 37, worldY = 23, posX = 281, posY = 85, posZ = 0 }
}
}
end
1. Once you have finished adding your spawnpoint files, navigate to /server-data/Server/
2. Right click pzserver_spawnregions.lua
and click Edit
3. Add any spawn files you created to this file. You can name the spawns whatever you like. Notice that each spawnpoint specifies a specific file. It should look as follows:
4. Save the file and Restart the server