RobertJohnson Posted October 1, 2013 Posted October 1, 2013 Howdy, Here's a description of how to add your mod in PZ. First, the folder tree :zomboidFolder |-- mods |-- MyMod/ |-- poster.png |-- mod.info |-- media/ |-- lua/ |-- lua1.lua |-- UI/ |-- myUI.lua |-- sounds/ |-- myCustomSound.ogg |-- textures/ |-- Item_customItem.png |-- Prof_customProfession.png |-- ui/ |-- Traits/ |-- trait_customtrait.png |-- scripts/ |-- myCustomItems.txtLet's explain now 1. The very important mighty mod.info The mod.info file will contains a full description of your mod, along with other great stuf, here's an example :name=My custom mod v1.7id=RJCustomModposter=poster.pngdescription=Here's a description of my awesome custom mod.require=Utility, CustomMod2url=http://theindiestone.com/forums/index.phpname = the name displayed in the mod selector.id = an unique ID you need to find, it'll be used for the require stuff for example.poster = the .png image which be displayed when someone click on your mod in the mod selector.description = a full description of your mod.require = you can add a list (separated by ",") of id of mods which are required for your mod to works, for example if you want to add an Utility mod you use, or if you just want to make change on another mod, etc.url = the url of your mod (indiestone forum, xeno-mods or pz-mods only), it'll be displayed as a button under the poster, click on it will open your default browser to this url. The only essential tag is "name". All the others are optional and can be left out. Here come my über paint skillz to show you how it look like in game : Please don't be shy, you can compliment me on my paint skillz, I know I pwn everything. 1.1 A bit more stuff about the require. The require work recursively, for example if you have 3 mods, mod A require mod B, mod B require mod C. If you don't have the mod C, you couldn't activate the mod A, a red cross will be displayed if you miss some of the mods required :Here, my test1 mod need the test2, I have it, but the test2 require exampleMod, which I don't have, so I can't use the test1 mod. If now I have all my mod (A,B and C), and I double click on the mod A, the mod B and C will also be activated.And then if I disable the mod B, the mod A will also be disabled, because it require the mod B to work. Then, the require mod is also used to load your mod in a certain order, for example if mod A require mod B, then mod B will be loaded in the game before mod A. Remember, you have to use the ID of the mod, not the name or the folder's name. 2. The lua files. The lua files are loaded after the vanilla lua files, which mean you can override the existing lua file (example, I make a new UI/ISLabel.lua file).All the .lua extension file will be loaded, even if they're inside folders. 3. Customize your items.txt ! You can add custom items for your mods, you just have to place them inside /scripts/ folder.You can override existing items or make new one.Here's an example : module custom { item myNewItem { HungerChange = -10, Weight = 0.1, Type = Food, DangerousUncooked = TRUE, DaysTotallyRotten = 21, DisplayName = Egg, Icon = customEgg, DaysFresh = 14, }} Here I created a new item (please note I used the module custom, but I could use the module Base if I wanted to). Now I want to override existing item, if you make a file named items.txt, it'll override the existing items.txt, it mean we gonna load YOUR items.txt and not the vanilla one, so be carefull to do it, use this only if you want to replace EVERY ITEM or a bunch of them.If you want to modify only some items, here's the solution :You make a file named as you want (except items.txt), like customItems.txt, and inside it, do that : module Base{item Egg { HungerChange = -50, Weight = 5, Type = Food, DangerousUncooked = TRUE, DaysTotallyRotten = 21, DisplayName = Egg, Icon = customEgg, DaysFresh = 14, }} Here I overrided the Egg, by setting the module Base (which is the one in items.txt).Now the egg will weight 5 and give 50 hunger reduction. 3. The custom textures In the /textures/ folder, you can add your custom textures.You can add textures for items, trait and profession. 3.1 The custom item icon To add a custom item icon, you just need to add the image in the textures/ folder, named like that :Item_iconname.pngHere's an example of my item : item myNewItem { HungerChange = -10, Weight = 0.1, Type = Food, DangerousUncooked = TRUE, DaysTotallyRotten = 21, DisplayName = Egg, Icon = customEgg, DaysFresh = 14, } So my item icon will be textures/Item_customEgg.png. You also can override items icon, for example just place a textures/Item_Axe.png file, and this one will be taken instead of the vanilla one. 3.2 The custom trait icon To add a custom trait icon, you have to add your image in the ui/Traits/ folder like this :ui/Traits/trait_yourtraitid.pngThe trait ID is the first parameter when you add a trait, it need to be in lower case, example :TraitFactory.addTrait("Athletic", getText("UI_trait_athletic"), 6, getText("UI_trait_athleticdesc"), false);To add an icon for this trait, I need to add a ui/Traits//trait_athletic.png image, the name is Athletic, but as I said, the name of the image have to be in lower case.You can also override the existing one, for example just put in your mod folder an new ui/Traits/trait_brave.png, and there you go, the brave trait will now take your image instead of the vanilla one. 3.3 The custom profession icon It's almost the same as the trait, in your textures/ folder, you image have to start by "Prof_", example :Prof_professionIcon.pngThe icon of the profession is the last parameter (no need to be lower case on this one) :ProfessionFactory.addProfession("fireofficer", getText("UI_prof_fireoff"), "Prof_FireFighter");In this case,my .png file will be : textures/Prof_FireFighter.png. You can add new one and override existing one. And here you go for now Please, don't hesitate to suggest new stuff for the mod.info or the mod loader, and tell me if there's any bugs Oh also, everything will be in for the next steam version only. ManoGihl, RoboMat, Realmkeeper and 5 others 8
RoboMat Posted October 1, 2013 Posted October 1, 2013 I love you <3 But your paint skills are pretty bad ...
RegularX Posted October 1, 2013 Posted October 1, 2013 Sweet! Thanks RJ, the modloader is looking awesome. I can pick up testing Xmod and SICmod with the next Steam build. The require and new profession stuff is looking great.
Kenpachi™ Posted October 2, 2013 Posted October 2, 2013 Waiting for custom textures of weapon, player and zombies
Kenpachi™ Posted October 3, 2013 Posted October 3, 2013 Why /mod/media/scripts/*.txt does't work (err)?
RobertJohnson Posted October 3, 2013 Author Posted October 3, 2013 Why /mod/media/scripts/*.txt does't work (err)? As I said in the last line of the OP, it'll be up for the next version I post it now, so people can start to change their mod a bit if they want to use the mod loader. Kenpachi™ and RegularX 2
LeoIvanov Posted October 6, 2013 Posted October 6, 2013 Wouldn't it be more user friendly if in "require" field it displays the "name=" of the mod , instead of "id="? It'd still look for "id=" in the general game folder, but it'll do that off-screen, so it doesn't scare away those who aren't really into mods yet. That would look atleast a bit more customer-friendly, instead of modder-friendly. The game is, after all, made for customers The way it will look like :"requires : Test 2 by RobertJohnson v1.5"instead of"requires : test2" UNLESS it already works like that And I'm just a noobinator that needs some sleep and coffee. DicheBach 1
RoboMat Posted October 6, 2013 Posted October 6, 2013 The id is not the same as the name field quiet often. The reasoning behind it is pretty simple. When you first release your mod you choose a name AND a (unique) id. The name can be changed on any release whereas the id should stay the same for all eternity. Why? Because other modders can "require" your mod and be sure that it always will be true even if you update your mod.Release:name=My Awesome Mod (2.0.0)id=rm_MyAwesomeModUpdate:name=Even Awesomer Mod (2.9.3)id=rm_MyAwesomeModOf course this still relies on the human factor called modder, but I'm sure that if people don't follow the rule no one will require their mods for long BESIDES:The only essential tag is "name". All the others are optional and can be left out.It is optional
LeoIvanov Posted October 6, 2013 Posted October 6, 2013 The id is not the same as the name field quiet often. The reasoning behind it is pretty simple. When you first release your mod you choose a name AND a (unique) id. The name can be changed on any release whereas the id should stay the same for all eternity. Why? Because other modders can "require" your mod and be sure that it always will be true even if you update your mod.Release:name=My Awesome Mod (2.0.0)id=rm_MyAwesomeModUpdate:name=Even Awesomer Mod (2.9.3)id=rm_MyAwesomeModOf course this still relies on the human factor called modder, but I'm sure that if people don't follow the rule no one will require their mods for long BESIDES:The only essential tag is "name". All the others are optional and can be left out.It is optional I'm sure you didn't fully get what I mean right there What I wanted to say was, the "unique" ID can still be mandatory to load one of the mods, but for the sake of simplicity, wouldn't it be better if instead of redirecting to "You need this ID with weird name with no spaces" it would redirect you to "You need this awesome mod version 1.5 that has this unique ID", kind of VISUALLY showing you that you need the "Name" of the mod, but in the end actually requiring the "ID" of it? So, in your example, it would look like : require :My Awesome Mod (2.0.0) (which is)id=rm_MyAwesomeMod It'll still require that specific ID, but you'll know what that actually means, so instead of browsing through countless forums finding what that "ID" actually is, you can simply look for the name of the mod.
RoboMat Posted October 6, 2013 Posted October 6, 2013 Yeah but that's what I meant.If you dorequire: My Awesome Mod (2.0.0.)and the mod has already been updated toname=My Awesome Mod (2.0.1.)it won't be able to find that mod.Unless I'm really not getting what you mean Besides searching for the id of the mod is as easy as checking that mod's "id" in the mod.info
LeoIvanov Posted October 6, 2013 Posted October 6, 2013 Yeah but that's what I meant.If you dorequire: My Awesome Mod (2.0.0.)and the mod has already been updated toname=My Awesome Mod (2.0.1.)it won't be able to find that mod.Unless I'm really not getting what you mean Besides searching for the id of the mod is as easy as checking that mod's "id" in the mod.info It will still require the specific ID (Which you don't really change after update), but visually it will tell you that it requires "My Awesome Mod" It's easy to search for "specific" id once you have the MOD installed on your PC, but what if you download some mod, and it will require some ID, that looks like this : "id=rm_am1". Then you'd have to search the forums for hours to find out which of the mods have that specific "rm_am1" ID. Instead, it will display the NAME that you need, but in fact, it will STILL require that specific ID. It is just to simplify things, I am not asking the "require" to change from specific ID to specific mod name, as those do tend to change. Marbaus 1
RobertJohnson Posted October 6, 2013 Author Posted October 6, 2013 THe ID can be the same as the name, without the version number... Like id=MyAwesomeMod So you know when reading the ID, the mod it use
Kidlonewolf Posted October 27, 2013 Posted October 27, 2013 Where or how can you find mod.info if it isnt included with mods?
RoboMat Posted October 27, 2013 Posted October 27, 2013 Where or how can you find mod.info if it isnt included with mods? You have to write one yourself like explained in the op
Zeblote Posted December 6, 2013 Posted December 6, 2013 You should add that creating a file simply called "items.txt" in the "scripts" folder will make the mod fail (main menu will not load). This just took me a full hour to figure out :v
RobertJohnson Posted December 7, 2013 Author Posted December 7, 2013 From OP : Now I want to override existing item, if you make a file named items.txt, it'll override the existing items.txt. So it's on purpose, if you want to override many items... Tho you'll need the base items, or you also have to modify the whole loot distribution to avoid any bug
Zeblote Posted December 7, 2013 Posted December 7, 2013 From OP : Now I want to override existing item, if you make a file named items.txt, it'll override the existing items.txt. So it's on purpose, if you want to override many items... Tho you'll need the base items, or you also have to modify the whole loot distribution to avoid any bug ohohoh, I didn't read everything! :c
chthonic Posted December 7, 2013 Posted December 7, 2013 RJ, how do I override a recipe from module Base?http://theindiestone.com/forums/index.php/topic/3986-replacement-of-a-recipe-in-base-module/Help, if you have time, please
GreenFabre Posted December 9, 2013 Posted December 9, 2013 Hi. So I just place any mods I download in the mods folder? I just want to be extra careful. Thank you
ROFLMAOmatt Posted December 18, 2013 Posted December 18, 2013 Am I putting the zipped folder into the mod file or something else? I followed the example mod folder thing but all that keeps showing up in the mod gui in the game launch is the example mod. Help?
RoboMat Posted December 18, 2013 Posted December 18, 2013 Did you make sure you only used updated mods? You need to drop the unzipped folder there. Maybe this will help you: http://theindiestone.com/forums/index.php/topic/1395-how-to-install-uninstall-mods/
michael Posted January 19, 2014 Posted January 19, 2014 The trait ID is the first parameter when you add a trait, it need to be in lower case, example :TraitFactory.addTrait("Athletic", getText("UI_trait_athletic"), 6, getText("UI_trait_athleticdesc"), false);The icon of the profession is the last parameter (no need to be lower case on this one) :ProfessionFactory.addProfession("fireofficer", getText("UI_prof_fireoff"), "Prof_FireFighter");Hey RobertJohnson, great Tutorial. However, I have reposted the quoted the two aspect from your post that are a little contradicting. First, you mention it needs to be lower case but in the example you use capital "Athletic". Second you say no need to be lower case but you then you use lower case.
RoboMat Posted January 19, 2014 Posted January 19, 2014 Hey RobertJohnson, great Tutorial. However, I have reposted the quoted the two aspect from your post that are a little contradicting. First, you mention it needs to be lower case but in the example you use capital "Athletic". Second you say no need to be lower case but you then you use lower case. IIRC that was during a time when the modloader differentiated between lower and uppercase for the icon loading. Not sure if it still works like that. The profession in my lockpicking mod works fine so far - I can post the code later if I don't forget.
hansel Posted March 16, 2014 Posted March 16, 2014 Can someone help me? I don't seem to be able to install mods for this game ( i'm on a mac ) , I tried Users/User/Zomboid/Mods <- put mod file there but still I can't see the mod when I go into the game in mods section. I really need help I'm literally breaking my head trying to think of a solution. ( i'm on steam ) Also sorry for my bad english.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now