#mod_development

1 messages ยท Page 262 of 1

tranquil kindle
#

Yes, its even encouraged by most modders

plush urchin
#

Okay just wanted to make sure as my model isnt being found atm. Probably a scaling issue then. ty for the help!

plush urchin
#

firearm

tranquil kindle
# plush urchin 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

Your first time trying to create your own gun mod, or struggling with making it work? I've been there. I've spend days figuring out why my gun model does not show / is semi transparent / is upside dow

#

So you can technicly override texture and model and see how your model looks in game

weary compass
#

how do i add custom animations to a weapon mod?

bronze yoke
#

48 ticks = 1 real second

ancient grail
#

i thought it was 60 i was totally wrong

quiet fulcrum
bronze yoke
#

yeah, every tick is half an in-game second

plush urchin
tranquil kindle
#

Happy to help.

solid horizon
#

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

quiet fulcrum
#

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?

bronze yoke
#

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

quiet fulcrum
solid horizon
#

the mod it self dont show on the mods list

bronze yoke
quiet fulcrum
#

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

bronze yoke
#

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);
quiet fulcrum
#

yeah that's a good point

solid horizon
bronze yoke
#

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

solid horizon
#

ok i will try and see

topaz tangle
bronze yoke
#

LOL

digital tinsel
#

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.

quiet fulcrum
#

the 'clock' icon when you are asleep, anyone know where this is triggered?

digital sail
#

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?

bronze yoke
#

classes have to be explicitly exposed, if you've decompiled look at LuaManager.Exposer.exposeAll

digital sail
#

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 :'(

bronze yoke
#

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

digital sail
#

