Project Zomboid

Project Zomboid

Extra Map Symbols
DOOMGUY 21 Jan, 2022 @ 2:06pm
Add-on Support?
Hello! I am making some 20x20, 50x50, 100x100 and 200x200 Symbols that I wanted to add on to this Mod - How could I do that? I`ve been going through the code but I feel like there is an easier way to do that which I don`t know yet.

If there is any form of doing this, it could be awesome for lots of servers, each making their own Add-Ons for this Mod with their own custom icons. Please let me know If I can have your support on that, I`ll be looking forward a feedback.

Have a great day!
< >
Showing 1-3 of 3 comments
Wipe  [developer] 21 Jan, 2022 @ 11:36pm 
All map symbols mods around use same vanilla function which takes care of storing textures until it's time to display them on map/ui. That means you technically don't need this mod as a dependency, as symbols will work as long you add them correctly.
Search for "MapSymbolDefinitions" in PZ directory for examples.




As you mentioned adding new colors in comment... you can, obviously, inject your own button into ui; there's already at least one mod which does exactly that.
However, you can also use few crayons-related functions, provided by ExtraMapSymbolsUI, made to allow other mods to add/remove their own colors without need for adding new buttons to UI in a first place.

Your script (media/lua/client/) could look something like this:
-- this makes sure your script is running *after* default crayons colors are initialized -- require "ExtraMapSymbolsUI.Crayons" -- this will remove "Strawberry" color -- ExtraMapSymbolsUI:DelCrayon(0xFF, 0x33, 0x99) -- this will add a cooler red color as RGB -- ExtraMapSymbolsUI:AddCrayon(0xB1, 0x00, 0x0D)

In case you add multiple colors, you might want to resize color picker size
-- this will change numbers of columns (1st argument) and rows (2nd argument) -- ExtraMapSymbolsUI:SetCrayonSize(4, 3)

In case you want to remove all default crayons colors, without going color by color, you can use:
ExtraMapSymbolsUI.Crayons = {}
Note that ExtraMapSymbolsUI requires at least 1 crayon color to exists, or it might break :)

Once you have your mod set, add this mod as dependency on Steam and in your mod.info:
require=ExtraMapSymbolsUI

Take a look at ExtraMapSymbolsUI.Crayons.lua in mod directory, which serves as a live example of adding crayons colors.




So why am i advertising using crayons "system" so hard?
Adding new color buttons, if done incorrectly, can and will lead to problems if N mods are trying to do that (which already happened in the past). On top of that, UI will be cluttered and start looking meh.
If you are using ExtraMapSymbolsUI anyway, crayons-related functions helps both of us:
You dont have to worry about hooking functions, creating button, and so on
I dont have to worry about mod conflicts, as both of us are using exactly same way to populate colors list. If my crayons script works, so will yours.
Last edited by Wipe; 21 Jan, 2022 @ 11:39pm
DOOMGUY 22 Jan, 2022 @ 8:22am 
Originally posted by Wipe:
All map symbols mods around use same vanilla function which takes care of storing textures until it's time to display them on map/ui. That means you technically don't need this mod as a dependency, as symbols will work as long you add them correctly.
Search for "MapSymbolDefinitions" in PZ directory for examples.




As you mentioned adding new colors in comment... you can, obviously, inject your own button into ui; there's already at least one mod which does exactly that.
However, you can also use few crayons-related functions, provided by ExtraMapSymbolsUI, made to allow other mods to add/remove their own colors without need for adding new buttons to UI in a first place.

Your script (media/lua/client/) could look something like this:
-- this makes sure your script is running *after* default crayons colors are initialized -- require "ExtraMapSymbolsUI.Crayons" -- this will remove "Strawberry" color -- ExtraMapSymbolsUI:DelCrayon(0xFF, 0x33, 0x99) -- this will add a cooler red color as RGB -- ExtraMapSymbolsUI:AddCrayon(0xB1, 0x00, 0x0D)

In case you add multiple colors, you might want to resize color picker size
-- this will change numbers of columns (1st argument) and rows (2nd argument) -- ExtraMapSymbolsUI:SetCrayonSize(4, 3)

In case you want to remove all default crayons colors, without going color by color, you can use:
ExtraMapSymbolsUI.Crayons = {}
Note that ExtraMapSymbolsUI requires at least 1 crayon color to exists, or it might break :)

Once you have your mod set, add this mod as dependency on Steam and in your mod.info:
require=ExtraMapSymbolsUI

Take a look at ExtraMapSymbolsUI.Crayons.lua in mod directory, which serves as a live example of adding crayons colors.




So why am i advertising using crayons "system" so hard?
Adding new color buttons, if done incorrectly, can and will lead to problems if N mods are trying to do that (which already happened in the past). On top of that, UI will be cluttered and start looking meh.
If you are using ExtraMapSymbolsUI anyway, crayons-related functions helps both of us:
You dont have to worry about hooking functions, creating button, and so on
I dont have to worry about mod conflicts, as both of us are using exactly same way to populate colors list. If my crayons script works, so will yours. [/quote]

I would like to firstly thank you for your great explanation and time you took to literally give me this great explanation - I struggled so hard with something that is actually very simple - Thank you once more.

I thought so that the UI could get sluggish if messed up in the wrong way, thanks for the heads up!

I would also like to mention that I had some people complaining about your mod not working properly with smaller resolutions, I don't believe this is fixable considering that the game itself gets weird in low resolutions - But just letting you know in case you didn't, maybe we can find a workaround for that.

I'll be trying to add some cool symbols, if it works I'll send you! I added you as a friend here on Steam, let me know if I can help with anything.

Thanks once more <3 Lots of success for your endeavors!
Wipe  [developer] 22 Jan, 2022 @ 10:06am 
Originally posted by 変理縣:
I would also like to mention that I had some people complaining about your mod not working properly with smaller resolutions, I don't believe this is fixable considering that the game itself gets weird in low resolutions
Hah. ExtraMapSymbolsUI started exactly to address that.
It sliiightly resizes near all symbols UI elements, to fit that one extra row of symbols, and allows to change the number of colums used for symbols, which helps with decreasing height of the whole thing at a price of increased width. Don't think i really can do more than that.
< >
Showing 1-3 of 3 comments
Per page: 1530 50