#mod_development

1 messages Β· Page 222 of 1

thick karma
#

(assuming your timing is logical)

#

Even between client and shared

#

(but base stuff must be in shared if imported within shared at runtime)

vital karma
#

so when I call it would be as simple as using something like "Getkills()"?

thick karma
#

Sure, you could create and call a function called NomOptions.getKills by calling NomOptions.getKills(from, necessary, params). I do recommend what has become known to some people as "lowerCamelCase" (which I was taught to call camelCase) for function, field, and variable names and "UpperCamelCase" (which is sometimes called TitleCase) for classes / modules to give some immediate clarity of purpose when people read your variable names.

vital karma
#

will do πŸ‘

#

thank you

thick karma
#

Just to be clear you cannot just call getKills() without the module prefix unless you create a truly global function with no parent module called getKills, and most of us would not recommend that.

#

When you make global functions with highly appealing and simple names, you increase likelihood of eventual conflict with other modders who want to do that or the vanilla game's future available global functions

#

Even when I'm 99% sure a global might eventually exist in vanilla and be named and used exactly as I would name and use it, I personally resist the urge. @vital karma

fathom sapphire
#

Oh, how do i use java in lua?

thick karma
#

There are a wide variety of classes, objects, and functions exposed to Lua through a Java class called Exposer in a Jaca class file called GlobalObject iirc.

#

That is where you find stuff like "getSpecificPlayer"

#

And other functions we call

#

I.e., you can just write it.

#

print(Keyboard) in your debug console should verify an object with that name exists

fathom sapphire
#

When i use key==Keyboard.KEY_G it doesn't work even though it's in the library mentioned, so would I have to reference Exposer to get that?

thick karma
#

Hmmm

fathom sapphire
#

I could also try printing the key var and see what i get in case its that

thick karma
#

print(Keyboard.KEY_G) prints 34 for me

#

So it's definitely getting something

fathom sapphire
#

Then the mod itself doesn't recognize it for some reason

#

Should I just change it to key == 34?

thick karma
#
WizBanger = {}

WizBanger.thisIsG = function(key)

  if getPlayer() and key == Keyboard.KEY_G then
    print("This is G")
  end

end

Events.OnKeyStartPressed.Add(WizBanger.thisIsG)
#

This works for me when I put it in console

#

if it doesn't for you, I think you need to move to client or perhaps you have a weird keyboard with abnormal keycodes.

#

@fathom sapphire

fathom sapphire
#

I was using
Events.OnKeyStartPressed.Add(WizBanger.OnKeyStartPressed)
Mb lol

#

Well actually
OnKeyPress = {}

OnKeyPress.log = function()
print("UP IS PRESSED")
end

OnKeyPress.OnKeyStartPressed = function(key)
local player = getPlayer()
if player ~= nil then
if key == Keyboard.KEY_G then
OnKeyPress.log()
end
end

Events.OnKeyStartPressed.Add(OnKeyPress.OnKeyStartPressed)

#

Would it not work cause it is named like that or

#

Cause its OnKeyPress.OnKeyStartPressed

#

Which is the event and the function name at the same time

bronze yoke
#

it doesn't matter what it's called

fathom sapphire
#

Well then idk why that one doesn't work, Ill try your code burry

bronze yoke
#

oh you're missing an end

thick karma
#

I just saw that

#

Lmao

#

I just dropped it in console and was literally copying his code to say that

#

Beaten to it again by the champion

#

❀️

fathom sapphire
#

Oh i added the second if without adding the end, mb lol

#

Thank u

#

Btw is there anywhere I can see all the functions I can reference, cause I assume there is seperate ones for lua and java
If not thats alr and thanks for the help so far lol

thick karma
#

They're kind of endless

#

Most of the rest are found searching ProjectZomboid/media/lua

#

You can access most of the functions in lua above

#

which is a directory, not a file

#

a directory of many, many files and directories

#

You can index the media directory and search its files for text in Window File Explorer

bronze yoke
#

if you're using vscode you can install umbrella and get autocomplete + warnings when you're using functions that don't exist/aren't exposed

fathom sapphire
#

tysm

thick karma
#

largely because of albion @fathom sapphire

#

she casually fails to mention πŸ€ͺ

fathom sapphire
#

Jesus lol
I'll try to use it but im brand new to vsc

bronze yoke
#

my hope is that it should only make things easier, even for a brand new user

wicked plinth
#

quick question that i want to try asking before actually pursuing
i know that pz can have random attachments spawn on firearms
is there a way to make that be able to force spawn one attachment onto every firearm?
primarily, i'm looking to spawn the Iron Sight attachment onto every firearm, for access to modularity aspects

languid glacier
#

hi how do i commision a mod

trail lotus
#

does anyone know if voice chat range is configurable?

#

nvm i found it its in the server .ini files lol

lethal ravine
#

Is there any way to modify all of a specific weapon type? For example, I want to increase the damage of all Short Blade weapons. I want this to include weapons added from mods as well.

uneven ore
#

Hey guys, I've been troubleshooting this for a while now, and I have no clue whats wrong, So im making a trait for every 100 Zombie Kills you get, you recieve a Food item, however whenever you Kill a Zombie it Spits out an error about "Then was Expected near '=' "

Here's the code:

    if ZombRand(0, 3) = 1 then
        inv:addItemOnServer(inv:AddItem("Base.CannedCorn"));
        HaloTextHelper.addTextWithArrow(player, getText("UI_trait_dokitraitrecievedfood"), true, HaloTextHelper.getColorGreen());
    end
bronze yoke
#

use == for comparisons

#

= is for assignment

lunar robin
#

I'm not sure if this is the right chat to direct the question I have, but nonetheless. I am currently trying to implement automatic Discord role removal on player death on my whitelisted server. What I've done so far:

  1. NodeJS scans for the latest *_user.txt and gets it's output.
  2. The needed entry with died at is regexed and I have the line with the timestamp and username of a person who died. Then I regex again, compare the username and Discord user name, run the Discord bot thing and voila, role removed.
    However I'm wondering if that's really an efficient solution to get dead players, as there is probably a better way to do this?
jaunty marten
lunar robin
#

Is there a way to lock certain item with type Literature from being edited?

small topaz
lunar robin
#

If a player has a pencil etc. he can edit/add stuff to the paper. There's a certain item I spawn in inventory for this player with information, which I want to stay intact

sour island
#

Can't papers be locked?

lunar robin
#

If someone else locks it, yes, but this paper is spawned through a script in player's inventory

#

If I'm not mistaken, this leads to player's being able to edit it if he has a utensil

#

Is there a way to lock it initially?

sour island
#

You could add a Lua function to the onCreate of the recipe. Which you can lock as if by someone else.

small topaz
sour island
#

Probably not, but he's saying it's spawned through a script

lunar robin
#

I'll try setLockedBy() with some random characters to be applied to this item

#

Yep, this fixes my issue

#

Thank you

small topaz
#

Is there a way to trigger a timed action when another timed action is aborted by the player? I tried to add the new action to the queque in the aborted action's stop() function, so smth like

    ISBaseTimedAction.stop(self)
    ISTimedActionQueue.add(NewAction:new(...))