you can only write and read in text mode :(

#

so all the \n and \r get lost in the process

bronze yoke
#

to my recollection getFileInput/getFileOutput aren't in text mode

#

the other read/write methods are though

digital sail
#

oh

bronze yoke
#

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

digital sail
#

where is the cache directory?

bronze yoke
#

%userprofile%/Zomboid/Lua/

digital sail
#

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

onyx valve
#

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

weary compass
#

how do i add custom animations to a weapon mod?

tranquil kindle
weary compass
tranquil kindle
#

Are you familiar with abimsets?

weary compass
tranquil kindle
#

Animsets

#

Yes, phone correction.

weary compass
#

Not really just getting into it

tranquil kindle
#

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?

tranquil kindle
#

What animation exactly you want to add?

#

Racking/Reloading/firing etc.

digital sail
#

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

digital sail
#

OMG I did it!

#

HAHAHA! It works!

#

Yes!

#

๐ŸŽ‰

#

I found the exploit

plush urchin
#

hey guys what would cause this? my muzzle flash only works in this position and i dont see shells falling out of the gun

placid delta
#

anyone know what texturepack the icons for traits reside in?

plush urchin
#

damn I did it again thats more of a modelling question.

solid horizon
#

Quick question: what files I have to make in order to make a mod with only a new recipe

raven zinc
#

Does anyone have any tutorials on how to create and Ingame map in worlded?

digital sail
#

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.

digital sail
#

Nevermind, Lua execution is still going after the exception

solid horizon
#

will post on steam workshop later

ancient grail
#

look for the scripts folder on your vanilla files and use the files as reference

tulip valve
#

Is it possible to make a new trait only appear when a specific profession is selected?

ancient grail
#

that boolean is what makes it hidden

#

this is from vanilla

tulip valve
#

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

ancient grail
#

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

quiet fulcrum
#

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

tulip valve
placid delta
ancient grail
quiet fulcrum
ancient grail
#

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

mellow frigate
ancient grail
#

i havent tested these

setFollowingTarget()
SetCharacterToFollow()
setFollowID

autumn pumice
#

Anyone know how to use setWornItem or something like it? I'm trying to put clothing on zombies.

broken lake
#

Odd, are we no longer allowed to post mods in showcase?

dull moss
#

<@&671452400221159444> surely this is not a phishing link Clueless

ancient grail
dull moss
#

since when

ancient grail
dull moss
#

130k members
phishing link stays on for longer than 10 min
waaaa

left plank
dull moss
#

<3

#

ty

broken lake
dull moss
#

DM spiffo

#

with suggestion

#

the bot, not the person

broken lake
#

Lmao ๐Ÿคฃ I feel bad for the user named spiffo considering that's a warning paired

bright fog
ancient grail
bright fog
#

For example

ancient grail
#

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

ancient grail
#

i know what youre sayin

ancient grail
#

like veteran gets desensitize

#

@broken lake

bright fog
digital tinsel
#

and 5000 props and textures done

broken lake
bright fog
digital tinsel
#

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

bright fog
#

oooh

digital tinsel
#

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

onyx valve
#

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?

bright fog
digital tinsel
#

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

bright fog
bright fog
digital tinsel
#

saving big textures for the non-repeating tiles

#

like side counter and windows

bright fog
#

Oh ?

broken lake
digital tinsel
#

lmao

#

but i think i fixed that

digital tinsel
#

really conservative with what texture i use in repeating tiles, but i got it

#

spiffo loking like a blood bath

quiet fulcrum
#

is there an easy way to block a player from doing anything like exercise, sitting down, opening doors, moving, aiming, etc?

digital tinsel
digital sail
broken lake
digital tinsel
#

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

broken lake
#

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!

inland steppe
#

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

tulip valve
#

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 :/

ancient grail
ancient grail
inland steppe
#

addSmokeOnSquare is it, thank you!

ancient grail
#

cuz this is for MP

inland steppe
#

appreciate it

digital tinsel
#

messing with trees hmm

digital sail
#

Is there anything in place to prevent packet loss?

#

I guess I'll have to do my own ping pong checks

real token
#

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

quiet fulcrum
#

given an InventoryItem in some container, how do I drop it at the feet of the player?

ancient grail
#

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

quiet fulcrum
#

and that would remove it from the current container?

digital sail
# digital sail Is there anything in place to prevent packet loss?

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

bright fog
indigo slate
#

spiffo 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.

bright fog
#

As an option

indigo slate
indigo slate
bright fog
broken lake
# bright fog what's a trimsheet ?

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.

bright fog
indigo slate
indigo slate
broken lake
broken lake
#

In things like Unreal; the engine has tools specifically built for trimsheet use and assets

bright fog
indigo slate
indigo slate
#

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

bronze yoke
#

modding is typically done through lua, you won't be able to extend java classes (technically lua is not even an object oriented language)

indigo slate
#

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 ๐Ÿ˜ญ

bronze yoke
#

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

indigo slate
#

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

bronze yoke
#

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

indigo slate
bronze yoke
#

you can interact with java objects, call their methods etc, you just can't extend classes or anything like tht

indigo slate
#

i see

#

thank you spiffo

bright fog
#

tho

indigo slate
bright fog
#

You can possibly mark a thumpable as not thumpable I believe

indigo slate
#

wouldn't that be better than accounting for all sorts of zombies?

indigo slate
bright fog
#

I remember something like this but it might be in the sprites properties however

indigo slate
#

gotchu

bright fog
#

The problem

indigo slate
#

I suppose I just need to figure out how to modify the properties then and I'm good to go

bright fog
#

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

indigo slate
#

ah I see lmao

bright fog
#

So it's kind of a pain to do

indigo slate
#

yeah understandable

#

i can't extend classes, but I wonder if there's something like an instanceof check in lua

bronze yoke
#

yeah, surprisingly not usually actually but pz's lua environment has one, instanceof(obj, "ClassName")

indigo slate
#

oh that's perfect

indigo slate
#

i can do that then, get the instance of the object and hopefully set a boolean from there

indigo slate
#

gang shit, thank you ๐Ÿ™

bronze yoke
#

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

indigo slate
tranquil kindle
#

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.

indigo slate
#

Alright everyone, thanks for the help, I should be able to do the rest myself spiffo

#

if not though i'll return

#

but i'll give it a good effort

bronze yoke
#

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

tranquil kindle
#

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?

bronze yoke
#

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

tranquil kindle
#

I'll try to come up with something but its a good start, thank you

sour island
#

Can anyone do a commission for kichjfjidjohugfj? Willing to pay.

indigo slate
#

i just made my first mod

#

(yes, an ID should be a string but gang shit)

ancient grail
#

its same as multi hit, you can only hit those that are targeted

twin turtle
#

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

twin turtle
#

thanks!

twin turtle
bronze yoke
#

i'm glad! i'm one of the maintainers so let me know if you have any trouble with it

twin turtle
#

๐Ÿ‘

#

thanks

inland steppe
#

as an example of something that only spawns once and in specific distributions

hazy jay
#

does anyone have a purely qol vanilla friendly collection? all of the ones i found are either outdated or are vanilla+

ancient grail
quiet fulcrum
#

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

ancient grail
#

to actually provide the xp
cuz if you set level
afaik it doesnt add the xp

reef magnet
#

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

visual robin
#

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)?

