#mod_development
1 messages ยท Page 11 of 1
I find many of them when I play ๐
Different item
They replaced ""Base.DigitalWatch2" with
WristWatch_Right_DigitalBlack & WristWatch_Right_DigitalRed
Newer are these ones
tyvm, this is very useful
Left/Right for each color and style
there's military/classic too
@sour island ugh if you remember my mod, i'm still having issues getting the crafting recipe to work, and drinking the recipe result's item makes it not replace on use
Why did they not just remove the old item unless it's being used as a Parent
?
Because removing the item like that would break saves
Had a similar issue with EHE
Makes sense
alot of the items/menus for clothing have IDs pointed to objects
love coding
The game does need a way to grab obsolete items that already exist though
afaik obsolete only applies on creation
It would be nice to do: force drop/unequipped from players /transfer out of containers -> delete
chuck do you know any reason this problem could even happen? maybe even a fix for it?
There is a rung in hell dedicated to Coding, and it is a place we will all be going to lol
coding is just a satanic ritual at this point
What do you think Egyptian hieroglyphs are?
Egyptians trying out coding in the real xD
hell yeah
fun fact the code i used for the recipe is a copied code for advanced recipes, the only thing i did was chnage it to my id
you mean evolved recipes?
only one, for trying to drink the item and then it not being able to replace it
yeah that
what does your recipe look like
in the folder they're called advanced
gimme a sec i'll send the code
What folder?
evolvedrecipes.txt ?
ProjectZomboid\media\scripts\evolvedrecipes.txt
Is there a resulting item called hotdrink canteen?
yeah from there i took the code for HotDrink since this is suppost to be having a bigger version of hot drink that includes my modded item
yes
show that too
You have not got a incorrect ID or something then from the original if you are basing it off of that as a template
item HotDrinkCanteen
{
DisplayName = Hot Drink in Canteen,
DisplayCategory = Food,
Type = Food,
Weight = 1.7,
Icon = HotDrinkCanteen,
GoodHot = true,
IsCookable = true,
ReplaceOnUse = AluminumCanteenEmpty,
MinutesToCook = 20,
MinutesToBurn = 60,
ThirstChange = -20,
UnhappyChange = -10,
CustomContextMenu = Drink,
CustomEatSound = DrinkingFromMug,
StaticModel = AluminumCanteenEmpty,
WorldStaticModel = AluminumCanteenFull,
Tags = AlcoholicBeverage;LowAlcohol;HerbalTea;CoffeeMaker,
}
i don't think so atleast
for some reason trying to cook it also emediatly burns it-
are canteens 100% custom items?
hey, what happens in singleplayer with Client and server ? its still the two of them, or all mod files are given to client, or what?
Is there a model for both empty and full?
cause I doubt it
StaticModel = AluminumCanteenEmpty, WorldStaticModel = AluminumCanteenFull,
- wouldnt make sense here
models not yet since i first wanted the code to even work but that hasn't caused any issues whatsoever for any of the other items
that'd be the only thing to occur to me
how do you mean that
just placeholder
have you tried removing those 2 lines then
static model is used for inhand animations btw
ah the empty version will be opened
i wanted to make 3 models for each canteen
item HotDrinkCanteen = full though
true
alright
ctrl+f 'stack trace'
copy the line or two above stack trace and to where the log goes back to normal
If you're not sure use https://pastebin.com/
Hello there! i ve been experiencing crashes in my game, tried unsubbing a few unneccessary mods,but it still keeps happening, please help me save my playthrough :/
Not sure what infos you need about my mods and else,but im at your disposal
thanks in advance
or help me create a fully safe working modpack that i like,im okay with that too
and i will forget about that playthrough
hey everyone, is there a mod or a way of getting that chainlink fences become indestructible? like, the player built ones
want that for RP purposes
onWeaponHitCharacter that's server side event?
welp i thought so. but why it'd an item in my files
item AluminumCanteenEmpty
{
DisplayCategory = WaterContainer,
Weight = 0.1,
CanStoreWater = TRUE,
Type = Normal,
DisplayName = Empty Aluminum canteen,
ReplaceOnUseOn = WaterSource-AluminumCanteenFull,
Icon = AluminumCanteenEmpty,
StaticModel = AluminumCanteenEmpty,
WorldStaticModel = AluminumCanteenEmpty,
}
like it's literally in the same file
you have the module as Base or WTC
MTC
also why would it be looking for empty's minutes to cook?
no idea
before you ask why, i don't know all i did was copy the start of how items are listed in base files
Best thing would be to back up the save and make a copy of it that you are using, and put it on your desktop.
Then load up the game and disable all of the mods and work your way through, enabling each mod at a time and until you find the culprit.
Then once you have found that, uninstall that one and put back your backup save into the folder, that way the save would have only had one mod removed from an existing save.
You should note though, you should not be installing mods mid way through your game to be safe, or unless the mod got updated, in which case, it wouldn't matter anyway.
Also make sure to look on the mod pages for anything being out of date.
hey,thanks for your answer first of all
Np
in the server options you can make player built structures have super high durrability
@wooden talon It is up to you, it is your save game
maybe its easier to build a new modpack
that works 100%
but i also need help with that
What happens in singleplayer with Client and server .lua files ?
singleplayer doesn't load server scoped lua
but zombies still break it, i want it to be unbreakable
It does but I'm sure it doesn't run like if it were a server.
It does when you load your world.
๐ค I threw print statements in client/shared/server and never saw prints from the server side anywhere in my logs
for testing my mod.... am i safe to do it in the default game? or is there likea test environment i can download or anyithng?
you can test it in the default game, or using the debug mode by adding "-debug" to the launch settings on steam
the only bad thing that can happen are crashes or freezes
and another question; i guess how do i go about testing it? do i need to upload to workshop to be subscribed for it to register as a mod?
you can add your mod directly to your game, by putting it inside users/zomboid/mods
but if you want to test it with friends, you can upload it privately on the workshop
currently just need solo testing, but thank u <3
I had a dream someone on this server said the name of the mod I'm making is dumb and doesn't make sense, then suggested other options, I just thought about it and looked it up on the server (didn't realize it was a dream yet), and then remembered I haven't really told anybody about the mod yet
Weirdly creepy experience lol
fear of failure appeared in your dreams
keep working at it, best of luck with the mod my guy
you should give yourself a break sometimes
HOLY FUCK PROGRESS
whatd u do
congrats
THE RECIPE ATLEAST HALF EXISTS NOW
also, you can use the windows snipping tool to take a picture
oh i'm aware+
my laptop just doesn't like it and throws a temper tantrum xd
aka freezes for a good minute or so
oh weird
eh this laptop is just not the best
god evolved recipes are a pain to code
contextOption = context:addOption("Do This", worldObjects, ThisScript.DoThis(item), player)
For some reason, "(item)" after ThisScript.DoThis makes it so the method is immediately called once you right click, but it needs the item for the method to work
Having it just be ThisScript.DoThis works fine but obviously still with the problem of not sending the item variable to the method
Forget all that, had this problem for so long in many different situations and just realized it should be "ThisScript.DoThis, item, player" the second I asked lol
Yeah you can't store referential functions with arguments afaik
It seems like a lot of modders don't know that server Lua is very limited.
Wait what?
local x = function() end
?
contextOption = context:addOption("Do This", worldObjects, ThisScript.DoThis(item), player)
what languages can you do that. In every one that I can think of, using the brackets calls the function as you are trying to provide the result of the function
I've never seen a way to pass a function, which partially filled arguments, although I don't exactly claim to be some sort of expert on the matter. Just curious if that is ever possible.
ah wait, in my mind, your message and delta mango's message got meshed together. Thought you were saying that Lua was limited in that it was a language that couldn't do that, implying that there are languages that don't have this limitation
hey whats the status of discord integration?
does it work? if so, that's really all i need
there's some mention of it in the java and settings
I know Dane has alot of outgoing data from his server
He may have discord integration
Apocalypsium, Serveur francophone hardcore Project Zomboid.
๐
I thought he had randomized jobs, why is burger flipper still the most lol
hahahah
ill look int oit
my thought is creating an in game mod that announces in game when it's night time and when it's day
using PZ's Discord server integration, the message is sent to a private discord channel
a discord bot reads for the chat message. if it sees it, it changes the server icon
to a night/day version of the server art
Can bots change server icons?
what about the amount of doctors?
Uhhhh what?
Sorry. Not following.
we're checking that now ๐ i hope so
That's storing a LuaClosure in Kahlua which is the Java adapter type for Lua's functions.
Something like:
local x = (function() return 'foo' end)()
.. would store the result.
Maybe I'm not getting the context of what's being asked lol.
Yeah. I thought you were saying that the function itself as the assignment is the result of invoking it.
He is adding a function reference inside of contentMenu add function - he included arguments
Ok cool nvm.
I think we both misunderstood what the other was saying
Had my fair share of boxing and invoking.
though you were using the word function as a placeholder name not as an actual function
so my bad
Hell I've done things like this in Lua:
local bar = loadstring('return _G["foo"]')()
Surprisingly works when invoking some Java stuff.
Heheh.
I forget the context
Typescript
Haha
The Lua lookup table for imports in PipeWrench has to do some whacky stuff to get imports working before Lua files are even loaded btw so that's more whacky.
Before the game loads them?
CHUCK
It loads and rebuilds the lookup table prior yeah.
I FOUND MY MISTAKE
?
caps my dude
progress is being made xd
so you had "canteen" instead of "mtc.canteen"
i am too excited about these simple things
yep
whats the current error?
well as you can see the recipe has no ingredients that can be added
eventhough the tags are attached to the result item like it should
@sour island PipeWrench environments injects boilerplate to the end of the generated Lua. (Specifically this example)
-- PIPEWRENCH --
if _G.Events.OnPipeWrenchBoot == nil then
_G.triggerEvent('OnPipeWrenchBoot', false)
end
_G.Events.OnPipeWrenchBoot.Add(function(____flag____)
if ____flag____ ~= true then return end
FMODSoundEmitter = ____PipeWrench.FMODSoundEmitter
getSoundManager = ____PipeWrench.getSoundManager
isGamePaused = ____PipeWrench.isGamePaused
end)
----------------
It then works with a rebuilt lookup table and executed event.
The chicken or egg issue doesn't matter thanks to this fix.
So yeah fun stuff. Obliterates loading-order limitations of the current Lua solution.
loading-order limitations?
can you show what you have right now for the recipe?
Yes. It has to do with the TSTL compiler.
just the recipe or also the result item?
recipe should be enough
module Base
{
/*************RECIPES*******************/
evolvedrecipe HotDrinkCanteen
{
BaseItem:MTC.AluminumCanteenFull,
MaxItems:3,
ResultItem:MTC.HotDrinkCanteen,
Cookable:true,
AddIngredientIfCooked:true,
AddIngredientSound:AddItemInBeverage,
Name:Prepare Beverage in canteen,
CanAddSpicesEmpty:true,
}
}
Imports in Lua are references however TSTL stores imports from Typescript as final local variables on the top-level so if I update the library imported the values won't change.
So imports from PipeWrench are reimported following OnGameBoot.
evolved recipes are funny to code. because it makes no sense whatsoever
which in term means that you can perfectly load every mod in a certain preset way, right? or am i understanding wrong?
In a way you're correct.
i have minimal coding knowledge so i have to kind of guess off of what i udnerstand
It has to do with resolving references of files that loads after yours does in a Typescript environment.
Lua uses require and Typescript import
Here. I'll give a file for an example.
so wait does that mean it makes it so you don't accidently make a file be exclusively run when trying to add an item?
Im trying to write a simple mod to modify some trait costs. does anyone know where I can find the trait names I would need to use with TraitFactory?
we love borked files
could you send an example of one of the items you have added to the evolvedrecipe?
hwo do you mean that?
Is it possible to get the square straight from a world item object?
i just added the standart tags to the result item just like every other evolved recipe
one of the ingredients that are meant to be shown for that evolved recipe
i have a list, it should be everything that can be used for hotdrink
Or a container I guess
ok can you show the code you are using to do this
- black sage
- bouillon cube
- bourbon
- brown sugar
- cocoa powder
- coffee
- common mallow
- dandelions
- ginger root
- ginseng
- honey
- lemongrass
- lime
- milk
- mushrooms x 7
- nettles
- opened canned condensed milk
- red wine
- rose hips
- strawberries
- sugar
- sugar packet
- tea bag
- thistles
- violets
i wrote them down, and the result item has the tags, AlcoholicBeverage;LowAlcohol;HerbalTea;CoffeeMaker,
i just have this and the recipe. i already guessed i was missing smth but i don't know what
ok so for example, have you added the evolvedrecipe to be used for the honey Item
@sour island You can see what's going on with that file.
uhhhhhh, deosn't the tag do that?
The only thing you don't see is the Lua lookup table being built.
no
item Lettuce
{
DisplayName = Lettuce,
DisplayCategory = Food,
Type = Food,
Weight = 0.2,
Icon = Lettuce,
EvolvedRecipe = Sandwich:3;Burger:3;Salad:5;Sandwich Baguette:3,
FoodType = Greens,
DaysFresh = 3,
DaysTotallyRotten = 5,
HungerChange = -15,
ThirstChange = -7,
Calories = 54,
Carbohydrates = 10.33,
Lipids = 0.54,
Proteins = 4.9,
StaticModel = RoundFood_Green,
WorldStaticModel = Lettuce_Ground,
}
here is the vanilla lettuce item. you need to add in "HotDrinkCanteen":# for the item you want to be able to add to the evolved recipe
the tag is just a tag
so could i now just copy all the items into my script, add the evolved recipe, and it won't mess stuff up cause it's techincally double?
Imports and global calls in Lua can get mighty fun.
what would be the import equivalent of
require('NPCs/MainCreationMethods');
if im using pipewrench/ts?
what you need to do is use the doParam function on the item, to modify the evolvedRecipe field to add in values for your evolved recipe. Im actually not sure how you can do a clean append though. the doParam thing is a relatively recent thing, but it is the proper way to modify items
import { addEventListener } from "PipeWrench";
import { MusicPlayer } from "./MusicPlayer";
export class MusicTrack {
constructor() {
addEventListener('OnTickEvenPaused', () => this.update())
}
update() {
}
}
can anyone help/suggest a fix for me? i enabled my mod in PZ, and then the game wouldnt reload lua and eventually crashed.
here is my source: https://github.com/AvocadoSteam/1-More-Backpacks
here was the error:
https://pastebin.com/4qxDRgFT
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
hmm i'm sure could explain how doParam works
im looking at the example from the pipewrench template and see how I import from pipewrench, im just a little confused what a one to one example compared to a lua version would look like
import { BaseGameCharacterDetails } from "PipeWrench"
BaseGameCharacterDetails.DoTraits()
@thin hornet could you explain how doParam works?
ty, and also ty for pzpw
Not 100% sure what I'm looking at
doParam changes script item params at runtime
so how would i apply it?
would i just doParam and the the file for an item with the changed values?
Does the evolved recipe for HotDrink include all those herbs?
yes
check how ItemTweaker works its the best example to use doParam
So why are you worried about params now?
i wrote them down for if i had to manually add them and well here we are
oh how i meant that is i have to still ad those to my hotDrink
since the item itself needs a tag of like "used in:" if put into non code language
alright thanks
I'm trying to print a square, and then print it again after sending it another function, but it's changing the item type in between somehow
I've been guess and checking for like an hour, this is the most painful experience of my life lol
like printing all its fields?
Just printing the square itself, it first prints as zombie.iso.IsoGridSquare and somehow turns to zombie.inventory.types.Food
I can't tell if it's an abnormal occurrence or if I'm just dumb
Probably both
O.o
[11-08-22 10:02:23.062] LOG : Mod , 1660237343062> loading MoreBackpacksMod.
[11-08-22 10:02:23.065] LOG : Mod , 1660237343065> mod "MoreBackpacksMod" overrides media/fileguidtable.xml.
[11-08-22 10:02:23.075] LOG : General , 1660237343075> translator: language is EN.
[11-08-22 10:03:24.194] ERROR: General , 1660237404194> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method)..
[11-08-22 10:03:24.195] ERROR: General , 1660237404195> DebugLogStream.printException> Stack trace:.
[11-08-22 10:03:42.721] LOG : General , 1660237422721> EXITDEBUG: RenderThread.isCloseRequested 1.
[11-08-22 10:03:42.721] LOG : General , 1660237422721> EXITDEBUG: GameWindow.exit 1.
[11-08-22 10:03:42.721] LOG : General , 1660237422721> EXITDEBUG: GameWindow.exit 2.
[11-08-22 10:03:42.722] LOG : General , 1660237422722> EXITDEBUG: GameWindow.exit 3.
[11-08-22 10:03:42.739] LOG : General , 1660237422739> EXITDEBUG: GameWindow.exit 4.
[11-08-22 10:03:42.739] LOG : General , 1660237422739> 1660237422739 znet: Java_zombie_core_znet_SteamUtils_n_1Shutdown.
[11-08-22 10:03:42.791] LOG : General , 1660237422791> GameThread exited..
[11-08-22 10:03:42.791] LOG : General , 1660237422791> EXITDEBUG: GameWindow.exit 5.
can anyone tell me wtf this error means
here is what I have found in a mod I am working in
local scriptItem = ScriptManager.instance:getItem("Base.TreeBranch")
if scriptItem then
scriptItem:DoParam("Tags = Box12")
end
but in your case you aren't trying to modify the tags, you want to instead use "evolvedrecipe = blahblah blah"
sooooo
and from what I can tell, there isn't a way to append onto the end of the field, so you need to just write the whole thing. which isn't great because it would remove other evolved recipes added by other mods, but I can't really think of a way to do it other than doing to very annoying string parsing crap
local scriptItem = ScriptManager.instance:getItem("MTC.Myitemname")
if scriptItem then
scriptItem:DoParam("Evolvedrecipe = HotDrinkCanteen X(number)")
end
?
local scriptItem = ScriptManager.instance:getItem("MTC.Myitemname")
if scriptItem then
scriptItem:DoParam("Evolvedrecipe = HotDrinkCanteen:#;Sandwich:3;Salad:3;
cont")
end
ah okay
you need a colon between the recipe name and the number. the number decides the max hunger, you are transfering from the ingredient, into the evolved recipe. And you need to use a semi colon for all the other evolved recipes that originally belonged to that item
ah alright i think i understand
what about things that are counted as a spice? like ginseng?
they are the same
what i mean is won't i have to add more numbers? since some items don't just chnage hunger
[11-08-22 10:03:24.194] ERROR: General , 1660237404194> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method)..
[11-08-22 10:03:24.195] ERROR: General , 1660237404195> DebugLogStream.printException> Stack trace:.
what could cause this error
ginseng for example adds endurance to the drink
I think they all actually have a hunger, but the spice parameter makes it so it isn't used
like look at the ginseng item
item Ginseng
{
DisplayName = Ginseng,
DisplayCategory = FirstAid,
Type = Food,
Weight = 0.1,
Icon = Ginseng,
EvolvedRecipe = Beverage:1;Beverage2;HotDrink:1;HotDrinkRed:1;HotDrinkWhite:1;HotDrinkSpiffo:1;HotDrinkTea:1,
Spice = true,
FoodType = NoExplicit,
EnduranceChange = 2,
Tooltip = Tooltip_Ginseng,
HungerChange = -1,
Calories = 0.1,
Carbohydrates = 0,
Lipids = 0,
Proteins = 0,
WorldStaticModel = Ginseng,
Tags = HerbalTea,
}
so i do spices just like ingredients? no othher thin needing to be added?
it has a hungerchange = -1
ah i see it has spice = true
I think the Spice = true is what gives it all the spice magic
I'm a little confused how DoTraits() works, wasnt able to find any online examples sadly. The lua seems pretty straight forward, something like this:
require('NPCs/MainCreationMethods');
local function initTrait()
TraitFactory.addTrait("traitname", getText("sometext"), -1, getText("moretext"), false);
end
Events.OnGameBoot.Add(initTrait);
but idk how to do it in typescript. this is my first pz mod so forgive me for being a little lost here
ah you want to add traits okay
I want to modify existing traits, but the mod Im following as an example also used TraitFactory.addTrait
I said screw it and decided I wouldn't add this for now since it's not extremely necessary, and once I removed that code the code that worked fine before is now broken, my brain
Genuinely fried lol
it looked something like this:
TraitsRebalance = {}
local TRAIT_COST = {
Athletic = 12,
............................ traits here
DummyBurglar2 = 5,
}
TraitsRebalance.TRAIT_COST = TRAIT_COST
local old_addTrait = TraitFactory.addTrait
TraitFactory.addTrait = function(name, trans, cost, ...)
local new_cost = TRAIT_COST[name]
if new_cost then
cost = new_cost
end
return old_addTrait(name, trans, cost, ...)
end
its from an older mod so idk if this even still works lol
nah i dont think you can overwrite that function
its a java object
Example of adding new traits
import { BaseGameCharacterDetails, getText, TraitFactory } from "PipeWrench"
import { hookInto } from "PipeWrench-Utils"
hookInto("BaseGameCharacterDetails.DoTraits", (doTraits: Function) => {
doTraits() // call original function first
TraitFactory.addTrait("MyNewTrait", getText("UI_trait_axeman"), 0, getText("UI_trait_axemandesc"), true)
TraitFactory.sortList();
const traitList = TraitFactory.getTraits()
for (let i = 0; traitList.size() - 1; i++) {
BaseGameCharacterDetails.SetTraitDescription(traitList.get(i))
}
})
would this work for modifying existing traits too?
you could probably use TraitFactory.getTrait("trait")
but you can basically only do setDescription ``setFreeRecipesandsetRemoveInMP`
you could maybe remove the trait and add it again edited
thanks for the example, ill try things out
nevermind you cannot remove it
public static ArrayList getTraits() {
ArrayList var0 = new ArrayList();
Iterator var1 = TraitMap.values().iterator();
while(var1.hasNext()) {
TraitFactory.Trait var2 = (TraitFactory.Trait)var1.next();
var0.add(var2);
}
return var0;
}
it give a copy of the the added traits so removing it from this ArrayList would do nothing
Hello guys,
I have a strange bug ๐ค
I made an item, using a mesh from the game, and when the item is near a wall, I can see its "anti-shadow" outside. Any idea what could be causing it ?
I mean, it's kinda creepy, now I have a giant ghost pickle waiting for me outside ๐
are you sure its a pickle? ๐
Yes ๐ฅฒ
picklerick
Well, thanks ๐ But I'd rather just have my regular Pickle Rick ๐
Anyone know why this might be considered a bugged action
The same foundation is used in another mod that isn't broken, and the two lined out things are apparently not the only reason it's broken
i might have a solution
What did you find
found out we can reset traits (aka remove them all)
so im testing something
Maybe that's how trait rebalancing mods work. Was wondering how they modified or replaced traits otherwise
I'll give it a try
so would this work
you don't need the "cont", i just put that in cuz i didn't want to write them all in the example
ah alright
so like this then?
you don't need the comma at the end either I think
does it not need any like
module MTC or Base or anything at the start?
anyone knows where is located the file responsible for player build structures?
I believe I've figured out my extremely annoying error, at least one of them, I'm trying to remove the item from it's container, but since it's container is the floor which I guess only exists when I'm near it, it's been giving me an error only when hovering over the floor menu doesn't show the object
I am happy that I've figured it out, but that, that is insanity lol
Probably nearing 3 hours of working on 2, count them, 2, lines of code
welp didn't work
no errors tho so maybe it's just not recognizing it
with and without?
yep no luck
do those can you check if that item still works in other evolved recipes?
hmm maybe try doing just the recipe you want to add, and not the others
hmm maybe
Good evening all! I am maintaining a mod that add new traits and I am encountering an issue with multiplayer.
I have my traits/profession code located in the lua/shared and it is called on OnCreateSurvivor
Events.OnCreateSurvivor.Add(initTraits);
With the initTraits function basically doing this kind of code TraitFactory.addTrait("customtraitname", "Custom Trait Name", 0, getText("Custom Trait Name Description."), true);
But this means the server never actualle get to run that code which makes it kind of freak out to see characters with traits it does not know (makes sense).
This leads to the console being spammed with this type of messages.
IsoGameCharacter$XP.load> unknown trait "customtraitname"
And also sometimes fully wipe the custom traits from the characters.
So I was wondering if anyone around has made this type of mod / experiences this type of issue. And if they would know how to make the server know about the new custom traits? Do I need to call the same code on the server, if so, using which event?
You need to do this:
--- remove original
Events.OnGameBoot.Remove(BaseGameCharacterDetails.DoTraits);
--- backup original
local original_DoTraits = BaseGameCharacterDetails.DoTraits;
--- overwrite original
BaseGameCharacterDetails.DoTraits = function()
original_DoTraits(); --- call original
--- add your traits here
--- finish up
TraitFactory.sortList();
local traitList = TraitFactory.getTraits()
for i=1,traitList:size() do
local trait = traitList:get(i-1)
BaseGameCharacterDetails.SetTraitDescription(trait)
end
end
--- add again
Events.OnGameBoot.Add(BaseGameCharacterDetails.DoTraits);
reason i remove before and add again after is cause the reference to the function change
Is it possible to read/write to fields of different classes without using a predefined method? (or... when there is no predefined method ๐ )
if you mean java classes? then to my knowledge there isn't. you need getter and setter functions if you want to manipulate them, so if they aren't provided, you are out of luck tmk
Oh that's a pity, well, I need to think of a different idea. Thank you.
what are you trying to manipulate? maybe there is a setter, and you are just missing it
Well I am trying to think of a way to insert items into containers inside... let's say rooms of type "medical" but only inside the SecretBase zone. My idea was to maybe dynamically change the zone of the secret base to my own using code when the player enters the room or something, but that didn't work out.
And then I would apply unique looting tables to the zone
Not changing the zone sorry
roomdef
i meant
hmm, sounds tough, not sure if you would be able to do that before it gets populated though as it would be probably the sameish time that the room gets loaded, and the roomdef is available for you to be able to modify it before it gets populated. would have to check in the javascript
is there any way i can cast my InventoryItem variable to the subclass clothing?
i've tried a ton of methods but cant seem to find a way to get it to work
Wait, I can change roomdef? Like there is an actual way to change it?
no idea, but I figure that was what you were trying to do
oh yeah... ๐
hmm actually, this is for the secret military base right
Yes
you can just dynamically modify the distribution tables, when you come close to the secret base
the base is surrounded by tons of forest and you will be so far away from any other rooms which have the definition "medical"
But wouldn't that mess up looting tables inside multiplayer?
As the loot tables are server based
so you can try to modify the distribution tables as you approach the secret base, then change it back after you return.
nvm i just figured out i can do ".clothing" lmao
true, but it would only cause a problem if you just happen to have 2 players loading that time of cell at the same time
also depending on the item spawn chance, you could always just make it a guaranteed spawn with code. Like for example, hydrocraft guarantees a hazmat suit in the secret military base because its important to the tech tree, and the military base is a reasonable amount of difficulty and effort to get it. So there is just code that spawns it at specific coordinates in a locker in the military base
Well that was my second thought
what kind of item are you trying to add? is it like an OP item you put alot of effort to get, or just like decorative stuff
To manually spawn items inside containers when entering a room
Oh I am making a way to cure the KNOX
but in a vanilla friendly way
there are risks that go with it
its rare
and its never a guarantee
So that the danger of the disease is not completely removed and is still a huge risk
But there is hope ๐
I would like to implement the ability to add keybinds to the extra buttons on my mouse without needing to make custom macros. I read somewhere that this was originally a default feature of the game but it was removed, and some of the code for it still exists somewhere. Is this something that is still doable or would it cause issues? I have little experience when it comes to modding, but I have to imagine this is something other people would like as well.
Had a thought โ any chance someone can make a mod where you get welding goggles??
Itโd be less protection than the welding helmet, of course, but itโd be much lighter and easier to carry around from day to day
Iโd love to have more options than just carrying around a welding helmet just in case
hey kinda new to this -- can you reload LUA while in-game in debug mode?
yeah you just need to select the file from the file browser and click reload
Thanks. I'm doing some guesswork to try and fix the overlay bug in the 10 Years Later mod because folks on my server are complaining about it lol
I'm having some trouble with getting a part of my mod to work, and I'm not sure what I've done wrong; it was working fine last night, but then I tweaked it and evidently broke something. I made a small mod which lets you recycle bags such as hiking bags and school bags. Now, a mod like that probably exists already, but I couldn't find it. Mind you, I have a habit of not looking properly.
Anyway, I'm trying to make it so that the player will get one thread at Tailoring level 3 and two thread at Tailoring level 7 and above. However, this is not happening on my debug mode character with maxed out everything. I get the leather strips, but no thread.
I created my own Recipe.OnCreate function, which is in the recipe code, but I must be overlooking something if the thread isn't actually being given to the player when they recycle a bag and have the appropriate skill level.
Lua Code: https://pastebin.com/dtvThrVi | Example Bag Recipe: https://pastebin.com/NfQnxM0b
I'm new to modding PZ, so forgive me if this is a stupid question or if I've made a screamingly obvious mistake somewhere.
The chance of getting thread is already a coded part of ripping clothing with tailoring, as per wiki:
I tried using that as well but it didn't work, hence why I tried my own method.
You could check how this mod implements it
Tried to find the simplest one, seems to only tweak underwear
I changed the name of the folder my Lua was in from 'client' to 'server' and it is now working.
Thanks for the help, though! ๐
I'm trying to figure out why the "Remove Vegetation" function in the 10 Years Later mod also removes any other overlays on the same tile
Hey all, I am trying to get into modding PZ. I have a lot of programming experience but I am new to LUA and to PZ modding. I found some useful resources to start but I cannot seem to find anything about how to affect player variables. For example, if I wanted to have an item that when used would make the character sick, or heal them, or zombify them or something like that. Can anyone point me in the direction of some resources? Anything about affecting the player with items or adding removing moodles etc is what I am looking for the most. Anything to get me started there would be much appreciated! Thanks in advance! ๐
i need to change the wires fence health, anyone know what is the file location of buildings?
https://www.youtube.com/watch?v=ikRcbRHc45k i believe in this tutorial he goes over changing moodles and stuff
@cyan basalt awesome thank you! I will take a look.
no problem! if i recall it's not super in depth but he shows debugging and the moods changing. im also a beginner tho so i am not super familiar either
No worries there is not a lot out there so anything helps ๐
Thanks a lot! ๐ My understanding is that this gameboot code will be called by the server too and hence both will have the traits. I'll give it a shot, thanks again ๐
Can someone confirm that local function OnFillContainer(roomName, containerType, itemContainer) doesn't work on multiplayer?
It seems to work on single but no matter what I do it doesn't work on multi...
or am I just using it wrong?
OnFillContainer is not triggered on clients, but it is on the server and singleplayer
public static void fillContainer(ItemContainer var0, IsoPlayer var1) {
if (!GameClient.bClient && !"Tutorial".equals(Core.GameMode)) {
How should I use the funtion then?
On singleplayer
I can spawn items inside a container
but on multiplayer it doesnt work
how should I go about making it work?
on the server it triggers when the client request items for a container
so in other word, container content is generated by the server and transmitted to the clients
so it would have to be in the server code instead?
I tried both server and client folders..
and it doesn't get triggered at all when it's in the server folder?
Well try to print some text and check the server console
That is exactly what I did
mhm
On single player this works
On multiplayer
it doesnt
no matter the folder
I mean dont mind the "addItem" method
that throws an error anyways ๐
idk how lua works lol does it error out b4 it reaches that part of the function then?
I think I know why it errors on the addItem
its because its not spelled with capital A
but point is
even if I remove it
and leave just print methods
on singleplayer they get called
it should trigger when the container is activated (first showing in the inventory pane)
on multiplayer nothing happens
like when a container is activated it send the request to the server
if isClient() then
container:requestServerItemsForContainer()
else
ItemPicker.fillContainer(container, playerObj)
end
Okay Im trying it on the server once more
with the file being in the server folder
In single 100% works
I just spawned an Axe in every container
Starting a server now
Alright it was somehow fixed
konijima is a wizard
yes
But I still
dont receive print messages ?
do I have to do it different way?
By the way, Im pretty sure what konijima sent was some game Java code. May I know how to get such resource? Is it through reverse engineering app or something?
wow
I remember using some old tutorial
which I had to find my way round some stuff because it didnt work
Thank you for that i will definitely use it
Hi Guys! Does anyone one know how to implement place feature natively? So that when you have a table in inventory, for example, you can put it into place by pressing "Put". I want to implement putting of a kiln and other stuff "vanilla way" rather than having a separated ISUI. Or maybe you aware about mods that do it natively?
Question: How are people still playing on 41.71 when devs released 41.73 to the stable branch?
they added .71 as a beta branch because of that zombie respawning thing i think
not sure of what you are referring to
the new version respawned zombies in places that players had already cleared or something like that
think this is the main reason: Hey all, we're aware of a current issue with Linux servers crashing and are investigating. We'll be working on a fix ASAP. Thanks for your patience!
from their twitter
ohh
You may refer to this: https://discord.com/channels/136501320340209664/1006534768491499560
is that a phishing link lol
ahh i saw that it was discord.com instead of .gg since i thought all the discord links end with that
Wrong place for this, just use my stable build link I put in my changelog. I am out of ideas of what is causing this.
After today I'm never playing this game again
I said that this is the wrong place for this, do you realize that I have been replying to you in the comment section of the mod? There is also the #mod_support channel which is the dedicated place to go for these issues. I also have my discord linked on the mod page itself. Finally I also have my DMs on Discord and Steam open.
Yes you can reupload it in your own modpack, I have been allowing people to do it that way. Just don't name your upload AuthenticZ or anything.
Don't ask why
It was fun while it lasted
Ok sorry for wrong place
bit of an odd question, but do yall think a multitool (like a swiss army knife) is possible for modding? so it doesnt change much other then being a small blade (smaller then weapon possible), screwdriver, tweezer, plier, can opener, and a scissor
yeah its possible, but you would need to modify the recipes to take that items. probably the cleanest way to do it, is to modify the recipe to use tags, then give the corresponding tags to the right items. would be more work to get the screw driver to work for all disassembly recipes and the tweezer to work for health stuff
Theres one on the workshop
Hey ! I'm having an issue with SurvivorFactory.CreateSurvivor to spawn a static NPC, it makes the NPC and I invisible ? (tried it out in a SP game)
#mod_development message I used this code so it should be working I guess
anyone having an issue with superb survivors mod where your survivors won't deal any damage to zombies at all and only be able to push them?
try in mod support channel
Hey, is there a way to make a fence not jumpable?
I think that is a tag in the tilezed that makes some objects jumpable, so maybe by modifying the vanilla tiles you could do this
tysm
Hey there, I have a file in /shared that require a file Client in /client and file Server in /server (testing if client or server).
I get the following log error on loading PZ lua (when I set up the mod in the main menu). Do you now how I fix that?
LuaManager$GlobalObject.require> require("Client") failed. [12-08-22 12:42:52.977] WARN : Lua , 1660300972977> LuaManager$GlobalObject.require> require("Server") failed.
local Client, Server = {}, {}
if isClient() then
Client = require "Client"
elseif isServer() then
Server = require "Server"
else --- else we're in singleplayer, right?
Client = require "Client"
Server = require "Server"
end
Hey everyone!
Does anybody know how much things are we able to do with PZ GUI? Is it possible to do nice custom interface and/or popup windows without major headache??
quite alot can be done with regards to functionality.
So nobody has any idea about IsoPlayer.new() making the player and the spawned NPC invisible in SP ?
maybe take a look at the super survivors mod to see how they handle spawning in NPCs
the exact same code provided by blair works fine for me
Hello Hello ๐ Not a modder and more a an experienced 3D artist with a teensy tiny amount of programming knowledge and no experience working in the engine
Was really curious what the general approach would be to add texture driven facial expressions to zomboid would look like?
(if one would theoretically create a system that looks at the current active moodles and maybe picks one from a list of importance especially when they stack)
Would PZ be able to handle texture swaps/updates on the fly? Not sure if the engine precaches it or if it is possible to update on the fly
I have a theory that it might be possible (especially when looking at when the character is covered with blood/dirt the textures seem to update, so maybe possible but might be cheated by having an overlay texture that gets activated/deactivated based on the dirtyness values of the player
The only other option I'd then see is creating an actual facial rig and replacing the base models to support that
setup, but I think that would go against the aesthetic the devs had in mind (and also the fact that I'm pretty sure adding additional bones would break the player character and the zombie rigs)
Feel free to @ me - was mostly inspired by the post on the subreddit pointing out the lack of facial expressions ๐ฌ
But once again, just a question in general
when you select stubble or add bandages to wounds they're actually treated as clothing items that apply a texture to the body, and are controlled through the games lua code so you could definitely do the same there
the code would probably be the difficult part though so i dont really know how you'd go about doing it
Does anyone have code sample for adding items to foraging?
true true ๐
never underestimate the code- almost never as simple as one might think
still a free idea for any devs or advanced modders out there ๐ฌ
@cunning marten if you dont find any answer PM me I'll try to look for it (when I find time). I started to mod like 10 days ago, I'll do what I can. I think if it's not done at all, that might be hard, but I can start to check how bandages are placed on the character, how the location is coded, and see if we could set a face location. Also we could try to directly use the 3D model of the player and see if we can move it for a (weird? ^^) smile.
oh so like shapekeys/blendshapes? Just not sure if that is supported in the current way the game handles 3D models ๐ค Would definitely be the easiest for me to set up though lol since my expertise lies more on the modelling rigging and animation side
hey hey
im looking for answer
you know, time in multipleyer passes so slowly when action slows down
is there any mod that allows time manipulation in multiplayer (like in split screen)
i know that this on big serwers would be useless but when playing with 1/2 friends it would be quite usefull
if you know any ping me, and dm me link to it
if there is none... anyone up to make it?
unfortunately I dont know a lot on 3D, but I think we can do custom animations (modders : can we?) so why not. I'f not mistaking 3D models are in project zomboid/media/models_X/Skinned for characters. Take a look at what you've got there
There definitely are custom animations- the true actions and dancing mods are living testaments to being able to add custom anims to characters, but adding custom joints and animations to those custom joints? not so sure ๐
Also The indie stone is still hiring around for an animations tech guy, so my assumption is that it's still pretty hard to add animations in general (or that a whole bunch of things still need to be standardised)
These animates bones unfortunately, not skin :/
take \ProjectZomboid\media\anims_X\Bob\Bob_WalkTrees.X (you can open with notepad for instance), you can read that?
unless you make not texture face
wait
brainrot
i meant unless you make 3d faces
Gone down a rabbit hole of trying to find a way to convert that .x into a useable format such as .fbx or .obj but no luck yet 
i think people use fragmotion to import .x but i've never used it so i'm not sure
you can download blender 2.79 and then use https://github.com/spamandeggs/directX_blender to import then export as fbx
https://www.youtube.com/watch?v=RIzePdZZQIY for setting it up
you can also convert to .dae using this site but it might not work for some models and definitely wont do animations:
https://3d-convert.com/en/
Convert any 3D files easily and quickly with our free online converter. Whether it's STL files for 3D printing, OBJ files for computer animation or CAD: we can easily convert them all. Give it a try.
if you want to import .x files add this plugin to blender
https://github.com/poikilos/io_import_x works for me
oooo i didn't know about that one
oh damn theres a new one?
Is it possible to take the map with marked locations and either edit it manually outside of the game or take it from single player into multiplayer?
i tried this this morning and it didn't work for me, froze immediately.. and i noticed a warning on the plugin about a library not working with blender >2.66
hmmm
I use blender 3.0
it works for me
I also installed the plugin earlier this week from that link
what OS are you on?
windows
i can enable it fine
and it shows up fine in the options
but then i hit import and so far every time it just freezes
hm tried my own model instead of one by another person and it spat out errors instead of freezing
for my models that's fine, i can export to whatever format, but for opening someone else's X models the crashing ain't helpful lol
that's a filter to just show enabled addons in the list only lol
don't think that'll help ;3
perhaps it's a windows vs linux thing
does anybody here know if there is a simple way to check if your item from a mod has spawned in the map? i have a distro setup, so the item should be, but id rather not have to go all around the map trying to find it.
i can spawn the item using debug, but wanted to know if i could check like global quantity or somethinhg maybe?
items are not spawned until a container is loaded in the surrounding
i guess i should just go around tp'ing myself? also.... i figured out the issue thanks to @winter bolt ..... my damn recipe script was breaking the game for some reason and was why it kept crashing
you can set the spawn rate of the item to 100 to test and see if it spawn
yeah what konijima said, and then just tp around and check a few buildings for it
but it should spawn anyway if its in the dist
okay, will do that. thank you
you may also want to test with different items spawnrate sandbox options (common, abundant etc)
i tried to do all abundant..... im unsure if my items are spawning as i didnt see any when i did that which is why i was wondering; i may just revisit and make sure i set it up properly
yeah usually when i make item spawn i check vanilla items that i remember and use similar values
you want rare spawn, check the sledge haha
was rare asf last time i check
sledge is rare
anyone know of an unique identifier for players that carries over between sessions?
steamid presuming u use steam
I meant to say player object - as per character
Snake's Mod Pack 41.73 is compatible with Brita's Weapon Pack?
try in mod support channel. Actually youd probably get the best info from their steam workshop pages
Ok, Thanks
Does this function look right? Trying to run it in singleplayer, but whenever I do, it does nothing. No debug error either, it just straight up does nothing:
if player:getKnownRecipes():contains("Make Fishing Rod") == true then
player:Say(getText("Yes! I know this!"))
else
player:Say(getText("I don't know this!"))
end
end```
I suspect something is wrong with my if statement, since I can get player:Say(getText()) to work outside of it.
getText is for getting translated strings iirc
if ur passing it direct strings
it prob isn't gonna work
just yeet the getText calls
or replace them with something like
MODNAME_IKnowThis
MODNAME_IDontKnowThis
and then put in a translation file
I'll try that. Thank you Evelyn. ๐
Nah, it seems the method doesn't work at all. Strange. I thought for sure I was using it right.
Got it working. Time to continue experimenting. :^)
How do I get an item to have the same recipes as scissors?
I'm trying to make an item that's a joke version of scissors that can do the same things, but idk how to make it do the scissors thing anymore. This update means my old Rip Clothing recipes don't work.
there has to be a category for scissors
and the recipes have to use the category
e.g., there is one for hammer, but sometimes ppl hardcode their mod to use "Hammer" and only clawhammers will work then..
there isn't one for scissors afaik so that's a hard sell - might have to autopatch recipes in code.
Is it possible to add a custom property to an item recipe? Someting like:
recipe NightItem { SomeItem, MyCondition:22-00 Result:NightItem, Time:15 }
most likely 30 degree\
or based on google Isometric drawings are built around 30-degree angles
I would like to know the angles, because i'm "recreating" the camera angle to build my site who will be a base planner!
you can probably get a tile in the game and check its angles
tiles can have mod data, right?
What do you mean?
Is there anyway to display a png on interaction with an item, like on a map?
I meant things like lamps, toilets, chairs, etc. can have getModData like items and players can, but apparently they can
Not sure why it isn't working for this specific thing though
This gives like 300 errors and I don't know why lol
Tile properties can't help with this lol
I'm giving toilets a custom context menu which calls this when clicked, and it's supposed to give it a new special boolean, but it just gives errors
Hello here ! I've sieved through all the code I could to find where the damage from car crashes were being processed by the game. Can someone tell me if this is something moddable or if this on the java side of the game ? The purpose is to add damage reduction on car crashes when the seatbelt is attached for this mod : https://steamcommunity.com/id/Fingbel/myworkshopfiles/?appid=108600
Love you all !
This works before I pass it to the FlushToilet method for some reason
It's like the object isn't actually even being passed, but I'm confused why it wouldn't be
Hi, is there a function to make a specific zombie not able to infect you? I am making Senator Armstrong zombie and I dont want him to infect the player. The decompiled Java code has no mention about infection chance on zombie.
if you want to add custom properties, you would have to do it through the Oncreate function
Is there any way to show a png on a context menu use of an item, like how you look at the map?
there isn't a very direct way of modifying it. The crash damage is handled by the crash function at ~ line 3761 in Basevehicle.java.
public void crash(float var1, boolean var2) {
if (GameClient.bClient) {
SoundManager.instance.PlayWorldSound(this.getCrashSound(var1), this.square, 1.0F, 20.0F, 1.0F, true);
GameClient.instance.sendClientCommandV((IsoPlayer)null, "vehicle", "crash", "vehicle", this.getId(), "amount", var1, "front", var2);
} else {
float var3 = 1.3F;
float var4 = var1;
switch(SandboxOptions.instance.CarDamageOnImpact.getValue()) {
case 1:
var3 = 1.9F;
break;
case 2:
var3 = 1.6F;
case 3:
default:
break;
case 4:
var3 = 1.1F;
break;
case 5:
var3 = 0.9F;
}
var1 = Math.abs(var1) / var3;
if (var2) {
this.addDamageFront((int)var1);
} else {
this.addDamageRear((int)Math.abs(var1 / var3));
}
this.damagePlayers(Math.abs(var4));
SoundManager.instance.PlayWorldSound(this.getCrashSound(var4), this.square, 1.0F, 20.0F, 1.0F, true);
}
}
however maybe you could try, by modifying the sandboxoptions instance on the fly, to reduce the option to a lower one when you put on the seat belt, and revert that, when taking the seat belt off
ah wait never mind, the sandbox option only affects the vehivle damage, not the damage a player takes
Hello ๐ Does anyone knows when the event OnPreDistributionMerge is called?
you can see it being triggered in the IsoWorld.java. not much to say other than it is called just before the DistributionMerge, but I guess that is kind of obvious from the name. You can see what the DistributionMerge does as it is in SuburbsDistributions.lua
Thanks, do you know if this is called only once, or it is called every now and then?
only once from what I can tell
How to stop an action from the outside of :isValid?
This plays stop sound (related to the action) but doesn't actually stop it:
ISTimedActionQueue.getTimedActionQueue(getPlayer())[1]:stop()
Can anyone help me with a few basic starter questions? I have been trying to make a custom poster by getting mods and changing the textures manually (I have like, zero experience modding this game, especially the correct way) but I can't seem to unpack the seemingly encrypted PACK files, not even the base game's textures. Not sure where to start with making said mod but if there's no way to unpack those files, I may have to. :c
I only play by myself so if I can get a way to access and change the ingame posters, that would be just as good. ๐ฆ
take a look at the "project zomboid modding tools" in steam. it comes with zomboid. you should be able to make the changes from there with tilezed
Thank you~
I'll give it a looksie
Idk if you figured it out but isogridsquares / tiles / mapobjects aren't all the same - and you can/should be able to add moddata to mapobjects like toilets
Not sure why you're getting errors - what does the error say?
Do containers, items, and ISOObject have a GUID or HASH or something to recognize them?
I'm trying to differentiate two different crates on the ground but holy shit this is not working ๐
k, well i got the software and figured out the UI a bit so far, i was able to view a tileset for posters and can extract each poster individually (which will make editing a HELL of a lot easier) but i cant figure out how to recompile the tileset, is there a button im missing?
I'm in .pack viewer btw, not even sure if thats the correct location...heh
if i figure this out, i could probably even upload it in the workshop too, along with my cobbled together plague doctor mask replacement i did a while back. i dont think my workaround of replacing the dust mask will be a good option to upload to the workshop..
No, but you can give it one using modData and getRandomUUID()
Had to do this for IsoPlayers
IsoObject:getModData().uniqueID = IsoObject:getModData().uniqueID or getRandomUUID()
local objectModData = IsoObject:getModData()
objectModData.uniqueID = objectModData.uniqueID or IsoObject:getFullType()..getRandomUUID()
If you wanted it to still have some recognizable identifier
You may also have to name uniqueID something more unique as other modders may break your mod if you use generic variable names
Mh, won't using moddata bloat the save file tho?
IsoSpriteInstance has a getID tho ๐
Only set it when it's used - should be fine
public int getID() {
return this.parentSprite.ID;
}
pretty sure that's to grab the sprite faster
and is not unique to each object
also you're just storing an additional value in a list
the list is saved empty afaik
so It's not adding all that much
Is it hard to make zombies 'say' something? Like show text above their head?
Because I've tried :say and either I'm doing something wrong or that's not the way to do it
Are you making a hygiene mod?