end```

But this doesn't work for me. Also tried adding to the queque before the stop(self) command without success.
buoyant sandal
#

Would anyone be interested in making kenshi-inspired weapon pack? Ill do the 3d but know nothing about coding

lunar robin
#

For some reason items from this mod fail to translate. I suspect it to be failing to find the translation files, as it uses the default DisplayName and "IGUI_ItemCat_Documentation" string as a category from the script. Any ideas what could cause this?

#

The symbols are broken because they're not UTF8

#

I kinda use the correct path: media/lua/shared/Translate/RU/filename.txt, so what could be the deal?

#

Also the server log shows the files are found:

uneven ore
lunar robin
#

Testing on my Windows machine revealed everything works properly... Weird.

lusty karma
#

little question about the "Recipe" translation files (Recipes_EN.txt for example). I saw some mods were starting the file with (lets take EN language as exemple) Recipes_EN = { and i saw another one starting with Recipe_EN (without the s). Do that change anything? Both mods are working, same with their translations. The game just don't care if their is a s or not ?

bronze yoke
#

the first line is a lie, the game just ignores it

grim onyx
#

Quick question, does anyone know where I can find a list of the names of the skills as they appear in the code? I.E. Woodworking for Carpentry

bronze yoke
#

most people don't know this and those who do just write the Recipes_EN = { for consistency, and if they make a mistake doing that it's not like it throws an error or anything

lusty karma
#

ohh ok

#

thats good to know, thanks

small topaz
#

Does anyone knows the difference between getAllTypeRecurse(something) and getAllType(something)?

bronze yoke
#

recurse searches containers inside the container, getalltype doesn't

wheat kraken
#

a recently released mod got my first big hit on reddit, useful for beginners, quest-driven people, and people dealing with missing loot frustation

after 1 year hiatus from modding scene,
my popular mods are Fire trail (35k subs) (with only 43 upvotes on reddit announcement post) and Wheelbarrow (26k subs)(without reddit post),

Dragon Radar have the concept that i first want in a mod, when i first play the game, as a newbie that didnt know where to find specific loot, so it was from that that i begin my modding scene, resulting in serve 75k people in total now a days
https://thejaviertc.github.io/steam-workshop-stats/user/id/reifel1

a reddit version will be out soon (and i will be in hiatus again after that)

i know its not for everybody, and its for some people, reddit post splits into two strong groups
if you want to try:
Dragon Radar - item finder searcher
https://steamcommunity.com/sharedfiles/filedetails/?id=3172486046

for the old ones
RIP 01-2022 to 06-2022 pz-map.com
with hot zones map used with that purpose
will Dragon Radar be the closest spiritual sucessor from it?

useful to find how to use generator magazine, sledgehammer...

shrewd tapir
#

I know this isn't related to mod support... but...
I'm looking for someone to collaborate with on a project, I have been inspired by project zombiod. I was thinking of making something similar to it... I know C/C++ very well with vulkan & opengl πŸ™‚
dm me
NOTE: this is pure hobby so don't expect anything professional xD

bright fog
#

np

shrewd tapir
#

also ur pfp looks like a cringe character from a lil indie game

#

if you play against this 'character' you will get annoyed... her name is briar

bright fog
#

Nah it's not a cringe character :(

#

I know the character lmao

#

I love her

#

I'm a main Briar :>

shrewd tapir
#

im darius main :>

bright fog
#

:>

shrewd tapir
# bright fog :>

we should play sometime, we could play like 1 match of lol... get tilted and go to project zombiod, die on day 2 and get even more tilted.

#

#imagine_being_left_on_read_could_not_be_me

bright fog
#

Haha I was in a match sry

grim onyx
#

Hey y'all! First time modding. I'm getting back this error when I'm trying to load into the game "unexpected symbol near ) at LexState.lexerror line:278."

#

I'm not sure what LexState.lexerror is

bright fog
grim onyx
#

I'll look for it πŸ₯²

#

Tysm

lethal ravine
#

Is there any way to modify all of a specific weapon type? For example, I want to increase the damage of all Short Blade weapons. I want this to include weapons added from mods as well.

warped valve
raven smelt
#

God bless. More half-life 2 pls...

mystic vessel
#

So I have a small doubt, I made a recipe through Lua.

But how do I make it necessary to have a specific level to be able to craft this?
Example Carpentry 5

plain crest
mystic vessel
bright fog
mystic vessel
bronze yoke
#

recipes aren't created through lua, they are created through scripts

bright fog
#

Did you check your recipe works without the skill requirement ?

mystic vessel
#

I want this crafting to be necessary to have
electrical 4 for example

#

that's why I'm asking about "skill required" in lua

bright fog
#

Why do you make a recipe in the lua ?

mystic vessel
#

yes

mystic vessel
bright fog
#

I see

mystic vessel
#

and the way he makes the tiles, it's different

plain crest
#

Ah that’s. An important detail

mystic vessel
#

i'm trying to put a skill required for making this computer

bright fog
#

Check in mods that use it how they added a skill requirement ?

#

Or check the documentation of the mod ?

mystic vessel
#

πŸ’€

bright fog
#

Did you check their code how they handle it ?

bright fog
#

The base mod doesn't add any recipes I believe (which they fucking should if they remake the whole recipe system with their thing)

mystic vessel
#

And only this mod added this "provisionally" until build 42 arrives

#

Once it arrives, this system will be native to the game itself and will no longer be necessary.

bronze yoke
#

you should ask the mod author for help, nobody here will have experience using their original recipe system

bright fog
#

Did you look at mods that use this framework ?

bronze yoke
#

if none of their recipes use it it is very likely that it is simply not supported

bright fog
#

Like I can't say it enough but go check mods that use this framework

mystic vessel
bronze yoke
#

i had a quick look at their github and i couldn't see anything that checked skill levels

mystic vessel
bright fog
#

I know but there are examples of mods that use it anyway

austere sequoia
#

SkillRequired:Tailoring=2;Aiming=1,
SkillRequired:MetalWelding=2,
SkillRequired:Woodwork=1,
SkillRequired:Electricity=2,
SkillRequired:Trapping=1,

#

this are some examples for adding skill requirements in lua

mystic vessel
#

Where should i put it?

austere sequoia
#

Dont know much about LUA, but just adding it as a line should/could work

mystic vessel
#

Let's hope everything goes well, this is the before

bright fog
austere sequoia
bright fog
#

Even more documentation that's in a random format for sharing

mystic vessel
#

after, where is my pc? 😒

bright fog
#

Gone in hell

#

That probably didn't work

mystic vessel
#

When I place this line, the object simply disappears
not from the world, but from the crafting tab

austere sequoia
bronze yoke
#

the framework you're using just doesn't support what you're trying to do

bright fog
#

No I think he wrote some wrong code

#

The :

bronze yoke
#

yes but that would just make it not disappear, it still doesn't support skill checks

mystic vessel
#

like this?

#

this is the correct way?

#

Unfortunately, it didn't work both ways, but thanks for the help anyway.

#

I'm finishing my machine mod, they are all solid tiles with unique craftings for each one

Press,Glass furnace,Paint mixer etc

austere sequoia
mystic vessel
#

Taking advantage of another quick (and easier) question

The time there put into crafting

is it in minutes?, seconds?, ticks?

austere sequoia
mystic vessel
bronze yoke
#

48 crafting ticks = 1 second

mystic vessel
coarse sinew
mystic vessel
#

Now I'm trying to make a recipe that gives xp when making it

coarse sinew
small topaz
#

Hi! What elements of the lua code determine whether a timed action makes sound which attracts zombies? (if there are any...)

thick karma
coarse sinew
thick karma
#

Wait it actually is controller supported?

coarse sinew
#

Yup

thick karma
#

Dang I hadn't tried it yet and one look at the page made me skeptical... Idr seeing anything mentioned about that on it. Good shit.

#

Yeah adding controller support to custom UIs is usually more work than modders want to do, so I tend to fear any custom UI that doesn't explicitly claim to be supported on its page. Sometimes stuff is so unsupportive that it breaks the few things that used to work for us.

#

cough Mod Manager cough most character creation panel mods

#

Kudos for doing a truly complete custom UI that can support the whole playerbase

#

I always try to warn people working on new UIs to base their stuff on the updated gamepad-friendly UI modules because if they don't they end up needing to redo most of their UI to add it at the end.

#

(I've redone several vanilla ones myself and oof.)

dawn portal
#

hi, is there any tutorial on modding UI elements using lua? looking at mods I have it seems there are "ISUI" files for each element (button, slider etc..) but I'm not getting the whole picture on how to use these elements. also are there any UI "containers"? like UI elements that sort child elements in certain patterns like a grid or a vertical alignment for example? sorry if this is a nooby question I'm really struggling to find any guides on modding ui

thick karma
#

If any of mine have elements you need to learn to implement, you're welcome to refactor my code

dawn portal
#

oof I wish there was some guide to get me started but yeah. so far that's what I've been doing. man the learning curve for PZ modding is quite challenging huh?

lunar robin
#
local unwantedPerks = { "Agility", "Aiming", "Axe", "Blunt", "Combat", "Doctor", "Firearm", "Fitness", "Lightfoot", "LongBlade", "Melee", "Reloading", "SmallBlade", "SmallBlunt", "Spear", "Sprinting", "Trapping" };
for i=0, PerkFactory.PerkList:size() -1 do
    local perk = PerkFactory.PerkList:get(i);
    if table.contains(unwantedPerks, perk:getType()) then 
        print("Don't level up")
        return 
    end
    print("Level up")
end

Why am I getting this?

Object tried to call nil
#

If I run

for i=0, PerkFactory.PerkList:size() -1 do
    local perk = PerkFactory.PerkList:get(i);
    print(perk:getType())
end

This outputs the values the same way as in the array in unwantedPerks

#

I suspect I compare incorrectly?

dry chasm
lunar robin
dry chasm
#

but a table isn't an array*

thick karma
buoyant merlin
#

say, a while back I know that I had some kind of mod that allowed for a visible belt: nothing fancy, just a "random tint = true" belt that appeared OVER a standard pants texture.
I thought it was from either AuthenticZ or ClothesBox; haven't used either of those for a while, but I just tried them again and neither one appears to have a visible belt option -- I mean just a simple texture-painted-on-the-player-model belt, not a holster or rigging or an added model.
I was hoping to play around with it and see how whatever mod I had been using had accomplished having your belt be visible, but I can't find it! Anyone know what I'm talking about / what mod I'm thinking of so I can look at its code, or alternately, know how I would accomplish making a visible belt that appears over your pants on my own?

(I know the vanilla xml defines an emptytexture and I can have it call for a visible one, but I can only ever get it to appear UNDER all the clothing, directly on the character's skin)

#

oh i suppose i could define the bodylocation as torsoextra...? but then i'm stinking up that slot.

tranquil kindle
# buoyant merlin oh i suppose i could define the bodylocation as torsoextra...? but then i'm stin...

You could use a slot noone pretty much uses, for example one of ring slots. I wanted to make a watch not be hidden when wearing longer shirts and jackets (it was pocketwatch that was hanging on side of pants). When i used vanila locations for watches, the model was hidden once you wore something "longer", but the moment i put BodyLocation = Right_RingFinger, it was working perfectly fine and was above every other layer of clothing.

buoyant merlin
#

that makes sense and is probably what I'll end up doing, thanks-- I certainly remember it being in the "belt" slot in whatever mod was making it happen, though. Strange!

Is there a reference file that shows what body slots take preference over the others for visibility, like how pants will always appear over shirts?

tranquil kindle
#

I think you can create your own body location, but i'm not familiar with it

buoyant merlin
#

ah well, thanks!

dawn portal
#

your example derives from an existing class, but what if I just want to use the built in panel instead of deriving my own?

require "SUI/ISPanel"

local function onGameStart()
    if getGameFrame():getActiveScreen() == MainScreenState.getInstance() then
      local screenWidth = getCore():getScreenWidth();
      local screenHeight = getCore():getScreenHeight();
      
      local blankPanel = ISPanel:new(0, 0, screenWidth, screenHeight);
      blankPanel:initialise();
      blankPanel:instantiate();
      blankPanel:addToUIManager();
  
      local button = ISButton:new(0, 0, 40, 40, "hello world", blankPanel, nil);
      blankPanel:addChild(button);
    end
end

Events.OnGameStart.Add(onGameStart);

this doesn't seem to work for some reason.. also why blankPanel:initialise() and blankPanel:instantiate() instead of only calling one? and why pass panel to button ISButton:new() as an argument while also doing blankPanel:addChild(button) shouldn't one of the 2 be enough?

thick karma
#

FYI, requiring SUI/ISPanel is not needed and in fact would not work at all because it's ISUI/ISPanel (and ISPanel is available without importing it). Friend might have a typo if that's what their code says. I haven't looked at it in awhile.

I do not recall testing whether both initialise and instantiate are required. I think that was likely copied from some other vanilla panel that did both and assumed to be necessary.

Good question about addChild; I'm not home so I cannot confirm whether that is actually unnecessary right now.

#

@dawn portal

#

If creating a new ISButton with those commands will call panel:addChild(self) on provided panel where self is the button, then that is probably not necessary to call again

#

I'd check ISButton:new to confirm

robust locust
#

Im doing the items_distributuion lua code... do I need the isShop = true for all the shops? Or is it ok how I've done it? I dont want to use the procedural distributions tho.

warped valve
#

You should see this framework I'm putting together, it's turning into something else lol

sage mantle
#

can I set the sound radius of a vehicle idle sound? like I want the sound to carry a little farther that normal

#

not the engine loudness that affect zombies but the distance from the vehicle the actual noise is generated

thick karma
#

@dawn portal Okay initalise calls this:

function ISUIElement:initialise()
    -- FIXME: need to avoid calling this method more than once, ID changes
    self.children = {}
    --    Give each UI element a unique ID.
    self.ID = ISUIElement.IDMax;
     ISUIElement.IDMax = ISUIElement.IDMax + 1;
end

instantiate does this:

function ISUIElement:instantiate()
    self.javaObject = UIElement.new(self);
    self.javaObject:setX(self.x);
    self.javaObject:setY(self.y);
    self.javaObject:setHeight(self.height);
    self.javaObject:setWidth(self.width);
    self.javaObject:setAnchorLeft(self.anchorLeft);
    self.javaObject:setAnchorRight(self.anchorRight);
    self.javaObject:setAnchorTop(self.anchorTop);
    self.javaObject:setAnchorBottom(self.anchorBottom);
    self.javaObject:setWantKeyEvents(self.wantKeyEvents or false);
    self.javaObject:setForceCursorVisible(self.forceCursorVisible or false);
    self:createChildren();
end
#

So I would definitely recommend both as they seem to have very distinct purposes.

thick karma
sage mantle
#

I did this ``` elseif instanceof(obj, "IsoObject") then
-- Check if the object has the specified tile properties
local tileProperties = obj:getProperties()
if (tileProperties:Is(IsoFlagType.HoppableN) or
tileProperties:Is(IsoFlagType.HoppableW) or
tileProperties:Is(IsoFlagType.TallHoppableN) or
tileProperties:Is(IsoFlagType.TallHoppableW)) then

                    vehicle:playSound("VehicleHitTree")
                    
                    -- Check if the object is a building component
                    local stairObjects = buildUtil.getStairObjects(obj)
                    if #stairObjects > 0 then
                        -- If it's a stair object, destroy it
                        for k = 1, #stairObjects do
                            if isClient() then
                                sledgeDestroy(stairObjects[k])
                            else
                                stairObjects[k]:getSquare():RemoveTileObject(stairObjects[k])
                            end
                        end
                    elseif not tileProperties:Is(IsoFlagType.solidfloor) then
                        -- If it's not a solid floor tile, remove it
                        if isClient() then
                            sledgeDestroy(obj)
                        else
                            k:RemoveTileObject(obj)
                            k:getSpecialObjects():remove(obj)
                            k:getObjects():remove(obj)
                        end
                    end
                end
            end```
dawn portal
thick karma
sage mantle
#

trying to figure out what tile property for road signs

dawn portal
#

oh I see, sorry I just glossed over the code. don't have access to my computer. I guess calling one should be enough. as far as I'm familiar with other software usually something like "initialize" or "init" is enough, it feels weird having 2 functions do the same thing pretty much

thick karma
#

They do entirely different things despite similar names.

gleaming sorrel
#

Making some textures but the ear seems to be staying the same color

#

Any idea why?

mellow frigate
sage mantle
mellow frigate
sage mantle
#

nah I actually forgot to try that lol

mellow frigate
sage mantle
#

I'll check it out

robust locust
#

it's not elegant, but it does the job!

#

I think the distributions is working... they're still craftable tho

bright fog
bright fog
#

Check where the base model UV sets the ears

sage mantle
#

so it breaks every kind of fence even like chain link and stuff. Also like the military fences and sandbags because I used the nothoppable tile property too

#

thats how I had it as a tunnel bore too because that was just the function without the filters

#

I guess I could probably use destroyFence()

gleaming sorrel
#

Probably gonna have to go through a few of my textures to fix the mistakes from that

#

Really need to figure out how people do this in blender

sage mantle
bright fog
sage mantle
bright fog
#

No that's not what I meant

#

Just the place where you think it is, isn't actually the place where the texture is

sage mantle
#

Increasing engine loudness and the new MG makes for some epic results lol

robust locust
#

does anyone know why my mod no longer be picked up off the wall?
I'm getting "testnill" in the debug window, and lots of them.

#

It worked when I tested right before i uploaded to the workshop

bright fog
#

Did you put a print in lua ?

gleaming sorrel
#

Everything stretchs out so sometimes like with the ears it takes a bit to find where a texture molds over the model

bright fog
#

The issue is that I'm not sure if you can access the current UV map of the model of the game

#

You'd have to find the folder where the model of the zombies are kept

gleaming sorrel
bright fog
#

probably

#

Search for bob and kate models

#

(fr)

gleaming sorrel
#

No bob

#

Only place both are is in the animation folder

robust locust
bright fog
#

πŸ‘Œ

#

I'm not familiar with script files and how they work exactly

#

But that looked like something printing in the console and all I know is that comes from a function printing it in the log

robust locust
#

oh ok... no I didn't put any print lines in anywhere... i'm not good enough for that stuff yet πŸ˜„

bright fog
#

np

robust locust
#

is weird why it's doing that tho. not seen it before. so long as it's not killing anything, i guess it's not a biggie

young aurora
#

Hello, if anyone could help me I'd greatly appreciate it.

I am trying to add a multi-barrel shotgun, but the double barrel reload animation is fixed to show the character loading two shells. I have found the vanilla reload animations (LoadDblBarrel.xml and LoadDblBarrelSawnoff.xml) and attempted tweaking them to no avail. When looping the animation, the character simply loads 2/x rounds every time you reload until full.

I have also found the Bob_Reload_DBShotgun_Load.X file though it is very large and I have no idea where to look/what to tweak. (I opened it in Notepad++, though I am sure that is not the correct way to open that file).

Please @ me/reply etc if you are able and willing to help! Thanks in advance!

cosmic ermine
#

I might release my traits and professions mod without multiplayer support and then support it on the next update, you guys think that's fine?

bright fog
#

You could just wait and finish it fully ?

#

But I get the impatience, I'm currently holding myself from sharing my zombie framework lol

thick karma
#

Unless your traits add lightning bolt attacks

oak mason
clever shell
#

I can't read lol - reposting here, triyng to replace the baseball bat model with a custom made .fbx model and im getting this as a result. Anyone know what could be the cause?

austere sequoia
clever shell
#

see I thought i did, I matched it to the original model

austere sequoia
clever shell
#

yeah, good point

#

is there a reference for what the scale should be?

rancid panther
#

at the same time tho, more people tend to comment if they have a request or a complaint. so the fact that no one is commenting anymore is also a sign that the mod is good enough for most people

cosmic ermine
#

If I were to add MP support right now before its first release then how would I test it by myself?

outer crypt
#

Sometimes I just need to wait a couple of days to get a friend that knows the exact test I need to run to hop on and try it. Some people have had luck with a local server and multiple copies of PZS running at once in different windows. Never could get that to work.

warped valve
#

Is there a way to re-add an IsoLightObject with addLamppost() that doesn't involve hooking into the LoadGridsquare event? I'm trying to persist one between server restarts

bronze yoke
warped valve
cosmic ermine
#

Ah, wasn't there x64 and x32 versions?

bronze yoke
#

a steam copy always launches using steam by default, use the -nosteam launch parameter

fading horizon
#

I never ended up releasing this. With the popularity of the source material now, would there be any interest in me finishing it and releasing it?

austere sequoia
#

Hey guys: Very basic question - how do you search through lua files? When I use windows searchbar, it cant find lua files, neither search through their contents, as it would do for txt files

young edge
#

In the windows search you can do *.lua and it will find any lua files.
The asterisk is a wildcard. I think you can even use it for partial words, but I don't remember rn

austere sequoia
rancid panther
thick karma
steady lagoon
#

Hey guys, I'm creating a custom weapon which should have infinite ammo by default. I created the weapon, defined a magazine, but how can I actually make it spawn directly with the magazine inside of it and without the bullets depleting on everyshot? The only thing I could, at the moment, was to spawn a clip with max ammo=999 and add 999 bullets into it, but that is kind of tedious to do.

thick karma
steady lagoon
#

Can this be done through scripts or should I make a .lua for it?

austere sequoia
ornate parrot
#

Hey, quick question

#

I want to try making a simple mod that allows you to unbutton the formal shirt

#

Like, wear it open collar

#

But the thing is, I don’t know how to go about that. I know you can just make another texture, but switching to that alternative texture in game in the same way you can with Spongie’s is what I’m trying to figure out

bright fog
#

Secondly for the models, you will have to learn how to use Blender and texturing in it, as well as modifying models

ornate parrot
#

Oh wait I thought it was just a texture

bright fog
#

Could be yeah

#

I'm not too familiar how Spongie does it

ornate parrot
#

If it was a jacket I’m sure I’d have to use blender

#

But IIRC if it’s just a regular shirt it should just be as simple as changing the texture

#

Or, to be more specific, changing the item ingame as you’re wearing it

bright fog
#

Idk how shirts are handled by the game but you can change the textures of the shirt yes that's possible

#

Tho is just changing the texture enough ?

ornate parrot
#

So you could change it from Formal Shirt to an item called Formal Shirt (Open Collar), which would change the texture of the shirt you’re wearing by making it an alternate item

#

I presume the way you do it is crafting it in Spongie’s

#

so when you right click on the shirt, you craft it into the alternative variant of it, being a different item.

#

That different item only being the shirt with just a texture change.

vast jasper
#

πŸ˜‚ for heavens sake i wish i knew how these new doors worked, i dont want to make door tiles just to have them not be usable in build 42

small topaz
# ornate parrot But the thing is, I don’t know how to go about that. I know you can just make an...

Spongies Mod (https://steamcommunity.com/sharedfiles/filedetails/?id=2812326159) already contains various open shirts.

However, if you like to make your own version, here is one possible approach where I assume you'd like to arrange things so that you can unbutton your formal shirt via right clicking on it and then selecting a new option:

  1. Edit your clothing item and bring it into game. (Either using blender and making a 3D model or just edit a texture depending on your likening. Vanilla formal shirts are just textures). The unbuttoned version of the formal shirt will then in fact be a new clothing item.

  2. The vanilla game contains a .lua file lua/client/ISUI/ISInventoryPaneContextMenu.lua. There the function createMenu() generates the menu which appears in game when you right click and item in your inventory. Add an option for opening your formal shirt (and maybe for closing it again in case it is open...).

  3. When the option has been clicked, simply exchange the default formal shirt with your edited one. A typical way to achieve is is using a TimedAction (TimedActions are also used by the vanilla when you exchange clothes for example).

  4. In step 3, you might like to transfer all properties form one shirt to the other For example, when the worn shirt has condition 50%, the opened version should probably also have condition 50%. Similar things might apply to dirtiness, bloodiness and other attributes a clothing item can have.

ornate parrot
#

I’m not familiar with LUA however so I’ll have to figure that out as well

#

When I speak about unbuttoned though I only mean so the collar is open

small topaz
# ornate parrot When I speak about unbuttoned though I only mean so the collar is open

Ah ok. Then it is different from what Spongie did. My bad. πŸ™‚

Anyway, the overall strategy I outlined would still apply to your case (may still be there are better way to do this... it's just one suggestion).

Some lua coding for the approached I outlined is necessary and I doubt that your mod project could be realized without any coding...

ornate parrot
#

Agreed

#

Though, it shouldn’t be very difficult to do in the first place

#

Since, it is indeed the same as the way that it was done in Spongie’s mod

#

Might not be an entirely good practice, but I could just take what was done in Spongie’s and just copy it over

#

I’d want this to be an add-on that just adds yet another way to mess with the shirt

bright fog
ornate parrot
#

You wouldn’t?

bright fog
#

You can in fact just use textures

#

Items have texture variants and there's an easy way to swap between those I believe

ornate parrot
#

Hmmm

#

That is a good point actually

#

Having the collar open wouldn’t change any of the protection values or how insulating the shirt is

small topaz
#

Didn't knew that changing textures of clothing in game is possible. Then this could simplify things...

ornate parrot
#

Yeah

#

Only thing though it has to be changeable ingame, not in character select

#

Like, by right clicking on it and stuff

small topaz
ornate parrot
#

Hmm, hopefully

#

it would just be a mostly cosmetic exchange as well, unlike opening the shirt or rolling up the sleeves

#

I’ll see what I can do but I don’t know how I could do that with LUA coding because I don’t know how to code with Lua

#

Most modding I’ve done was map modding but that’s it

bright fog
#

Yes that's still doable

#

I will just point you towards your solution:
-look for itemVisuals
-look for commands you can apply on clothing items
-check out how to make custom menus for items

#

(context menu)

ornate parrot
#

Though, one extra thing

#

I do want it to be compatible with Spongie’s

#

So you’re able to have the unbuttoned collar with rolled up sleeves and such

bright fog
#

You're changing the same items than Spongie does ?

ornate parrot
#

Yes

#

The formal shirt

#

Being able to make it have an unbuttoned collar

bright fog
#

You can definitely make it compatible, in fact the texture change could make it even more compatible since Spongie might not use that but I have no idea how he handles his stuff

ornate parrot
#

But IIRC, I don’t think Spongie’s replaces the collar shirt, only lets you change it into different variants

ornate parrot
bright fog
#

You'll have to look at how Spongie does it bcs then you could just make your mod an addon to his own

bright fog
ornate parrot
#

I think so

#

From what I know, you right click on the shirt (either while you’re wearing it or not), and choose what option (rolled up sleeves, open, etc) and then you change the shirt to that variant

#

Usually via a timed action

#

And the shirt’s name usually something like β€œFormal Shirt (Rolled Up)”

ornate parrot
#

It could possibly be what Razab said as opposed to just crafting since when you change shirts, the animation looks as if you’re putting something on

small topaz
#

Hmmm.... in case you'd like to have a shirt which can be unbuttoned (from your mod) and rolled up (from Spongie's Mod) at the same time, I guess you have to make a texture for each possible case, so one texture for "only unbottned" and one texture for "unbottened and rolled" and so on... Can't imagine how this will work automatically...

ornate parrot
#

Way I was thinking was adding 2 more options for when you change the shirt

#

When you right click for the shirt on Spongie’s, the options are:
Rolled up
Open rolled up
Open
Closed

bright fog
ornate parrot
#

I understand

bright fog
#

You'll just have to look at how he does it and be smart on your way of doing it

ornate parrot
#

That’s fair

#

Either way, it shouldn’t be too hard it’s just adding 2 more variants

#

Or 4 if you count the colored shirts but I don’t think I want to mess with those

bright fog
#

Be it the way you described it. The issue is if he uses models, you'll have to make models unless you create textures for all his model variants or if he uses textures then do the same

small topaz
#

whoops... I meant "unbottened and rolled up" in my previous comment. "unbottened and opened" make no sense XD Edited

ornate parrot
#

Luckily it isn’t since it’s just a shirt and not a jacket

#

It’s all good lol

bright fog
ornate parrot
#

Shirts are just textures from what I know

small topaz
#

yeah. just textures here

bright fog
#

πŸ‘Œ

#

Easy then

ornate parrot
#

So in theory it should be very easy then

small topaz
#

From what I see, Spongie seems to use some APIs for adding new options like "rolled up" in the UI. Maybe you could also try to use them. This could make it easier to make the mods work together as you like it

ornate parrot
#

That’s what I’m going to try doing

bright fog
#

Me waiting for the moment he realises it is, in fact, hard asf to do
aPES3_CursedDemon

ornate parrot
#

That’s why I said β€œin theory”

#

In reality it is just adding two extra options for when you change the textures in Spongie’s so

bright fog
#

Oh yeah spongie has an api in a separate mod no ?

ornate parrot
#

I don’t think so

#

?

#

Not if I can recall

small topaz
ornate parrot
#

Ohhhh I see

#

Unsure if that’d make it easier however

small topaz
#

they are set as requirement in spongies mod's steam page

ornate parrot
#

But they do seem to add the option

small topaz
ornate parrot
#

Like?

bright fog
#

No control over it, dependent ok mods

#

Advantages less work

ornate parrot
#

If my mod is an addon for another mod then it being dependent on other mods isn’t much of an issue

small topaz
#

Advantages: 1. You may not need to write too much code since you can simply use some predefined functions from the API.
2. Since Spongie seems to use them, just using the same APIs may make it easier to make both your mods work together nicely.

Disadvantage: 1. If the APIs contain bugs, your mod might also be malfunctioning and your are completely dependent upon the API's creators and wait until they fix them (which might happen quickley, slowly or never). Even worse, the authors could also remove them from the workshop.
2. An update of the API could require you to update your mod too.
3. Modlists of users get longer (= more annoying mod management)

ornate parrot
#

That’s fair

#

The disadvantages seem negligible however atleast in this scenario

small topaz
#

ya... it's just a matter of personal preference. Totally fine to use them but also legitimate to try to avoid them.

latent hare
#

heya, i want to make my first ever project zomboid mod, where should i start?

ornate parrot
#

Alright

#

I’m gonna see how I can utilize the API

#

Not that I know how but having access to it for what I’m trying to do really does simplify things

small topaz
small topaz
ornate parrot
#

That’s the plan

latent hare
ornate parrot
#

Well I’m gonna figure this out later when I’m back on my desktop

#

Came a long way from making map mods πŸ₯Ά

warped valve
#

Any ideas on how to play sounds/music to the client so that other people won't hear it?

bright fog
bronze yoke
#

assuming you're already using a sound emitter and you're just trying to stop it from networking, the -Impl methods don't get networked automatically, whereas the ones missing that suffix do

bright fog
#

Or send command to a specific player

warped valve
warped valve
clever shell
#

hey folks - back at it again, figured out my first problem and it definitely was scaling, I wasn't applying the scale or exporting right lol. New problem, it looks like the textures are using the default baseball bat despite me changing it in the games folders, is there anything I'm missing?

#

nvm figured it out - I thought textures would update automatically but that's just models lol

final finch
#

What is the most up to date/commonly used .pack unpacker? I'm trying to unpack a mod for troubleshooting a minor compatibility issue. (Trying to see what Plain Moodles looks like.)

#

The one I found and used (Zomboid Pack Manager 1.0) did not seem to work.

mellow frigate
final finch
#

And neither has PZ UnPacker

buoyant merlin
#

so the order each category appears in that file's generation list is the order it "paints" the model, and you can directly change it by cut and paste

final finch
#

It's a rather minor issue. Basically it looks like they scale poorly due to how they were made, but I just want to check if what I think is the issue is correct.

#

Thank you very much!

bright fog
#

πŸ‘€

final finch
#

Oh interesting, thank you very much! It looks like my assumptions were wrong, and they should scale fine, but the API I'm using might not be properly expecting the change in size.

#

Is it possible that the mod is improperly scaling the images down in game, due to how they're packed? They seem smaller than vanilla, and have some blurring that reminds me of bilinear scaling.

#

Next to the yellow line, do you see the slight bleed?

#

You gotta squint since it's quite small. πŸ˜… But it becomes obvious with my mod that makes moodles resizable. I can see it though. And it looks different than it does in the files.

#

It seems to be an issue with how the game is scaling them, possibly due to them being 32x35, instead of 32x32. Though that resolution seems mostly necessary to properly position the heads.

#

The background looks a lot sharper in the base image... 😩

#

Wdym the tiles are the same size?

#

How do you check this information? I'm using TileZed as well, which I think is the same thing.

#

Since it says Tiled at the top.

#

Ah yeah I'm in the pack viewer.

#

Just didn't see that additional information.

#

πŸ‘€

bronze yoke
#

i remember chuck having some issue with non-vanilla textures scaling differently? but maybe i'm conflating something

final finch
#

God damn it. 🀣

#

Thank you so very much. I didn't realize how much it compressed them. I'll be sure to tell people on the mod page to turn that off. πŸ˜…

sour island
#

The texture compression was it, also the max texture size impacts textures abnormally.

#

Or I could be misremembering it, I think I wrote a bug report a while back.

drifting ore
#

Hello, I'm curious about updating my mod that added food variants and distributions to the world, and there is current subscriber an ongoing multiplayer server. Is it safe to do?

small topaz
# buoyant merlin hey I found the answer to this: the Shared NPCs Bodylocations lua **IS** an orde...

Just cut and paste will overwrite the vanilla body locations and all manipulations done to body locations by mods which are loaded before yours making them incompatible. To solve the issue, you can backup all body locations in a lua table, reset the vanilla locations and restore them step by step. You can then apply your changes during the restore process. You also have to back up all infos related to body location like "setHideModel" and stuff to make it work properly.

small topaz
# drifting ore Hello, I'm curious about updating my mod that added food variants and distributi...

In every case, server owners have to restart their server to make the update effective. Before the server restart, players are not able to login to the server.

In most cases, updating a mod should be completely safe for singleplayer as long as your updates are save game compatible.

In case your update is not save game compatible, single player as well as servers must start a completely new game.

For the thing about the food distribution, you should note that your update may not affect parts of the game where the items have already spawned. But this depends on what exactly your mod and the updates do.

austere sequoia
# thick karma <@297443874115420160> https://www.geeksinphoenix.com/blog/post/2022/05/15/optimi...

Do you by any chance happen to know how to fix when only a part of the files are indexed? I made windows index lua, and made it index my PZ folder. When I search I rarely get luas searched including their content, what leads me to believe that in principal everything is working. But then it seem like it only indexed a fraction of the lua files, since some others cant even be searched for by their names

#

Next best option that is coming up to my mind would be wiping all of the indexes, so windows has to start from scratch. But I would prefer not to delete system files, lol

#

I also got the most windows notification ever trying to fix it: "Problem manager can not be started due to a problem" lol

thick karma
#

Uhhh I just followed the instructions and added Lua to the filetypes indexed, and made sure it selected all folders and subfolders I wanted it to search. Didn't delete any index rules, just added my own for the folders where I want to search for Lua in addition to everything else.

austere sequoia
#

dang it... I will keep trying around until it works then πŸ™‚

thick karma
#

It does take time...

#

You're sure it finished indexing right?

#

Took a fair chunk of time to index ProjectZomboid e.g.

austere sequoia
#

it says "0 files left to index", so I'd guess. I just found the button to restart all the indexing on my PC. Will take some time (900k files), but should work hopefully

bronze yoke
#

you can just open the lua folder with your ide and search it there

austere sequoia
#

ide?

bronze yoke
#

the program you use to edit code

austere sequoia
#

the editor can search my files for the contents of lua code? oO

thick karma
#

Ctrl Shift F unless I changed the default and forgot.

austere sequoia
#

What do you use?

thick karma
#

I also use VS Code. But I frequently do Windows searches because it's more convenient than opening a folder in VS Code every time I want to search it.

#

If by "Windows Editor" you mean Notepad, only masochists and people who lack experience code in Notepad.

#

Booooo Notepad

#

(I'm joking, you're allowed to like Notepad, but I would need to be masochistic to want to use it over a proper editor.)

austere sequoia
bronze yoke
#

it's pretty lightweight and user friendly, even if you don't know how to use many of its features it should be a far better experience than notepad

austere sequoia
#

got it! Thats awesome, thank you to both of you! I am still new to programming, so I dont know shit

thick karma
#

Good luck!

austere sequoia
#

That is sooo much better than opening each file by hand in Notepad and searching it for specific terms xD

#

I love it already

thick karma
#

Lmao yeah

#

There is an open folder shortcut too and by default the shortcut is absolutely awful if I remember right

#

Idk I make it Ctrl Shift O and take other shortcuts off of that

#

Is it Ctrl K O by default? Idr but it feels bad to me

austere sequoia
#

ctrl k o, yes πŸ˜„ too complicated

thick karma
#

Yeah oof I changed it

#

keyboard stuff can be rebound in menu

#

I prefer ctrl O for file ctrl shift O for folder personally.

#

I think VS Code defaults use ctrl shift O for switching focus to open files and also jumping to things in open files

#

Which can be useful sometimes but doesn't feel like it belongs on ctrl shift o to me

austere sequoia
#

Yeah, I guess I will find my optimal shortcuts by playing around πŸ™‚

small topaz
#

Hi! I have a situation where I have to use identical auxiliary functions in different .lua files in my mod's cient folder. Performance wise, it is a good idea to copy-paste the auxiliary functions and put them as local functions in the respective .lua file? Or is it better to make only one version for each auxiliary function, set them global and just call them in the different .luas whenever I need them?

heady crystal
#

Plus, assuming you're not running Win 11, VS Code has a dark theme so you don't go blind

austere sequoia
thick karma
#

I had entirely forgotten W10 Notepad still doesn't have a standard dark mode... What garbage lol

#

I have W11 so even Notepad isn't that kind of terrible. White backgrounds. Oof.

austere sequoia
#

So lets say I want to write a mod that changes one tiny thing in lua (somthing stupid like make the counterclock rotate key alt instead of shift), how would I replace a vanilla function (function ISPlace3DItemCursor:checkRotateKey in my example) with my own function? Just add it and it automatically overwrites vanilla function? Sorry for the super basic question, trying to fill my toolbox with some nescessities, lol

thick karma
#

Yes but we usually try to avoid doing that at all costs. What people recommend instead is decoration, which involves override but doesn't completely throwaway original functionality and is therefore more compatible with other mods.

#

At least that works if the module is a Lua module and it's either global or you've required it successfully somehow.

#

You just want to rebind the checkRotateKey function? Is that your literal goal r.n.?

austere sequoia
thick karma
#

Lua module = classlike Lua table.

#

Can be used either statically or dynamically in the instantiation of objects or the derivation of functionality.

thick karma
#

It means, "Establish this file as a dependency, make sure it has already run, and grab the return values it provides after it runs."

austere sequoia
thick karma
#

You can catch them by going local ReturnedModule = require("ReturnedModuleFilenameWithNoExtension")

#

local is optional but considered good practice to keep the table of global variables (including modules) limited

#

your answer is part of this.

#

Many other questions you'll have will also be answered there

austere sequoia
rancid panther
#

u should consider instead of replacing the keybinds to just make those options bindable through modoptions or whatever is the most up-to-date alternative. that way you can update it for other keybinds you wanna change and still have it available if u host a server with friends who dont wanna change those binds

austere sequoia
rancid panther
#

idk what is currently bindable or not bindable, but i think anything that changes a keybind might as well just be an option (from client-side) instead of a full replacement

austere sequoia
rancid panther
#

oh ok

#

if u wanna start simple, try making a flag with that flag mod

thick karma
#

It also demonstrates function decoration

rancid panther
#

i see

thick karma
#

It also explains modules

rancid panther
#

whatever burryaga sent is probably already more than enough info for a launching point

austere sequoia
#

I mean simple LUA, I already did a couple of mods, also with tiles and stuff. Now I am trying to get into LUA, since without much of the stuff I want to achieve would lack elegance or even the potential to work in the first place

rancid panther
#

good luck!

austere sequoia
thick karma
#

I am trying to find you a good link for the basics of scope but everything is overcomplicating it so I'll just try to tell you.

rancid panther
#

my first mod was just some traits that changed stats, and i kept branching out to more things i wanted/thought were doable

#

so i only slightly increased in ambition each time and made better and better mods

#

burryaga helped me make blackouts work in multiplayer and greatly optimized it, so you're in good hands

#

gn!

thick karma
#

@austere sequoia Scope is the field of existence (or at least referenceability) for any variable define in any computer program. Often scope is indicated by keywords like then and end or special characters like { }.

austere sequoia
thick karma
#

The broadest of all scopes is the "global" scope. In Lua, variables are global by default. This means that if you declare a variable in file A.lua, and then that file loads, and then you try to access the variable in file B.lua, it will work.

austere sequoia
#

and in the "require" files?

thick karma
#

The next broadest scope would be files; if you declare a local variable at the root level of a file, it continues to be referenceable from any code that executes in that file after that declaration.

thick karma
#

Not in any function or module.

#

module or table

#

Modules are are just a kind of Lua table

#

Almost everything "fancy" in Lua is done using Lua tables, which are very flexible.

austere sequoia
thick karma
#
aLuaTable = {
  looks = "like",
  this = "."
}
thick karma
austere sequoia
thick karma
#

Now as soon as you enter a table or a function or a loop or various other defined constructs in Lua, you enter new scopes, and locals defined there are only referenceable from within those scopes after they are declared.

thick karma
#

Sometimes people define new functions within other functions.

austere sequoia
thick karma
austere sequoia
thick karma
#

See above.

#

What I'm saying is that a local in a function, e.g., does not "exist" for practical purposes (or more specifically can no longer be referenced) once you are no longer running commands in that function.

austere sequoia
#

Ah, awesome! So I thought correctly. Sorry, I dont know a lot of the proper terms yet, so I have to translate your smart people language into my stupid people language πŸ˜›

thick karma
#

Even if that function is global, its locals are limited to its own scope. ayoooooo above is in fact global because I did not tell it to be local.

thick karma
#

I knew you would need an example

#

I am operating under the assumption that you, too, are human.

#

And this is alien speech.

austere sequoia
austere sequoia
thick karma
#

So then, as I mentioned, loops and modules and some other things are also scopes, and you can have scopes within scopes within scopes where things come to exist and get recreated over and over. Each iteration of a loop, e.g., is its own scope.

thick karma
#

because the label x would be interpreted as having the value nil (no value ever assigned)

#

Because the line local x = 5 was done in deeper scope than the file-level print statement

#

So the file-level print statement has no reference to it

austere sequoia
thick karma
#

Correct.

austere sequoia
#

the "--> prints nil" are your notes, not part of the code?

thick karma
#

Keys declared in Lua tables are also being declared in their own scope. So if you do this:

local y = 5

local DerGeisslinAround = {
  x = 3,
  y = 4,
  z = 7
}

print(x) --> prints nil
print(y) --> prints 5 (not 4).
print(DerGeisslinAround.z) --> prints 7
austere sequoia
#

print({y}) probably not like this?

thick karma
#

Added that example

austere sequoia
#

aaaaaah!!!!

#

tablename.value

#

because the whole table is a local. and we reference the locals

thick karma
#

And you can also have functions that use this to make your code a bit simpler:

function getPlayerXYZ()
  local player = getPlayer() --> Keyboard player, no good for splitscreen.
  local x = getPlayer():getX()
  local y = getPlayer():getY()
  local z = getPlayer():getZ()
  local xyz = {
    x = x, --> The LEFT variable is a new variable, a key defined in the xyz table's scope.
    y = y, --> The RIGHT variable is the variable from the scope of getPlayerXYZ.
    z = z
  }
  return xyz
end
#

(This would almost certainly be a pointless function to have, it's jut an example for understanding.)

thick karma
#

There is measurable performance cost in using global table references instead of local variables.

#

Especially for looping references.

thick karma
#

So people try to encourage newbies to make their modules local whenever possible.

austere sequoia
thick karma
#

lol I never played MC tbh

#

Only with kids

#

(I worked daycare for awhile)

austere sequoia
#

it basically is a never ending, continous circle that keeps ticking forever. That is what I believe a loop to be from what it sounds like. Stuff like checking for certain conditions to be met, probably

#

correct me if I am wrong, lol

thick karma
#

Oh no

#

Loops are not neverending

#

Sorry I could not understand what you were asking for a minute

austere sequoia
#

btw, off topic: is there a way to save/favorite this conversation?

thick karma
#

A loop is a structure in programming that tells a certain process to happen repeatedly under certain conditions, but not necessarily forever.

#

Usually a loop that never ends is a mistake; in Zomboid, it would definitely be a mistake.

#

Only the main game is allowed to loop forever.

austere sequoia
thick karma
#

If you tried writing a loop that lasted forever, your game would freeze and crash.

thick karma
#

A loop that is neverending until a switch is flipped is called a while loop.

#

for loops are more common.

#

I always like this guy's language overviews.

#

Keep in mind that his printing commands will differ from yours because it's a different environment

#

But a lot of structural patterns will apply

austere sequoia
#

dude, I cant thank you enough πŸ™‚ That is awesome help, opening some knots in my brain

thick karma
austere sequoia
#

For testing, yes. Do you mean that small window on the bottom left that always tells what is currently going on (looks like codestuff to me)?

thick karma
#

Yes. You can also drop entire functions into it for testing, and just keep overwriting them and trying them differently, depending on the nature of the function

austere sequoia
#

as in copy pasting them and the game runs them?

thick karma
#

As in copy-paste and the game loads them

#

And then you can call them

#

to run them

austere sequoia
#

ahhhh, I get it

thick karma
#

So, to give you a specific example, you wanted to decorate this:

function ISPlace3DItemCursor:checkRotateKey()
    if self.chr:getPlayerNum() ~= 0 then return end
    if self.chr:getJoypadBind() ~= -1 then return end
    local pressed = isKeyDown(getCore():getKey("Rotate building"))
    local reverse = isShiftKeyDown()
    self:handleRotate(pressed, reverse)
end
austere sequoia
#

to make it use the X-Key instead?

thick karma
#

@austere sequoia In order to do what you want, you would really need to intervene in the middle of this function's process, but that would require decorating isKeyDown (which most would not recommend because that's a major global function that everyone needs to work correctly and quickly), or overriding (which again I would discourage). My favorite solution would therefore be to replicate a few conditional checks to figure out what the outcome will be, and branch as needed:

local DerGeisslinAround = {}

-- Container for any decorations of Indie Stone's Place3DItemCursor functions:
DerGeisslinAround.Place3DItemCursor = {} 

-- Store reference to original function:
DerGeisslinAround.Place3DItemCursor.checkRotateKey = ISPlace3DItemCursor.checkRotateKey

function ISPlace3DItemCursor:checkRotateKey()
    if self.chr:getPlayerNum() ~= 0 then return end
    if self.chr:getJoypadBind() ~= -1 then return end
    local pressed = isKeyDown(getCore():getKey("Rotate building"))
    if not pressed then
      pressed = isKeyDown(getCore():getKey("Your custom keybind name"))
      local reverse = isShiftKeyDown()
      self:handleRotate(pressed, reverse)
    else
      DerGeisslinAround.Place3DItemCursor.checkRotateKey(self) -- Call original function.
    end
end
#

Lua note: : in the function signature is a way of passing "instances" around. Without going into endless detail, the instance gets passed as self. When you call your backup reference to original function, you don't use : notation on the object itself, so you need to manually pass self forward.

#

To understand more about what an instance actually is, you need to look into basics of object oriented programming.

austere sequoia
#

what does "container for decoration" mean. I assume you dont mean pixelart.

Store reference to original function is the part that makes my function override the original function?

thick karma
austere sequoia
thick karma
#

A function is called using a variable name that points to it.

#

In Lua, people (including me) often use the following notation for statically called functions:

MyModule.staticFunctionName = function(parameters, you, will, need)
  -- stuff happens
end
#

Which emphasizes that MyModule.staticFunctionName is just like any other variable... like x in x = 5

#

and in fact if you then said x = MyModule.staticFunctionName, you could do this:

MyModule.staticFunctionName = function(parameters, you, will, need)
  -- stuff happens
end

x = MyModule.staticFunctionName

x(parameters, you, will, need) -- stuff happens
#

That's what you're doing... you're saving the original function inside of a new variable.

#

Then you can redefine the MyModule.staticFunctionName to refer to a new function that does new stuff, but x will still do the original stuff.

#
MyModule.staticFunctionName = function(parameters, you, will, need)
  -- original stuff happens
end

x = MyModule.staticFunctionName

-- parameters, you, will, need assumed to exist
x(parameters, you, will, need) -- original stuff happens

MyModule.staticFunctionName = function(parameters, you, will, need)
  -- new stuff happens (original stuff overridden)
end

MyModule.staticFunctionName(parameters, you, will, need) -- new stuff happens

x(parameters, you, will, need) -- original stuff happens (still)
#

Might take awhile to sink in fully. You have to mentally separate the function itself from the label used to call it. Colloquially we often refer to ISPlace3DItemCursor.checkRotateKey as a function, but technically speaking it's a label that points to a function. The function itself is just data at a memory location, like the number 5, or "bob".

thick karma
#

Okay good good.

#

Well then yeah you just gotta see how the function data continues to exist as it is in its original location even if the variable that originally pointed to it is told to point to a new function.

thick karma
austere sequoia
#

leaving the rest of the function untouched

thick karma
#

Sort of. Technically you're adding behavior external to the original function

#

I didn't actually change anything about original function; I just don't call it if the key was wrong.

austere sequoia
thick karma
#

Both keys would work

#

In my example

#

Because it doesn't call the original function if it's not the original key

austere sequoia
#

ah, I get it. Now it makes sense

thick karma
#

And it doesn't call crucial lines of the new one if it is

austere sequoia
#

If I run into problems in the future, may I ask you for assistance?

sour island
#

Looking for testers for Expanded Heli Events: #1215626507846688808

Trying to figure out how to do this whole testing thing. I personally should be home around 5-6 EST. But the test requires no group participation, mostly seeing if events are wonky, if the sounds are good, etc.

wheat kraken
#

can i use getModData

to save persistent table?

to keep data stored, when loading a save again

steady lagoon
thick karma
#

It'll give you line numbers but they're a bit tough to interpret because they'll be relative to the first line in the chunk you enter. And if you enter a function with a runtime error it'll give you the usual error message for that exception.

steady lagoon
#

right

#

Still better than relying on writing/rungame and repeat

thick karma
#

For a ton of things, yes, it can save a lot of time

#

Sometimes it's just not worth the effort to avoid a restart, but if you just need to test a utility function with data that you can either fabricate or scrape using another function, it's much quicker.

#

You can also test functions added to events if you globalize them or their modules first and then remove them from the event before you overwrite them

#

(and then add them again after overwriting)

#

I've done this often when doing context menu stuff.

steady lagoon
#

the point is that I'm trying to spawn a custom gun with infinite ammo, I don't want to have infinite ammo on everything, just on this one but to do it I need to find this weapon in the inventory and then permanently keep the clip size to the max.
The problem is that the documentation seems to be obsolete, so maybe I can find some information directly through debugging.

thick karma
#

@steady lagoon I would add a function to OnEquipPrimary and grab item for a global variable as you equip it

thick karma
#

(then explore global for opportunities)

steady lagoon
#

Do I need to import those external libraries into my custom lua script or can I just call those events directly?

thick karma
#

Events.OnEquipPrimary.Add is global

slow graniteBOT
#
cf1c has been warned

Reason: Bad word usage

wheat kraken
#

how can i store table, or table values in moddata?

and load it when game starts again (load, continue)

modern hamlet
#

I'm looking for the section where the maximum weight the character can carry is recalculated when he gains a level in STR, but I'm a little lost in the files, can anyone guide me?

steady lagoon
#

hello guys is there an event to check if you shot with a weapon?

bright fog
#

nop

#

But you could verify that your bullet hit a zombie or player

steady lagoon
#

you can use:
Events.OnPlayerAttackFinished.Add

#

just found it

#

it's better and is more graceful than onEquipPrimary

#

onEquipprimary is triggered on unequips as well

#

and you need to deal with Exceptions there

bright fog
#

True

#

Check the weapon in your hands is the correct one

local function OnPlayerAttackFinished(character, handWeapon)
    -- Your code here
end

Events.OnPlayerAttackFinished.Add(OnPlayerAttackFinished)
humble cobalt
#

I'm looking to ask a few questions to a modder regarding player currency, specifically with Shops - Noir. If anyone is familiar with it, that has a few moments to break it down for me, please let me know.

supple grotto
#

Good morning, friends.
I am creating a new map for Project Zomboid, and I've successfully completed almost everything. It's working perfectly in my game, but there's one issue: I don't know how to enable the map when I press the "m" key (the minimap). Can anyone provide assistance with this?
Thanks in advance.

oblique shard
#

if i start working on a custom map for the current build, will it carry across and work on build 42? or would i be better off waiting?

#

assuming most mods are gonna break too

supple grotto
#

I understand, it's indeed a good idea for those starting a new mod. However, it's a pity because I've already done everything on the map; only this minimap is missing. I just wanted to finish it since no other errors are occurring, only this one.

bronze yoke
bright fog
#

Example of what Albion is talking about with vanilla functions

--- Import functions localy for performances reasons
local table = table -- Lua's table module
local ipairs = ipairs -- ipairs function
local pairs = pairs -- pairs function
local ZombRand = ZombRand -- java function
local print = print -- print function
local tostring = tostring --tostring function
bronze yoke
#

pulling in members of the tables is also slightly faster```lua
string.gmatch(...) -- slowest

