Project Zomboid

Project Zomboid

BeeArr's BB Guns
 This topic has been pinned, so it's probably important
BeeArr  [developer] 21 Jul, 2023 @ 5:53am
How to create your own map/ingame picture.
How to create your own map/ingame picture.

1.Within the /media/ folder of your mod, create the folder "/ui/LootableMaps". Within this folder, place the picture(s) you wish to add to the game as a "map".

2.Within the /media/ folder of your mod, create the folder /lua/client.

3.Within that folder, create a .lua file, filename of your choosing, that contais the following code:

--I have taken this piece of code from "BeeArr's BB Guns" by BeeArr, who took the code from "Undead Survivors" by Scavenger, who took and modified from the mod "PKMN Trading Cards" by Duchess require 'Maps/ISMapDefinitions' local MINZ = 0 local MAXZ = 24 local function overlayPNG(mapUI, x, y, scale, layerName, tex, alpha) local texture = getTexture(tex) if not texture then return end local mapAPI = mapUI.javaObject:getAPIv1() local styleAPI = mapAPI:getStyleAPI() local layer = styleAPI:newTextureLayer(layerName) layer:setMinZoom(MINZ) layer:addFill(MINZ, 255, 255, 255, (alpha or 1.0) * 255) layer:addTexture(MINZ, tex) layer:setBoundsInSquares(x, y, x + texture:getWidth() * scale, y + texture:getHeight() * scale) end LootMaps.Init.YOURPICTUREHERE = function(mapUI) local mapAPI = mapUI.javaObject:getAPIv1() MapUtils.initDirectoryMapData(mapUI, 'media/maps/Muldraugh, KY') mapAPI:setBoundsInSquares(10000, 9000, 10800, 9707) overlayPNG(mapUI, 10000, 9000, 1.0, "YOURPICTUREHERE", "media/ui/LootableMaps/YOURPICTUREHERE.png", 1.0) end

4. Rename "YOURPICTUREHERE" to the filename of your picture from step 1.

5. Within this line of the code "mapAPI:setBoundsInSquares(10000, 9000, 10800, 9707)", replace the bolded numbers to 10000 + the width of your image in pixels, and 9000 + the height of your image in pixels.

6.Within the /media/ folder of your mod, create the folder "/scripts/". Within it, create a .txt file of the filename of your choosing, containing:

item YOURPICTUREHERE { Weight=0.05, Type=Map, DisplayName= DISPLAYNAMEHERE, Map=YOURPICTUREHERE, Icon=YOURPICTUREICONHERE, StaticModel = YOURPICTUREICONHERE, WorldStaticModel = YOURPICTUREICONHERE, }

7. Rename "YOURPICTUREHERE" to the filename of your picture from step 1. Rename "DISPLAYNAMEHERE" to the name the player will see in his inventory. Rename "YOURPICTUREICONHERE" to the filename of your item's icon.

This should create the picture item and allow you to view it as you view a map.