No lol, I'm trying to improve my Prox Inventory mod
where you have to wash your hands before eating, etc
ye
where even after washing your hands if you don't have a fork in your inventory when eating (which the game already checks for and uses afaik) you risk getting sick
going to try and keep it simple tho
nothing too crazy
The medicine overhaul mods seem to be done very well
Oh, I got you and MonkeyShark confused lmao
kek no problem dude
you made the merged inventory tabs mod?
And I'm trying to find a clean way to highlight the containers I'm loading
Eh found it!
I found notthing usefull in the vanilla code, but I made my own solution, It sucks that I had to go through the OnTick even, but better than notthing
This sets the containers to highlighted using the user set hightlihgt color
local function OnTick()
if not ProximityInventory.isToggled then
return
end
for _, container in ipairs(ProximityInventory.containerCache) do
local isoObject = container:getParent()
if isoObject then
isoObject:setHighlighted(true);
isoObject:setHighlightColor(getCore():getObjectHighlitedColor());
end
end
end
Events.OnTick.Add(OnTick)
Ahh, nice one
To prevent containers to be "Accidentally" left highlighted, I do this before resetting the cache
ProximityInventory.containerCache = {}
ProximityInventory.resetContainerCache = function ()
-- Removes the hightlight
for _, container in ipairs(ProximityInventory.containerCache) do
local isoObject = container:getParent()
if isoObject then
isoObject:setHighlighted(false);
end
end
-- Reset cache
ProximityInventory.containerCache = {}
end
The cache is reset when I re-render the prox inv button
Nice
@gilded hawkhi i just installed ur proximity inv mod but i cant see any items in it
Mod compatibility issues then
Stuff like alternate inventory rendering and similiar stuff is not supported
what's alternate inventory?
all my items on the world are from vanilla
we just used scripts mod and some ateliers vehicle modification
Are you using the zombonly mode?
nope
Is there any error in console?
If not, make a singeplayer mod with no mods except proximity inventory, if it works, then it's a mod compatibility issue and I can't help you
how can i check?
C/user/yourwindowsnamehere/Zomboid/console.txt
Also, don't ask for modsupport here, ask in #mod_support or #old_techsupport
ok ill ping u there
Anyway, the best way to check if a mod of mine does not work, is to test it by itself, if it work by itself then it's a mod compatibility issue and I can't help you
a simple mod that i feel would be useful is allowing hotwiring cars to give you maybe 2-3 times the xp of dismantling an electronic wristwatch, and then maybe some mechanical xp
so it allows you to just hotwire every car you come across for some spent time, to at least provide you with more skill gain
i can't get custom sounds for my gun working at all, i've made sure it links to the right directory and that it's all case sensitive and there's no typos and so on but it still doesn't work
i've even tried doing the weird separate sounds file thing but no dice
i have discovered that the issue was because my character had the "Deaf" trait, help no longer needed thank you
that's honestly just poetic
Question... If I have a variable in my mod... I set the variable to some value.. How do I make this variable stay this value when the player quits and enters the game again? Is there a way in the game for that or do I need to create my own files or something?
Edit: Is it ModData thing?
depending what you are saving you can use player, item, object and global modData
Just a numerical value, unique to each player
like a unique id
Well not id, it can change based on various factors in the game, more like a timer
ah then its not unique ok
per player yeaah
then player:getModData() is what youll need
Nice. Thank you again ๐
Is it possible to turn pz gun combat into foxhole-type weapon mechanics?
So... I have some of Tsar's mods, tuning atelier and such, I'll later check what exactly and from what I understand, the tuning mod is only for his own mods?
Each of the mods are named "Autotsar Tuning Atelier - ___" with the underscores being the type/model of vehicle for that corresponding mod. Basically they are just specific vehicles added by those mods that are much more customizable than base vehicles are. Doesnt effect the other base game vehicles in any way, as far as i know
Anyone knows which lua script is responsible for unlocking new recipes via book/magazines?
Do you know the name of the recipe? @sudden drum
Not really, i am just looking for a script responsible for unlocking recipes
here is the reference for the literature btw, seems the base is "TeachedRecipes", then you tack on the individual recipies
The idea is that i want to launch an event after new recipes were unlocked
Is it a custom recipe that you are creating, or one already in game?
It could be a recipe for pipe bomb, which is in the game already. I want to fire an event after player read the magazine
This is my best guess, check after the character updates if they have learned the recipe, if yes, run whatever you wanted
It might turn out to be really heavy๐
Thanks anyway
oke thanks for answer
@sudden drum You can alter the Timed Action of book reading event and create a condition based on your needs to perform your code when finished with such book/magazine. Check: media\lua\client\TimedActions\ISReadABook.lua ๐
That look promising! Thanks๐
Hi guys ! I want to install mod Firearms B41 from https://steamcommunity.com/sharedfiles/filedetails/?id=2256623447 but it contains two Mod ID: firearmmod and
Mod ID: firearmmodbspatch . Which one should I use?
What do you mean? Where does it say that? You should just put it into mods folder get in game, enable it and it should work
I mean gmod dedicated server when you have to add ModID and semicolon suffix same for SteamID of mod
You add whatever version you want
Mod ID and the Workshop ID
Well I won't help you much with dedicated servers as I have never done them, but looking into the files of the mod you should add: 'firearmmod' and 'firearmssilencer'
Also read the mod
aah okay so dbspatch means silencer patch thanks
One is a patch
Im not sure if this is the case.. But test it you don't have much options ๐
@thin hornet I've done my code, I have also searched up how to use getModData and everything seems like it should work but it just doesn't want to read or save the values. There is no error but the values just basically stay "nil" after reading them.
Am I wrong somewhere?
well I want to read that varaible
in every part of my code
as it's quite important
then just read it from the player object
player:getModData().myVar = player:getModData().myVar or { test = 1 }
player:getModData().myVar.test = player:getModData().myVar.test + 1
print(player:getModData().myVar.test)
i just dont understand what you are trying to do, give me a bit more info
well like I said before
I want to assign a value to a variable and save it, so when the same player loads a save or joins a server again the game loads the values that were present before he/she left/quit.
this code is supposed to check if it is a new player or not
if it is it assigns default values
if not
it should read the values of modData
this code
is saving the values of a player whenever there is a save performed (and I am not sure if that works on a server yet but for now im trying to make the modData work at all)
Anything added to modData is instantly saved
global are not
With the two screenshot i see what you want to do.
What i dont see is where else do you want to use the values.
By using only modData you dont need that OnSave
well there are few places where I use them
Okay that makes sense
but
the real question is how to access the player where it isnt passed by the function right
well that is why I have a global player variable
I can access it anywhere and its client based
no?
it work sure, but not the best nor cleanest solution
what about splitscreen
second player will overwrite the first one
up to 4
show me somewhere you think you need that global player reference in code
ill try to figure how you would properly do it there
oh yeah first of all you need to stop using globals like this ๐
lets start from zero
Oh yes
no
I know
right now
I was just quickly writing this
to make sure it works
I wanted to change all the variables to locals
later
and another thing is I come from C# OOP language Lua is sometimes weird for me ๐
local onEveryTenMinutes()
for i = 0, 3 do
local player = getSpecificPlayer(i)
if player then
local modData = player:getModData()
end
end
end
Events.EveryTenMinutes.Add(onEveryTenMinutes)
Well you could try PipeWrench then, it's using Typescript which is OOP similar to C#
but this code i would do... server based?
and I would loop through each player
player mod data is not server sided, so basically you cannot transmit it
well the loop is only to make it compatible with the 4 local player
to support splitscreen
doesn't getSpecificPlayer(i) return the object of a player on the server?
player1 player2 player3 etc
what if there are 5 players on the server
getSpecificPlayer is client only
Oh
local player is on the client
alright
when someone join a server in splitscreen it create a new player
yeah see im jsut confused with the way the game is coded and Lua works sometimes Lua does magic and sometimes I feel like it's a pain
okay
let me try
when I do this ThereIsHope_player = player; doesn't that mean that ThereIsHope_player now refers to player
and whatever I change in ThereIsHope_player also changes in the player
in Lua it's not just a copy. It's a direct reference no? or pointer I should say
its not a copy it a reference
so I still don't understand why my code doesn't work
but re-assigning ThereIsHope_player = 1234 changes its value only right
I did as you said
I still find no luck
even after assigning this
it prints "nil"
wait
I realised my mistake
wait
nevermind
it works
Okay it worked for the print... when first assigning
but it still doesn't want to read the saved values after joining
again
๐ญ
It just reassigns the default values over and over
dont worry there is hope
the modData table doesnt change so grabbing it on a timer is useless
can grab on first tick and keep the reference from then on
depend if you die in mp and respawn without quitting, i mean, the first onTick wont run again
well what ever thats optimization for sure
there is many way of doing that i think the point of the example his to show him how to grab it without resorting to globals
After looking through decompiled code of 41.73 I stumbled upon this. In IsoPlayer:pressedAttack(...) there's crit calculation going on and at some point the code goes like this:
if (var11 instanceof IsoPlayer && var4.isRanged && !this.bDoShove) {
var9 = (int)(this.attackVars.getWeapon(this).getStopPower() * (1.0F + (float)this.getPerkLevel(Perks.Aiming) / 15.0F));
}
which to me looks like, it checks for whether you're shooting a gun and the target is another player, and if yes, then it completely rewrites crit chance with this formula based on weapon's StopPower and without factoring distance to the target at all.
Was it always like that?
quick question, trying to make a poster mod and im currently editing another poster mod to do so. i was able to export the posters and edit them individually, but i cant find the option in the zomboid tools to recompile them. anyone know where its located?
hi please help me with a script pls pls
its fairly simple
i just need to create a countdown timer
is there a reason this doesn't work?
oh this is probably similar to what im looking for .. i think
Making a real world cancelable timer with callback and data
lua/shared/startTimer.lua
local gameTime = getGameTime()
local function startTimer(seconds, callback, ...)
local startTime = 0
local function onTimer()
startTime = startTime + gameTime:getRealworldSecondsSinceLastUpdate()
if startTime >= seconds then
if type(callback) == "function" then callback(...) end
Events.OnTick.Remove(onTimer)
end
end
Events.OnTick.Add(onTimer)
return function()
Events.OnTick.Remove(onTimer)
end
end
return startTimer
lua/client/myScript.lua
local startTimer = require('startTimer')
local player = getPlayer() --- example data
-- example usage
local cancelTimer = startTimer(10, function(player) --- access passed data in the function
-- do something after 10 second(s)
end, player) --- pass data at the end
cancelTimer() --- canceled the timer
this is probably a stupid question but how do I make an item smaller when dropped on the ground? xD
I know there is item:setWorldScale(float)
but how do I properly get to the item in the first place
onItemFall event doesn't seem to work as I thought it works
modify the model scale
well I am not sure how though, icon size doesn't seem to do anything. Do I need to make a 3d model or something?
which item do you want to modify
my own
Is there a mod that allows you to add a multiplier to one category? Like crafting? Instead of a blanket modifier
@unique trail
model mybox_ground
{
mesh = WorldItems/mybox,
texture = WorldItems/myboxtex,
scale = 5.6,
}
the mesh has to link to fbx
and texture to a png which is the UV
you can then play with the scale
In what file do I go looking for if I want to find the sickness moodlet? (for the rotting corpse disease)
I would like to take a look at how the sickness is calculated over time. To see if I can make it deadlier and affect the player faster etc.
The related sandbox setting is: "Sandbox_DecayingCorpseHealthImpact".
So I need a 3d model then?
that complicates things
but thank you
that explains it
bodydamage.java
Thank you for the fast answer. Appreciate it. I will look there ๐
someone is reporting a dictonary error when adding my mod to their MP server. are there kinds of errors actually a problem?
ERROR: General , 1660446082806> 0> zombie.world.WorldDictionaryException: Warning client has no script for item Base.DakiArmorBack30```
hmm don't those errors usually kill that save? are they still able to play?
I asked them. What could be causing the error? From what they pasted in the report it is only "DakiArmorBack30" There are 29 more of the exact same item that use the exact same code.
Hi, I'm trying to remove this section in function ISWorldObjectContextMenu.onSleepWalkToComplete(player, bed) to disable autotically awaking in Multiplayer and instead waking up with an action (Right click etc.). Can I check whether the game is currently in multiplayer and only remove that method call in that case?
is isServer() the right check?
how do i access this properly to add an item to this list on WeaponPart dynamically
i tried accessing it as a table, but it comes out nil somehow
the javadocs show getMountOn and setMountOn functions but they do not seem to exist
so how do i access this data to manipulate it
i wrote an entire autopatcher in lua
this one line of code is preventing me from moving forward :|
unless the game already combines rather than overrides it when u override a WeaponPart's MountOn
but due to the nature of things i imagine it does not
then this is a useful thing i could release as a framework
two gun mods add their guns to vanilla attachments -> conflict requiring a patch right now
with this both could do it collaboratively..
im not super knowledgable about this specific bug, but my understanding is that it is sometimes caused when people change the mods for a save, so not really a problem with the actual mod. I don't know if it is recoverable.
ask if they deactivated your mod in that save, or maybe added one that overwrote some of your mod files. My understanding of the error is that there is an Item in the save i.e DakiArmorBack30 that exists in the save, but doesn't have a script for it, causing the crash. My guess is that they removed your mod, but they have the item in the save somewhere which is breaking the save on load.
I'll ask them. Thanks
ok so i learned that ScriptManager.instance:FindItem returns an item, rather than a WeaponPart, but since things aren't strongly typed in lua.. what does that mean for me
:/
in C# or whatever i'd do a cast
but here why does it matter?
and why can i still see the mountOn in debug
ok so the issue is that Item is not the base class of WeaponPart
it's a different type of item
one is a scripting object the other is java internal shit
i need to manipulate the java one
cannot find any way to get at that
i really wish there was even one hook to execute java, so frustrating
looks liek the only way to do this might be to do it to every instance of the item the player comes across which is an irritating amount of code to run just to make a line of code synchronized across all items when the data to manipulate is already present one layer up..
hopefully just something i'm missing that i can use..
what u tryna do dawg?
i wrote an autopatcher to dynamically add all guns from a data structure to all attachments they are assigned to in that data structure
the idea being i can release a framework that lets people use attachments for more than one gun mod without needing a patch mod
but
ultimately the thing im tryna do is modify the MountOn list for a WeaponPart in code
and i can't find a way to get at it
not sure how to get the necessary object reference
looks through all lua for refs to getMountOn()
i guess i can take over the attachment system
looks like the best approach
I forgot I asked you something for about an hour.
An item instance has getMountOn, and a script item has DoParam. You can get an instance of an item with InventoryItemFactory.CreateItem, and the script item with ScriptManager.instance:getItem. In the text files, the list of weapons the weaponpart can attach to ends with a ,, but when you use doparam you should make it end with a ; otherwise it will miss the last one.
If you add a lot of attachments like that, the tooltip gets quite big, so you might want to not do this for the weaponpart, and instead add some code to Events.OnFillInventoryObjectContextMenu. You can use Lua to make the game attach weaponparts to weapons without the weaponpart listing the weapons. You could add a telescopic scope to the broom, without having to edit the scope's script item, and have it show the scope model if you edited the broom script item to show a model for the scope.
yeah i just found DoParam
luckily didnt waste too much work on anything that was specific to the other idea
thanks either way, and gave me some more to think about
I got to vent, I'm so tired of making a mod and then having 50% of the comments be like "How do I turn the mod on", holy shit why people don't read the description
LOL I feel you, such is our burden, vent away
As much as I'm happy that my mod is on the homepage, I had to turn off the comments cause this is ridiculous
maybe should make it on by default instead of off by default, might shut 'em up
heh
hi btw :)
i don't like to turn comments off myself but i can totally understand
anyone familiar with the pipewrench typescript implementation here that knows how to add items to the distribution tables using it? I can definitely easily do it during lua im just curious lol
Venting about frustrations involved with modding is absolutely within the scope of this channel. ๐
Talking about those things is good for people.
Sorry I took so long, this is the error, it doesn't give much info at all
Currently this mod is just a combination of the urination/defecation mods, but recoded and with some improved features, however I'm working on some other mods like dental hygiene which would make each tooth replaceable, able to be lost, brushable, etc.
A germ mod sounds pretty cool though lol
that's the line that's broken, but it passes the toilet variable from the other function to this one, so I don't know why it only works when I do it from the other method
If it wasn't allowed we'd all die
Actually trying to exit the debug menu gives it another error
check the log when u get that - sometimes the debug popup stops the error from logging completely i find
but it's in the log either way
or maybe re-open the debug window
Yeah, I think the actual error is the nil one
I don't usually look at the log files, should probably do that, thank you
what's the correct way to get a player in a client script so it supports multiplayer? can we just do getPlayer() or would that not get the correct player
gotcha cool beans thanks!
not sure could be language setting?
Making this as my first mod. Already got the code functioning and added an extra option to limit visibility when wearing the goggles (if you enable it). just need to model the goggles themselves / post
yeah I totally agree, about 50% of feedback/bugs are issues with not getting the mod to work on a server, and it almost always comes down to them not activating the mod in both the workshop section and the mods sections. I really wish IS would atleast have some text there to explain what it is, and how to do it. I think alot of people go from just activating it in the menu, and don't understand why there are the 2 sections in the server config. Even better would be if we could configure the mod so that if the workshop id is activated, you could set a default configuration for the mod ids that need to be activated. would just remove so many headaches to deal with.
someone commented asking if the mods required on the workshop page were actually required once
No clue. Maybe? My mod is only in English.
"no script for item Base.DakiArmorBack30" i'm not sure but it looks like the version of the mod the other person is out of date or something?
Couldn't say. They didn't give me a lot of info but it will be something I ask. I'm fairly sure the issue isn't on my end tho.
so, hello, a question! If I added mods (that have options) to an existing save, I can't edit them right?
From what I see I cannot edit certain mods despite having the possibility in sp in world creation
if you mean editing the sandbox options, you can technically manually make modifcations by modifying the sandbox vars file, but there is an easier way by using a mod on the workshop that will let you modify them in an existing save. just search for sandbox options on the workshop.
huh, ok thanks
Thank you Blair 
Yeah, the default mod manager is quite lacking, I had to switch to using "Mod Maneger and Mod Maneger Server" Mod, to help me with my sanity
Required mods on the workshop page can be added later. Sometimes, it's not actually required. So the question is valid.
i can think of very few mods on the workshop in total where theyve required mods that werent actually required
and in either case, that is the incorrect usage of that anyways
I've seen some like translation mod, the mod author added all mods that his mod supports as required ๐
oh my god
somehow one of my mods has more subscribers than one of the mods that it literally doesnt function without lmao
Probably 90% of the mod support posts are from people who don't have the required mods set up properly for Britas or Autosaurs?
omfg yeah, Modder: "Do you have arsenal 26 installed?" "no" ":-|"