ancient grail
#

i could be wrong tho

bronze yoke
#

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

visual robin
#

Ok, thanks

real token
tranquil kindle
quiet fulcrum
#

the BodyPart class is a fun mix of method capitalizations... SetInfected and setInfectedWound ...

digital tinsel
quiet fulcrum
#

why does setPerkLevelDebug not work for anything but strength and fitness? I can't see anything limiting it in code

pliant rivet
#

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

bronze yoke
#

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

pliant rivet
#

i will give it a try :p

bronze yoke
ancient grail
bronze yoke
#

yes and yes

ancient grail
#

oh so you can intercept them early and just doParam('isHidden = true')

#

so that you hide them
or something

pliant rivet
#

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

dull moss
bronze yoke
#

Uninstall intellij

dull moss
#

But it's so nice

bronze yoke
#

it's lovely... i have it open right now LOL

dull moss
#

lmao

pliant rivet
#

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. ๐Ÿ˜‘

dull moss
#

@sour island can help prob

broken lake
#

Ahh could be the username looks random but is a mem address lol

drifting ore
#

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.

tulip valve
#

Your players don't have the same files as the server

drifting ore
tulip valve
#

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

drifting ore
#

Ah damn so they won't be able to join unless I actually give them the file, darn.

tulip valve
#

yeah

drifting ore
#

Bummer, Thanks.

tulip valve
#

If you are just playing with some friends, just send them the whole mod folder, problem solved

drifting ore
#

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.

tulip valve
#

You could publish that new modified mod on workshop and then have them download that, actually the server might download it for them then

drifting ore
tulip valve
sour island
#

We received a report from a credible source from elsewhere.

sour island
#

I believe they were mistaken. Sorry about that.

#

Previous?

sick ermine
#

wait theres a seperate discord thats more focused on modding pz?

sick ermine
#

thats dope ima join that

#

thanks thanks

azure rivet
#

Hi, who knows what is the clothing damage mask?

orchid quest
#

anyone have the invite link to the unofficial modding server?

lime hedge
#

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

drifting ore
#

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

digital sail
#

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

magic star
#

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?

digital sail
#

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;
   }
sand parcel
#

probably so translations made for current builds still work in past builds where different variables were used

digital sail
#

nevermind there's only one function :D

magic star
#

@digital sail Thanks! and thanks for sharing the code, helps me learn

digital sail
# magic star <@207118109591470080> Thanks! and thanks for sharing the code, helps me learn

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'
GitHub

Modern Java decompiler aiming to be as accurate as possible, with an emphasis on output quality. Fork of the Fernflower decompiler. - Vineflower/vineflower

#

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

lofty epoch
#

How do I make custom crafting recipes?

#

Well how would I go about making a custom recipe?

ancient grail
#

check out lua timers mod

bright fog
#

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)
bronze yoke
#

using == for time? ๐Ÿ˜ญ

drifting ore
#

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.

plucky pumice
#

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

ancient grail
plucky pumice
#

i posted the code

ancient grail
#

imean like
``

--code

``

plucky pumice
#

nvm

digital sail
digital sail
#

Did you try to debug it by adding print() everywhere in your code to see if execution flow goes as expected?

plucky pumice
#

look first time ever coding ok i am trying my best

ancient grail
#

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

plucky pumice
#

oh ok thank you

#

do think you could help with that because i am not sure on the whole character facing

ancient grail
#

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

plucky pumice
#