local string = string
string.gmatch(...) -- faster

local gmatch = string.gmatch
gmatch(...) -- fastest, but not by much

supple grotto
# supple grotto I understand, it's indeed a good idea for those starting a new mod. However, it'...

This is a tutorial on how to update your in-game map system in project zomboid. I hope that this video offers you some guidance and clear directions on how to. The original written instructions can be found here:
https://theindiestone.com/forums/index.php?/topic/43627-how-to-update-your-map-mod-to-work-with-the-new-in-game-map-system/

For the k...

β–Ά Play video
slow graniteBOT
#
jackiel5245 has been warned

Reason: Bad word usage

hot void
#

oh hi

#

how can rename the sub menu

austere sequoia
# hot void how can rename the sub menu

item Hat_BaseballCap
{
DisplayCategory = Accessory,
Type = Clothing,
DisplayName = Baseball Cap,
ClothingItem = Hat_BaseballCap,
ClothingItemExtra = Hat_BaseballCap_Reverse,
ClothingItemExtraOption = ReverseCap,
clothingExtraSubmenu = ForwardCap,
BodyLocation = Hat,
IconsForTexture = BaseballCapRed;BaseballCapGreen;BaseballCapBlue,
CanHaveHoles = false,
ChanceToFall = 60,
Insulation = 0.10,
Weight = 0.5,
}

