magicalmira Posted July 4, 2024 Posted July 4, 2024 (edited) I have insectiphobia and I'm trying to create a mod that replaces the names and icons/models of all the bugs in the game with "fish food." I'm completely new to modding Zomboid so I found some related posts but no definitive answer, and using the recommendations to those questions, I came up with my own mod, but it's not working. I started by creating a mod folder with mod.info, poster.png, and a media folder in my User/Zomboid/mods folder. Inside the media folder are scripts and textures folders. In scrpits, I have a script called replace.txt, and in textures I have Item_FishFood.png. So the file structure can be written like this: User/Zomboid/mods/insectiphobia insectiphobia/mod.info insectiphobia/poster.png insectiphobia/media media/scripts media/textures scripts/replace.txt textures/Item_FishFood.png I'm doing a test with chips because they're a food and included in the starter kit. I've been testing variations, ex: I used the base module, changed the display name, icon, and world static model parameters, and added the override parameter, but left all the other information the same as base game. module Base { item Crisps { DisplayName = TEST, DisplayCategory = Food, Type = Food, Weight = 0.2, Icon = FishFood, CantBeFrozen = TRUE, Packaged = TRUE, HungerChange = -15, Calories = 720, Carbohydrates = 72, Lipids = 45, Proteins = 4.5, CustomEatSound = EatingCrispy, WorldStaticModel = FishFood, Override = true, } } I enabled the mod in game and have been testing it by creating new save files with the starter kit option checked, but every time I load in I still see "Chips" and the chip icon. Any ideas on how I can get it to work? Edited July 4, 2024 by magicalmira formatting
Hugo Qwerty Posted July 4, 2024 Posted July 4, 2024 Items don't typically use the DisplayName value specified in the config, they use the translation - which you can find in: \media\lua\shared\Translate\EN\ItemName_EN.txt (for English) If no translation is present then the game will default to the DisplayName You can make your own translation file, just copy the format from vanilla and change it to whatever you want. You only need to include the changes, you don't need to copy the whole thing. Not sure why the icon isn't working. I know there are 4 types of 'Chips', so maybe the game gives you a random one and you got one that you hadn't overwritten? You can also modify vanilla items without overwriting them, here is an example from a mod I wrote - I've simplified it slightly (I wasn't actually modifying the Stone Axe). local sm = getScriptManager() local weaponName = "Base.AxeStone" local weapon = sm:getItem(weaponName) if weapon then weapon:setMinDamage(.5) weapon:setMaxDamage(1.25) weapon:setConditionMax(13) weapon:setConditionLowerChance(20) weapon:setDoorDamage(20) weapon:DoParam("TreeDamage=20") weapon:DoParam("CriticalChance=5") weapon:DoParam("critDmgMultiplier=2") else print("Error: unknown weapon - ", weaponName) end Available functions can be found here on the link below, you would want something like setIcon("FishFood") (I assume, I've never changed an icon in this way) https://zomboid-javadoc.com/41.78/zombie/scripting/objects/Item.html magicalmira 1
magicalmira Posted July 4, 2024 Author Posted July 4, 2024 1 hour ago, Hugo Qwerty said: Items don't typically use the DisplayName value specified in the config, they use the translation - which you can find in: \media\lua\shared\Translate\EN\ItemName_EN.txt (for English) If no translation is present then the game will default to the DisplayName You can make your own translation file, just copy the format from vanilla and change it to whatever you want. You only need to include the changes, you don't need to copy the whole thing. So I added the lua/client/Translate/EN/ItemName_EN.txt folders/file to my media folder, and like you said, there are 4 types of chips, so I found and included all 4 in the translation I copied from the base file. I also found the other chips and added them to the original script file, but it's still not working. I have to be doing something wrong, right? But I can't think of what it might be... :c
Hugo Qwerty Posted July 5, 2024 Posted July 5, 2024 14 hours ago, magicalmira said: So I added the lua/client/Translate/EN/ItemName_EN.txt folders/file to my media folder, and like you said, there are 4 types of chips, so I found and included all 4 in the translation I copied from the base file. I also found the other chips and added them to the original script file, but it's still not working. I have to be doing something wrong, right? But I can't think of what it might be... :c \media\lua\shared\Translate\EN\ItemName_EN.txt ItemName_EN = { ItemName_Base.Cockroach = "Fish Food", ItemName_Base.Grasshopper = "Fish Food", } \media\lua\server\Insects.lua local sm = getScriptManager() local insects = { "Base.Cockroach", "Base.Grasshopper" } for i=1, #insects do local name = insects[i] local insect = sm:getItem(name) if insect then insect:DoParam("worldStaticModel=Snackcake_SnoSpheres") insect:DoParam("icon=Snackcake_SnoSpheres") else print("Not found: " .. name) end end This works, the only things you need to change are: 1) Swap Snackcake_SnoSpheres for whatever you want. 2) Add all the insects to the insects table 3) Add more translations You may want a different translation for Grasshopper, Cockroach, & Cricket as they can be used in stick traps as well as for fishing. magicalmira 1
magicalmira Posted July 7, 2024 Author Posted July 7, 2024 (edited) So I think I found out what was wrong, I had copied and pasted the mod.info and poster.png from the example mod so it had the same ID as it (silly, I know!) Your code didn't work for me until I updated the info and added a random test ID. Btw, I wanted to make sure, is this mod server side or client side? Since I'm the one with the phobia I want to make sure this mod is only on my side so I don't confuse my friends, if possible. As far as I understand I just use "client" instead of "shared" for that folder, but when I did that in testing it didn't work. Edited July 7, 2024 by magicalmira initially didn't work, did more testing and changed reply
Hugo Qwerty Posted July 7, 2024 Posted July 7, 2024 No idea how to make a mod that only works for 1 player on a server. If you move all files to /client/ all players will still install them when they join the server. You might be able to do something to hide them from the foraging, e.g. lock all insects behind a new magazines, then give everyone the magazine to read - except you. I did something similar to hide all the trash items, I miss out on some xp but its worth it to not be repeatedly alerted about a completely useless item. This wouldn't hide the item though, you'd still find cockroaches in bins, & if your friends wanted to troll you by leaving insects everywhere they could. magicalmira 1
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