ok

digital sail
#
  // 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.

digital sail
#

I tried adding a 3D portrait to my Chat bubble, it did not go as planed

ocean venture
#

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!

digital sail
#

What's wrong with moddata?
Unless you reimplement SQLite entirely in Lua I don't think this is possible anyway.

ocean venture
#

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.

digital sail
#

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

ocean venture
#

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`

digital sail
ocean venture
#

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?

GitHub

A lightweight JSON library for Lua. Contribute to rxi/json.lua development by creating an account on GitHub.

bright fog
digital sail
#

An interactive chess game

proper palm
#

Guys, can you answer my question? Is it possible to limit administrator access to the Zomboid project server? Like Admin, Moderator, Helper?

digital sail
#

And you can get the player role from the code and write conditions accordingly.

drifting ore
digital sail
quiet fulcrum
#

is it possible to replace/override vanilla animsets?

ancient grail
digital sail
ancient grail
tranquil kindle
ancient grail
#

i wonder if the animation viewer can be used this way

ancient grail
digital sail
digital sail
#

I realize some of you already answered Jaxe :D

ancient grail
#

you might be able to unlock something new that wasnt entirely possible before
if youre able to take that anim viewer character

quiet fulcrum
ancient grail
#

btw if it has a parent xml you should also copy it

#

usually its named default

tranquil kindle
#

I mean, depends on what you want to do

quiet fulcrum
#

oh I see what you mean.. will try that thanks

tranquil kindle
#

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.

ancient grail
#
<?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

quiet fulcrum
#

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

drifting ore
quiet fulcrum
drifting ore
#

yeah death animation and death state cannot reverse the death itself

quiet fulcrum
#

it's all the server sync stuff which is the hard part to block, so better to stop death actually happening

drifting ore
#

it's quite an issue since you can lose arbitrarily large amount of health from attack damage

quiet fulcrum
#

so setting the trigger point somewhere around 20% is needed

#

but I'm still exploring if there's any other way

drifting ore
#

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

quiet fulcrum
#

no OnPlayerDeath is too late

drifting ore
#

technically the player is still not a deadbody when this triggers, but there's just no provisions for reversing death sequence

quiet fulcrum
#

yes but the server sync stuff already fires

drifting ore
#

this is kind of an issue if you want to track dead bodies since you need to account for death animation real time length

quiet fulcrum
#

I'm mostly ok anyway, it works fine with 20% trigger point

drifting ore
#

also fun fact isodeadbody can spawn on a different square than where you died

quiet fulcrum
#

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

drifting ore
#

can you just decorate it?

quiet fulcrum
#

what do you mean?

drifting ore
#

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

quiet fulcrum
#

the function call happens in java

#

javaObject specifically

drifting ore
#

if it's available from lua then it can be decorated

quiet fulcrum
#

I'd have to redo the health panel

#

which is doable I guess... just way more effort

ancient grail
#

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

quiet fulcrum
#

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

mild sundial
#

Made my first mod that displays a simple interface with a toggle button, I wanted to end myself throughout the entire process ๐Ÿ˜‚

robust locust
#

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

digital sail
#

Isn't it windows1252?

#

Nevermind, it's only latin characters

#

It's supposed to be 1251 from what I'm reading.

bronze yoke
#

keep in mind that changing encoding in notepad++ doesn't convert the file

sand parcel
#

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

bronze yoke
#

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

bronze yoke
#

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

bright fog
#

No idea

fleet bridge
#

Farming is all lua

bright fog
#

@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)

pine patio
#

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

blazing vine
pine patio
tepid bison
#

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

grizzled fulcrum
mild sundial
# grizzled fulcrum 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

bronze yoke
#

this will only catch some runtime errors though

grizzled fulcrum
#

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

grizzled fulcrum
# bright fog 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

bright fog
bright fog
bronze yoke
#

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

grizzled fulcrum
#

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

bronze yoke
#

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

digital tinsel
#

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 =)]

ancient grail
#

cuz i tried to make a duplicate of a vanilla outfit but with different name
it didnt work

the zed turned naked

blazing vine
#

youll just copypaste whatever it is into yours so

ancient grail
#

i see

blazing vine
#

you dont need to change the guid because it pulls it from the basegame I assume.

ancient grail
#

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

ancient grail
blazing vine
ancient grail
#

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

blazing vine
# ancient grail so if i need to make a clone of an outfit i need the filegui from vanilla quest...

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

ancient grail
#

i just wanted the duplicate the outfits

blazing vine
#

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.

dull moss
#

how does splitscreen work?
i use mostly getPlayer() in my code. Will it work in splitscreen?

ancient grail
#

then im making a heavy mod

ancient grail
ancient grail
#

just type that using mobile so syntax might be wrong

thick karma
#

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

dull moss
#

yea

#

I aint doing that so guess rip splitscreen players

thick karma
#

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)

dull moss
#

but ty for info

thick karma
#

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

thick karma
deep pilot
#

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?

scenic path
#

i myself am looking for the inagame Speedometer ui so i can change it to look cooler but im unable to find it lol

deep pilot
#

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

scenic path
#

not the ui map

#

if your talking about the ui map i have no idea

deep pilot
#

They are the lootable ones yeah, but when you open one of the lootable maps in game, it looks like the normal map UI

scenic path
#

hm?

#

are you running mods?

deep pilot
#

Is that why.. So it normally looks like this then?

#

In game that is

scenic path
#

yh

deep pilot
#

Alright then its because of mods, my bad sorry!

scenic path
#

np

#

chainsaw...??

#

is that a thing?

deep pilot
#

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?

scenic path
deep pilot
#

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

winter bolt
deep pilot
#

But for that I need to figure out how the .txt locates files

winter bolt
#

it doesnt work but theres a mod on the workshop that properly adds it

scenic path
#

i found the profanity file๐Ÿ˜จ

winter bolt
#

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

scenic path
#

aw

winter bolt
#

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?

scenic path
#

a texture pack?

winter bolt
#

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

scenic path
winter bolt
scenic path
#

YESS! What program should i use to open .pack files? What file is it?

winter bolt
#

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

scenic path
#

Ah, I have the already installed No worries. How should i go about changing the texture?

winter bolt
#

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

scenic path
#

Im looking to try retexture most of the dashboard though.

winter bolt
#

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

scenic path
#

Alrighty.

winter bolt
#

these ones are here too

scenic path
#

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

winter bolt
#

i do have them extracted already so i can send them

winter bolt
#

some of them are from the vehicle radial menu though im pretty sure

winter bolt
scenic path
#

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?

winter bolt
#

i think it should work but ive not tested it

quiet fulcrum
#

how to hide the buttons on the left hand side like health, search, map, etc?

quiet fulcrum
thick karma
#

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

bronze yoke
#

iirc that's a java object

thick karma
#

This is also my memory but mine is not exactly perfectly reliable ๐Ÿ˜…

bronze yoke
#

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

ancient grail
quiet fulcrum
#

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

deep pilot
#

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?

uneven ore
#

How do I make a file overwrite a Vanilla file

bronze yoke
#

just make sure it has the same filepath

digital tinsel
#

Some opnions on this grass texture? reworking the current version of my mod

digital tinsel
unborn rover
#

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.
deep pilot
#

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?

ancient grail
#

maybe you need to put that on an distib event?
or youre missing an "end"

#

@unborn rover

ancient grail
unborn rover
#

Oh does end need to be there?

ancient grail
#

if then end

ancient grail
unborn rover
#

Hmmโ€ฆlโ€™ll try that tomorrow. This was really stumping me

deep pilot
#

Does it have to do with the ID in mod info maybe? Does it need to match something in the other files?

ancient grail
#

you might have a syntax error
might bit have properly loaded the mod
wrong folder structure
or other issues

ancient grail
deep pilot
#

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?

dull moss
#

You could check the code

#

It's like a hitlist of rare zombie outfits

#

Hit-list of sort

deep pilot
#

Oh sweet, that sounds good. Thank you

shy minnow
#

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

placid yoke
shy minnow
runic siren
#

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"

civic tree
#

yeah it was me

runic siren
#

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

civic tree
#

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

#

i named the file "zombiezonesedit2" or something, but you can change its name, its ok

civic tree
#

mod info, description, image, etc.

#

you there?

runic siren
#

yeah just all a good bit confusing

civic tree
#

ModTemplate\media\lua\shared

#

follow this path and youll get to the file im talking about

runic siren
#

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

civic tree
runic siren
#

this is all i see

#

it's practically telling me ii can only use winzip

#

i could probably use 7zip actually

civic tree
#

alr just double left click it

#

its the same

runic siren
#

if i double left click it tries to use winzip lol

#

which says my trial expired

#

7zip worked

civic tree
#

cool, you found the modtemplate folder?

runic siren
#

both of em yea

#

goes ModTemplate then ModTemplate then the files

civic tree
runic siren
#

i guess so

but i extracted it into "test mod folder" in my downloads folder which i made beforehand

civic tree
#

now get to the file i was talking about

runic siren
#

lua/shared right

#

got it

#

zombieszonedefinitionedit2

civic tree
#

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

runic siren
#

sorry had to do someth

runic siren
civic tree
#

then you can delete zombiezoneedit2, we wont need it

runic siren
#

alr i cut and pasted it

#

๐Ÿ˜ˆ

#

should look like this correct

#

should probably start replying back to you @civic tree

civic tree
#

now, you got notepad++ or just the regular notepad?

runic siren
#

what's ++ again

#

i got regular

civic tree
#

both are good but notepad++ has more tools and such

runic siren
#

iirc chestnuts uses ++

civic tree
#

we can do it with both

runic siren
#

gotcha

civic tree
#

but as i said, you can just not use it for this one

#

and itll be just fine

runic siren
#

unfortunately i barely paid attention in my coding class

#

kahn academy? more like naptime epic_face

civic tree
#

well. now go into the lua file

civic tree
runic siren
#

alr got it open

civic tree
#

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

runic siren
#

oh shoot wait this is vanilla right??? cuz i have other clothing mods like VCE and Spongie

runic siren
civic tree
runic siren
#

alr i'm getting ++

#

is it free or

#

@civic tree alr i got N++

civic tree
#

open it

runic siren
#

got it open with the code

civic tree
#

epic

#

press ctrl + f

runic siren
#

ignore JK Leeds at the bottom

runic siren
civic tree
#

in the right

#

press the option to look for all the results in the file

dull moss
#

step-by-step instructions on how to use search

runic siren
#

type it here right

civic tree
runic siren
#

this part's rather simple tbf

#

actually we prob should move to DMs as to not bloat here

civic tree
placid yoke
# shy minnow oh thats not mine but yes

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

shy minnow
#

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)

placid yoke
#

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

runic siren
#

alr wanna ask now just in case anyone currently online knows

#

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

bright fog
#

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

runic siren
#

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

torpid aurora
#

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

torpid aurora
bronze yoke
#

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

torpid aurora
torpid aurora
#

THANK YOU!

floral cloud
#

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.

quiet fulcrum
#

is it possible to make SandboxVars that show up on singleplayer sandbox options only?

floral cloud
#

Anyone that can help

ancient grail
bronze yoke
#

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

quiet fulcrum
#

I guess the tooltip is the easiest way

dull moss
#

So it's easier to separate

#

Gunfighter does that

ancient grail
quiet fulcrum
dull moss
#

that's literally what i suggested xdd

quiet fulcrum
#

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

bronze yoke
#

blacksmith is unused, i don't recognise melting but it probably is too

#

the others are perk *categories*, yes this structure is insane

quiet fulcrum
#

can't see anywhere in java where those category skills do anything

bronze yoke
#

they don't, they aren't skills

#

in a gameplay sense anyway

quiet fulcrum
#

but they can have perk levels

bronze yoke
#

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

runic vine
#

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?

torpid aurora
#

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

runic vine
runic siren
#

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

steep vortex
#

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

torpid aurora
#

Does anyone know how to spawn in a bag with custom loot in it? Trying to put something like this in my mod

brisk palm
inland steppe
# brisk palm https://steamcommunity.com/sharedfiles/filedetails/?id=2868229063 So I found th...

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

brisk palm
#

xdd

brisk palm
#

Looks good that you can also use blackouts so its not instantly repaired on the day

#

so you have to survive without power still

drifting ore
#

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

quiet fulcrum
#

is there a way to stop any other anims/animsets from occuring? i.e force one animation so no other anims play

neon bronze
deep pilot
#

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?

ancient grail
deep pilot
#

Which Lua would that be?

#

There are a fair few-

deep pilot
#

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

deep pilot
#

Its still not appearing, am I missing something?

summer vale
#

I was thinking to try to create a mod, but I don't know how hard it is?

#

Or it isn't?

dull moss
#

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"

deep pilot
#

Yeah, guess it also depends on what you want to add

#

Don't start with trying to add custom maps, bad idea-

summer vale
#

I wanted to start with something easy before as I also need to learn using blender still.

deep pilot
summer vale
#

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.

vocal wigeon
#

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.

dull moss
#

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

vocal wigeon
#

Ok, then I'll just put deprecated before the old one in that case. Thank you

quiet fulcrum
#

how to change a sandbox option via code? Changing SandboxVars.Foo.Bar = 555 doesn't persist after reloading a game

ancient grail
#

try

ancient grail
west marlin
#

Hello, have any form to create a weapon zero damage and with no possibilities to make scratches, and others wounds?

ancient grail
#

if its for zed its easy just set avoid damage when they get hit

drifting ore
pine patio
#

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

drifting ore
#

I have one more question, what category should I translate what players say into?

#

IG_UI?Recipes?

lofty frigate
#

IGUI_PlayerText_

dull moss
#

put it into `