#

isnt it "clothingExtraSubmenu"?

austere sequoia
# hot void how can rename the sub menu

could also be "ClothingItemExtraOption", I dont have the game in english, so I cant check right now. But in your files it should be called "context menu_downhoodetc....", so you should be able to recognize it

hot void
#

@austere sequoia

#

like this?

austere sequoia
#

try it πŸ˜„ If it works for baseballcap, it should work for your hoodie

austere sequoia
hot void
#

i found a way

#

which is making translations for it so its better that way

austere sequoia
#

Thats great!

final finch
#

@mellow frigate Hope it's alright for me to ping you! I'm working on a mod to work with MoodleFramework, and I'm running into a weird issue with MoodleFramework. If a user loads in with the scale set to 1, and then sizes up a moodle, everything works as expected. However if a user changes the moodle size before loading into the game, moodles using moodleframework are offset on the x-axis.

#

Example:

#

The code:

local LuaMoodles = require("StatsAPI/moodles/LuaMoodles")

local old_adjustPositions = LuaMoodles.adjustPositions

-- Set the default moodle size.
local RvMoodleScale = 1

-- Check for MoodleFramework
local modInfoMF = getModInfoByID("MoodleFramework")
local MFenabled = 0
if modInfoMF and isModActive(modInfoMF) then
    MFenabled = 1
    require 'MF_ISMoodle'
