#mod_development
1 messages ยท Page 262 of 1
Okay just wanted to make sure as my model isnt being found atm. Probably a scaling issue then. ty for the help!
Melee or Firearm?
firearm
I made a guide on how to set up your firearm so you do not encounter some common issues if youre intrested, there is also link to Example mod that you can download, put in your mods folder and check out how its done. https://steamcommunity.com/sharedfiles/filedetails/?id=3060255898
So you can technicly override texture and model and see how your model looks in game
That is epic!!! Ty very much!!
how do i add custom animations to a weapon mod?
48 ticks = 1 real second
i thought it was 60 i was totally wrong
isn't it linked to game time rather than real time?
yeah, every tick is half an in-game second
Thanks again! looking over your template really helped. I realized that you had just used the Base module instead of importing it. I was naming a new module after the mod id like I did for my dunkaroo mod. Idk why it would be an issue as it worked fine with them. but changing it to the base module fixed the issue.
Happy to help.
hello
Im trying to make my first mod and would appreciate some help
i want to make a simple mod that adds a recipe to craft ddumbbells and barbells
i think i make the script right and put it on the mods folder but it doesn't show up in the game for me to test it out
I'm trying to get sendClientCommand to fire once on OnPlayerUpdate and my code around it fires but the command doesn't on the first time (although on testing it can fire later). I suspect it's because of this line if (GameClient.bClient && GameClient.bIngame) {. I can check bClient via isClient() but bIngame is a little harder and it seems isIngameState() doesn't help. Is there a way to check if sendClientCommand will actually send to the server instead of the singleplayerclient?
i just rely on it working on the second tick
it doesn't work on the first but it seems like it always works second tick onwards
Mod or item doesnt show up
what's your method to constrain it to the second tick only? I'm guessing you don't want to sendClientCommand every tick?
yes
the mod it self dont show on the mods list
something like this should work```lua
local doCommand = false
local sendCommand = function()
if doCommand then
sendClientCommand(...)
Events.OnTick.Remove(sendCommand)
end
doCommand = true
end
Events.OnTick.Add(sendCommand)
it really must be that bIngame is false on the first tick, that's the only reason I can think of it not firing
but yeah the second tick thing works like a charm
i've never really worked out why it doesn't work on the first tick
i thought you may be right about that but
this.UpdateStuff(); // first line of this sets bIngame to true lol
LuaEventManager.triggerEvent("OnTick", (double)this.numberTicks);
yeah that's a good point
any one have any idea if i did something wrong
make sure your mod.info is valid (reference the one in the mod template)
and make sure you placed your mod in Users/(your username)/Zomboid/mods/ and not the steam game folder as that mod folder is fake, nothing there ever loads, it's literally there for no reason
ok i will try and see
Me rnโฆ.
LOL
Working an near-full texture overhaul for ruined/post-apocalyptic/better textures/everything i can think of, some sneakpeeks
currently having a problem with outside tiles/grass so im leaving those out for now and focusing on the props and inside buildings.
the 'clock' icon when you are asleep, anyone know where this is triggered?
I get a texture with local texture = getTexture('path/to/image.png')
And I noticed some of the methods are unusable:
local w = texture:getWidth() -- works as intended
local idObj = texture:getTextureId() -- works but
local buffer = idObj:getData() -- java.lang.RuntimeException: attempted index: getData of non-table: zombie.core.textures.TextureID@4353641f
local buffer = texture:getData() -- crashes the client without error message
Would you know what rules expose an object to the Lua and make it usable like a normal table?
classes have to be explicitly exposed, if you've decompiled look at LuaManager.Exposer.exposeAll
Oh, thank you!
Here goes my hope of getting the texture buffer, putting every byte into a table, sending it to the client and writing them in a texture again.
I'd like to allow the admin to put players PNG/JPG portraits into a directory so they can be shown next to the chat bubble
of course I would not just send the images like that, I would have made kind of an async system with my own state machine and split the packet with my own encapsulated protocol... I had hope :'(
you can read a file from the cache directory byte-by-byte using getFileInput but i don't think you'll be able to put it anywhere useful
you can only write and read in text mode :(
so all the \n and \r get lost in the process
to my recollection getFileInput/getFileOutput aren't in text mode
the other read/write methods are though
oh
you'd have to find some way to actually load a texture you've placed into the cache though and i don't think that's possible
where is the cache directory?
%userprofile%/Zomboid/Lua/
the getTexture is only allowed to read in the directory containing /media
and .. is checked
although... the Texture class has some methods to load a path
var1 = var1.substring(var0.lastIndexOf("/") + 1);
damn it
Hello, good day, I apologize for being so annoying but I just have one last question, how could I make my mod compatible with the VFE mod? only in the accessories section because the VFE accessories, except for the iron sight and the slings, may be overwritten with the accessories that I designated for my weapon. I have permission from the creator but I can't find the solution, I just need that to be able to play calmly jajja.
Thank you very much in advance
how do i add custom animations to a weapon mod?
Do you actually have any custom animations or need to make them first?
I made a quick lil placeholder
Are you familiar with abimsets?
Animsets?
Not really just getting into it
You need to make your own Xml file in animsets. I'd take one that is doing the same thing as yours. Is it melee or firearm?
Firearm
Looking at that getSharedTexture
What the hell is that
We can't call static methods :(
Exception thrown java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method)
this game hates me
hey guys what would cause this? my muzzle flash only works in this position and i dont see shells falling out of the gun
anyone know what texturepack the icons for traits reside in?
damn I did it again thats more of a modelling question.
Quick question: what files I have to make in order to make a mod with only a new recipe
Does anyone have any tutorials on how to create and Ingame map in worlded?
I am only missing one small thing: a way to know the size of a file. Since the Java will throw an exception if we try to read after the EOL.
If there is no way to know that then I'll have to write my own PNG/JPG parser. ._.
And that would mean any badly formatted image file would crash the game.
Nevermind, Lua execution is still going after the exception
it was literaly just that.... well my mod is up and runing now
will post on steam workshop later
just an item script
look for the scripts folder on your vanilla files and use the files as reference
Is it possible to make a new trait only appear when a specific profession is selected?
that boolean is what makes it hidden
this is from vanilla
I know about that one, it's to make profession exclusive traits, I meant more a trait that you pick that would rather cost points and only be shown with a specific profession, maybe that's not possible
ahh you mean it can picked optional but you cant if you dont have that profession selected?
hmmm interesting
maybe of you make it mutual exclusive to every profession
but you would have to make hidden trait and use that to do the mutual exclusive thing . thats how vanilla does it
is there any way other than setGhostMode to stop zombies from seeing and walking towards a player? Problem with ghostmode/invis is it hides the player from other players. setZombiesDontAttack doesn't help as the zombies still walk towards the player
yeah but I decided not to do that, just made the trait profession exclusive instead
continually remove the player as the target from the zombie object
this is what i did before
it works
i also have another solution
where's the targetting happening? there a event trigger for that?
i modified the idle animation since i only need this feature for special zeds so i used setVariable to to have em do alternative animation
and i used a custom idle animation that i did and its triggered on the walk
meaning if they want to walk
they will use that
but the translate bone is not moving so they cant move
this locks the zombie in place as they do not look for other targets
yeah i didnt need to move my zed when i did this but if you need to move them then i guess you would have to manually do move them..idk
i havent tested these
setFollowingTarget()
SetCharacterToFollow()
setFollowID
Anyone know how to use setWornItem or something like it? I'm trying to put clothing on zombies.
Odd, are we no longer allowed to post mods in showcase?
<@&671452400221159444> surely this is not a phishing link 
that sucks
since when
you can only use visuals or outfits
you cant access the zeds inventory cuz afaik they dont exist they become corpse
130k members
phishing link stays on for longer than 10 min
thank ya
I just woke up lol usually I get it immediately if I'm awake and at home, or someone else will
Yaa, I am wondering if they plan on adding a new channel to share mods actually made ๐ค
Lmao ๐คฃ I feel bad for the user named spiffo considering that's a warning paired
100% sure that's already a thing
sample
There's already professions that have unique traits in the base game even
For example
yeah but they are asking for something different
those traits youre saying are FREE traits
they are asking for traits that you can pick after you select profession
sorta makes sense
Ah that's a thing too
i know what youre sayin
Very cool mod tbh, I'll give it a try!
If anyone wants to checkout and toss some balance feedback to my mod, here is the link: https://steamcommunity.com/sharedfiles/filedetails/?id=3196209274
I talked with one server group that uses it and they love it based on how it gives more scrapping options + the weapons are balanced by how their durability is absolutely dog compared to some mods with like 20/20 or more.
10 YL style mod ? Nice lovely, do you know about manik's textures ?
Yeah it was my initial inspiration
maniks mods is awersome I used it in a lot of playtroughs
but I'm using this as an experiment to also re-render all the zomboid assets trough A.I + Manual paintover, as manik keeps them intact with grime textures on top, without messing with the way things are drawn
oooh
im trying to get a lot more details like better textures, ambient occlusion, cracks, blood spills, etc
my initial intention was to re-render the base assets but thats too boring, so year later vibe is more fun!
a more direct comparison i guess
mine, vanilla and manik
Does anyone know how to solve this? When the weapon gets stained with blood the textures go crazy and look horrible.
Without blood / With blood:
Or can I do something so that it never gets stained with blood and thus the textures are not corrupted like this?
so that's AI ?
Mix of ai and paintover in photoshop
still need to fix some weird stuff is does
some stuff is hard to fix like the same tile repeting 5x
so it repeats the same texture 5x

vines look more natural now
yea I noticed that
Those look amazing
manage to fix it i guess
saving big textures for the non-repeating tiles
like side counter and windows
Oh ?
If only zomboid supported trimsheets lol The amount of space saved would be astronomical
would make my life 300x easier tooo
lmao
but i think i fixed that
not having trimsheets make having ground variation really hard too, so grass can only be seamless
really conservative with what texture i use in repeating tiles, but i got it
spiffo loking like a blood bath
is there an easy way to block a player from doing anything like exercise, sitting down, opening doors, moving, aiming, etc?
Some of it, yes getPlayer():nullifyAiming() will cancel the aiming setPerformingAnAction(false) should cancel any action, but I don't know about opening doors and moving. You'd have to look at the java source code and test whatever you find (path functions, timed actions).
Oh ya as a game dev also, I have run into my fair share of issues with zomboid mods. One mod I made gave the ability for multithreaded processes with Lua using a c++ wrapper with a return but only worked on windows and I for the life of me could not get it working on Linux or Mac.
yeah, the big problem i ran into recently is not being able to create specific floor textures without affecting EVERY tile, so i can't make beuatifull variations for it 
but im revisioning the grass to create more variation and interest
bigger grass, smaller grass patches
for some reason vanilla grass is literally the same height, starts the same way, have no specific variety
changed it to this
trees and plants still look really weird but i'll change that too eventually
Thats still a good alternative approach for the limitations faced. I bet once b42 releases with more components for procedurally generated maps; might be easier hopefully!
anyone happen to know what one would use to spawn a smoke bomb? I made an attempt with IsoFireManager.StartSmoke() but no dice so far
an ignited one to clarify, not the item itself
how to make a new outfit?
When I made my new BodyLocation named FullSuitHeadShoes, it would make all backpacks invisible, I suspect that I have to add my new BodyLocation somewhere so the backpacks show up but I have no idea where :/
oh i figured it out
thnx for the reply tho. also i did not use that cuz it didnt seem to work
what i did was
zed:setShootable(false)
since im not sure what you mean by "SPAWN"
ill provide both codes
local pl = getPlayer()
local sq = pl:getSquare()
sendClientCommand(pl , 'object', 'addSmokeOnSquare', { x = sq:getX(), y = sq:getY(), z = sq:getZ() })
getPlayer():getInventory():AddItem('Base.SmokeBomb')
addSmokeOnSquare is it, thank you!
you also have to check isClient
cuz this is for MP
Is there anything in place to prevent packet loss?
I guess I'll have to do my own ping pong checks
not intended to bloop but open question about the possibility of using his 10 years later textures:
How feasible would be to add them as part of erosion of the world? let's say after 6 months they start to look like thtat
given an InventoryItem in some container, how do I drop it at the feet of the player?
AddWorldInventoryItem(InventoryItem item,
float x,
float y,
float height,
boolean transmit)
the transmit should be isClient()
i think
so that it transmit if youre in a server
@quiet fulcrum
and that would remove it from the current container?
answering my own question
PZ is using Raknet and sending client commands (I guess server commands as well) with RELIABLE flag
http://www.jenkinssoftware.com/raknet/manual/reliabilitytypes.html
Reliable
Reliable packets are UDP packets monitored by a reliablilty layer to ensure they arrive at the destination.
Advantages - You know the packet will get there. Eventually...
Disadvantages - Retransmissions and acknowledgments can add significant bandwidth requirements. Packets may arrive very late if the network is busy. No packet ordering.
so packet loss when sent from sendServerCommand and sendClientCommand should never be possible
what's a trimsheet ?
that's interesting, so that stops a player from ever shooting a zombie ?
hello there, i'm looking to create a mod that prevents zombies from breaking down player built walls. i have a basic idea on how to achieve this, i heard there's a thumpable boolean which when disabled can prevent zombies from attacking the structure. i have experience with programming and with modding other games, but how could i get started on a modification like this: ie. modifying existing content via scripts.
Isn't that already a thing in the game?
As an option
zombies break down walls built by players
that is to make all things built by players indestructable
Yes I'm aware -_-
Basically a master texture that stores various tiled or styled textures that can then be used by multiple assets where the source of the texture for the asset faces can be specified along it as needed or even procedurally.
Saves memory as you only have one larger texture loaded into memory versus various texture files.
Technically, you could probably do this in Zomboid still but it becomes troublesome without any support and just aligning the textures of multiple assets in a model making software like Maya or Blender to a master trimsheet is tedious.
Yeah but there's an option for it no ?
i don't want it to be OP so I think they should be able to still break windows, etc, everything else.
Like tilesheets basically
to make all things indestructable, i don't think specifically just walls
Exactly! So the support is not far off in zomboid, just not directly supported for asset texturing
https://projectzomboid.com/modding/zombie/characters/IsoZombie.html#setThumpCondition(float)
perhaps, something like these
declaration: package: zombie.characters, class: IsoZombie
In things like Unreal; the engine has tools specifically built for trimsheet use and assets
declaration: package: zombie.iso, class: IsoMovingObject
declaration: package: zombie.iso.objects, class: IsoThumpable
something like this perhaps?
theoretically should I just extend the wall, override its method, call super and then update the value of the boolean post constructor call or how does that work in the context of modding
modding is typically done through lua, you won't be able to extend java classes (technically lua is not even an object oriented language)
sorry I misunderstood, I was referring to in lua but I thought that there was a pseudo-OOP system in lua
I'm coming from a java background mainly in terms of modding ๐ญ
there is pseudo-oop (honestly the distinction is a little meaningless, lua is commonly used for oop and it's obvious many of its language features exist specifically to support that) but that doesn't provide a way to extend java classes or anything
ah I see. if I'm looking to modify existing content using lua, are there any resources you could direct me to? thanks!
i suppose i should actually look at some github repos and see the most basic version of someone modifying any existing content
the starting point would probably be to decompile the game, find out how the sandbox option works and see if it's something you can do with lua
only issue is i'm a new-ish player so i'm not really sure what the simplest one would be to look for
you can interact with java objects, call their methods etc, you just can't extend classes or anything like tht
yeah, so my logic was that you'd make it so that it wasn't thumpable
You can possibly mark a thumpable as not thumpable I believe
wouldn't that be better than accounting for all sorts of zombies?
probably better mod compat too
I remember something like this but it might be in the sprites properties however
Yes, definitely
gotchu
The problem
I suppose I just need to figure out how to modify the properties then and I'm good to go
Is getting the thumpable
Because you'd have to modify any tiles being placed
Which uh, spoiler, there's no events for that kind of shit lmao
ah I see lmao
So it's kind of a pain to do
yeah understandable
i can't extend classes, but I wonder if there's something like an instanceof check in lua
yeah, surprisingly not usually actually but pz's lua environment has one, instanceof(obj, "ClassName")
oh that's perfect
this ? https://projectzomboid.com/modding/zombie/iso/objects/IsoThumpable.html#setIsThumpable(boolean)
declaration: package: zombie.iso.objects, class: IsoThumpable
i can do that then, get the instance of the object and hopefully set a boolean from there
oh HELL YEAH we're cooking now thanks, this is perfect
gang shit, thank you ๐
a caveat with it is it's exact, it won't return true if the object is of a subclass
which is sometimes what you want but if it's not there isn't an easy way to do it the other way
This is fine, ty! I can work with this 100%
I know it was talked at least few times, but i can't find proper keywords to find it. I'm looking for a way to make item that would spawn only Once per world. I got told, that "VHS_Home" do spawn only once, but i'm not sure where to find files where i could take a look how its done.
Alright everyone, thanks for the help, I should be able to do the rest myself 
if not though i'll return
but i'll give it a good effort
unless you're making a vhs i don't think that would help, they use a different spawning system entirely
one way to do this might be to just add an OnFillContainer callback that looks for and deletes the item if it's spawned already
I'd like to make unique gun that would spawn in garages, but only one could spawn and be unique.
Can you actually check which items have been spawned already? How would it work, like if 2 containers rolled same item, it just deletes one, or it checks if item was picked up first?
i'd just set some global mod data to true when it spawns (detected by the OnFillContainer callback) and then delete them from then on
I'll try to come up with something but its a good start, thank you
Can anyone do a commission for kichjfjidjohugfj? Willing to pay.
yeah cuz they cant be aimed at
its same as multi hit, you can only hit those that are targeted
Hi, somebody knows how can you setup visual studio code so that it shows the fuctions of the game and the events as well, so that it autocompletes when you type, for example, Events. and it shows you the differents type of events? thanks
there's instructions here https://github.com/asledgehammer/Umbrella
thanks!
worked 100%, just what i was looking for ๐
i'm glad! i'm one of the maintainers so let me know if you have any trouble with it
take a look at VFE, there is a unique silenced shotgun that only spawns in motel rooms once in the world, i think it's called Coin Toss
as an example of something that only spawns once and in specific distributions
does anyone have a purely qol vanilla friendly collection? all of the ones i found are either outdated or are vanilla+
this is actually something i looked at last night
i was able to get the thump object
but setting its condition and timer didnt do anything
what's the best way to set a skill to a certain level? setPerkLevelDebug only seems to work for passive skills, getXp():setXPToLevel doesn't seem to work, LevelPerk and LoseLevel work but it involves multiple steps
i guess AddXp()
to actually provide the xp
cuz if you set level
afaik it doesnt add the xp
Random question, so ive been making a collection of (car) keys that i have no idea where they go, would a mod be viable to make something like the investigate arrow (different colour or shape to tell the difference) that when picked up or selected "Find Car" or "Find Door" for standard key, the arrow would point to where it's connected to and disappears when within a certain distance?
i know there's AVCS, jsut thinking of something a bit more lite
Hello people. Tell me, is it possible to impose voice distortion during a conversation in PZ (for example, if a person has a gas mask)?
not by lua. i dont think its possible.
i could be wrong tho
doable
not through lua
voice chat doesn't go through lua at all and even if it did you really wouldn't want to risk the slowdown lua would cause
Ok, thanks
so cool, no country for old men reference
Thank you, I'll take a look
the BodyPart class is a fun mix of method capitalizations... SetInfected and setInfectedWound ...
yep

my zomboid retexture pack is in alpha rn, feel free to hmu if u wanna test!
https://www.youtube.com/watch?v=9g9P8p3G9kY
congrats man
just a friendly reminder to update the wiki tiledef
why does setPerkLevelDebug not work for anything but strength and fitness? I can't see anything limiting it in code
how would i reference another mods item (or all items from said mod) in an "and not" statement like such in lua code?:
and not ModItem
I am trying to get a mod to ignore items from a certain mod...
please and thank you
i'm not sure exactly what you're asking but you can filter items by mod using item:getModID() and comparing that to the id of the mod you want to ignore
i will give it a try :p
it relies on the PerkInfo object which doesn't exist until you've leveled the perk at least once - strength and fitness start at 5 so they always have one
that's it, thanks
its this the same thing that is used by the debug tooltip?
and would this work on getScriptItem()
yes and yes
oh so you can intercept them early and just doParam('isHidden = true')
so that you hide them
or something
it worked. i am making auto drink not drink my energy drinks. but since they have hunger too i need to edit auto eat also but it does work. :p
thank you albion
comments are not spellchecked in intelliji 
Uninstall intellij
it's lovely... i have it open right now LOL
lmao
apparently spiffui didnt like the autoeat asking the items ModID and threw constant errors. so i just piggybacked on a vitamin buff mod instead and im just gonna remove the energy drinks to avoid the issue all together. ๐
@sour island can help prob
Ahh could be the username looks random but is a mem address lol
Hey all, Sorry if this is the wrong channel. I'm pretty sure I'll need to make a mod for this to be doable but making sure.
I'm trying to edit engineforce data for my vehicles, but upon doing so, I'm the only one able to join my server. My players are getting this error message: https://gyazo.com/b89bd98ed5f6b0431fb95a516d850945
Any advice?
I'm unsure if I need to make a mod that modifies the base game values then implement that.
Your players don't have the same files as the server
Wouldn't they automatically get it by joining the server? If that's not the case, is what I asked not possible due to that? Or if it is, I'd have to ask them to replace that certain file in their folder?
I don't think the server downloads the files, apparently it dosnt seem to since they get the error. If it's a mod you have modified they need the exact same files
Ah damn so they won't be able to join unless I actually give them the file, darn.
yeah
Bummer, Thanks.
If you are just playing with some friends, just send them the whole mod folder, problem solved
I have a dedicated server a handful of players play on, haha. Appreciate the thought though.
I was trying to modify it because base towing is awful, towing certain things with certain cars should be a breeze and hitting zombies in cars shoudln't just stop me completly.
You could publish that new modified mod on workshop and then have them download that, actually the server might download it for them then
Oh, I didn't think about that. Good idea.

We received a report from a credible source from elsewhere.
wait theres a seperate discord thats more focused on modding pz?
Indeed.
Hi, who knows what is the clothing damage mask?
anyone have the invite link to the unofficial modding server?
thanks
Whats most efficient way to update an item that has been dropped, everytime i did, i need to iterate cells, find isoworldinventoryobject, get the item, update the itemcontainer moddata itself also the contained item in it. Seems a lot of work there
Should i intercept the grid cell coords then write it under moddata for server tick update? But this seems need a lot of prepatch postpatch within drop/addinventory stuff to take care my modded item
hi! my apologies if this is the wrong place to post this, but me and my friend were planning on making a mod for pz that gives more of a story to the game because we both really want to see more emotional depth added to the games, so i wrote down a couple of ideas i had, if any, which of these would be the most doable/easy to make? we have no prior experience coding but we do want to learn
There might be another way to do this, I don't know the API very well
-- this will be executed once, 5mn after the game started
local function MyFunction()
end
local StartingTime = Calendar.getInstance():getTimeInMillis()
local function ExecuteOnceAfter5mn()
local currentTime = Calendar.getInstance():getTimeInMillis()
local elapsed = currentTime - StartingTime
if elapsed > (1000 * 60 * 5) then
MyFunction()
Events.OnTick.Remove(ExecuteOnceAfter5mn)
return
end
end
Events.OnTick.Add(ExecuteOnceAfter5mn)
SandboxVars.DayLength server side
DayLength = 3, -- 1 is 15 minutes, 2 is 30 minutes, 3 is 1 hour, 4 is 2 hours, 5 is 3 hours, 6 is 4 hours, 7 is 5 hours, 8 is 12 hours, 9 is real-time
Trying to edit the shout texts on my server, does anyone know the difference between IGUI_PlayerText_Callout1 and IGUI_PlayerText_Callout1New?
IGUI_PlayerText_Callout1 = "Hey!",
IGUI_PlayerText_Callout2 = "Over here!",
IGUI_PlayerText_Callout3 = "Hey you!",
IGUI_PlayerText_Callout1New = "HEY!",
IGUI_PlayerText_Callout2New = "OVER HERE!",
IGUI_PlayerText_Callout3New = "HEY YOU!",
IGUI_PlayerText_Callout1Sneak = "pssst!",
IGUI_PlayerText_Callout2Sneak = "psst",
IGUI_PlayerText_Callout3Sneak = "hey",
Does it use lines 4-6 when shouting while running or something?
From what I have seen in game, only the New and Sneak vars are used.
Reading the Java code confirms it:
@Override
public void Callout() {
String var1 = "";
byte var2 = 30;
if (Core.getInstance().getGameMode().equals("Tutorial")) {
var1 = Translator.getText("IGUI_PlayerText_CalloutTutorial");
} else if (this.isSneaking()) {
var2 = 6;
switch (Rand.Next(3)) {
case 0:
var1 = Translator.getText("IGUI_PlayerText_Callout1Sneak");
break;
case 1:
var1 = Translator.getText("IGUI_PlayerText_Callout2Sneak");
break;
case 2:
var1 = Translator.getText("IGUI_PlayerText_Callout3Sneak");
}
} else {
switch (Rand.Next(3)) {
case 0:
var1 = Translator.getText("IGUI_PlayerText_Callout1New");
break;
case 1:
var1 = Translator.getText("IGUI_PlayerText_Callout2New");
break;
case 2:
var1 = Translator.getText("IGUI_PlayerText_Callout3New");
}
}
zombie.WorldSoundManager.instance.addSound(this, (int)this.x, (int)this.y, (int)this.z, var2, var2);
this.SayShout(var1);
this.callOut = true;
}
probably so translations made for current builds still work in past builds where different variables were used
nevermind there's only one function :D
@digital sail Thanks! and thanks for sharing the code, helps me learn
Sounds like stress ?
nvm
I would strongly recommend decompiling the game if you plan on modding PZ. There is little to no documentation, the API is not self explanatory and the scopes of the Java and Lua code are arbitrary.
I used vineflower: https://github.com/Vineflower/vineflower
cd steamapps\common\ProjectZomboid\zombie
'C:\Program Files\OpenJDK\jdk-22.0.1\bin\java.exe' -jar .\vineflower-1.10.1.jar . --folder './decompiled'
Open the newly created decompiled directory in a new VS Code window (or any IDE/glorified text editor you like) so you can search through it easily
How do I make custom crafting recipes?
Well how would I go about making a custom recipe?
check out lua timers mod
yes
local timer
-- call this when the timer should start
local function setTimerStart()
timer = os.time()
end
local function temp()
if timer and os.time() - timer == 5*60 then
timer = nil --stop the timer
-- trigger whatever you want to do
end
end
-- this can be any event, just try to not use something that runs a lot, so one minute could be enough
-- depands how precise you want the timer to be
Events.EveryOneMinute.Add(temp)
using == for time? ๐ญ
using == for non-integers in general is a poor idea
simple fix, just use > instead.
that said == does works fine if your algorithm can arrive at exact value, such as by using math.min with this value in it. It's generally not possible to do this by normal arithmentical means.
otherwise you can use the "close enough" technique. Define a small tolerance value (epsilon) and check if math.abs of your target value is less than the tolerance.
ok im making a mod for when people are drunk cant find out why its not doing what it needs to do i did it lua first time doing a mod
this is helpful
can you post the code instead?
i posted the code
imean like
``
--code
``
nvm
his code is too long for a snippet
What result do you expect. What result do you get instead?
Did you try to debug it by adding print() everywhere in your code to see if execution flow goes as expected?
look first time ever coding ok i am trying my best
isee i downloaded the txt
anyways i understand what your trying to do now
youre having problems noving reverse right?
what you can do is this
look at how keybind works
and save the current keybind to moddata (since other Players might have set it differently)
then swap the left and right and up and down
then when players no longer drunk reassign
also theres already ingame drunk level
use that instead of moddata
@plucky pumice
you could also mess with the face direction i bet thats a better approach if you make the character face random directions when moving and all the other keys would just move straight to where player is facing
and you should disable autowalk btw
cuz it will beat the purpose
oh ok thank you
do think you could help with that because i am not sure on the whole character facing
let me look for the syntax
try
player:setDirectionAngle()
player:setDir()
player:setDirection()
not sure which but there are those who use "N", "NW", "S", etc
some use float 1 to 359 i think
some use vector
im afk rn
ok
// in IsoDirections.class
public enum IsoDirections {
N(0),
NW(1),
W(2),
SW(3),
S(4),
SE(5),
E(6),
NE(7)
}
// in IsoGameCharacter.class, parent of IsoPlayer.class
@Override
public void setDir(IsoDirections var1) { // getPlayer():setDir(IsoDirections.E)
this.dir = var1;
this.getVectorFromDirection(this.m_forwardDirection);
}
// unused in the vanilla Lua code
public void setDirectionAngle(float var1) { // getPlayer():setDirectionAngle(angleValueInDegrees)
float var2 = (float) (Math.PI / 180.0) * var1;
Vector2 var3 = this.getForwardDirection();
var3.setDirection(var2);
}
This is what can be found in the Java code.
I tried adding a 3D portrait to my Chat bubble, it did not go as planed
Question about using SQLite databases with Lua in Project Zomboid
Hi everyone,
I'm currently working on a mod for Project Zomboid and I'm interested in saving some persistent data (warnings, player info, etc.) in a custom SQLite database rather than using the default global_mod_data.bin file. I noticed that the game uses SQLite for things like players.db, and I was wondering:
Is it possible to create and manage custom` .db` files through Lua scripts within the game?
If so, could someone guide me on how to interact with SQLite databases from Lua code in the Project Zomboid environment? Is there a specific API or module like` lsqlite3` available, or does PZ have its own database management functions?
Are there any examples or best practices for handling custom databases with Lua in mods?
Thanks in advance for your help!
What's wrong with moddata?
Unless you reimplement SQLite entirely in Lua I don't think this is possible anyway.
Thank you! I'll stick to using modData for my project as I'm developing an advanced warning system.
I was considering using .db files for displaying some of the warning information on a web page, but I'll go ahead with modData for now.
if you want to access the data from an external program you could write a JSON file
depending on the size of the file it would be fine if you only write it every few minutes
Yes, I had thought about that too. I'm just not sure which solution to go with yet. JSON could be a good option., but Iโm still weighing the options.
I already have a Lua code for reading JSON, and I could use it to handle the data. Here's the code for anyone interested:
`local function parseJson(jsonString)
local json = {}
local jsonDecodeError
jsonString = jsonString:gsub('\\\\', '\\')
jsonString = jsonString:gsub('\\"', '"')
jsonString = jsonString:gsub('\\/', '/')
jsonString = jsonString:gsub('\\b', '\b')
jsonString = jsonString:gsub('\\f', '\f')
jsonString = jsonString:gsub('\\n', '\n')
jsonString = jsonString:gsub('\\r', '\r')
jsonString = jsonString:gsub('\\t', '\t')
local function parseValue(jsonString)
local value
if jsonString:sub(1, 1) == '"' then
local endPos = jsonString:find('"', 2)
while endPos do
if jsonString:sub(endPos - 1, endPos - 1) ~= '\\' then
break
end
endPos = jsonString:find('"', endPos + 1)
end
value = jsonString:sub(2, endPos - 1)
jsonString = jsonString:sub(endPos + 1)
elseif jsonString:sub(1, 1) == '{' then
value, jsonString = parseObject(jsonString)
elseif jsonString:sub(1, 1) == '[' then
value, jsonString = parseArray(jsonString)
else
local endPos = jsonString:find('[,}]')
if endPos then
value = jsonString:sub(1, endPos - 1)
jsonString = jsonString:sub(endPos)
else
value = jsonString
jsonString = ''
end
end
return value, jsonString
end
local function parseObject(jsonString)
local obj = {}
jsonString = jsonString:sub(2)
while jsonString:sub(1, 1) ~= '}' do
jsonString = jsonString:gsub('^%s+', '')
local key, val
key, jsonString = parseValue(jsonString)
jsonString = jsonString:gsub('^%s*:%s*', '')
val, jsonString = parseValue(jsonString)
obj[key] = val
jsonString = jsonString:gsub('^%s*,%s*', '')
end
return obj, jsonString:sub(2)
end
local function parseArray(jsonString)
local arr = {}
jsonString = jsonString:sub(2)
while jsonString:sub(1, 1) ~= ']' do
local val
val, jsonString = parseValue(jsonString)
table.insert(arr, val)
jsonString = jsonString:gsub('^%s*,%s*', '')
end
return arr, jsonString:sub(2)
end
json, jsonDecodeError = parseObject(jsonString)
return json, jsonDecodeError
end`
supporting the full JSON specification is a lot of work, I recommend using a library like
https://github.com/rxi/json.lua (with a bit32 backport from Lua 5.2 like https://github.com/davidm/lua-bit-numberlua)
A lightweight JSON library for Lua. Contribute to rxi/json.lua development by creating an account on GitHub.
Thank you very much for sharing! I understand that supporting the full JSON specification is a lot of work, and Iโll follow your advice by using a library like https://github.com/rxi/json.lua with a bit32 backport from Lua 5.2 (https://github.com/davidm/lua-bit-numberlua). Also, if I run into any issues with my script, would it be okay to ask for your advice?
A lightweight JSON library for Lua. Contribute to rxi/json.lua development by creating an account on GitHub.
Lol that's actually quite cool, there might be things to do with this
An interactive chess game
Guys, can you answer my question? Is it possible to limit administrator access to the Zomboid project server? Like Admin, Moderator, Helper?
I am not sure I understand the question.
You can set those roles to a player : https://theindiestone.com/forums/index.php?/topic/21056-server-access-level/
From build 35.17, you'll be able to set different access level for your admin staff using /setaccesslevel "username" "accesslevel" option or directly inside the server database. List of access level possible: admin, moderator, overseer, gm, observer. This is what they all can do: (please note thi...
And you can get the player role from the code and write conditions accordingly.
you might need to use the zoom option on the 3dmodel renderer
;)
is it possible to replace/override vanilla animsets?
looks good so this is like a dynamic 3d image?
it's the same function used in the info panel where you can change your character hairstyle
you can hook on the functions that you want to limit.
but are you asking cuz youre going to make a mod? if not this is the wrong channel...
ahhh...
It is. Im doing that with my mod "Bolt Action Rifle Adjustment". I did copy vanila files, edited them to use animations i want and they override vaniala animsets and play animations i selected.
i wonder if the animation viewer can be used this way
clone it dont overwrite it
I don't have the answer, I suppose it is, you might have more luck in #modeling
You can set a specific animation although I'm not animating it for my bubble
I realize some of you already answered Jaxe :D
hmmm.. this is very promising
you might be able to unlock something new that wasnt entirely possible before
if youre able to take that anim viewer character
so just keeping the same filename will override?
dont overwrite duplicate then name it differently
then modify the condition
btw if it has a parent xml you should also copy it
usually its named default
I mean, depends on what you want to do
oh I see what you mean.. will try that thanks
Like i wanted to change animation for every gun that used Bolt Action reload animsets so i did override them, but if you for example want to make a gun that has new animations for reloading/racking and only this gun to use it, you then create new animsets.
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="AttachItem_Back.xml">
<m_Name>AttachItem_BeltRight</m_Name>
<m_AnimName>Bob_Equip_HolsterRight_1Hand</m_AnimName>
<m_Conditions />
<m_Conditions>
<m_StringValue>belt right</m_StringValue>
</m_Conditions>
</animNode>
AttachItem_Back.xml
you should duplicate this on the same folder you made if you copied something like this
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>BlowTorch</m_Name>
<m_SpeedScale>0.80</m_SpeedScale>
<m_AnimName>Bob_IdleBlowtorch_High</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_BlendTime>0.20</m_BlendTime>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>BlowTorch</m_StringValue>
</m_Conditions>
<m_SubStateBoneWeights>
<boneName>Dummy01</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Translation_Data</boneName>
</m_SubStateBoneWeights>
</animNode>
so heres an example you want to make an action
you just create a new file after cloning this xml
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>myAction</m_Name>
<m_SpeedScale>0.80</m_SpeedScale>
<m_AnimName>myActionAnimationFileName</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_BlendTime>0.20</m_BlendTime>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>myAction</m_StringValue>
</m_Conditions>
<m_SubStateBoneWeights>
<boneName>Dummy01</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Translation_Data</boneName>
</m_SubStateBoneWeights>
</animNode>
and turn itinto something like this
i would name this same as my m_Name as much as possible but its not required
thanks. I'm not sure if I really should be in animsets actually. I'm just trying to stop player death / becoming a corpse from happening. I know there's many ways of doing it but I was exploring if it's possible via animsets as it seemed somewhat linked to the ongroundstate
what are you trying to accomplish exactly?
doing something other than death when death should occur. I've got various ways of doing it but the most reliable is through OnPlayerUpdate when the health gets low enough but not quite enough to die
yeah death animation and death state cannot reverse the death itself
it's all the server sync stuff which is the hard part to block, so better to stop death actually happening
it's quite an issue since you can lose arbitrarily large amount of health from attack damage
exactly this is a problem
so setting the trigger point somewhere around 20% is needed
but I'm still exploring if there's any other way
i don't think there is since death is triggered when overall health is at 0 and after that it's not reversible
i mean there's the onplayerdeath callback and you should be able to cancel death by returning true from it or something, but it's specifically not the case
no OnPlayerDeath is too late
technically the player is still not a deadbody when this triggers, but there's just no provisions for reversing death sequence
yes but the server sync stuff already fires
this is kind of an issue if you want to track dead bodies since you need to account for death animation real time length
I'm mostly ok anyway, it works fine with 20% trigger point
also fun fact isodeadbody can spawn on a different square than where you died
and then I trick the UI into displaying 20% as 0%
but unfortunately, it doesn't work for another player checking your medical status
tricking getBodyDamageRemote is a lot harder
can you just decorate it?
what do you mean?
make your own function that runs instead of it, which at some point calls the original function to preform the vanilla operation
so you could retreive the real body damage, then scale it to the adjusted range, and then return that
if it's available from lua then it can be decorated
what do you want to do with this?
purpose?
do you need the health to stay low? cuz if your purpose for example is to create a different kind of godmode then you can just prevent damage using the OnPlayerDamage event
also this might be better than using player update
you can add to the health the damage param
not to worry, I'm actually close to releasing my mod soon, just in optimization stage
I was trying to go down a route that's not worth it and now I've sorted out some issues on my original route I'm doing ok now
ok goodluck
Made my first mod that displays a simple interface with a toggle button, I wanted to end myself throughout the entire process ๐
Hi, are there any Russian translators, or anyone that has done Russian translations that could help with encoding for my mod?
I just need to know what to convert it to in Notepad++... I've tried Windows 1251 but it still shows as weird characters
Isn't it windows1252?
Nevermind, it's only latin characters
It's supposed to be 1251 from what I'm reading.
keep in mind that changing encoding in notepad++ doesn't convert the file
im trying to change the farming_vegetableconf.props["Carrots"].timeToGrow into a float, but im not sure its working? should i just be rounding the float into an integer or am i just doing something wrong somehow
farming stuff is pure lua right? it shouldn't really care if it's an integer or float, although depending on how exactly it works it may behave as the next highest/lowest integer anyway
uh
Is it ?
what part of farming isn't?
it was a mod originally and i'm not sure if any of it was ever rewritten like erosion was
No idea
Farming is all lua
@magic halo hey posted a comment on FarmingAPI mod, got me quite confused as it seems to be natively imcompatible with Soul's Filcher awesome time (his crops)
Any reason why custom zombie outfits won't take vanilla items? The jacket is from the mod but the pants and shoes were supposed to be vanilla
You need to add the vanilla items inside the fieldguid
xml to your mods fieldguid.xml or whatever itโs called
Yep, that fixed it. Thank you :D
I want to know what would be the price for devs to make a mod, for example my server needs a automated pay check menu through a ATM and admin whitelist menu.
or if there is any modders that takes comissions
i make mod for 3 dollar
I agree because I hate UI
Now that you've pinged me I have a question, I made that mod with VS by looking through existing zomboid code without ever coding in lua before, now, is there anything I can do or use so that it would display errors in the code without me having to restart the game to test the mod manually for errors?
Like when I am writing a script for unity game, I can't even run it unless I fix all errors and it shows exact line with problems in the console
you can have vscode display syntax errors by following the instructions on this page https://github.com/asledgehammer/Umbrella
this will only catch some runtime errors though
use dat ^^^^^^
its the best we got
but you might also want to launch game in debug mode, then you only have to reload lua button in main menu and not the whole game
Or even better, in-game :3
I just don't suggest it from myself because every time I try to use it, I get things like double events happen / event callbacks not being updated, errors from 5 file revisions ago showing up, and some other weird stuff
since I have a good pc and test my mods mainly on the mini map, it takes like 3-5 seconds to load the save anyway so it works well enough for me
That's why you set the events OnGameStart (so that only happens once) or you do it in another file that you don't reload
Nah I swear a lot of things you need this insta reload, it's so useful, it changed my life so hard
it can be helpful for things that are already isolated but i don't find it very helpful in most cases
as aoqia says load times are not so bad that it justifies restructuring my code around being reloadable
true, I don't know if this would apply but I do all my stuff in modules like events with init function, distributions, etc (literally every single file in all of my mods are modules) so I don't think I can do this?
but I agree more with albion, usually I only need to reload the save if i've got an error. I fix that, then I can load in and test all I want until another error or some unexpected gameplay shows up
I'm not really hot-reloading my files much, it's more testing than fixing errors honestly
and I suck at testing so it takes me 2x as long lol
if something is zomboid specific i'm probably going to test it out a bunch in the console before i actually write any code, and if it's not then i'll probably just test it in an external lua interpreter
Yeah you can't do this then
Sup everyone!, my zomboid apocalyptical retexture pack has entered public alpha! about 7000 Retextures ATM, feel free to give me feedback on your experience on it and give the rating u think it deserves =)]
do you copy the guid from vanilla or provide a new one?
cuz i tried to make a duplicate of a vanilla outfit but with different name
it didnt work
the zed turned naked
So if you need to use a vanilla item in your mods clothing.xml so you can have a custom outfit you need to bring the fileGuidTable.xml items that you want in it to your own mods fileGuidTable.xml
youll just copypaste whatever it is into yours so
i see
you dont need to change the guid because it pulls it from the basegame I assume.
thnx
its same with animation xmls
you need to also copy the file its refereeing to
but for outfit it seems like they dont have access to the fileguid from vanilla only within its mod
this is very useful
how did you manage to figure this out?
Like 1.5-2 years ago when I tried to make custom outfits and wondered why I couldnt figure out why it wasnt working. I downloaded one of authenticpeaches stuff to see how that file worked and thats how.
so if i need to make a clone of an outfit i need the filegui from vanilla
question
what abt the clothing xmls? do i copy it too ?
cuz i want to duplicate all of the outfits and just change their name
to contain a suffix
so thats what im gona look for to determine if its special zed
i thought i just needed to add them to the spawn distro but assign em 0
Ok so heres an example. Usually I typed these names out fast because I didnt expect to show anyone but here we go. Shoes/sneakers, Eye makeup, Long socks and fingerless gloves are vanilla items. You need to first copy those from the vanilla fileGuidTable.xml and add them to your fileGuidTable.xml. Then once you do that you can use the same GUID for custom outfits inside clothing.xml. You do need to make a new GUID for the one underneath the m_name one though or else it wont work.
Theres also <m_Top>false</m_Top>
<m_Pants>false</m_Pants>
that stop the outfit from spawning those types of clothes
But yeah I assume you can just copy the whole thing for what your doing, change the guid underneath m_Name and do what your looking for
but i dont need to add clothing
i just wanted the duplicate the outfits
I misread that, but I assume you can copy the whole clothing.xml and manually change the names like you said along the with guid. It should work.
how does splitscreen work?
i use mostly getPlayer() in my code. Will it work in splitscreen?
oh so without the clothing files they will still become naked?
then im making a heavy mod
i think this is from old versions
not really sure if it still works
but i learned from burryaga you just use
getSpecificPlayer(getPlayer():getPlayerNum())
just type that using mobile so syntax might be wrong
getPlayer will only work for player 1
For code to work in splitscreen you have to use the player's index to find the correct player object
For 2 players there'll be a player index 0 and 1
(And a corresponding joypad index 1 and 2)
How to get the proper player index for your situation varies; Glytch3r's suggestion is for OnPlayerUpdate, but he is showing you incorrectly.
@ancient grail What you wrote is functionally equivalent to getPlayer() because you got the player number from player one
In OnPlayerUpdate, the first parameter is a player object, so in that context you can go
playerIndex = player:getPlayerNum()
But you would never need to get player object in that function
Some functions especially in the context menu code send player index instead
(though confusingly often still call it player)
So in those functions you can do
player = getSpecificPlayer(playerIndex)
but ty for info
Assuming you rename the parameter
Yeah it's just about knowing which player is calling a function that's all. It takes some practice but imo it becomes second nature pretty quickly

youre 100% right im dumb
Everyone makes mistakes
Does anyone know where the devs have snuck the map files? And I'm talking for the ingame map like the rosewood map, march ridge etc.
As I assume they are image files, or am I wrong on that?
Actually, how does things like maps and doodles that you can write on get displayed in game?
C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\ui\LootableMaps is this what your looking for?
i myself am looking for the inagame Speedometer ui so i can change it to look cooler but im unable to find it lol
That is exactly right, thank you!
But wait, that doesn't seem entirely right- At least the images don't match what is in-game
They are lootable maps
not the ui map
if your talking about the ui map i have no idea
They are the lootable ones yeah, but when you open one of the lootable maps in game, it looks like the normal map UI
yh
Alright then its because of mods, my bad sorry!
But now the next question is, how does the items.txt file manage to locate the map image files. As in the files they are called their respective names full lowercase, plus they have .png behind them, but in the .txt they are called this. So is there a file that helps bind/navigate between the txt file and the image file?
Wait chainsaw? Coming soon?
tbh i have no idea, all i really know is lua, never done java
I mean fair. I hope its not too complicated
As all I want is to make like, text documents converted to pngs with story, then have that be in the game, that's it lol
its an early test item thats been there a while i think
But for that I need to figure out how the .txt locates files
it doesnt work but theres a mod on the workshop that properly adds it
I see. Would you know where the speedometer ui texture is located?
i found the profanity file๐จ
it looks like it doesnt use a texture but is just drawn onto the ui through lua code
i have no idea how vehicles work though so i have no idea
aw
i think this is where the speedometer is created?
oh wait
theres nothing in that folder so i guess its packed into a texturepack maybe?
i dont understand.
a texture pack?
a lot of the vanilla games sprites including the ui are inside these files which you need to open with the mapping tool
i'll see if i can find it 1 min
Thanks alot๐
found it
YESS! What program should i use to open .pack files? What file is it?
you need to download the project zomboid modding tools from your steam library and then open tilezed
i can extract the images for you though
Ah, I have the already installed No worries. How should i go about changing the texture?
you wont need to mess with packs if youre wanting to retexture the ui since the filepath you need to use is in that lua file
as long as you put your texture as this file it should work i think
Im looking to try retexture most of the dashboard though.
when you open the pack viewer in tilezed the vehicle ui is in UI2.pack and then you can extract images and save them as separate images
it'll extract every texture in the pack though so you'll want to go to the bottom to the ones that start with vehicle
all of the filepaths should be here in media/lua/client/vehicles/isui/isvehicledashboard.lua
Alrighty.
these ones are here too
I think your going to need to zip them because of the new discord file size limit.
Im not sure how big they are though in size.
"Itll" Sorry, Though you said "Ill" My bad.
Thank you
i do have them extracted already so i can send them
these are all the ones i could find related to the dashboard
some of them are from the vehicle radial menu though im pretty sure
anything thats not in this list you might wanna delete i guess
I rename and drag them into the file locations when im done and it will replace the texture packs? "media/ui/vehicles/vehicle_spedometer.png" for example?
i think it should work but ive not tested it
how to hide the buttons on the left hand side like health, search, map, etc?
Dawn of the Zed
thanks, I'll check it for how you did it there. What's the actual buttons called in lua?
I think I had to hide them super obscurely by just hiding the UI but you can optionally not hide the parts of the UI that are in Lua. I believe that part may not be Lua but I could be mistaken. Some UI stuff is Javaside and not easy to control. Idr solving independent control of those specific buttons. But DotD lets you manage what parts of the UI hide and do not hide when you press its shortcut, and you can review my code to see how I was able to target what I could target
iirc that's a java object
This is also my memory but mine is not exactly perfectly reliable ๐
a technique that worked for me to remove the moodle ui, which is also java, was:```lua
local ui = UIManager.getUI()
for i = 0, 3 do
ui:remove(UIManager.getMoodleUI(i))
end
texturepacks
woops spongie already answered.my bad
ISEquippedItem really looks like it's the left hand buttons toolbar but ISEquippedItem.instance is nil despite it showing. I'm confused what it is
Quick question. Does anyone know how the txt file locates where the "maps" are stored? As it doesn't mention any folder locations or anything, so it only based off of name?
How do I make a file overwrite a Vanilla file
just make sure it has the same filepath
Some opnions on this grass texture? reworking the current version of my mod
Just updated it with a new grass alternative =), more full and sharper textures, now grass is separated from the main mod so you can use it without props.
https://steamcommunity.com/sharedfiles/filedetails/?id=3333779609
if getActivatedMods():contains("Arsenal(26)GunFighter[MAIN MOD 2.0]") or getActivatedMods():contains("Arsenal(26)GunFighter") then
table.insert(ProceduralDistributions["list"]["SchoolLockers"].items, "Base.BA_ARCase");
table.insert(ProceduralDistributions["list"]["SchoolLockers"].items, 10);```
Am I missing something here? The item doesn't show up in LootZed or as a spawn. Currently only using Procedural Distributions to spawn.
Question. Do you need to set up procedural distributions in order for items to show up inside the debug spawn menu, or should they show up there no matter what?
maybe you need to put that on an distib event?
or youre missing an "end"
@unborn rover
you dont need distro to use item viewer to spawn items
Oh does end need to be there?
if then end
--code
end```
Hmmโฆlโll try that tomorrow. This was really stumping me
Hmm, I see. Thank you. Yeah since the items I am trying to create don't show up at all-
Does it have to do with the ID in mod info maybe? Does it need to match something in the other files?
goodluck
you might have a syntax error
might bit have properly loaded the mod
wrong folder structure
or other issues
depends where the mod is
is it on the workshop folder or mods folder
if its mods folder then just make sure you dont have another folder with the same mod id
That might have been the problem then
Alright, now I am able to spawn the items, so thank you!
Now I just need to figure how to make them readable like maps. Where they pop up an image on the screen
Does anyone know how to do that?
AuthenticZ has few things like that
You could check the code
It's like a hitlist of rare zombie outfits
Hit-list of sort
Oh sweet, that sounds good. Thank you
That's hot
I have a little problem with my helicopter mod, helicopters are spawning in differents location in the map and all the spawn ones are glitched
Its like the helicopter is freeze and i cant repair it with admin or get the key
Do someone have the answer of this thing ? Or can help me please
wow nice model! can i text you about your mod?
oh thats not mine but yes
alr, i'm finally starting up on that mod i wanted to make, so i was curious if anyone could assist me?
actually i should ask thee person who told me someth before
@civic tree think it was you
basically i'm trying to make a mod where all zombie spawns have a spiffo suit
titled "Attack of the Spiffos"
might as well stop putting it off yk
lol
anywho
my only real confusion comes from how this'll even be transported into a mod onto the steam workshop
my assumption is i go into the Zombie .zip, alter the clothing for spawns to just be the suit, tail, and head, and then somehow port that into a mod
its easy
you need basically just some folders with names and other folders inside, with the file you want to overwrite the vanilla one on the right file path so the game knows
here, i made a mod that alters the same file you want to alter
i named the file "zombiezonesedit2" or something, but you can change its name, its ok
feel free to change all the other things and use this as a template
mod info, description, image, etc.
you there?
yeah just all a good bit confusing
just download that file i gave you and extract it, the stuff is already done
ModTemplate\media\lua\shared
follow this path and youll get to the file im talking about
how do i extract again? it keeps telliing me to use winzip but i SWEAR ii can extract these normally without it
i just don't see the option to
right click and extract here dont work?
this is all i see
it's practically telling me ii can only use winzip
i could probably use 7zip actually
if i double left click it tries to use winzip lol
which says my trial expired
7zip worked
cool, you found the modtemplate folder?
oh, you clicked the option to extract it into a folder with the same name as the compressed file?
i guess so
but i extracted it into "test mod folder" in my downloads folder which i made beforehand
alr its the same, dw
now get to the file i was talking about
yeah thats the one
thats the one i modified, we could work from that one but its preferable if you copy the original one from your pz files
you know how to get to it? its easy
its location (after you go to the local files option on steam library for pz) is:
ProjectZomboid\media\lua\shared\NPCs
file name is ZombiesZoneDefinition.lua
sorry had to do someth
oh it's in NPCs, i would have thought it was in the Zombies folder
on it
cool, copy the zombiezonedefinition to where the zombiezoneedit2 file is
then you can delete zombiezoneedit2, we wont need it
alr i cut and pasted it
๐
should look like this correct
should probably start replying back to you @civic tree
yep looks good
now, you got notepad++ or just the regular notepad?
both are good but notepad++ has more tools and such
iirc chestnuts uses ++
we can do it with both
gotcha
yeah coders and such usually use it because its got more functions and useful stuff
but as i said, you can just not use it for this one
and itll be just fine
unfortunately i barely paid attention in my coding class
kahn academy? more like naptime 
well. now go into the lua file
dont worry man i understood this stuff and i know absolutely nothing about coding
alr, well. what you are seeing is
the zones that zombies can spawn in
then a preset outfit or pool or whatever thing is named
then they set the chance for the zombies to spawn with that outfit in that zone
first thing you need to do is set all spawning chances to 0
because we dont want none of them, we just want the spiffo
oh shoot wait this is vanilla right??? cuz i have other clothing mods like VCE and Spongie
maaaaaaaaaaaaaaaaan do i really gotta go through scroll slowly and set everything to 0
you could use the notepad++ tool to do it quickly lol
open it
ignore JK Leeds at the bottom
donezo
look for chance=
in the right
press the option to look for all the results in the file
type it here right
he just downloaded the thing bro, dont be like that
this part's rather simple tbf
actually we prob should move to DMs as to not bloat here
yup in the find what, then click (under the find next option) find all in current document
sure why not
are you working in the mod? I had a plan to develop a realistic and accurate helicopter mod too
Im armed forced aircraft mechanic, and i worked with both fixed wing and helos.
I have a lot of ideas and cool features such as realistic mechanical parts of the uh-1 chopper and also i was thinking to develop the dashboard of the aircraft with realistic indicators and functional features so it doesn use a car dash. Also though about try to develop realistic startup procedure so it doesn't start with a key like a car.
I know, sounds so crazy, with a lot of things and some of them require a rework of the lua, but i think it would be a nice and realistic mod
So basically what im doing here is that im reworking the original mod that called better helicopter with the basic features and then im adding cool features like heli spawn locations, complete rextexture heli (from an other mod)
But yeah i didnt think about a custom dashbord and features
Custom ui like the fallout armor ?
This will be cool on a heli (not the same but you know what im saying)
Yeah! But idk where to start to rebuild the standard vehicle dash and implement it on the chopper. Maybe the power armor mod it's a good example to follow
I also thought about rework better helicopters like you did, bc no idea where to start
If you want we can try work it together
But I have to take a look at the modding documentation and those things bc I never modded before
alr wanna ask now just in case anyone currently online knows
i was wondering if anyone knew the process of either/both making the zombies always have the full suit, and also/or the process of allowing them to still have "loadouts" for a mod i just made with help from gas 4 go
https://steamcommunity.com/sharedfiles/filedetails/?id=3337308401\
by loadouts, i mean making zombies still have their proper gear, such as military zombies will be wearing spiffo suits, but will have their backpacks (if they have them) and normal gear spawns such as weapon loot and whatnot
or survivor zombies still having backpacks and weapons, on their person but also wearing spiffo suits
Zombie visuals
For example
-- get zombie visual clothing
local visual = zombie:getItemVisuals()
if visual:size() > 0 then
local hasHat_Fungi = false
local priority = 100
local itemReset = nil
for i = 1, visual:size()-1 do
local item = visual:get(i)
if not item then
break
end
local bodyLocation = item:getScriptItem():getBodyLocation()
local priorityTest = clothingPriority[bodyLocation]
if item:getItemType() == "Base.Hat_Fungi" then
hasHat_Fungi = true
break
elseif priorityTest and priorityTest < priority then
-- if not, then add one to the item
priority = priorityTest
itemReset = item
end
end
if not hasHat_Fungi and itemReset then
itemReset:setItemType("Base.Hat_Fungi")
zombie:resetModel()
end
end
This is an old version of a code I had made to make my Clickers all have the same fungi headset
While still keeping their loadout and original outfit
oh sweet!! wait so that resolves both issues i had?
sorry, this is kinda my first mod and gas had to lead me through basically bit by bit
Does anyone know how I can add items in the game once when the world initializes? Can I just make a simple lua script or is this more like map modding?
I want to add specific items in a specific location one time. The issue im having is that the loot reappears when the game is loaded again
add items like distribution?
no, like 1 item in 1 specific place on the map. only to appear 1 time
im thinking i could use something like this?
https://github.com/Konijima/PZ-Community-API/tree/master/Contents/mods/CommunityAPI/media/lua/client/SpawnerAPI
if you already have a script that spawns it, just use global mod data to flag when it has already been spawned and don't spawn it if it's set
something like:```lua
-- inside your script that spawns the item
local modData = ModData.getOrCreate("MyMod")
if modData.itemSpawned then return end
-- spawn the item
modData.itemSpawned = true
Okay, how could i fit that into this?
local sq = getCell():getGridSquare(4846, 6282, 0)
if (sq ~= nil) then
sq:AddWorldInventoryItem("Base.WaterBottleEmpty", 0, 0, 0)
Events.LoadGridsquare.Remove(SpawnInventoryItem) --once
end
end
Events.LoadGridsquare.Add(SpawnInventoryItem)```
never mind i figured it out
THANK YOU!
Yo how would I make a mod that allows you to attach helmets and hats in general to your belt.
And it attached then shows up on the hotbar slot, and if you use the hotbar slot then it wears the hat/helmet.
is it possible to make SandboxVars that show up on singleplayer sandbox options only?
Please DM me about this
Anyone that can help
Pretty sure no
i dont think so
just add tooltip that says for sp only
you can probably do some weird crap with hooking the sandbox options screen to hide it in the multiplayer one but it'd probably be annoying as hell
there's no simple way to do it
I guess the tooltip is the easiest way
You can make sandbox page that says "Your mod name [SP ONLY]
So it's easier to separate
Gunfighter does that
i have an idea
you can split the option pages
mod name singplayer option
mod name multiplyer option
yup that's probably the best. I think that's what MusicManiac was suggesting
that's literally what i suggested xdd
do the perks Passiv Agility Melee Firearm and Combat actually affect anything? I can't figure out their purpose
and Crafting, Survivalist, Blacksmith and Melting too
blacksmith is unused, i don't recognise melting but it probably is too
the others are perk *categories*, yes this structure is insane
can't see anywhere in java where those category skills do anything
but they can have perk levels
they can but nothing ever gives xp to them
they just use the same object for categories as they do for actual skills, for some reason
Hi guys me and my friend making a car mod but we can't find how the make autotsar I mean tuning or armored cars someone can help me?
Hi, is there anyway to spawn in a container with custom loot filled in it?
I'm using AddWorldInventoryItem to spawn in Base.Bag_WeaponBag
but i'd like to fill it with the loot of my choice
Hello I have question, you know how the make autotsar costume mod car? My friend and I making one
anyone know how to prevent zombies from spawning with clothing in specific locations? i assume that's what i need to do to prevent the clipping issues
since what i'm doing apparently uses visuals rather than outright altering their outfit i assume it won't thereby prevent them from spawning without the tails if i deactivate vests as a body location since the tail counts as a vest
...or whatever
hoodies, dresses, aprons, hats
player:getXp(Perks.Aiming)
Would this return the player's current aiming experience or do you need to do more?
Found this message; trying that
That does not appear to have worked, hmf
Does anyone know how to spawn in a bag with custom loot in it? Trying to put something like this in my mod
https://steamcommunity.com/sharedfiles/filedetails/?id=2868229063
So I found this mod that introduces a power grid, but its admin reliant. Is there a mod where after power outage, you can just maintain some facility in the world? Forget lore, just some fun gameplay mechanic that requires you to check up on a facility to keep the power going.
Maybe someone could take a commission for it?
The mod that I use is Restore Utilities - it lets you restore power or water at given locations based on Electrical Skill, and also has items you can collect that improve your odds or give you buffs during repairs. The mod itself has locations (which i dont use) but there are also a few other map mods that allow you to restore power or water when paired with restore utilities. Additionally you can also set specific tiles as admin
beat me to it lol
xdd
You can use these two map mods to add locations for fixing the power and water respectively.
Looks good that you can also use blackouts so its not instantly repaired on the day
so you have to survive without power still
I'd like to add a code that automatically converts cash into credit cards. I've tried this code, but it doesn't seem to work. Is there anything wrong?
function MoneyTrans(player)
local inventory = player:getInventory()
local moneyCount = 0
-- Money ์์ดํ
์ ๊ฐ์ ์ธ๊ธฐ
for i = 0, inventory:getItems():size() - 1 do
local item = inventory:getItems():get(i)
if item:getType() == "Base.Money" then
moneyCount = moneyCount + 1
end
end
-- Money๊ฐ 100๊ฐ ์ด์์ผ ๋
if moneyCount >= 100 then
-- Money 100๊ฐ ์ ๊ฑฐ
for i = 1, 100 do
for j = 0, inventory:getItems():size() - 1 do
local item = inventory:getItems():get(j)
if item:getType() == "Base.Money" then
inventory:Remove(item)
break -- ์ฒซ ๋ฒ์งธ Money๋ฅผ ์ ๊ฑฐํ ํ ๋ฐ๋ณต๋ฌธ ํ์ถ
end
end
end
inventory:AddItem("Base.CreditCard", 1)
player:Say("ํ๊ธ 100์ฅ์ ์ ์ฉ์นด๋ 1์ฅ์ผ๋ก ๋ณ๊ฒฝํ์ต๋๋ค.")
end
end
is there a way to stop any other anims/animsets from occuring? i.e force one animation so no other anims play
getType() will only give โMoneyโ back, use getFullType() if you want the module name aswell
Currently trying to add my own "Maps" in game. I've gotten it so the map menu itself shows up, but the image does not. I've been looking at the Authentic Z mod, copying the spots the maps are put in the folder structure "ui -> LootableMaps -> insert map name here" But I feel like I am missing something. Anyone got any ideas?
Do I maybe need something more?
no. you can however set its condition to something else instead
but this doesnt guarantee to work everytime
you need the lua too
Is it distributions? Objects? Something else? As there isn't a Lua inside lootableMaps
Okay I think I found it, now its just understanding what it means
Its still not appearing, am I missing something?
I was thinking to try to create a mod, but I don't know how hard it is?
Or it isn't?
depends on the mod
anywhere from "anyone who can read english can do it in 10 min" to "you need to figure complex math so it doesnt fuck up the game"