#

like dis

#
you can have multi-line```
drifting ore
ancient grail
pine patio
#

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

ancient grail
silent fulcrum
#

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?

bronze yoke
silent fulcrum
west marlin
#

I give life, but every hit makes a wound in the target

drifting ore
#

chat quick question. if i put the map to be 1x1 will it still be decently large?

west marlin
drifting ore
west marlin
#

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...

โ–ถ Play video
silent fulcrum
#

How can I access the user's frame rate? ๐Ÿ‘‰ ๐Ÿ‘ˆ

silent fulcrum
bright fog
unborn rover
#

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.

bronze yoke
pine patio
#

I'll try replacing it with the vanilla military helmet to see if at least those show up on the zombies

ancient grail
pine patio
#

It's okay, I appreciate it spiffo

winter bolt
#

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

pine patio
#

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

patent jackal
#

anyone need a polish Translator i can translate everything for any reward

quiet fulcrum
#

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

ancient grail
#

nope

ancient grail
#

but i could help you with what i know so far

feel free to ask

quiet fulcrum
night iron
#

Question from someone completely ignorant regarding modding PZ... is it possible to patch another mod's lua file in a new mod?

winter bolt
night iron
winter bolt
#

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

night iron
#

it is local : ```
local UsagesLeft = {}

UsagesLeft.managed_discrete_items = {
["Base.Matches"] = true,
["Base.PillsAntiDep"] = true,
["Base.PillsBeta"] = true,
["Base.PillsSleepingTablets"] = true
}

winter bolt
#

i think you might have to replace the file then but i'm not super experienced in lua so i'm not sure

night iron
#

never touched lua untill today either but i do have 20+ years of programing exp so it doesn't look that scary he he

grizzled fulcrum
#

lua's easy to learn if you come from literally any other lang ๐Ÿ‘

grizzled fulcrum
grizzled fulcrum
#

like dis

local module = require("UsagesLeftFileName")
module.managed_discrete_items = {
    ...
}
red tiger
#

Don't call it module though in practice.

grizzled fulcrum
#

yes true

red tiger
#

Call it what it is or something close to it.

#

Obviously a foobar example.

grizzled fulcrum
#

I just call it the same name that the module table was named

#

and or file name depending on other stufd

red tiger
#

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.

grizzled fulcrum
#

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

grizzled fulcrum
#

WHAT IS THIS--

red tiger
#

Welcome to anonymous function execution.

grizzled fulcrum
#

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 panic

red tiger
#

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.

grizzled fulcrum
#

hmm

red tiger
#

A major security benefit that I personally use with my loadstring bootloaders.