end

-- Get the moodle scale from MCM
if Mod.IsMCMInstalled_v1 then
    -- initialize the main mod option table
    local MyModOptions = ModOptionTable:New("ResizableMoodles", "Resizable Moodles", false)

    -- Add options
    MyModOptions:AddModOption("RvMoodleScale", "number", RvMoodleScale, { min = .1, max = 10, step = 0.001}, "Moodle scale", "The multiplier for moodle size.  Default is 1.", function(value)
        RvMoodleScale = value
        LuaMoodles.adjustPositions()
    end)
end

-- Adjust size
LuaMoodles.adjustPositions = function()
    LuaMoodles.scale = RvMoodleScale

    if MFenabled == 1 then
        MF.scale = RvMoodleScale
    end
    
    old_adjustPositions()
end
#

Even if I delete everything and just use MF.scale with no other settings, setting it above 1 and then loading in causes issues. It's really weird... Since your Bigger Moodles compatibility script doesn't seem to have the same issue.

mellow frigate
final finch
#

No no, that was just a troubleshooting step I tried to see if I could find the issue with my code.

mellow frigate
#

What do you want your mod to do ?

final finch
#

Allow a user to resize their moodles.

#

But to a scale of their choice

#

Vanilla moodles work perfectly. MF moodles work if they load in with a scale of one, and then upscale, But if they start at a higher scale, the issue arises.

