Project Zomboid

Project Zomboid

Not enough ratings
Build 42 - how to add new fliers
By Deon ☣
This guide explains how to add new fliers to Unstable build 42. Fliers that display an image, have a failback text and point to a location on a map that they reveal.
   
Award
Favorite
Favorited
Unfavorite
Example mod
Creating the necessary mod structure
Open your Workshop directory, where you create mods in order to later upload them to Steam Workshop.

The path is:
C:\Users\<YourUserName>\Zomboid\Workshop\

Create the necessary folder structure with the following folders and files:

..\YourModName\preview.png - preview image for the workshop ..\YourModName\workshop.txt - descriptor file for the workshop ..\YourModName\Contents\mods\YourModName\Common\ - leave this directory empty ..\YourModName\Contents\mods\YourModName\42\ - this is where all mod files will go

Here's the example of workshop.txt file:
version=1 id= title=B42 - New fliers description=New fliers. tags=Build 42;Items;Map visibility=public

In the next section we will describe what goes into the following folder:
C:\Users\<YourUserName>\Zomboid\Workshop\YourModName\Contents\mods\YourModName\42\
Creating the mod
We start with the following folder:
C:\Users\<YourUserName>\Zomboid\Workshop\YourModName\Contents\mods\YourModName\42\

At first, make two files in this folder:
..\YourModName\42\poster.png ..\YourModName\42\mod.info

Poster.png can be any image used as a poster for in-game mod manager.
Here's an example of mod.info file for in-game mod manager:
name=NewFliers poster=poster.png id=MyNewFliers description=New fliers. url=

Those two files are the poster and the descriptor.



At this point we can create the following files that actually contain our mod data:

..\YourModName\42\media\textures\printMedia\FlyerPic\MyNewFlier.png ..\YourModName\42\media\lua\shared\myFlierDefinition.lua ..\YourModName\42\media\lua\shared\Translate\EN\Print_Media_EN.txt ..\YourModName\42\media\lua\shared\Translate\EN\Print_Text_EN.txt

MyFlier.png is the actual picture you want to use for the flier. You need to know its dimensions (width, height).
myFlierDefinition.lua is the file that adds your flier to the list of other fliers.

Inside of definitions, you need to maintain the same fler ID (name) across all definitions. Let me show you how. The flier definition (id, object name) will be MyNewFlier.


Here's an example content of myFlierDefinition.lua:

require "PrintMedia/PrintMediaDefinitions" local newFliers = {"MyNewFlier"} for n= 1, #newFliersDeon do table.insert(PrintMediaDefinitions.Fliers, newFliers[n]) end local MyCoords = { MyNewFlier = { location1 = { { x1 = 1889, y1 = 10812, x2 = 1965, y2 = 10844,}, }, }, } for k,v in pairs(MyCoords) do PrintMediaDefinitions.MiscDetails[k] = v end

Pay attention that we used the same name MyNewFlier twice:
- Once in "newFliers" list. Here we simply create the defnition.
- Once in "MyCoords" list. Here we add coordinates of the rectangle that should be revealed on the map by reading the flier.

You can find the needed coordinates in Debug mode/in beta42 by right-clicking on a world tile and checking coordinates. You want coordinates of North-west and South-east corners of a rectangle.

If you want to add multiple fliers, you will add them to the list like this:
newFliers = {"MyNewFlier1", "MyNewFlier2}




Finally, we describe what goes inside of the flier in terms of the picture and the failback text.

This is the example of Print_Media_EN.txt.
Note that we use MyNewFlier as a name again inside of Print_Media_<NAME>_title lines etc.
Print_Media_EN = { Print_Media_MyNewFlier_title= "My flier title", Print_Media_MyNewFlier_info= "<type:parent, width:800, height:1200>".. "<type:texture, x:0, y:0, texture:getTexture("media/textures/printMedia/FlyerPics/MyNewFlier.png"), width:800, height:1200>", }

Make sure to use width and height in th line Print_Media_MyNewFlier_info that are the same as the width and the heightof the picture.




At this point the flier is ready to display he image and show us coordinates on map, but you may want to add a "failback" text that you can read by clicking small icon on bottom left of the banner.

To fill this text, write into Print_Text_EN.txt file.
Here's the example

Print_Text_EN = { Print_Text_MyNewFlier_title= "My flier title", Print_Text_MyNewFlier_info= "This is a description\nThis text is on a new line",

All that is left is to test that it works in the game (spawn in -debug mode multiple fliers until yours shows).
Publishing the mod
Launch the game and click WORKSHOP in the menu.

Select the option to "Create and update items", and select your mod to be published.

After that you may want to go to Steam Workshop and add extra formatting to Steam Workshop description of your mod.

I would recommend to save your final mod description formatting in a text file, as updating your mod from the game can overwrite your carefully structured description again.
6 Comments
RestinRaxys 30 Jan @ 5:15am 
I think maybe there is an issue with the examples you're using, in the "myFlierDefinition" there is a
#newFliersDeon but then there is table.insert(PrintMediaDefinitions.Fliers, newFliers[n]) and because of that it spews out an error if you don't make them the same, hadn't ever done this before and it was a bit head scratching finding the issue as I'm a very novice modder
AriieSiiS 19 Jan @ 11:44am 
Is possible to write/put simbols on this flayers like u do on the map?
Deon ☣  [author] 14 Jan @ 3:10am 
Yes, you can use my More Fliers mod to see how it's done.
Duc Houx 14 Jan @ 2:47am 
Can we dl your folder plz to compare ? thx !
Deon ☣  [author] 28 Dec, 2024 @ 12:51pm 
I hope it helps. If you get stuck, don't hesitate to ping people on PZ community modding discord, they are very helpful. https://discord.gg/3fa6tA2s
Клюрен? 28 Dec, 2024 @ 7:35am 
Thank you so much for the guide, I needed it! <3