Yeah, guess it also depends on what you want to add
Don't start with trying to add custom maps, bad idea-

I wanted to start with something easy before as I also need to learn using blender still.
Does the numbers in overlayPNG need to match the dimensions of the PNG? Or does that not matter?
If what I want to after have learned as mod is all variant, limited edition and from movie of the 2nd Generation Pontiac Firebird Trans Am from 1970 to 1981.
That's why I asked that question before.
Hello, is there currently any versioning for sandbox settings?
I'm changing a boolean setting to an enum to support 3 choices. And if possible I want to map the old values to enum values instead of always returning the enum default value. Because in that case I might change some people their sandbox settings on existing saves.
Editing defaults doesnt change exising saves
oh it's slightly different question
yea not really
you'd have to introduce transition update
where you have both old and new option present
Ok, then I'll just put deprecated before the old one in that case. Thank you
how to change a sandbox option via code? Changing SandboxVars.Foo.Bar = 555 doesn't persist after reloading a game
local options = getSandboxOptions()
local val =
options:getOptionByName(""):setValue(val)
options:toLua()
try
works perfectly, thanks
try lookin at vanilla stuff
Hello, have any form to create a weapon zero damage and with no possibilities to make scratches, and others wounds?
youre talking about pvp right?
cuz you mentioned scratches?
theres no event to detect where injuries are coming from
so you cant prevent it by reversing the effect
afaik
maybe just try the weapons properties
see if that might do it
if its for zed its easy just set avoid damage when they get hit
I don't know how, but I got what I wanted. Thank you
Is there any secret trick for making zombies spawn with helmets? I have several custom clothing items in my mod and the only ones giving me problems are helmets
I have one more question, what category should I translate what players say into?
IG_UI?Recipes?
IGUI_PlayerText_
thanks
no just declare them on the clothing xml
thats basically how you add outfits
I did that. Everything but this item works. I can make it spawn with debug mod and everything works perfectly, but it won't spawn on zombies
The same thing happens with this one. It's a different helmet (which can be worn open or closed) and has the same result as the previous one: Can be crafted, can be worn, can be placed on the ground, used on recipes, everything but spawning on zombies
what guid did you use? did you add it to the fileGuidTable.xml?
and did the guid matches the ones on the helmets clothing file?
I'm developing my first mod and trying things for fun. But I never understood the health system. I can't get the health percentage of either body parts or the overall health. Do you have any suggestions?
for the player's health, use BodyDamage:getOverallBodyHealth()
You mean? I tried but even though I'm injured, it returns the value 1.
local hp = getPlayer():getBodyDamage():getOverallBodyHealth()
Got it. Sorry my bad. ๐ฅฒ
Yes, in the pvp. Thnx for the help. I'm trying to make a restore HP weapon, but unsuccessful ๐ฌ
I give life, but every hit makes a wound in the target
chat quick question. if i put the map to be 1x1 will it still be decently large?
I think they are 300x300 squares
so alot?
In this video maybe you have a idea for the proportion
https://www.youtube.com/watch?v=MR11p0khmsM&list=PLc7_sQ-Tb6e3siC4Cwu4JfxuqJZkGO6sy&index=2
In this video I will show you how to create a basic world the project zomboid world editor. Don't worry about adding details at this point, just about getting the basics right.
The colors which can be used can be seen in this document:
https://drive.google.com/file/d/1Zl38dxOiMLryiGDAy5T3k0bkAcyj30KW/view?usp=sharing
And if you want to support...
How can I access the user's frame rate? ๐ ๐
Thank you ๐ I did my first mod. Smart Watch โจ
Nice that looks clean
Do l come here for workshop questions? One of my mods is crashing my server and lโm not exactly sure why since itโs setup like the rest of them in terms of format. I have the co-op console to look at.
you should ask in #mod_support
All of those guids are for my custom items and all of them are in the table. I checked like four times and the guids match. Kinda weird that it doesn't work for helmets only
I'll try replacing it with the vanilla military helmet to see if at least those show up on the zombies
that is weird.. idk how else to help you man
It's okay, I appreciate it 
try removing everything other than just the helmet maybe? including the probability line
the only thing i could think of is that another item in the outfit overwrites the helmet slot but it doesnt look like that from the screenshot
Okay I found the mistake and feel kinda embarrassed now
Turns out I changed the name of the clothing items, but left the old names in the guidtable
I thought the clothing items didn't work at all if the names didn't match so I never thought of checking that
anyone need a polish Translator i can translate everything for any reward
there any guide out there to actiongroup transitions? I have no idea what to really do with them
or even <m_Transitions> in AnimSets, no idea on those too
nope
i wish
but i could help you with what i know so far
feel free to ask
I'll definitely need some help with the anims for future polish of my mod. Speaking of which, here is the result of all my questions:
https://steamcommunity.com/sharedfiles/filedetails/?id=3338664412
congrats
Question from someone completely ignorant regarding modding PZ... is it possible to patch another mod's lua file in a new mod?
yeah if you make a lua file with the same name in the same filepath it will overwrite it
Will that replace the other mod file completly? say i only want to add some values to a list on the original mod....
i think it depends if the list in the original lua file is local or not
if its not local then you could do table.insert
it is local : ```
local UsagesLeft = {}
UsagesLeft.managed_discrete_items = {
["Base.Matches"] = true,
["Base.PillsAntiDep"] = true,
["Base.PillsBeta"] = true,
["Base.PillsSleepingTablets"] = true
}
i think you might have to replace the file then but i'm not super experienced in lua so i'm not sure
never touched lua untill today either but i do have 20+ years of programing exp so it doesn't look that scary he he
lua's easy to learn if you come from literally any other lang ๐
please don't quote me on this, but I think require returns a ref to the module table so you could just require it and then set it to an empty table (or modify whatever you want with it). though i can't remember if it returns a copy of the table or a ref to. I keep leaning towards a ref so its possible if you want to try it
like dis
local module = require("UsagesLeftFileName")
module.managed_discrete_items = {
...
}
Don't call it module though in practice.
yes true
I just call it the same name that the module table was named
and or file name depending on other stufd
It's always a good idea to modularize and simplify calls to things. Make your file-tree the same. Make sure not to poison the global table.
is it crazy to say I've never once used a global in any of my mods? (to be fair i only have 4 published rn)
never once defined a global*****
I see people use global tables everywhere but I'm more OOP minded and I find it confusing to mentally map where things are being accessed to and from when its a massive big blob of data in a table instead of modules split elegantly into different files
(function() end)();
WHAT IS THIS--
Welcome to anonymous function execution.
an empty anonymous function being called is akin to a warcrime
the moment when people overuse anonymous funcs so the whole callstack is really hard to read 
Did you know that a loadstring(..) loads code with a null file reference in Kahlua? Using these two makes code unavoidably executable and overloadable.
The only way to remove or clean it is by resetting the KahluaEnvironment.
hmm
A major security benefit that I personally use with my loadstring bootloaders.