mellow frigate
final finch
#

Yes that is correct

#

I've tried looking through the code to see what's different but it seems like it's functioning the exact same.

mellow frigate
final finch
#

What do you mean?

#

Oh the size doesn't change in the other one?

mellow frigate
#

I think the point is to choose the size once and for all.

final finch
#

Still... I would think if that was the issue, then it would load in correctly, and break on an update. But instead, it breaks immediately upon load in.

mellow frigate
#

what is load in ?

final finch
#

If you load into the game with a scale of 1, then change the scale to anything else, nothing is broken. Both vanilla and MF moodles work flawlessly.
If you load into the game with a scale other than 1, Vanilla and MF moodles are scaled properly. Vanilla has no issues, and MF moodles have a strange x offset.

final finch
mellow frigate
#

how do you change the scale after loading ?

final finch
#

Once the scale is changed, it fires LuaMoodles.adjustPositions()

mellow frigate
final finch
#

Basically yes.

mellow frigate
#

it looks like Moodle Framework would need to adjust the reference position of all moodles created before your changes.

final finch
#

πŸ€” Is there a specific function in MF I could call to adjust it? It seems to be capable of doing it, and just isn't properly being called by my code?

#

Perhaps mine doesn't work because the value is set too early? So perhaps I could have it somehow wait till a save is loaded to make the change?

bronze yoke
#

the only real difference between this and big moodles is that mod options is calling adjustPositions, so the blame is probably that being called too early

#

although i don't really know how mf's compat works

mellow frigate
#
LuaMoodles.adjustPositions = function()
    local scale = core:getScreenHeight() / 720 + 0.5
    scale = scale - scale % 1
    if scale < 1 then scale = 1 end
    MF.scale = scale
    
    adjustModdedMoodlesPosition()
    old_adjustPositions()
end

local function adjustModdedMoodlesPosition()
  --we need a double loop that parses the following table containing the modded moodles instances
--for each valid playerNum / moodleName, do
  local myMoodle = MF.MoodlesStorage[playerNum][moodleName]
  local x, y = myMoodle:getXYPosition();--uses MF.scale
  myMoodle:setX(x)
  myMoodle:setY(y)
  local width = 32 * MF.scale;
  local height = 32 * MF.scale;
  myMoodle:setWidth(width)
  myMoodle:setHeight(height)
--end do
end
final finch
#

My brain hurts but I will give that a shot, thank you.

mellow frigate
# final finch My brain hurts but I will give that a shot, thank you.
-- can you try this the following ? 
require 'MF_ISMoodle'

function MF.adjustScale()
    for playerNum, playerMoodles in pairs(MF.MoodlesStorage) do--for each local players (splitscreen)
        for moodleName, myMoodle in pairs(playerMoodles) do--for each moodle already created
            local x, y = myMoodle:getXYPosition();--uses MF.scale
            myMoodle:setX(x)
            myMoodle:setY(y)
            local width = 32 * MF.scale;
            local height = 32 * MF.scale;
            myMoodle:setWidth(width)
            myMoodle:setHeight(height)
        end
    end
end

--the following requires MF_MoodleScale to be loaded
require 'MF_MoodleScale'

local modInfoBM = getModInfoByID("BigMoodles")
if not modInfoBM or not isModActive(modInfoBM) then
    return--handle : compat not required
end
require 'BigMoodles'--I guess your code replaces BigMoodles, so it should require your own file instead here 

local LuaMoodles = require("StatsAPI/moodles/LuaMoodles")
local core = getCore()

local old_adjustPositions = LuaMoodles.adjustPositions
LuaMoodles.adjustPositions = function()
    old_adjustPositions()--let BigMoodle/StatsAPI do the job and then MF_MoodleScale set MF.scale
    MF.adjustScale()--use MF.scale to reposition/rescale each already created moodle.
end
final finch
#

That did not work for me, but I probably did something wrong. Is there a list of events or triggers available somewhere? Like OnGameStart, OnGameBoot, OnGameLoad, etc? As well as an explanation of when each triggers?

#

Is there a way to check if currently in game, or just at the start screen? I feel like I definitely saw that somewhere...

bronze yoke
final finch
#

Oh awesome, tyvm

final finch
#

I feel like the isClient() function is really close...

bright fog
#

isClient() returns true if ran in a client lua and when ran in multiplayer

#

Also why would you want to know if it's in the start menu or in-game ?

#

What kind of mod would you need to run in both ?

final finch
final finch
#

The issue seems to be caused partially by the game applying the values too early... So I was hoping to delay them till after the game is loaded. But it would need to know if the client is currently in a game or not too to apply them.

verbal yew
#

Guys, hi, it's possible to remove events from one mod X with mod N
For example:
Mod X have folder lua/myExample/luaTemplate.lua with func:

local function somecodeshitstuff()
--*bla bla bla*
end

if getActivatedMods():contains("another mod neebubratan") then
    Events.EveryOneMinute.Add(somecodeshitstuff);
else
    Events.EveryTenMinutes.Add(somecodeshitstuff);
end
bronze yoke
#

not if it is local

verbal yew
#

but can i just remove event?

#

like
Events.EveryTenMinutes.Remove(somecodeshitstuff);

bronze yoke
#

you need a reference to the function to remove it

verbal yew
#

okay, if func global?

bronze yoke
#

yeah

hasty vector
#

anyone knows how to get zombie's Z position??

bright fog
hasty vector
mystic vessel
#

Where can I promote my mod?

slow graniteBOT
#
dapehs has been warned

Reason: Bad word usage

cosmic ermine
plain crest
austere sequoia
#

is there any way to let recipes not appear in the "big" crafting menu, but only get the option to apply the recipe when rightclicked on an item in inventory? I have to add a lot of recipes, but would prefer not to flood the craftingmenu

sour island
#

Anyone else run into issues where random wooden tiles appear around the map? I'm noticing a connection with EHE - but I think the issue is getCell():getOrCreateSquare() being used on cells outside the current cell.

#

My interpretation of the method was that it would be loading a single square's data when called. Haven't tested my new draft that avoids using that method, but just curious if anyone ran into a similar issues.

#

Previously using fastmove and having events call getOrCreate made swathes of wooden floors - in my current testing the problem seems fixed.

small topaz
#

Is it save to declare your mod's TimedAction functions as local and then import them via the require() command whenever you need them?

steady lagoon
#

sorry folks, how can I find the ItemID using the debug mode?

#

It's an item ID of a custom item created within a mod

small topaz
austere sequoia
austere sequoia
small topaz
# austere sequoia Do you happen to know how this works? πŸ˜„

I am just looking because I could use this in my modding work too.

So the recipes have a java command called
recipe:setIsHidden(boolean)
This could be useful. But I don't know how to get the actual recipe object which should be in the variable "recipe" in my code example

austere sequoia
magic swan
small topaz
# austere sequoia Do you happen to know how this works? πŸ˜„

Here is something that seems to work:

function ISCraftingUI.populateRecipesList(self, ...)

     local recipe = getScriptManager():getRecipe("Make Jar of Broccoli")                
     recipe:setIsHidden(true)  

     vanilla_populateRecipesList(self, ...) -- execute vanilla code

     recipe:setIsHidden(false)

end```

This must be the content of a .lua file which has to be in your mod's client folder. But use with care and playtest this a lot!!!! I just had a quick look at and it looked good. But could still be that smth is wrong with.
#

... the example will hide the recipe for crafting a jar of broccoli from the Craft Menu but not from the right click menu according to my testing

steady lagoon
#

are ArrayLists treated differently in Project Zomboid?
I should be able to call the content using array[index], but it just throws an error?

small topaz
# steady lagoon sorry folks, how can I find the ItemID using the debug mode?

In the debug menu, there is an option called Items List. You can try to search within the first field called "Type" (bottom left of the search menu after you clicked on Items List). But not sure whether it will also show you mod item. The second field "Name" can be used for searching an item by its display name.

small topaz
austere sequoia
bright fog
#

Yeah it's like this

robust locust
#

Hii, I'm trying apply a different texture to an existing guitar item, but the new guitar doesnt visibly show in the character's hands.
Is it best to copy the .x file and change the texture filename, or use a .fbx of the guitar item?

bright fog
#

use :get(index)

robust locust
#

I'm not sure if the Weapon item searches in the models_X/Weapons/2handed folder location

small topaz
#

and don't forget the :setIsHidden(false) commands at the end for each of your recipes. Otherwise, they will be completely removed from game (i.e. also in the right-click menu)

austere sequoia
#

okay! I dont need any "require ISRandomLuaStuff" thingies? Just copy paste and I am good to go? πŸ˜„

small topaz
#

so yeah, just try copy paste

austere sequoia
small topaz
austere sequoia
#

In worst case I have to give everything its own name

small topaz
small topaz
austere sequoia
#

almost all of them have

#

there should just be one item in the current list that can be crafted in vanilla

small topaz
#

A bit difficult to explain if do not a lot of coding. But there is a command
local list = getScriptManager():getAllRecipesFor("Base.MyItem")
I've never tried it but I guess the "list" will then contain all recipes for the item. You could then iterate through the list, check each item if it is one you would like to hide and then hide it as done above. At the end of the code, you have to unhide each of them again ofc

#

what I do in such a situation is trial and error and check whether this or something similar will work...

austere sequoia
lethal tulip
#

Hello everyone! I want to make a mod that change an item's Category based on its Display Name (not base Item Name). For example, if I rename an item to "My xxxx", its category will change to "AAA", (so it will be at the top when sorted by catogory). Is it possible? If so, please give me a some pointers on how to do it?

#

Thank you in advance!

small topaz
# austere sequoia oooof, that will be quite a lot of work. But as long as everything is fine in th...

Yes. There should be your items script ID. The code itself would probably not be so long. Just a few lines. But testing stuff and working everything out might take some effort.

I would start with smth like this

local backUpTable = {}
for i=1, myList:size() do
      local recipe = list:get(i-1)
      if recipe:getName() == "Your recipes name" then
          recipe:setIsHidden(true)
          table.insert(backUpTable, recipe)
      end
end

vanilla_populateRecipesList(self, ...) -- execute vanilla code

for _,v in pairs(backUpTable) do
        v:setIsHidden(false)
end```

But not sure if this works. Just made it up in my head
austere sequoia
#

the upper part would be one per item?

small topaz
# austere sequoia the upper part would be one per item?

this would do this for all recipes which have the result "MyItem". In case you have more than 1 result items, you have to do this for each of your items BEFORE the command "vanilla_populateRecipesList(self, ...)". And write everything you changed with "setIsHidden(true)" into the backUpTable

#

local myList = getScriptManager():getAllRecipesFor("Base.MyFirstItem")
for i=1, myList:size() do
      local recipe = list:get(i-1)
      if recipe:getName() == "Your recipes name" then
          recipe:setIsHidden(true)
          table.insert(backUpTable, recipe)
      end
end

local myList = getScriptManager():getAllRecipesFor("Base.MySecondItem")
for i=1, myList:size() do
      local recipe = list:get(i-1)
      if recipe:getName() == "Your recipes name" then
          recipe:setIsHidden(true)
          table.insert(backUpTable, recipe)
      end
end

vanilla_populateRecipesList(self, ...) -- execute vanilla code

for _,v in pairs(backUpTable) do
        v:setIsHidden(false)
end```

something like this maybe
austere sequoia
#

yes, that is what I thought it would look πŸ™‚ Thank you man, I am currently trying to get a grisp of lua, so I hope to repay your help in the future!

small topaz
#

np. but not sure if my code will really work. maybe some syntax errors. also not sure if you have to use "Base.MyItem" or just "MyItem" instead. These are things to find out via trial and error

small topaz
austere sequoia
austere sequoia
small topaz
austere sequoia
small topaz
# austere sequoia dang, I wanted them out of the inventory, to keep it from lagging

hmmm... not sure. taking recipes out of the craft menu could increase performance since the game does not have to calculate and render the options for the recipes. however, if you take out 100 items, it may happen that just the process of taking all the recipes out may slow down it again so that there is either no effect at all or the game gets even slower...

#

as I said, it is something to find out via trial and error

austere sequoia
#

I guess I will just take the middleway - add an own crafting category, so noone, who does not click on it, has to suffer through it

small topaz
#

It might also be worth thinking about whether there is another place in the vanilla code where you could add your new code. I have taken the function "ISCraftingUI.populateRecipesList". It is always called when someone opens the craft menu. Maybe there is an alternative which is only called once the game starts or smth

austere sequoia
#

that would be sick! Great hint, when I have time I will go on the search

slow graniteBOT
#
rithxd has been warned

Reason: Bad word usage

bronze yoke
#

the timed action queue just needs to be passed a reference to a timed action instance, nothing about it actually needs to be global

small topaz
#

then I think I can rework all my mods so that they have no global data at all (except for modData in case they count as global)

bronze yoke
#

through all of my experience i have never found a situation where you have to use global variables except for functions referenced in scripts

lethal tulip
#

Hi everyone! I am trying to make a simple mode that create a few new items, base on vanilla ones, new item category, and add some recipes involving the new ones. I created translation files. I put the mod in (Windows 11) User/xxxx/Zomboid/mods. The game recognizes the mod. I add the mod to an on-going game. But I couldn't find the new recipes. Here is the code on github: https://github.com/WarBuggy/PZMods/tree/master/PersonalizeItems

GitHub

Contribute to WarBuggy/PZMods development by creating an account on GitHub.

#

Could someone please point me in the right direction? Thanks in advance!

bronze yoke
#

scipts

austere sequoia
#

Does maybe one of you know, how I can write translation files without them losing german special characters (Γ€ ΓΆ ΓΌ)?

lusty karma
#

i do french translations so have to do the same ^^

austere sequoia
lusty karma
#

np!

lethal tulip
somber frigate
small topaz
#

Hi! I am currently re-working some of my mods by replacing global variables with locals using the "require" command to call the locals in other luas. Works fine so far.

However, what I found out is that if I put a
local myData = require("myLuaFile")
command in the client folder for example, it only searches for the file "myLuaFile" in the client folder. If I want to require the file from a client's subfolder, I can use
local myData = require("mySubFolder/myLuaFile")
and it works fine. But how do I require a file in the client folder when the file is located in shared?

bronze yoke
#

requiring shared from client should work fine with the same syntax

#

i don't know what happens if there's a file with the same name in both directories so don't do that

#

oh, do you mean requiring client from shared? that's not possible because shared loads before client

#

it doesn't really make sense to, you're trying to pull client-only code into a file that will also be executed by the server

small topaz
bronze yoke
#

yeah

small topaz
#

A totally different question which some people here might know smth about:

What does the command "setMetabolicTarget()" exactly do? I see it sometimes in the vanilla TimedActions. For example
self.character:setMetabolicTarget(Metabolics.LightDomestic)
Is this somehow related to how much endurance a TimedAction costs the player?

austere sequoia
#

I could be totally wrong though, since I am still learning the lua stuff. But from what I have read, it seems logical

small topaz
#

and "LightDomestic" probably means that not much calories are used?

austere sequoia
#

I would assume so at least

austere sequoia
austere sequoia
#

in case you need it πŸ™‚ "Erect", "Knock Over", etc, are the recipe names. Works flawless even if multiple recipes share the same name

#

To be fair, I dont fully understand what the first function (hasValue) is doing, looks cryptic to me. But it is working

#

goes in "server"

small topaz
#

btw the hasValue just checks whether the acutal recipe belongs to listhiddenReicpes as far as I understand

austere sequoia
#

only if you add one of those lines it makes problems (I guess why is self explanatory, lol):

            recipe:setNeedToBeLearn(true)                recipe:setCanPerform("nope")
small topaz
#

In this case, setIsHidden() is exactly tailored to your needs! πŸ™‚

austere sequoia
#

exactly πŸ™‚ fixed all my issues

upbeat night
#

Hello! I do not know in which chat to address this question: How to make normal display of non-English text in the server console? (in the CMD itself the text is displayed normally, but in the server console it is not).

small topaz
#

Does anyone knows what determines whether an obejct of the map (tables, chairs,...) hides the player model? There are different things which could happen:

#

Chair does not hide the player model. Toilet does.

plain crest
#

Someone pls correct me if I’m wrong πŸ™πŸ½

small topaz
plain crest
#

I think it may also have to do with the fact that the window is there, since the game lets you access windows on the inside even if there’s furniture in the way, even though from the outside you’d climb over it.

#

So I’m curious if the chair still does that when you place it away from the window.

small topaz
plain crest
#

Interesting…I’m nearly certain it has to do with layers, but I have no idea what layer chairs go on.

small topaz
#

Would be great if you could somehow change this hiding behavior via modding. Maybe the people from the mapping channel know more.

plain crest
#

Yea! I wonder how possible it is, because I think the chairs from build menu work differently from chairs in the brush tile. So I wonder what the dev of that mod does for their chairs, cuz they have collision and hide the player

#

What are you wanting to do with this again..?

small topaz
plain crest
#

yea i know! i'm more saying that it's possible to move tiles from one layer to another, given that build menu's chairs are solid

austere sequoia
#

wall objects appear in front of player

#

chair is a normal moveable

small topaz
# plain crest What are you wanting to do with this again..?

Depending on how the "hiding the player model with furniture" exactly works, it might be possible to let the player sit on chairs facing in all directions without looking too glitchy. But just some rough ideas. Not sure whether this could work

reef vine
#

hello here ! I created a mod that added a recipe to find via a magazine. This recipe allows you to make an axe. Users have informed me that with this mod, it becomes impossible to tear clothes! And honestly I don't see the connection. It's the magazine part that seems to be the problem because without the axe part, the problem is still there. An idea ? πŸ™‚

small topaz
austere sequoia
#

but you would have to creat a new tile I guess, unless you really want to go mad and start changing one of the games most important vanilla files XD

#

at least I think so. Maybe there are better ways to change to property of vanilla tiles

small topaz
austere sequoia
#

tbh, I would not be surprised if lua would work. Have seen mods that add functionality to vanilla tiles, or even check for certain vanilla tiles to replace them with modded tiles. But I have no clue how exactly to program this

#

But best give it a shot beforehand if this is actually the setting causing the issue. Sound logical to me, though. Toilet is mounted to wall, wall is displayed before player, so toilet is displayed before player. I unfortunately have no real option right now to test this theory

frank elbow
reef vine
small topaz
small topaz
austere sequoia
# small topaz do you know any web resources which explain a bit about tiles modding and bringi...

Daddie Dirkie Dirk has some nice youtube tutorials that helped me a lot:
https://www.youtube.com/watch?v=Fbvb6LeX0Sw

Quick video on getting custom tiles in the project zomboid editors (buildinged, tiled and worlded)

If you like what im doing please consider donating to my Patreon.
https://www.patreon.com/DaddyDirkieDirk

β–Ά Play video
austere sequoia
austere sequoia
reef vine
austere sequoia
austere sequoia
austere sequoia
austere sequoia
reef vine
#

I'm learning modding ^^

austere sequoia
#

no problem πŸ™‚ You have unintentionally overwritten the games vanilla recipe.txt file by naming your file the exact same way. That is why nothing is working anymore πŸ˜„

#

because the game only knows the CanaxeStone now

reef vine
#

yeahhhh 😎 🀭

#

humm nope I can't rip the clothes ^^ I rename the file and start a new game

austere sequoia
#

I renamed the file and everything worked for me πŸ˜„

reef vine
#

damned

#

gonna try something

#

nope doesn't work for me, can you send me zip file of my mod ? lol

austere sequoia
#

this is what I changed in your scripts folder - only the recipes.txt name

#

that is everything I changed πŸ˜„

#

and that is the result: I have your axe, but still can rip clothes ("kleidung zerreißen" in this case because german)

reef vine
#

I think I found, I'm stupid, It was on the wrong folder

austere sequoia
reef vine
#

and it's ok !!! thanks !!!!!

#

OMG so much to learn ^^

#

gonna update my mod ! thanks thanks thanks !!!

austere sequoia
reef vine
small topaz
austere sequoia
#

on windows

weak needle
#

are there any modders hoping to have voice lines in their mod packs? I’d be happy to help as a voice actor c:

chilly hemlock
#

Good day sirs! I have recently dwell into modding and I must say that it is even more addicting after playing 600 hours.
I have a question regarding InventoryItems and similar (items on the ground). Lets say I'm saving some item ID into a file on OnSave event. Is it possible to somehow get that object instance by ID the next time I load the game up? Currently I have only found tile scanning techniques and looping over them to find item instances but maybe I have missed something?

small topaz
# austere sequoia on windows

any idea where this problem comes from:

Invalid tileset size '0,0' for tileset 'fixtures_bathroom_01_2'
(while reading Tilesets.txt)

??

austere sequoia
#

tilesets.txt?

#

why .txt?

austere sequoia
#

ah! I see it, it is the file in the TileZed folder? I never touched this, what do you need it for?

austere sequoia
wicked crane
#

Hello everyone, thanks to some friends of mine we have been working on a mod that turns Water into Seawater.

I am excited to finally share this mod with you all.

What does this mean for gameplay? You cannot drink or fill containers at water tiles anymore. Admins can create custom 'Fresh Water' zones using the Zone Editor.

Prince Edward Island and ROK's Bria Island are supported out of the box without any additional setup required.

https://steamcommunity.com/sharedfiles/filedetails/?id=3178562599

spare fiber
#

question. I finished my mod which ads a new type of beverage, everything worked perfectly, i even have footage of it working perfectly. Then i upload it and leave for about 5h. I come back and the model is 2x the size and in the drinking animation it is held backwards.

#

nothing changed in the code

#

theres like 30 lines total so id know if it was changed

#

bewildered at this

wicked crane
#

If you’re subbed to the mod unsubscribe and test the local workshop directory version

spare fiber
#

I wasnt subscribed, didnt work.
Subscribed to see if it would work, didnt work.

#

like how does this even happen

sonic needle
#

RotationData Bug in Blender. Oddly Common.
Try Re Applying Transforms. After Sizing it again?

spare fiber
#

i use the vanilla fbx model and just change the mesh texture

sonic needle
#

hmm. Size Annotation issues. perhaps Doubling the model to the mod, and Forcing Scale will help

spare fiber
#

tried messing with scale, 0.5 and 1 are identical

#

dont know if its limited to integers or anything

#

but didnt get lua errors so 🀷

sonic needle
#

odd.

spare fiber
#

I had the large model error before. I changed scale to 0.5, worked perfectly, drinking animation worked even

#

then i uploaded to workshop

#

come back, broken

#

πŸ‘

#

no console errors either