#mod_development

1 messages · Page 223 of 1

spare fiber
#

also restarted my computer and asked a friend to try the workshop version incase i had sth cached.

#

broken for them aswell

austere sequoia
spare fiber
#

id love it if it worked as it should

#

like how does the animation model get flipped compared to the world model?

#

its using the same model

#

Is there any ways i can debug this somehow?

sonic needle
#

so the AnimNode for each hand, is where the item attaches to. If that anim is Messed up in any way. the item can do all kinds of magical stuff.

#

EG, throw a beer of the screen as if playing baseball, with an anim.

spare fiber
#

right so i got the size correct. But the animation is still backwards

#

Where and how do I set the animation to use?

#

cuz the module declares that:
EatType = Bottle,
CustomContextMenu = Drink,
So id assume that it uses the DrinkBottle xml for animations?

#

But i have no idea

#

if that is even the file, perhaps it uses the Bob_DrinkFromBottle.X file

bright fog
#

This is the most important part of AnimSets

#

THIS is what defines what animations are playing

#

Whenever a player fills up those conditions (which can be set in many places of PZ code), it will trigger this animation

spare fiber
#

yea, i get that. But the model is being held in reverse position in the animation.

bright fog
#

So what interest you to look for is: where and how PerformingAction is set to drink

bright fog
#

(I'm not sure for that)

spare fiber
#

same model as vanilla game beer bottle, just renamed

bright fog
#

Ok I see

#

Is the script good ?

spare fiber
#

sprite works

#

works fine when placed in the world

#

correct way and everything

#

animation just holds it backwards

#

makes no sense to me

bright fog
#

ground placed and in hands is not the same model I believe

spare fiber
#

in the items_food.txt for the beer bottle it is

#

the thing is it worked fine once, then it broke when i wasnt looking

#

anomolous activity

bright fog
#

Yeah just realized you're the guy that got an issue with the mod getting uploaded and breaking

#

You said you have footage of it working before uploading ?

spare fiber
#

yup

austere sequoia
#

my dude

#

if you use the normal beer bottle anyway

#

then why on earth would you replace the X model with an fbx model

#

😄

spare fiber
#

Gave me lua errors when i told it to get the base game BeerBottle model

austere sequoia
spare fiber
#

said it couldnt find it

austere sequoia
#

dude, rename the basegame beer file to CervezaMesh, put it in your folder, and it works 🙂 get rid of the fbx

spare fiber
#

in my defense the .x files are not clearly explained

austere sequoia
#

nah, everything is fine man, no need for defense 🙂

#

you mostly confused yourself 😄 It should work with the file I sent

#

just remember to scale up to 1.0 again

#

if you have meddled around in your files and dont have the "old" files anymore, I can send them as well

spare fiber
#

nah i have em

#

since there isnt much to change in the code

austere sequoia
#

Great 🙂

spare fiber
#

alright yea, now it works. Thanks

austere sequoia
#

you are most welcome!

uncut verge
#

I'm so confused, I'm trying to add an simple mod to zomboid for my first attempt at modding. but i cannot get it to show up in-game.

I've got it saved to %UserProfile%\zomboid\mods
My mod folder contains
-media
--lua
--scripts
--textures
mod.txt
poster.png

#

Hopefully that's clear

austere sequoia
#

you have to put it at zomboid/workshop

uncut verge
#

omg really? EVERYTHING i have read, including the game itself was saying otherwise, but i will go try that now.

austere sequoia
#

there is a "ModTemplate" folder, build a folderstructure like this. You need also need a preview png and a workshop info file

#

Uploading is ingame, via the workshop button 🙂

uncut verge
#

Even tho i only want to test in singleplayer, do i still need all of it?

austere sequoia
#

noooo

#

then you dont want to upload it anyway 😄 then "mods" is the right place

uncut verge
#

So preview.png not poster.png
and the workshop info file is different from the mod.txt?

austere sequoia
#

you can active mods you have there ingame without actually having to download them from the workshop

uncut verge
austere sequoia
#

what is your folderstructure?

slate fractal
#

If the save system was added as additional settings in the game, at least all my efforts while training the character would not be wasted. Can you recommend a save Back-Up style mod?

slate fractal
uncut verge
#

C:\Users\Kylee\Zomboid\mods\Whetstone

austere sequoia
uncut verge
#

inside media i have folders;
lua
scripts
textures

austere sequoia
#

best it to copy it from the examplemod and change it to your likings, so you know it has the right format

slate fractal
austere sequoia
#

you mean due to the journal? 😄 Well, that is the best mod to fit your request I could think of

uncut verge
austere sequoia
#

cause otherwise your mod pops up as example mod ingame

uncut verge
#

I created the structure from scratch so no
but i will use the example mod to recreate it and see if it fixes my problem

austere sequoia
#

alrighty! If it still does not work then, you could zip up the whole mod and send it to me

uncut verge
#

@austere sequoia I got it 😄

#

copying the example structure and replacing it with my files etc worked.

#

thank you

austere sequoia
#

You are most welcome 😄 have fun modding!

subtle sapphire
#

@sour island I am here 🙋 I am glad you welcomed my feature requests for the mod "shops and trades", I will start working tomorrow and if I need help or I have questions about your code I will ask here. Thanks again 💯

bright fog
bright fog
#

Where he's put it is fine

bright fog
austere sequoia
bright fog
#

aaah happens np

#

yeah I read the messages a bit after

trail bloom
#

Question, Is there any way, to have Two different textures for male and female clothing meshes? I have two meshes Different baked Textures, and I don't see a way to specify which texture is for the male mesh, and which is for the female mesh. Any ideas?

uncut verge
#

Can i put a Distributions file in this directory? media\lua\server\items

bronze yoke
#

yeah

uncut verge
#

table.insert(ProceduralDistributions["list"]["ArmyHangarTools"].items, 1);

The number at the end, is that a chance of it spawning or how many will spawn?

bronze yoke
#

the chance

uncut verge
#

Sorry last question! 😛
what's the range? does it accept decimal?

bronze yoke
#

technically 0-100 but it's scaled by loot rarity (* 0.4 on default settings) and there's a bit of wonkiness nobody really seems to understand, better to just base it on other items than to try and work it out mathematically

uncut verge
#

0.4 is default? Wow ok

sonic osprey
#

what should i put in the script for a ham leg? i want it to be able to be sliced

austere sequoia
sonic osprey
#

thanks

hard narwhal
#

hello! just wonderin if anyone knew where I could go to commission for a mod? Modeling + the mod itself. (its a clothing/armor mod)

hard narwhal
#

Thank you!

Edit: @sour island this is EXACTLY what I was looking for. seriously! Thank you so much!

verbal yew
#
    local trait = TraitFactory.getTrait("Hoarder");
    if trait ~= nil then
        if player:HasTrait("Hoarder") then
            maxWeightBase = maxWeightBase + strength * SBvars.HoarderWeight;
        end
    end

this is right construction?

hidden compass
#

Hello, everyone. I am very interested in the "Standing Item" mod that has been talked about recently.
https://steamcommunity.com/sharedfiles/filedetails/?id=3175484316

I subscribed the mod and it uses a simple recipe (no Lua hooks) to reproduce the switching between standing and lying items. I was wondering if the parameters unique to the item object, such as durability, would not be copied in this case, but when I actually tried it, the values were copied. Does anyone know how this works? (I used to hook in Lua and copy each value for this kind of converting recipe.)

verbal yew
#

check ISCraftAction.lua

#

transfer some param on craft

hidden compass
# verbal yew vanilla stuff line 104-109

Thanks, I didn't know there was such a specification.
And I see that the specification is only for HandWeapon.
I guess I was unaware of this spec because when I implemented it, it was for clothing.
Anyway, thank you so much!

small topaz
#

This only happened I after tried to "import" a png file to TileZed as explained in various tutorials. The error occurred after I closed TileZed and then re-open it.
But maybe I start asking those questions on the mapping channel or in the modding discord

austere sequoia
bright fog
rancid panther
#

can you put a space or titles between options in the sandbox menu for better organization?

#

like divide it into sections

verbal yew
#

option zReAAS.zReAAS_InfoChecker2
{
    type = boolean, default = true,
    page = zReAAS_ArmorAbsorbSystem_general, translation = zReAAS_InfoChecker,
}
option zReAAS.YOUR_DIVIDE_INTO_SECTIONS    --  <--- HERE BE line like "----------------------------------" between options
{
    type = boolean, default = false,
    page = zReAAS_ArmorAbsorbSystem_general, translation = zReAAS_YOUR_DIVIDE_DIVEDER,
}
option zReAAS.zReAAS_InfoChecker2
{
    type = boolean, default = true,
    page = zReAAS_ArmorAbsorbSystem_general, translation = zReAAS_InfoChecker2,
}
#

in translate file for sandbox options zReAAS_YOUR_DIVIDE_DIVEDER = "-------------------",

unborn hatch
#

Can smb help me with this? Idk why but wings are invisible from one side.

open drum
#

Does anyone know if it's possible to play an animate image in pj?

#

considering how rain or water is animated I suspect it would b possible

#

but not sure whether it will be possible to make it using Lua

bright fog
coarse sinew
bright fog
warped valve
bright fog
#

And yeah don't do dividers like that please, it looks terribly bad

unborn hatch
bright fog
bright fog
warped valve
#

(Not to be confused with Project HL2RP)

bright fog
#

You got any examples of the possibilities it adds ?

coarse sinew
coarse sinew
bright fog
bright fog
#

Especially on big mods I definitely think it's fine

unborn hatch
bright fog
#

Haha np happens

open drum
bright fog
#

What does it look like when facing the other direction ?

bright fog
#

Check out how Braven did it with his overlay maybe ?

#

He sort of has an animated overlay
Not sure if it's actually an animated image or just playing around the contrast of it

warped valve
# bright fog You got any examples of the possibilities it adds ?

It's still pretty early in development, but currently it has ways of adding/managing a sort of "overlay" to characters, inventories, items, and entities along with hooks on the objects related to those that can be extended/modified. I want to add other ways to easily extend functionality like admin/user commands, maybe a crafting system (even though PZ already has one), skills/traits (but simplified), housing, jobs, quests, etc.

For example, when someone joins the server it'll load their character into memory like so (there's a global table containing the instanced information):

local character = ProjectFramework.Characters:New(player:getUsername())
character.playerObj = player
return character:Initialize()

This is going to be changed up a bit later on to separate between player and character (player being the connected user, and character being the specific character that they've created/loaded on a single user). The character object contains data such as their name, description, age, etc. even their inventory as another object using the Inventories module I created.

open drum
#

around the screen

bright fog
#

There's a mod that makes video games ?

open drum
#

there is ?

open drum
#

ty, ill take a look!

bright fog
#

👌

ornate sand
#

So I have a question about making my mod compatible with another.
The way I fumbled my way through the .txt files ends up with my mod creating a duplicate of another mod's item instead of just overriding it
How can I do this better?
FYI I am not a java dev or anything. Complete amateur here who only understands some of PZs code that I can access via notepad 😄

austere sequoia
ornate sand
#

No atm I don't want to work as a dev at all, I just want to make a pretty simple mod. I got the idea of it working but I just don't know how I would make it so that I could simply add in item compatibility for other mods. Basically I want to wear machetes in belt slots instead of on the back slot, and I got the basegame machete doing that, but when I try to make other mods' machetes do it, my mod just creates duplicates for them.
Maybe something in the "module { imports" stuff idk

small topaz
#

Is there a command I can use so that a specific IsoGridSquare shows a specific sprite I made? What I was able to do is taking a worldobject from the square and then assigning my sprite to that object via
object:setSprite("mytile_1")
However, I would like to do this without overwriting the sprites of the square's objects.

One strategy I thought about was creating a new object, equipping it with my new sprite and then adding the object to the square. The problem is that I don't have any idea of how to make such an object.

austere sequoia
rancid panther
#

was just wondering if there was a way at all

rancid panther
#

currently the settings r fine but i eventually wanna make it even more customizable

slow graniteBOT
#
thicanimegrl408 has been warned

Reason: Bad word usage

grizzled fulcrum
#

Does anyone know of lua type definitions? I hate when there are undefined globals everywhere and being able to see function arguments is nice. I considered using PipeWrench but it seems possibly outdated as the last commit was 2 years ago.

#

nvm ctrl+f saved me, Umbrella on github by asledgehammer 😄

bright fog
#

Yup Umbrella

bright fog
#

So you don't even have to download from github

#

In VS code:

  • ctrl shift P
  • Open Addon Manager
  • Search for Umbrella
uncut verge
#

Im trying to make water a requirement to fix an item (along side my moded item)

I've got the water as "GlobalItem : Water=3" so it's a secondary item.

but things like a bottle filled with water, or a kettle/pot with water are not working, what would those be under if not "Water"?

grizzled fulcrum
bright fog
bright fog
#

It'll update itself

uncut verge
#

Would a recipe use the same thing? I didn't think to look in recipes.

bright fog
#

No idea, I'm not familiar enough with item scripts

austere sequoia
subtle sapphire
azure edge
#

any mod expert here????

#

want to make a knife at a mod i use for cutting zeds to be drainable each time it cuts a zed

wicked crane
azure edge
#

😦

#

recipe Get Zombie Eye
{
CorpseMale/CorpseFemale,
keep LCKnife,
Result:ZombieEye,
CanBeDoneFromFloor:true,
Time:100,
Category:Health,
}

wicked crane
#

nevermind, I misunderstood you

wicked crane
azure edge
#

yea

#

item LCKnife
{
DisplayCategory = Material,
Weight = 0.4,
Type = Normal,
CanBeEquipped = TRUE,
DisplayName = LCKnife,
Icon = LCKnife,
WorldStaticModel = LCKnife,
}

#

i must change item and recipe right?

#

i want it to be near 100 times lets 110 to be safe

#

its for questing

#

so i need it to brake so they cant repeat quest unlimited time

#

any idea is welcome

#

TicksPerEquipUse
The parameter sets the value of how many ticks must pass for the item to spend one use.

#

maybe its this?

lusty karma
#

Hello guys, I need help. Im working on translating The Workshop/Scrap Armor/Scrap Weapons mods in French but for some reasons the recipes are still in english when i look in Crafting menu. Also some items from The Workshop are still in english. All the tooltips/weapons etc are correctly in french. I have no idea why some things are working and others not. Anyone has any idea?

#

i translated many other mods before and they always worked

azure edge
#

i saw this i hope it works

#

item LCKnife
{
DisplayCategory = Material,
Weight = 0.4,
Type = Drainable,
UseDelta = 0.01, /100 uses/
CanBeEquipped = TRUE,
DisplayName = LCKnife,
Icon = LCKnife,
WorldStaticModel = LCKnife,
}

#

usedelta

wicked crane
#

uhhh you need to make your item drainable

#

lol

#

yeah

#

what I was thinking

#

it might make it look weird in the ui

azure edge
#

must i mess recipe also?

#

or only item is ok?

wicked crane
#

LCKnife = 1 in recipe, i think

azure edge
#

ty

wicked crane
#

remove keep, i think

#

not needed for drainable

azure edge
#

remove keep?

#

i will change LCKnife=1 only?

azure edge
#

ty

wicked crane
lusty karma
mystic vessel
#

Does anyone here have a step-by-step link or where can I find it? I wanted to make an animation for my Zomboid mod, where do I start?

azure edge
#

@wicked crane ty it worksssssss

azure edge
#

is there somewhere i can see all skill names for mod making?

#

SkillRequired : MetalWelding= this is metalworking for example is there anywhere on internet all these skill together?

austere sequoia
# azure edge SkillRequired : MetalWelding= this is metalworking for example is there an...

IGUI_perks_Combat = "Combat",
IGUI_perks_Blunt = "Long Blunt",
IGUI_perks_SmallBlunt = "Short Blunt",
IGUI_perks_LongBlade = "Long Blade",
IGUI_perks_SmallBlade = "Short Blade",
IGUI_perks_Axe = "Axe",
IGUI_perks_Spear = "Spear",
IGUI_perks_Aiming = "Aiming",
IGUI_perks_Reloading = "Reloading",
IGUI_perks_Crafting = "Crafting",
IGUI_perks_Carpentry = "Carpentry",
IGUI_perks_Woodwork = "Carpentry",
IGUI_perks_Cooking = "Cooking",
IGUI_perks_Farming = "Farming",
IGUI_perks_Agility = "Agility",
IGUI_perks_Sprinting = "Sprinting",
IGUI_perks_Lightfooted = "Lightfooted",
IGUI_perks_Nimble = "Nimble",
IGUI_perks_Sneaking = "Sneaking",
IGUI_perks_Fishing = "Fishing",
IGUI_perks_Survivalist = "Survivalist",
IGUI_perks_Trapping = "Trapping",
IGUI_perks_Foraging = "Foraging",
IGUI_perks_Doctor = "First Aid",
IGUI_perks_Accuracy = "Accuracy",
IGUI_perks_Guard = "Guard",
IGUI_perks_Maintenance = "Maintenance",
IGUI_perks_Firearm = "Firearm",
IGUI_perks_Passive = "Passive",
IGUI_perks_Strength = "Strength",
IGUI_perks_Fitness = "Fitness",
IGUI_perks_Electricity = "Electrical",
IGUI_perks_Mechanics = "Mechanics",
IGUI_perks_Tailoring = "Tailoring",
IGUI_perks_Metalworking = "Metalworking",

austere sequoia
azure edge
#

@austere sequoia ty m8

#

why it says metalworking?

#

i thought it was MetalWelding

random minnow
#

Is there any guide or tutorial on how to create items? for example I want to create a card, just a card that says "CARD" and an image that I choose.

austere sequoia
#

sorry, I forgot to copy it. There seems to be two perks with metal stuff:

IGUI_perks_MetalWelding = "Metalworking",

azure edge
#

ty

random minnow
#

thx

austere sequoia
# random minnow thx

that is all scripttypes - scroll down a bit and you will find "Item block structure". You will eventually need some of the other scripttypes too though. You can of course simply copy what already exists in vanilla and alter it to your likings 🙂

random minnow
austere sequoia
#

Items are actually very, very easy to make, so they are the perfect point to start from

random minnow
#

Perfect, if it is well explained, it will be easier for me, thank you very much.

azure edge
#

WeaponSprite any1 know what this is at weapons?

austere sequoia
austere sequoia
azure edge
#

fbx?

#

or png?

austere sequoia
# azure edge fbx?

no, the link to the model script. Model script sets mesh ("fbx") and texture ("png")

azure edge
#

ok really ty for your time

austere sequoia
#

no problem mate!

azure edge
#

i am trying to make 6 unique super rare items

#

1 for each trader

#

was having in mind a superkatana that can be repaired many times

#

will check probably how the scrap weapons mod repairs weapon and use katana vanilia stats

austere sequoia
#

I think there already even is a katana repair mod

azure edge
#

i dont want all katana to be repaired

#

only this special u get by making a quest

austere sequoia
#

no, I mean, you could look at how they did it. Would save you a lot of time

azure edge
#

tyyyyy

#

will check workshop

#

steam*

azure edge
#

tyyy

#

fixing Fix Katana
{
Require : Katana,

    Fixer   : SheetMetal=1,MetalWelding=4,
    Fixer   : ScrapMetal=2,MetalWelding=4,
    Fixer    : Katana=1,

}
#

lol not even tools?

austere sequoia
#

You could of course add tools 😛

azure edge
#

but so simple will add tools

#

ty

pure patrol
onyx sage
#

could someone point me to the best place to start learning pz modding as big man bonepart once said if you want something done do it yourself

flint beacon
onyx sage
#

im trying to remake someones car mod so it can work with rv interiors

flint beacon
#

Modeling you can just watch any blender tutorials that suit you, i wouldnt reccomend doing any YT tutorials that seem boring to you find someone that you can easily learn off of and actually enjoy learning it.

reef vine
#

Hello here! I'm creating a mod with custom crates. Everything works, except when I want to place a crate from my inventory, I get the error "cannot create recipe for this movable item". If I restart the game with the item still in the bag, no more errors. We only see this error in debug mode. Otherwise everything is going well. An idea ? 😅

small topaz
#

Hi! iirc, there is a random house story sometimes appearing in game where the owner seems to be some type of survivalist or prepper. You can find various trapping/hunting related items lying on their tables as well as crafted jars of vegetables. Does anyone happen to know how I can spawn this story in debug mode? I tried the options of the "Randomized Buildings" but wasn't able to find this particular thing.

small topaz
#

a related question: where are the data for randomized building and zone stories stored in the game files?

cosmic ermine
#

I think it's only for vehicles and survivor events?

austere sequoia
#

is there any way I can see the games current "callstack"? as in what exactly is going on when I make an action

willow pendant
#

🤔 I'm on a quest to link Raven Creek's river to Slocan lake, currently following the holy Dirkie tutorial, but when exporting from BMP to TMX, I end up with that error text.... It's been like that for a few months now, everytime I tried fixing it by installing back the map editor from the forums, from Steam, verifying the files... I always end up with that. I'm quite confused

verbal yew
#

attempted index: getBodyDamage of non-table: null function: zReMonitor -- file: zReVAC2_TestCode.lua line # 3 | MOD: zRe Vaccine 2.0 ReMod by kERHUS java.lang.RuntimeException: attempted index: getBodyDamage of non-table: null at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689) at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:492) at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163) at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980) at se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1812) at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:66) at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:139) at zombie.Lua.Event.trigger(Event.java:64) at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:65) at zombie.GameTime.update(GameTime.java:671) at zombie.gameStates.IngameState.UpdateStuff(IngameState.java:566) at zombie.gameStates.IngameState.updateInternal(IngameState.java:1623) at zombie.gameStates.IngameState.update(IngameState.java:1333) at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:101) at zombie.GameWindow.logic(GameWindow.java:298) at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71) at zombie.GameWindow.frameStep(GameWindow.java:765) at zombie.GameWindow.run_ez(GameWindow.java:681) at zombie.GameWindow.mainThread(GameWindow.java:495) at java.base/java.lang.Thread.run(Unknown Source)

#

what's wrong?

#
local function zReMonitor(player)

    local infectionStatus = player:getBodyDamage():IsInfected();
    local infectionLevel = player:getBodyDamage():getInfectionLevel();
    
    if infectionStatus then 
        player:Say(tostring(zReInfectionLevel));
    end
    
end

Events.EveryTenMinutes.Add(zReMonitor); ```
neon bronze
#

Your player is probably smth different than an IsoPlayer

#

Do getPlayer() for the time being instead of player

verbal yew
#

ah shieet... yep. thats work

random minnow
#

There is one thing that is not clear to me in the PZWiki to create my own item, the icon image, where should it go? and what dimensions should it have? I don't see anything on the wiki.

#

And can all items and other configurations be in the same file or must they be individual?

austere sequoia
austere sequoia
random minnow
#

pefect, thx mate

austere sequoia
#

no problem

random minnow
#

Does the object have to have some special weight option or something to be shown? because I get the "?" icon in the game, both names are fine, they are 32x32 and that's it.

austere sequoia
austere sequoia
random minnow
#

Ok, thanks, but it's weird because the guide doesn't say anything.

austere sequoia
random minnow
#

The thing is that since I was doing it inside the soulficher quest mod (so I didn't have to do all the folder creation etc) I had a custom object image right next to it and I didn't even notice it, hahaha. Thank you very much for the help.

austere sequoia
#

you are most welcome!

sour island
#

If you have the java decompiled you can see what's getting sent into the method.

verbal yew
#

i have a braincrack after war with formulas

#

found most of them, like infection rate

#

but how knox infection fill stress and sick

#

like stress and sick from infection source

#

i want reduce/absorb/downgrade how much stress and sick gain from infection

#

but idk how

#

just i know i should divide sources, because for stress and sick exist another sources

#

looks like it progressive with mortality duration

#

like, u should die after 3 days from knox infection
your stress level be full after ~40% of this time

#

hmm....

slow graniteBOT
#
seloropi has been warned

Reason: Bad word usage

jaunty glen
#

Hey guys!
I've recently released a mod called "To-Do List". Its main purpose is, at the title goes, to give you a UI in which you can keep list of stuff to do or scavenge. I of course use it myself, and find it quite helpful for those like me who are having a hard time keeping track of all the various stuff that Zomboid requires of you to survive and prosper.
Gaben did not yet bless the mod with being promoted on "Popular this week" block, so I would appreciate your likes, subscribes and comments 🙂
Cheers!
https://steamcommunity.com/sharedfiles/filedetails/?id=3175536048

austere sequoia
slow graniteBOT
#
bula.e36 has been warned

Reason: Bad word usage

terse merlin
jaunty glen
austere sequoia
jaunty glen
terse merlin
terse merlin
#

Now I just need a mod to ping a place I can see kinda like how battle royales do nowadays

jaunty glen
austere sequoia
jaunty glen
austere sequoia
#

It basically is the recipe name for all "stand up" recipes

rancid panther
#

i love launching a server to test a bug report

#

why must my computer be so slow

exotic ember
#

Hi all, I am attempting to transition my Script to LUA base to be more streamlined and hopefully be a bit more compatible with other mods, though I've ran into an issue where I just cant seem to incorporate the users Sandbox Settings into my scripts equation, it just seems to completely refuse to run the Events.OnLoad Function, the rest of my mod works fine, except that the Users Sandbox Settings will not come into effect and the value will always remain the default

This is the part of the script that just does not seem to initialize (nor does it trigger any Print outs):


Events.OnLoad.Add(function()
    weightMultiplier = GetWeightMultiplier()
    print("DGConfigurableGunWeights: Returned a Weight Multiplier of: "..weightMultiplier.." with a Settings Multiplier Listed as:"..SandboxVars.DGConfigurableGunWeights_weightMultiplier)
end)

function GetWeightMultiplier()
    print("DGConfigurableGunWeights: Now Requesting Users Sandbox Multiplier Settings")
    return SandboxVars.DGConfigurableGunWeights_weightMultiplier
end

I have set my Sandbox setting for the mod to a value of 2 which should Double the weight of all weapons rather than halving it, but unfortunately it just doesnt seem to trigger either event

But these are the only Log print outs that I get in relation to my Mod:

LOG  : Mod         , 1710362810989> loading DGConfigurableGunWeights
LOG  : Mod         , 1710362810994> mod "DGConfigurableGunWeights" overrides media/lua/shared/translate/en/sandbox_en.txt
LOG  : Mod         , 1710362810997> mod "DGConfigurableGunWeights" overrides preview.png

LOG  : General     , 1710362821584> DGConfigurableGunWeights: Successfully Set Adjusted Weight of: Base.Pistol to: 0.75
LOG  : General     , 1710362821584> DGConfigurableGunWeights: Successfully Set Adjusted Weight of: Base.Pistol2 to: 0.75
LOG  : General     , 1710362821584> DGConfigurableGunWeights: Successfully Set Adjusted Weight of: Base.Pistol3 to: 0.75
etc
etc
etc
ornate quiver
#

Question, how would one go about editing container sizes for inventory tetris, I currently have a patch of my own I made that changes gun sizes to things as big as 3x6, 2x7, etc, but I need to resize the gun/pawn store display cases for them to fit. What's the proper way to get the container name and how should I be formatting it the .lua files for it?

bronze yoke
onyx sage
#

anyone got vehicle mod exp?

#

can someone look at my mod and tell me what ive done wong

austere sequoia
#

what exactly is the problem with your mod?

onyx sage
#

i have no idea

#

it doesnt work

exotic ember
# bronze yoke i don't really know why it isn't firing, but try OnInitGlobalModData instead - t...

Thank you for that 🙂 I may give that a try if i run into this issue again, for some reason magically, it has finally decided to trigger the event 😛 I have no clue what was stopping it initially, though I've found out that the 'SandboxVars.DGConfigurableGunWeights_weightMultiplier' value is apparently returning as null, rather than the users sandbox setting, which could be why it keeps reverting back to the default value of 0.5 - Atleast it seems I am finally making progress again now 😅

onyx sage
#

any good car mod tutorials?

rancid panther
#

tfw fuel pumps still work (under certain circumstances) when my mod restores the power

#

now i have to figure out why it does that and how to make it not do that

#

it seems to be consistent amongst cars and happen only to the fuel pumps that specifically were under the condition i discovered

onyx sage
#

anyone got links to the up to date mod tutorials?

rancid panther
#

apparently my blackouts mod does not disable fuel pumps that you have interacted with before (when it catalogs the fuel count)

#

any way to look at further details of tiles?

#

i used F2 to read the details but the only thing that looks off is the fuel count is catalogued

#

the tile even says haveElectricity = false

#

but i think that might be for the floor tile

onyx sage
#

is it possible to take a model of a car in game and put it into blender to use as a base to make my own?

rancid panther
#

probably. you can ask #modeling about that one

onyx sage
#

my b i thought i was in that channell ahah

exotic ember
#

Would anyone know why my Mod attempts to run desired code during game start ONLY when there is an error there, but if their is no error, the Initialization side of my script is completely ignored until the shutdown process begins..... I'm terrible at explaining and often creating walls of text trying to explain my terrible grammar and Coding Lingo, so I've added a video to hopefully explain my issue.

https://youtu.be/UdfQB3Ld_NU

In short... my Code execudes during startup like it should, but only if there is an Error there.... if there is no error within the parts of the code that I would like to happen when the game starts... it wont do ANYTHING untill the user decides to shut down/exit the game.... then and ONLY then will my script then decide it wants to implement it's modded data....

bronze yoke
#

your video is private

bright fog
#

yeah

exotic ember
#

Oh my bad, I forgot to save the videos settings, should be good now

bronze yoke
#

it's not actually running your function, the error is during compilation

#

when you do function GetWeightMultiplier() it creates a new function with that code - and since there's an error in that code's syntax it fails to compile it, hence the error

#

your function isn't actually being called in either situation

exotic ember
#

Its a weird error, because before when I wasnt able to return a valid Sandbox value, all guns weight would be modified based on the default value given by the script which was 0.5 successfully the moment the player loaded into their save... the moment I fixed the Sandbox Variable issue, it now refuses to execute the code until the the clicks exit/ ALT+F4s (which seems to be why I only get 1 lot of logs stating that the weights were changed when the game exits, rather than 2 sets that use to happen during startup and exit when it was working with a broken Sandbox value)

bronze yoke
#

try a different event, i don't see OnLoad used very much so that one might be weird

exotic ember
#

is there some official documentation or atleast well explained documentation in regards to events? What they do? when they execute? firing order etc?

bronze yoke
exotic ember
#

at least so I can look into and try understand the events more, initially I was told to use OnGameBoot, but in my head that seems like it only happens once when the player starts up the game.. and doesnt fire again when the player loads into their save. so hence I went to OnLoad as that is suppose to only fire once when the player either begins a new game or Continues a save

bronze yoke
#

yeah, ongameboot is way too early for sandbox options

#

i use OnInitGlobalModData for anything sandbox related, since it's the earliest event after sandbox options actually load - least likely for something to already be set in stone

#

in some cases you might need to use something later because something you need hasn't loaded yet but i haven't come across anything like that yet

exotic ember
#

Awesome thank you so much for that, that will certainly help me gain a better understanding, I could certainly use the OnInitGlobalModData one for at least initializing my mods Sandbox Settings. The one I'm a little confused on is how to have an event that Only triggers once when the player loads into their save, ideally the last ever operation before the player clicks the 'Click to Play' so all Gun weights can be adjusted the moment the players fully loads into their game, as i feel changing these Gun Weight values on the main menu wont have a result when the player eventually loads into the game? or am I wrong with that?

bronze yoke
#

OnInitGlobalModData is suitable for that

#

when i mean it's the first one after they load, i mean during loading into an actual game

#

the sandbox options aren't actually loaded during the first few stages of loading and they just return the default values

#

OnGameStart is usually good for this kind of thing but that fires after the chunks around the player have been loaded in, which sometimes means items in that area are still using the old values

exotic ember
#

Ohh okay, I think thats where I am getting confused Im pretty sure the OnLoad event actually triggers every time something Loads, IE from going to Desktop to mainMenu is considered a load event, going from main menu to saved game is considered a Load event and returning from a saved game to the main menu is also considered a load event

supple grotto
#

Good evening guys, I'm trying to make a mod to open a resource box for my server. Well, I made two mods, one works perfectly, the other one gives an error both when trying to open the box and when putting the items in the player's inventory. Can someone help me? I'll attach the console.txt. Thank you

fathom sapphire
#

Errors using umbrella?

#

Not global or smthn

bronze yoke
#

not sure what that extension is, our umbrella is part of the lua addon manager (ctrl-shift-p -> addon manager)

fathom sapphire
#

Would lua also be a part of the addon manager then?

#

instead of extensions

bronze yoke
#

the addon manager is part of the lua extension

bronze yoke
# fathom sapphire

man you're getting this too? i'm gonna have to look into that, you're not the first

abstract cairn
#

is there any way to change/edit already existing context menus?

For example, I want to make it so the context menu for trading uses the characters name rather then the accounts username.

Would I have to make a context menu that mimics it (and calls the function that the already existing trade menu runs)?

fathom sapphire
onyx sage
#

anyone know why my cars invisible 😭

exotic ember
#

Any LUA gurus out there that may have an idea what is going wrong with my script? I have been going around in circles all day and am dang near just about over it, just to get one simple thing working is being such a pain 😅

I seem to be stuck in some crazy loop where if the Sandbox settings are successfully pulled from file then my use of the TweakItemAPI Mod to Tweak Item Weights based on those gathered settings refuses to work, at worst my entire For Loop will refuse to run (or at least all logs within the loop wont be produced), where as if I get the For Loop/TweakItem working then regardless of what my sandbox settings are set to the script will only ever use the default value of 0.5 which is the value the Logs claim to be retrieving from the Sandbox settings, despite that number potentially being 7.5, where that 7.5 Value would be displayed as retrieved in the logs only if the TweakItem/For Loop had some sort of failure or mishap due to Initiating too early/Late when attempting to use Events.

Any help would be greatly appreciated 🥰 After launching PZ for well over the 100th time today just to find that either the Weapon Weights weren't changed at all and were left at default PZ Weights (due to the For Loop or TweakItem Failing), or the Sandbox settings weren't taken into account and it defaulted to my scripts 0.5 (half weight), and its only ever been those two outcomes, never anything else is a bit demotivating unhappy All just to have a Single dang Sandbox setting hungover😅

small topaz
austere sequoia
exotic ember
# small topaz Has the TweakItem API a specialized function for using sandbox values? And where...

The ItemTweaker mod is quite basic, this is the core of ItemTweaker which I am now attempting to hook it directly into my mod, rather than relying on it as a dependency so i can adjust it according to my needs, as I just don't think the event is firing at the right time so am currently going through a handful of different events trying to find one that may work

--Initializes the tables needed for the code to run
if not ItemTweaker then  ItemTweaker = {} end
if not TweakItem then  TweakItem = {} end
if not TweakItemData then  TweakItemData = {} end

--Prep code to make the changes to all item in the TweakItemData table.
function ItemTweaker.tweakItems()
    local item;
    for k,v in pairs(TweakItemData) do 
        for t,y in pairs(v) do 
            item = ScriptManager.instance:getItem(k);        
            if item ~= nil then
                item:DoParam(t.." = "..y);
                print(k..": "..t..", "..y);
            end
        end
    end
end

function TweakItem(itemName, itemProperty, propertyValue)
    if not TweakItemData[itemName] then
        TweakItemData[itemName] = {};
    end
    TweakItemData[itemName][itemProperty] = propertyValue;
end

Events.OnInitGlobalModData.Add(ItemTweaker.tweakItems)

I can DM my script if that would help, I just dont want to keep posting big text walls 😛

drifting ore
#

Maybe im dumb, but is there any way to make one item change into another after some time? 💀

exotic ember
# drifting ore Maybe im dumb, but is there any way to make one item change into another after s...

You could potentially create a new local int in lua, and also create an event that cycles every game minute, you could increase that int you created with the event firing every minute, once the int reaches your desired time passed you can then trigger a function that would handle changeing the items, I'm a little unsure of how to actually change items, i am still learning LUA at the moment 😛 But hopfully this can help get you started 🙂


local timeLimit = 35
local currentTimePassed = 0

function incrementTimePassed()
    if currentTimePassed < timeLimit then
        currentTimePassed += 1
    else
        print(currentTimePassed.." Game Minutes have passed and achieved/surpassed the timeLimit of: "timeLimit" Game Minutes - Now Changing Items")
        currentTimePassed = 0 --Reset back to 0 to loop the process if required
        --Change Items Here
    end
end

Events.EveryOneMinute.Add(incrementTimePassed)

Maybe something like this (this is untested and knowing my limited LUA knowledge likely isn't the greatest way about achieving this, but hopefully helps get you started :))

azure edge
#

any1 know a mod or an idea how to create a mod that make all recipe from all mods to disapear recipe after u read???

#

basically i want it to remove ReplaceOnUse = from all mods i will be using

verbal yew
# drifting ore Maybe im dumb, but is there any way to make one item change into another after s...
local bloodLife = {
    MatInfectedBlood = { Target = "MatTaintedBlood", Time = 24 },
}

function LabRecipes_UpdateBloodAge(item, container, square)
    obj = bloodLife[item:getType()];
    if obj then
        if item:getModData().Condition == nil then
            item:getModData().Condition = obj.Time;
        else
            item:getModData().Condition = item:getModData().Condition-1;
            if item:getModData().Condition <= 0 then
                if container == "floor" then
                    local temp = item:getWorldItem();
                    square:transmitRemoveItemFromSquare(temp);
                    temp:removeFromSquare();
                    square:AddWorldInventoryItem(InventoryItemFactory.CreateItem("LabItems."..obj.Target), 0.5, 0.5, 0);
                else
                    container:DoRemoveItem(item);
                    container:removeItemOnServer(item);
                    local temp = container:AddItem("LabItems."..obj.Target);
                    container:addItemOnServer(temp);
                end
            end
        end
    end
end
Events.EveryTenMinutes.Add(LabRecipes_AdjustBloodCondition);
#

after 240 min (ingame) MatInfectedBlood change on MatTainedBlood

small topaz
# exotic ember The ItemTweaker mod is quite basic, this is the core of ItemTweaker which I am n...

Sending me huge chunks of code is not a good idea. 😉

First of all, if you would like to avoid the ItemTweaker API, you can can easily manipulate the script parameters of your items with a few lines of code by yourself. For example:


  local name = "Base.BoxOfJars"
  local item = ScriptManager.instance:getItem(name)

  if item then
     item:DoParam("Icon = MyCustomIcon")
     item:DoParam("Weight = 3")
  end
end

Events.OnGameBoot.Add(modifyJarBox)```

Probably clear what this does. 😉

In this example, the modification of the JarBox is done on "GameBoot" which is the event where your mod is first loaded after enabling it in the game menu (or when a safe game has been loaded where your mod is active - but let's assume for the moment that you start a new game). Problem is that at this point time, the user cannot have set the sandbox values because the ordering works like this: enable (and load) the mods -> then go to the sandbox menu and change something. So the "OnGameBoot" event is not the right thing for you.

The ItemTweaker uses the event "OnInitGlobalModData" instead. I don't know when this event is triggered (never used it) but your problems might come from a situation similar to the stuff I explained above: the "OnInitGlobalModData" is triggered before you can change any sandbox option and therefore your changes don't have any effects. But just a speculation since I don't know enough about InitGlobalModData...
verbal yew
#
local function zReAdjustItem(Name, Property, Value)
    local Item = ScriptManager.instance:getItem(Name)
    if Item then
        Item:DoParam(Property.." = "..Value)
    end
 end

zReAdjustItem("Base.K1_Hood", "CanHaveHoles", "false");

without events, easy for adding another items

small topaz
azure edge
#

what i asked cant be done probably right???

austere sequoia
azure edge
#

i dont want to hide i just want all recipes to disapear when some1 read them

#

it will be cool cause when ya die u must gather recipe again + every1 must find a recipe to learn and not all reading same recipes

exotic ember
# small topaz Sending me huge chunks of code is not a good idea. 😉 First of all, if you woul...

Thank you for that, honestly even my script isn't even big as it's only 80 lines (about 50% of them being Debugging Logs :P), its quite compact and I've tried to limit repeating lines by utilizing a table for the Items I wish to modify.

However the ItemTweaker API Started with an Events.OnGameBoot which I had changed that to OnLoad and OnInitGlobalModData all 3 without success at the moment, as just from guessing it seemed like OnGameBoot was happening far to early, before the Sandbox settings had even been initialized (which I would like to incorperate to allow the User to tweak my mods aggressiveness towards its weight reduction/addition), and both the OnLoad and OnInitGlobalModData seemed like they happened way too late

azure edge
#

@austere sequoia but ty for trying to help

small topaz
# exotic ember Thank you for that, honestly even my script isn't even big as it's only 80 lines...

Ok. Then you already thought in the same direction as I did, namely that the event is not appropriate for your work 🙂 (still no guarantee that this is really the source of your problems). You could simply try some other events like "OnGameStart" or "OnCreatePlayer", "OnNewGame". See here for more events: https://pzwiki.net/wiki/Category:Current_Lua_Events

Problem is that I don't know how the DoParam() command which my example and the TweakerAPI uses behaves on those events. (Not sure whether you can just use it any time and it still works).

You might also try those things with your own code and not just changing single commands in the TweakerAPI's code unless you know the API's code very well and you know exactly what you are doing (possible that the API's code has some strange side effects you are not aware of and your testing is therefore not so diagnostically conclusive...)

jaunty glen
small topaz
exotic ember
# small topaz Ok. Then you already thought in the same direction as I did, namely that the eve...

Thank you for that 🙂

Believe me, I spent 13+ hrs today, going backwards and forward, doing everything I could humanly think of with my own script, with countless stops and starts of PZ testing every minuscule change to see if it would finally work, before only just about an hour ago decided to resort to modifying the API rather than thinking the issue was my script 😛

As even the almighty ChatGPT and another Discord user yesterday said my code looks fine and that it was very strange that things weren't firing correctly, So if the issue isn't in my code (granted I spent 13+hrs today tweaking, adding debugging, changing, removing etc) the last thing I thought I could try is modify the resources that my mod relies on to operate 🤔 but honestly still kind of leaning toward one simple little thing wrong with my script somewhere, it generally is 😅

exotic ember
# small topaz you edited your comment? maybe you mean "way too early" in your last line?

I am terrible at explaining myself at the best of times 😛 thats why I thought It may be better to just send my code/mod to someone that knows more and test it them selves if they have the time to see the issues first hand.

I am now kind of thinking the issue lies in that my script relies on the timing of the ItemTweakers event for things to happen just perfectly, I am wondering is there a way that I can directly trigger ItemTweaker's 'ItemTweaker.tweakItems()' function through my own script, rather than hoping the Event happens at the right time? 🤔

exotic ember
#

But unfortunately now that I've messed with ItemTweaker and removed it from my Workshop folder and directly added the Core Script along side my Mods Script, ItemTweaker is no longer even being detected it seems

small topaz
exotic ember
verbal yew
#

ItemTweaker - it's very old mod with huge massive - avoid this shit

#

like razab says, do it like this with do param.
Normal code for easy integration:

local function zReAdjustItem(Name, Property, Value)
    local Item = ScriptManager.instance:getItem(Name)
    if Item then
        Item:DoParam(Property.." = "..Value)
    end
 end

zReAdjustItem("Base.TheItemIWantToChange", "Weight", "3");
exotic ember
# verbal yew what you trying to do?

Creating a Configurable Gun Weights Mod that the User can set the Multiplier in the Sandbox Settings to either Reduce or Increase the weight of all vanilla guns, the Main issue just seems to be timings, and things just dont happen as expected, the issues have varied wildy since yesterday, from either ItemTweaker not firing or firing before the Sandbox settings have loaded, sandbox settings not being detected and reverting to the default value of 0.5, and after reloading the LUA in-game my script will reload everything, but then ItemTweaker will never re-fire its code to actually update the weights, and everything inbetween while triny to learn LUA to so very hard for me to understand and follow what is actually going wrong, and half the time Debug Logs that are within my script just don't seem to appear on the In-Game console nor in the console.txt file (some times) I managed to get it working again now, but the issue I am facing now that the sandbox settings are just not referencing properly... so probably all very confusing... it certainly is for me XD

verbal yew
#

you want apply Multiplier for all weapons?

#

not change one by one?

#

like reduce 50%?

#

yep?

exotic ember
# small topaz you could simply avoid the ItemTweaker altogether and write your own version of ...

My script already seems to do that, or atleast it uses that way to gather the original weight to be used in calculating for the modded weight, which I Have listed all Vanilla Gun ID's (Base.Pistol) etc in a table at the top of the script, and the for loop iterates each found ID to apply a weight to each in theory

for _, itemID in ipairs(baseItemIDs) do
            if getActivatedMods():contains("ItemTweakerAPI") then 
                local originalWeight = 0
                local itemDef = ScriptManager.instance:getItem(itemID)
                if itemDef then
                    originalWeight = itemDef:getActualWeight()
                    local adjustedWeight = CalculateAdjustedWeight(originalWeight)
                    TweakItem(itemID, "Weight", adjustedWeight)
                    print("DGCGW: Successfully Adjusted Weight of: "..itemID.." from: "..originalWeight.." to: "..adjustedWeight.." Based of a weightMultiplier of: "..weightMultiplier.." and a given Sandbox Value of: "..SandboxVars.DGConfigurableGunWeights.weightMultiplier)
                else
                   error("DGCGW: Item not found with ID: " .. itemID .. " - Now reverting to 0")
                   originalWeight = 0
                end
            else
                print("DGCGW: ERROR - ItemTweakerAPI was not Activated!")
            end
        end

small topaz
#

@keRHUS, I think the main problem is to execute the "zReAdjustItem" function AFTER the player has accessed the sandbox menu so that OP can change Weight with a value coming from the sandbox options (and not with a hardcoded value like "3"). Question is then simply which event to use for triggering the ReAdjust function. Do you happen to know a suitable event for this?

small topaz
verbal yew
#
local function zReAdjuster(Name, Property, Value)
    local Item = ScriptManager.instance:getItem(Name)
    if Item then
        Item:DoParam(Property.." = "..Value)
    end
end

local function zReWeightChecker(item)
    local items = getAllItems();
    for i = 0, items:size() - 1, 1 do
        local item = items:get(i);
        if item:getTypeString() == "Weapon" and item:IsAimedFirearm() then
            local MultiWeight = SandboxVars.zReAAS.zReAAS_WeightMulti;
            local StandartWeight = item:getWeight();
            zReAdjuster(item:getFullName(),"Weight",StandartWeight*MultiWeight);
        end
    end
end
Events.OnInitGlobalModData.Add(zReWeightChecker)
small topaz
#

otherwise, the code looks like something OP could almost copy-paste. just the event is still in question...

verbal yew
small topaz
coarse sinew
coarse sinew
small topaz
#

but maybe they should simply try kERHUS' updated code from above without any ItemTweaker API and it will work then

exotic ember
small topaz
verbal yew
#
local MultiWeight = SandboxVars.zReAAS.zReAAS_WeightMulti;
local StandartWeight = item:getWeight();
local ModifiedWeight = StandartWeight*MultiWeight
local MModifiedWeight = tonumber(string.format("%.2f", ModifiedWeight))
if MModifiedWeight >= 0.01 then
  zReAdjuster(item:getFullName(),"Weight",MModifiedWeight);
else
  zReAdjuster(item:getFullName(),"Weight",0.01);
end
exotic ember
#
LOG  : General     , 1710415407217> DGCGW: Found Weight Multiplier - Now Returning Value: 0.5
LOG  : General     , 1710415407217> DGCGW: Retrieved a Weight Multiplier of: 0.5
LOG  : General     , 1710415407219> -----------------------------------------
STACK TRACE
-----------------------------------------
function: AdjustGunWeights -- file: DGWeightsScript.lua line # 58 | MOD: DefectGamingsConfigurableGunWeights
function: DGWeightsScript.lua -- file: DGWeightsScript.lua line # 85 | MOD: DefectGamingsConfigurableGunWeights

LOG  : General     , 1710415407220> Object tried to call nil in AdjustGunWeights
LOG  : General     , 1710415407287> creating new sourcewindow: C:/Users/Fury-PC/Zomboid/Workshop/DefectGamingsConfigurableGunWeights/Contents/mods/DefectGamingsConfigurableGunWeights/media/lua/client/DGWeightsScript.lua

More weirdness happening :L somehow the returned Sandbox value is 0.5 despite my setting being set to 2 and apparently some nil value slipped through after the sandbox settings were gathered

verbal yew
#

nothing can say, should look into code

small topaz
verbal yew
#

Or object doesnt exist

#

:D

#
function zReAdjuster(Name, Property, Value)
    local Item = ScriptManager.instance:getItem(Name)
    if Item then
        Item:DoParam(Property.." = "..Value)
    end
end

this is stuff if item then for avoid nil. It's terrible situation when working code drop fatal error because something NIL, stupod lua!
just avoid it, huh?!

exotic ember
#

😅 😅 Seem to be making progress now, better not speak too soon though all progress will be stripped soon I can feel it 😛

exotic ember
# verbal yew ```lua function zReAdjuster(Name, Property, Value) local Item = ScriptManage...

I was able to get it back to the 'working' state that I had it with ItemTweaker at its best stage, which was that all weights are successfully changed.. though the Multiplier is just some random number that my mod decides to make up.. I changed the Script default to 1.5, the Games original sandbox multiplier was Set to 2 when first starting this save, and the current Sandbox settings according to the mod that allows me to change the settings says that its on 7.5

So I am absolutely baffled as to where its pulling this 0.5 digit from now once again 😅

This is the Logs:

LOG  : General     , 1710416791356> DGCGW: Now Requesting Users Sandbox Multiplier Settings
LOG  : General     , 1710416791356> DGCGW: Found Weight Multiplier - Now Returning Value: 0.5
LOG  : General     , 1710416791357> DGCGW: Retrieved a Weight Multiplier of: 0.5
LOG  : General     , 1710416791357> DGCGW: Successfully Adjusted Weight of: Base.Pistol from: 1.5 to: 0.75 Based of a weightMultiplier of: 0.5 and a given Sandbox Value of: 0.5
LOG  : General     , 1710416791357> DGCGW: Successfully Adjusted Weight of: Base.Pistol2 from: 1.5 to: 0.75 Based of a weightMultiplier of: 0.5 and a given Sandbox Value of: 0.5
LOG  : General     , 1710416791357> DGCGW: Successfully Adjusted Weight of: Base.Pistol3 from: 1.5 to: 0.75 Based of a weightMultiplier of: 0.5 and a given Sandbox Value of: 0.5
LOG  : General     , 1710416791358> DGCGW: Successfully Adjusted Weight of: Base.Revolver from: 1.75 to: 0.875 Based of a weightMultiplier of: 0.5 and a given Sandbox Value of: 0.5
ETC (Shortened due to exseive length)

I put my Script into paste bin if that would help at all, am I even initializing the Sandbox settings correctly? as it just doesn't even seem to represent a logical accurate number

https://pastebin.com/7RNmmRHL

verbal yew
#

line 26 looks like something wrong...

#

if SandboxVars, but what it'is, where this is predetermine... should it be here?!

#

getActualWeight()

try getWeight()

exotic ember
# verbal yew line 26 looks like something wrong...

From my very limited knowledge, I had assumed, and ChatGPT led me to believe that was the way to access the Sandbox Settings, but that specific line on 26 was added at later stage to help debug to figure if it even existed, which apparently it does somewhere, but from the sounds of your reply this is something entirely unrelated to what i actually want?

#

I ahd seen servers use the SandboxVars.lua file in order to hold their settings so thought that it was the way about it, who knows 😛 it could well be for multiplayer, but single player could be an entirely different way to access sandbox settings 🤔

exotic ember
#
VERSION = 1,

option DGConfigurableGunWeights.weightMultiplier
{
    type = double,
    min = 0.01,
    default = 0.50,
    max = 10.00,
    page = DGConfigurableGunWeights,
}

I do have the option added for the Settings which they appear and let me input a value, though it doesnt seem my script is taking it into affect

#

Which does seem to link up to the requested value in my script:

SandboxVars.DGConfigurableGunWeights.weightMultiplier
DGConfigurableGunWeights.weightMultiplier
exotic ember
# verbal yew

In this do you have to initialize or declare SandboxVars anywhere? or is it a global variable that can be accessed by any mod at any time?

verbal yew
#

SandboxVars.DGConfigurableGunWeights.weightMultiplier - anywhere anymod

#
function changeGunWeight(Item, Weight)
    if Item then
        Item:DoParam("Weight = "..Weight)
    end
 end

this is scary me

bright fog
#

same for if SandboxVars.DGConfigurableGunWeights then

#

Your function is within your mod, if your mod isn't installed, that function will never run anyway

exotic ember
#

Hmmmmmm... its definitely some form of timing issue, while I was in-game after everything have already finished initializing, I press the F11 menu and reloaded my script and turns out it then decided it wanted to now use the 7.5 multiplier, however exiting and returning on first startup still results in a 0.5 multiplication, so somewhere the SandboxVars are being requested by my script before they've fully initialized or something?

bright fog
#

and if it runs, your mod is installed and thus your sandboxoptions too

exotic ember
bright fog
#

Yeah but definitely no need for this function at all ;)

#

instead of using your function, just retrieve the sandbox option directly

#

it will cost less resources for the game overall

#

No idea if your code is ran all the time but if it is, definitely watch out for these kind of stuff, also the prints should be removed or it'll just clog up the console logs, if there's no point to logging stuff

exotic ember
bright fog
#

Also one thing you could do with this function if you really want to log that your sandbox options are retrieved is to store the value in a table

exotic ember
#

where on the first startup the script fails to read (or atleast it pulls 0.5 randomly from nowhere) but when reloading the script mid-game, it then recognises that the Sandbox value is not actually 0.5 but instead 7.5

exotic ember
bright fog
#

So for example:

local mysandboxvalue = {}
myfunction = function()
  mysandboxvalue["weightMultiplier"] = SandboxVars.DGConfigurableGunWeights.weightMultiplier
end

Events.OnGameStart.Add(myfunction)

-- in a random function, access that value
  local multiplier = mysandboxvalue["weightMultiplier"]
  local weight = weight * multiplier (depending on how you use it exactly)
#

In fact, I suggest doing that

#

And you should do that

exotic ember
#

When would the OnGameStart event fire in compareson to my Script that is all just hanging out there executing when ever?

bright fog
#

Bcs from what I understand it stops you from getting access to this sandbox option the hard way (access sandboxvars then dgconfigurable etc etc) but directly access it in a single operation

bright fog
#

So, if someone changes the sandbox settings in-game, they need to restart their saves anyway

#

And if you restart your save, you run through this code again and update the value with the new one

exotic ember
#

Okay cool, I will give that a try 🙂

bright fog
#

what's that timing issue you got ?

bright fog
#

Yeah I see your issue

#

line 43 you define your function AdjustGunWeights() but you made the mistake of running it directly inside your code

#

NEVER RUN A FUNCTION DIRECTLY INSIDE

#

Always add it to an event to run or another function to run it

#

Never run your functions from the code unless it has some use for it and specific conditions

exotic ember
#

Say I start an entirely new game.. within that new game I setup the Sandbox Settings to make all guns 2x Weight.. when loading in initially i will see that the Guns have all been reduced with a multiplyer of 0.5 instead of 2 this will happen indefinitly if leaving/rejoining... however if i relaunch my script while the player is still idle inside their game save, i can re-load my code which will forcefully recheck the Sandbox settings, find that it made a mistake by making all weapons 0.5 weight instead of 2.0 and then will re-weigh them all to have 2x weight

bright fog
#

So in your case you'll have:

local mysandboxvalue = {}
myfunction = function()
  mysandboxvalue["weightMultiplier"] = SandboxVars.DGConfigurableGunWeights.weightMultiplier

  -- run your gun weight updater
  AdjustGunWeights()
end

Events.OnGameStart.Add(myfunction)

-- in a random function, access that value
  local multiplier = mysandboxvalue["weightMultiplier"]
  local weight = weight * multiplier (depending on how you use it exactly)
bright fog
#

And in your case it will run your function AdjustGunWeights()

#

Because it's in the core of the file

#

So when you launch game and it loads the lua, it runs your function even through you are not in a save with custom sandbox options, and when you get in a save with sandbox options, it won't run your function bcs it's in the core

#

However if you reload lua, in-game or in the menu, it will run through the script file again

#

Thus run through your function and get new sandbox options since now there are different ones

#

That's why whenever you need a function to be ran for a save, you do OnGameStart or OnLoad (which triggers after game start)

exotic ember
#

So are you saying that my script have been launching on the main menu this whole time, and all sandbox values etc were all being janked because tehnically no sandbox settings can exist on the main menu? so then by the time i click Continue.. load the game.. my script has already gathered all it's information and has no use for the newly found information upon starting the save?

bright fog
#

it has already ran through your script in main menu

exotic ember
# bright fog exactly

Okay that's starting to make a bit of sense now 😛

Would you think first steps first is to put the AdjustGunWeights() into an Event trigger preferably OnGameStart or something to make it only fire once when the player loads into the saved file?

bright fog
#

Just take my example above

exotic ember
bright fog
#

Run it OnGameStart and it should work

#

np ;)

#

Nice, you even took the time to make a video lol

#

I'm curious actually, what did you use to edit your video ? That looks like a quick edit you just made

exotic ember
#

Thank you so much for all the help! Including @verbal yew & @small topaz Also, couldn't have done it without you's 🙂 ❤️ 👍

bright fog
#

Also it's technically possible to update the weight in real time, but I definitely think it's not needed

exotic ember
bright fog
#

thx the zooming effect looks clean so I was curious

exotic ember
#

Both for recording and editing 🙂

bright fog
#

I'll probably stick to OBS for recording but I learned a bit of video editing a month ago to make a presentation video that runs on my workshop page

#

You could do that in fact

#

Not enough people use it and it makes it so good to show off features of mods in an instant

#

Even better than putting images

exotic ember
#

Heheh I'm certainly no wizard when it comes to editing, Camtasia hoeslt ydoes all the work 😛

bright fog
#

like I did here

#

It shows features from my two mods on the page

bright fog
exotic ember
#

😮 nice that looks awesome is that a HQ gif or is it an actual video?

bright fog
#

it's an actual video

exotic ember
#

ohh thats awesome, I thought you could only do gifs for moving pictures 😛 I'd certainly have to look into that if I get more into modding and creating for the community 🙂

bright fog
#
[video mp4=https://i.imgur.com/dAvvzEL.mp4][/video]
bright fog
#

But it's used a lot in other game's workshops

#

you just link a video like you would with an image

#

I mean you're the guy who made all those weight reduction mods are you ?

exotic ember
bright fog
#

nice what's your game

exotic ember
#

Once the Gun Weights is sorted I aim to Update both the Bag Weights mod and Item Weights mod to work on a similar framework 🙂

exotic ember
# bright fog nice what's your game

Scrapping Simulator, Just a little passion project, but i'ts definitly getting there 🙂 but don't want to shameless plug to much ahahah 😛 I couldnt be more grateful for the support with my Mods/Issues 🙂

bright fog
#

interesting

#

never heard of it lol, there's so many simulator games these days

exotic ember
bright fog
#

Would definitely be the kind of game Let's Game It Out would fucking destroy lol

harsh dawn
#

what are the engine limits for character animations?
I'm a sucker for good animations and I've been working with blender animations for FPS reloads, I was wondering if i could create detailed third person animations for actions and reloads

livid sluice
#

Can someone tell me how i can add items for a custom occupation?

bright fog
livid sluice
#

first time coding anything, so i have no idea what im doing

austere sequoia
austere sequoia
livid sluice
#

alr, thanks.

grizzled fulcrum
#

Can someone explain what ZedScript's purpose is for? I saw other mods using it to (presumably) register items, but I have no idea what role it represents.

jaunty glen
#

@austere sequoia hey mate, just noticed you're about to do the translations of your "erect 'em all" mod

#

I can't stress enough how much time it saves

#

like, you run one command, kick back and watch it working

#

creates all 20+ translations automatically, even minding the different encoding requirements

austere sequoia
grizzled fulcrum
neon bronze
#

you could theoretically do it through Lua

#

but i wouldnt recommend

#

the recipe constructor is public

#

but you'd need to hook into an event in the beginning of the game to create the recipe and add it to the list of recipes

#

whereas a simple txt file would do all that hassle for you

grizzled fulcrum
small topaz
#

When defining a lot of new items in the script.txt file, is it in general a good idea to define a new module or is it better to assign them all to the vanilla module "Base"?

verbal yew
#

another module avoid problem with override side mod by mod

#

like Base.Bleach and MyModBase.Bleach - not same and not overrides

#

i prefer use personal tag/suffix in my mods

#

like
Base.zRe_Bleach

#

uniq enough, imho

abstract cairn
#

is there any way to change/edit already existing context menus?

For example, I want to make it so the context menu for trading uses the characters name rather then the accounts username.

Would I have to make a context menu that mimics it (and calls the function that the already existing trade menu runs)?

small topaz
chilly hemlock
twin fossil
#

Hey guys! Is there a way to switch a specific light switch of a house on or off in a certain radius? is there a way to open a specific gate or door or lock it in a certain radius? Is there a way to turn a specific generator on or off in the same manner?

onyx sage
#

anyone know how to make a poster mod?

bright fog
#

You mean for the main menu ?

austere sequoia
onyx sage
austere sequoia
sleek heath
#

ok so ive bumped into a weird problem

#

one of my true music mods started spawning a ton of cassettes in vehicles

#

ive reduced the rates in the lua files but its now spawning more?

#

lol

#

makes 0 sense

#

this is the rates im at rn

#

lemme see if they stop spawning if i make the rates a ludicrously low number

sleek heath
#

honestly just gonna reupload the mod, something must of broken when i updated it 2 weeks ago

#

gonna be overheating my cpu converting mp3 files again 🙃

sleek heath
#

yea i think a recent update fucked up the spawn rates

#

game update i mean

urban plaza
#

I really like medical simulation mods for games (e.g. Ace Advanced Medical in Arma 3).

I've heard that some things in the game are 'impossible to mod' is the current hp/medical system along those lines?

I currently have https://pzwiki.net/wiki/Modding open to try and suss that out.

sleek heath
#

either true music is broken or lua files aren't being read properly, spawn rates aren't being set properly

#

worked fine last month

#

if they spawn with these rates then the mod is utterly broken

#

lol

bronze yoke
#

numbers this low aren't interpreted correctly

#

inherent flaw behind the 'millions of nearly identical items' strategy

sleek heath
#

again

#

these numbers arent what i used to use

#

i think i used to use like 0.0001 at the most

#

since theres like 1000 tracks

#

so need the spawns to be lower

#

but im making it like 0.00000000000000000000000000000000000001 to see if it outright just doesnt spawn lol

#

and if they still spawn a bajillion then the mod is borked

bronze yoke
#

we use custom spawning logic to handle this better

#

imo true music just should not have been designed this way in the first place

sleek heath
#

ye

#

its unfortunate

#

theres no other music related mods

bronze yoke
sleek heath
#

ah fair

#

i just assumed since why would it work 1 month

#

but not the next

#

well worked fine since about a year and a half ago

#

flawlessly

bronze yoke
#

we use 'dummy' items, we actually spawn one single item and use lua to swap it with a random cassette when it spawns

#

so we can actually control the spawn rate in a meaningful way + so more items doesn't mean more items spawning

sleek heath
#

i just don't know how to fix this spawning issue

#

it spawns like 30 cassettes in almost every car lol

#

thats with nothing but my mod enabled

sleek heath
bronze yoke
#

it's a true music problem

sleek heath
#

oof

bronze yoke
#

imo it never should have had separate items for each song

#

but also i have no idea if they could have predicted the scale on which people would use it

#

i always almost convince myself to write my own but i just don't see it being a large benefit to users

sleek heath
#

yea i think the developer of the core mod is going to have to modify it

#

unless they aren't active anymore then rip

bronze yoke
#

realistically it would be ignored, at 'best' it would create a nightmare situation of two incompatible systems

onyx sage
#

anyone know how to make their own rv interior cell?

old cape
#

Hello Hello! I'm trying to create a mod that simulates a woman's menstrual cycle (it's an inside joke), in which basically, as many know, every x week, during one week a woman has her period. As she bleeds, she has to use menstrual pads as a bandage so her clothes stay clean, don't get infected or attract zombies. And also add variation in moods.

Currently I've already added the menstrual pads as bandages and added a menstruation trait if the character is a woman and made her bleed from the groin, but I don't know how I'm going to simulate or do the part of just bleeding x times a day, during a week, after x weeks, how the menstrual cycle works. Any idea? (My first time modding)

sleek heath
#

@bronze yoke the other issue is if it was all 1 item, wouldn't you not be able to spawn the items using a cheat spawn tool since you can't exactly search for the song you want?

#

or would it be coded in a way that would show every song?

onyx sage
bronze yoke
#

i'd probably do something similar to the way vhses work and have some admin tool to switch spawned 'blank' cassettes to a specific one

sleek heath
#

ah

bronze yoke
#

the way we did it within the bounds of how true music currently works though is to just replace the blank with the individual items when it spawns

#

so those individual items still exist and can be spawned, they just don't technically have spawn chances of their own

old cape
onyx sage
#

if game time passed = 1 week then stop mod

if above true start counter

if above counter = 4 weeks activate mod

#

not that code exactly

#

that shit wont work but thats the baseline for you idk what the code would say specifically but those 3 points would make it work for you when coded properly

old cape
#

okok I will try to make it work thx

verbal yew
# old cape Hello Hello! I'm trying to create a mod that simulates a woman's menstrual cycl...
local function MenstrualCiclesLol()

    local player = getPlayer();
    if not player:isFemale() then return end
    
    local cicles = player:getModData().MyModCicles 
    if (cicles == 0) or (cicles == nil) then
        cicles = 720            -- 1 day = 24 h, 30 days = 720        168 = 7 days
    end
    cicles = cicles - 1;
    if cicles <= 168 then
        --DOIT HERE MENSTRUAL SH1T!!!
      player:getBodyDamage():setAnger() = ZombRand(0, 0.8)
      player:getBodyDamage():setSick() = ZombRand(0, 0.8)
    end
    if cicles > 168 then
      --REMOVE MENSTRUAL SH1T!!!
    end
end

Events.EveryHours.Add(MenstrualCiclesLol);
exotic ember
#

Would anyone know if the function:

ScriptManager.instance:getItem(itemID)

Would be able to pickup Items that have been added to the game by a separate mod?

bronze yoke
#

yeah

exotic ember
#

Awesome thank you 🙂

onyx sage
#

anyone know how to make their own rv interior cell?

verbal yew
# bronze yoke yeah

hi, do u know how to work with overvrite stuff by events and another way (without events)
for example:
Im trying remove item tweaker from better sorting, by have a problem with override categories, like:
first and main core get all items and change categories for them by condition:

#

and second step should be predetermine specific items by mods, like:

#

this is step without events and it's okay when you first launch game - all categoryes ok, but after rejoin to server - all categories changes back like in first step

#

it's possible to launch first step without OnGameBoot event?

bronze yoke
#

it doesn't look like anything you're doing relies on that event

#

so it should be fine to just call it when the file executes yeah

verbal yew
#

or both of this not req here?

bronze yoke
#

yeah

#

technically not required to put it into a function at all but it's cleaner

verbal yew
#

thanks :з

verbal yew
#

how are they accumulated, where i can get these values?

#

like, yep, i can do it with event everyTenMinute for example, get first value, after ten minute get second value, subtract the difference between this. But... knox infection not alone way to generate sick or stress... And idk how to get this values... How to separate this...

plain crest
#

does anyone know how possible it is to change a hat/head accessory model based on the hair equipped? for example--having a ribbon/bow model look one way on tied hairs and another on loose hairs, or even different per-hairstyle..?

slow graniteBOT
#
panagiwtakyz has been warned

Reason: Bad word usage

verbal yew
#

OnZombieUpdate - high weight for performance?

bronze yoke
#

probably the most expensive event in the game

verbal yew
bronze yoke
#

difference is ontick is once a tick, onzombieupdate is once a tick per zombie

#

so often hundreds of times heavier

verbal yew
#

hmm... but how work OnTick? What thats mean? One frame per second or?

bronze yoke
#

as fast as possible, usually whatever the fps limit is set to

#

rendering happens on the same thread so frame == tick in this context

verbal yew
#

hmm...

#

but if i want doing some code every 7 sec, what i should do with events?

#

for example

bronze yoke
#

usually a timer ontick

#

there are some timer apis on the workshop to simplify it

onyx sage
#

anyone got a good guide onto making a poster mod hungover

austere sequoia
#

Can I make it that my mod overwrites its own data in case another certain mod is installed alongside it? And if so, how exactly?

onyx sage
austere sequoia
#

I found Daddy Dirkie Dirks tutorial series very helpful

sleek heath
#

@bronze yoke someone posted a fix for my problem in my mods comments :)

#

this basically solves the issues

#

i think this works best for massive music collection mods rather than smaller ones

#

which is perfect for me

finite rover
#

Hello! I was thinking is it possible to make 1 makeup item for example lipstick to be capable to apply all kinds of make up?

    {
        DisplayCategory = Appearance,
        Weight    =    0.2,
        Type    =    Normal,
        DisplayName    =    Lipstick,
        Icon    =    Lipstick,
        MetalValue = 1,
        MakeUpType = Lips,
        WorldStaticModel = Lipstick,
    }```

I tried editing item in MakeUpType = Lips; Eyes, but got no luck![unhappy](https://cdn.discordapp.com/emojis/721361533636182047.webp?size=128 "unhappy")
verbal yew
#

something here:

shrewd sable
#

Is there any way to set the key for certain door?
I'm making a mod for my server and i created a keycard item which is basically a key.
I need to set my security doors to be opened with that created key card that i pretend to spawn as admin in the proper place.

How would i set door and key IDs ? Or a workaround to make them be opened with that keys. I'm a bit lost.
I can get building and/or door key as admin. But i want that key to be my keycard.

bright fog
shrewd sable
#

Oh! You're right, i can make the trick xD Thank you

bright fog
#

You can access the key of a building this way

#

I believe you can change it

#

give me a sec I'll look at it

shrewd sable
#

I'm so noob with lua, but i will try. Thankfully i understand most scripts due to my C# background

bright fog
#
-- access an IsoDoor object anyway you want, I'll name it door
local keyID = door:getKeyId()

myCardKey = --number integer
if keyID ~= myCardKey then
  door:setKeyId(myCardKey)
end
shrewd sable
#

If i'm not wrong this sets the key to be the keycard, right?

bright fog
#
-- you access an item and check if it's a key, it outputs a Key object
-- I'll name it key here, let's say you already checked it's a keycard then:

myCardKey = --number integer you set for the door
local keyID = key:getKeyID()
if keyID ~= myCardKey then
  key:setKeyId(myCardKey)
end
bright fog
#

This is only showing how to access and change the ID of a key

#

This would probably allow you to make sure your keyCard has the keyID of the door it should open

#

And will also allow you to make those IDs unique

#

So you don't end up with random keys being able to open those doors

shrewd sable
#

wow that's exactly what i need. Thank you very much. The last thing i don't understand very well is...
I would place those lines in a lua file but the folder structure gets me, where should they be placed?

bright fog
#

Then you'd have to use these to check if the door the player is trying to open has the corresponding keyID to the item key in the inventory

shrewd sable
#

i will just place 4-5 doors with 4-5 keycards levels that all, all spawn as admin in my server. If keycard are not in loot tables they won't appear, so np

bright fog
#

then create a file myKeyCardChecker.lua

bright fog
shrewd sable
#

i can set a word, right?

bright fog
#

Unless you completely remove keys from spawning in the natural loot which involves removing the key from spawning in container, zombies etc

shrewd sable
#

so regular system won't get them duplicated ever

bright fog
#

It's need to be an integer

#

These are the pages that interest you and you need to look for getKeyID() and setKeyID()

shrewd sable
#

would be easy to set them as Nexus1, 2, 3...

bright fog
#

if only lol

shrewd sable
#

ok, thank you very much

bright fog
shrewd sable
#

i would change half my knowledge of Unity and C# for this

exotic ember
#

Would anyone have an idea on how to modify Bag Capacity in LUA?

I was able to to retrieve the Original Capacities using this:

local instanceItem = itemDef:InstanceItem(itemDef:getFullName())
            originalCapacity = instanceItem:getCapacity()

Which I was hoping just changing the Params, Similar tot Change the Items Weight would work, but it is producing an error for each Bag it attempts to change the Capacity of

This is the function that handles attempting to change the Capacity:

function changeBagCapacity(Item, Capacity)
    if Item then
        Item:DoParam("Capacity = "..Capacity)
    end
 end

Is there some other way I should be using to handle changing Bag Capacities?

bright fog
#
myKeyNames = {
  1267925 = ["Nexus1"],
  1267926 = ["Nexus2"],
  -- etc
  }

--outputs the string in the dictionary above corresponding to the keyID so if the keyID of door == an ID in the list it will output the corresponding string, else it outputs None
local myDoorKeyID = myKeyNames[door:getKeyID()] 
local myKeyKeyID = myKeyNames[key:getKeyID()]

if myDoorKeyID == myKeyKeyID then
  door:open()
end
bright fog
#

or

#

but there's no point to it I will be honest with you

#

Bcs here it's useless code

shrewd sable
#

yeah it's not necessary

bright fog
#

But you can do this:

myKeyNames = {
  1267925 = ["Nexus1"],
  1267926 = ["Nexus2"],
  -- etc
  }

--outputs the string in the dictionary above corresponding to the keyID so if the keyID of door == an ID in the list it will output the corresponding string, else it outputs None
local myDoorKeyID = myKeyNames[door:getKeyID()] 
local myKeyKeyID = myKeyNames[key:getKeyID()]

if myDoorKeyID == "Nexus1" then
  -- do code
end
#

if you REALLY don't want to use numbers for clarity

#

I mean if you have some base in other languages you should be good

#

The main challenge will be accessing whenever the player is trying to open a door

#

I'm not sure if there's a method for that

shrewd sable
#

I will try that, you have marked a path to follow and i've learnt by trial error, so it's just a matter of time xD

bright fog
#

👌

slow graniteBOT
#
david0927. has been warned

Reason: Bad word usage

bright fog
#

I would either check if the player is in front of a door perhaps and access the tiles on the square the player is on or in front

shrewd sable
#

Won't it be helpful for others to have as a modding tool? Problem it's just a small part of my mod, but maybe i can extract that part to share

bright fog
#

Also player could thump the door which can be detected and I've used it in recent code

bright fog
#

You can do a tool for it if you want

shrewd sable
#

my mod is not going to be shared, at least for now, sadly

bright fog
#

👌

#

You can do a framework for key cards yeah

#

it will interest a lot of people I'm sure

#

also gave me an idea of a troll mod

#

To make the player have to search for the right key for the door he's trying to unlock lol

#

Like it would be a roll dice that takes a random key in your inventory and checks if it's the right key to open the door, if not then don't unlock the door

#

so the more key you have the less change you have to roll the right key lmao

shrewd sable
#

if this could have been done with C# i would force the key to be in hand and many other little details, but i will be ok just to allow only open with that key xD More than enough

bright fog
#

PZ doesn't support C#

shrewd sable
#

i know i know xD

#

i would made another game above Vanila in that case

bright fog
#

Also you can do it in lua

#

you can check if the player has the key in hands

shrewd sable
#

i don't understand lua 2% of how i can handle C#

bright fog
#

Nothing stopping you there

#

You'll learn

#

It's not that hard

#

Since you have good bases in other coding language, just have to share with you how the game handles stuff and you'd be set

shrewd sable
#

problem is that we don't have some kind of mod editor or some tool to make things a bit easier, maybe i'm notdoing the proper workaround for things xD

bright fog
#

If you want more modding detail and go further in the modding you can come here

bright fog
#

One which allows easy reload of lua within the game too

shrewd sable
#

I've made 2 scripts by now:

  1. In a recipe, you have files, you can read them, and by script i give a chance to receive valuable data. Files are converted into Read files by recipe.

  2. When dragging an item to a container it will allow only certain type, in my case Ammo, but made another container for literature.

#

with C# at this point i would have done the mod already xD

bright fog
#

There's many containers that only allow some type of items

#

And there's many mods that already have something like that

shrewd sable
#

i tried to set Ammo in the vanila set, and it would accept guns too

#

now it only accepts ammunition, ammo

bright fog
#

hmm

#

I see

#

Like I said, once you understood how the game handles stuff it will go fast too

shrewd sable
#

magazines too sadly, as i don't know to set custom types

#

yeah, but i'm impatience

bright fog
#

it's not a language issue, it's just that you have to learn lua

shrewd sable
#

i've been learning C# since 2016 i still consider myself a noob, even having made many projects already. I started as modeller and it's the least thing i do now.

#

I do everything in Unity, model, texture, programming, the whole pack xD

#

The struggle with Unity is Unity itself

exotic ember
# exotic ember Would anyone have an idea on how to modify Bag Capacity in LUA? I was able to t...

My issue was that After calculating the Original Capacity * Multiplier It would often convert the value to a float, however the Capacity Value is required to be an INT, so using math.ceil I was able to round up to the nearest round number

https://projectzomboid.com/modding/zombie/scripting/objects/Item.html#Capacity

The more you know 🤦‍♂️ 😅

chilly hemlock
#

Can I assume that if I update getModData result and call transmitModData it will sync that data between server and clients or I should not rely on it at all?

#

Or it only works if I call transmitModData only on server?

shy hearth
#

Anyone know when OnWeaponSwing and OnPlayerAttackFinished are supposed to go off? Or where they should be?

#

I'm trying to test when they fire and it seems like the answer is never

#

neither of these do anything when the admin character swings

verbal yew
slow graniteBOT
#
supanova_ has been warned

Reason: Bad word usage

old cape
#

I am new to modding

verbal yew
#

its your personal condition for easy using, not need write all time player:getModData().MyModCicles

#

now its just cicles

#

or u about moddata?

old cape
#

yeah about the modData().MyModCicles

#

its a way to get like global state that I should declare somewhere

verbal yew
#

u can rename MyModCicles on another

#

what u want, its should be uniq

#

its just something like flag or info contain in character

you put it new condition

chilly hemlock
#

is it possible to swap out item model using lua at runtime?

verbal yew
#

first state for this is nil

old cape
#

Ah I see it now thx thx

slow graniteBOT
#
verres9999 has been warned

Reason: Bad word usage

mellow frigate
finite rover
reef vine
#

Hello here! I'm creating a mod with custom crates. Everything works, except when I want to place a crate from my inventory, I get the error "cannot create recipe for this movable item". If I restart the game with the item still in the bag, no more errors. We only see this error in debug mode. Otherwise everything is going well. An idea ?

mellow frigate
reef vine
mellow frigate
slow graniteBOT
#
cocaa has been warned

Reason: Bad word usage

slow graniteBOT
#
cocaa has been warned

Reason: Bad word usage

bright fog
#

My boy has been getting warned over and over lmao

shy hearth
#

They've no other messages on the server I'm so curious what was said lmao

sour island
#

Could be a bot trying to link dumb stuff.

shy hearth
#

M O D S | I N | B I O

manic helm
#

Hey I have a question, how do these different modes work in those code?

#

More specifically, is there a way I can put the player into one of these modes?

#

Maybe some way I can access the UI and simulate a click? I know you can do something like that with inventorypanes and their fuctions like lootall

bright fog
#

Loot all probably doesn't simulate a click at all

#

And what do you plan on doing with this exactly ?

#

There's most likely an easier way

manic helm
#

Well I'm trying to make a hotkey that puts me into that mode specifically

#

Just a quality of life thing I'd like to have

bright fog
#

Isn't that already a thing ?

manic helm
#

Is it?

bright fog
#

Did you check your hotkeys ?

#

I know there's a button for destroying furnitures

#

And I think one for rotating

#

So there probably is one for all of these ?

shy hearth
#

don't think so

#

hmm

manic helm
#

Once you are in the mode you can press tab to go inbetween them, but I don't think its a hotkey no

shy hearth
#

it'd be easier to figure out if we knew what exactly the like 'build mode' is called in code

#

searching 'mode' or similar in the javadoc gives you all the results for model too

#

and i haven't the patience to check

shy hearth
#

best possible outcome

#

excellent

manic helm
#

Hell yea

#

Thank you!

plain crest
#

looking to see how possible it would be to have accessories as a collectible seperate from my hairs without the possibility of like...making a hat that wouldn't be compatible with any other hairs

bright fog
#

tho I'm not familiar with it but I know it's possible

plain crest
#

is there a way to pull what hairstyle someone is wearing maybe..?

#

and have the "ribbon" item use a specific model IFF a specific hairstyle is being used?

bright fog
#

Possibly yeah

opaque yarrow
#

Is there any modders here that do mod work for compensation based on user request?

plain crest
bright fog
#

yes

plain crest
#

but you'll need to be more specific about what you want/need ofc

opaque yarrow
#

That is # unknown for me rn

plain crest
#

oh, weird...it may have to do with your roles.

bright fog
#

It will still lead you to the channel

opaque yarrow
#

Ahh i see, sweet

plain crest
# bright fog Possibly yeah

i'm thinking what i want to do (and ik this is a dumb idea but hear me out) is make a "scrunchie" mod that lets you wear the scrunchie on your wrist in that classic 90s fashion AND lets you tie your hair with it--i don't mind going thru the base models for example and making it so the scrunchie shows up in some capacity on tied hairs, but i'd need ot know how to do that

#

it would also be cool to be able to change the way tied hairs work so you "need" a hairtie to tie your hair

bright fog
#

hmm

#

I got an idea

#

Why not using the haircut menu ?

#

So like when you have scisors you can change your haircut, why not do that here too but instead you need to have a hair tie

#

no idea if that can be modded in tho

plain crest
#

yesss i love that, and i think that would be a good way to do it...my one concern is like, say i have a "red" scrunchie. how do i make it so that it knows red scrunchie = red tie for the hair without having to make like. a new model for every color.

bright fog
#

basically you make versions of your hair with the hair tie

#

tho you'll have to make multiple hair styles with the hair ties

#

but if you can mod custom haircut tools, then it's definitely doable that way

plain crest
#

wym by different item? sorry idk if i understand. cause i would want the color of the item in the inventory and on the actual hair model to match up, idk how to get those to sync.

bright fog
#

if you can make a custom haircut tool with a red hair tie for example, then it means you can do it for N colors by creating new items that are just different colors of hairties

#

then reference those various hair tie as tools that allows access to your custom models with the corresponding model and texture of hair tie

plain crest
#

so it wouldn't be possible to have like, a hairtieTINT item--it would have to be finite colors?

bright fog
#

that I'm not familiar enough with how items with different textures are handled and how to setup custom hair styles linked to custom hair cut tools

rancid panther
#

your mod proposal sounds very cool! would love to see how it turns out!

#

if you make it, also consider the "untie hair" option to return the hair tie

bright fog
#

Yup, or have hairs untie naturally

plain crest
#

i'll try to figure out if it's possible then

#

i just wear a lot of scrunchies irl and i was like "hey...what if scrunchies" LOL

stark gull
#

PLS DOOO A MOD FOR SHOES LIKE CONVERSES I NEEDED

stark gull
#

THANKS drunk

pearl sundial
#

no problem drunk man

onyx sage
#

im missing all the stuff on the right side how do i get id back

pearl sundial
#

there should be a little bar to hold down at the bottom of the pad

onyx sage
#

thats not it 😦

#

I FIGURED IT OUT

#

right click on the top bar!!!

onyx sage
#

could someone help troubleshoot my mod

thick karma
# onyx sage could someone help troubleshoot my mod

@onyx sage I recommend asking a more specific question... "help troubleshoot" is rather broad; you'll have better luck if you explain what you know and ask a specific question that follows from it. E.g., if your mod isn't showing in MODS, you would go, "I have my directories set up like this [screenshot(s)], and my mod folder is here [screenshot], and my mod.info looks like this [screenshot], but I can't see my mod in MODS. Any ideas why?" Agreeing to troubleshoot broadly is potentially a much bigger commitment from anyone lurking in this channel than answering a specific question in a specific context.

#

Or, if you are completely unaware of any information that would be relevant to your question, at least be specific in the question, such as, "How do I make my mod appear in the MODS menu so that I can enable it?"

onyx sage
thick karma
#

Post screenshots of your directories expanded from %UserProfile%/Zomboid down through your mod's subfolders. Also post mod.info file.

#

That'll most likely tell us what we need to know

thick karma
# onyx sage apologies for vaugeness, Ive set up my mod correctly as far as i can see but it ...

Also no need to apologize for being vague; I was just trying to help you get helped. Some people might agree to sit down and help you troubleshoot with no particularly obvious end goal in sight, but I suspect most wouldn't... A much higher percentage of people who know what you need to know will respond in a moment of free time if your questions are specific than if they aren't. Could be waiting all day for general support when a specific question would've gotten you where you wanna go.

onyx sage
#

files

#

other thingys

thick karma
#

Hmm okay that's pretty weird. @onyx sage Sure looks normal to me at a glance. If you DM me a zip I'll try to play with it on my end and see if it's visible for me. I would expect to be able to see it. I'm unfamiliar with usage / consequences of the tiledef and pack tags, tbh, but the rest looks normal and I would expect it to work at a glance.

onyx sage
#

its supposed to be a custom tile mod to add my cat as a picture into the game ill dm you know ty!

neon bronze
#

i think you got the folder structure wrong, try updating it to the path Zomboid/mods/Beaus Poster/Contents/ and put inside Contents your current Beaus Poster folder

onyx sage
thick karma
#

Chinny has it in Zomboid/mods

#

Zomboid/mods corresponds to Zomboid/Workshop/Mod Name/Contents/mods

#

This one loads just fine for comparison (don't get hyped, it will never be released, Brutal Handwork does it best imo):

thick karma
#

@onyx sage

#

mod.info:

name=Beau Poster
poster=poster.png
id=beau
description=Picture of Beau
tiledef=beau_poster 2024
pack=beau
#

I just randomly used 2024 because that's the year.

#

I have no clue if the specific id chosen is extremely important or how to make the decision, but it must exist or your mod.info file will be invalid (and therefore as you saw the mod will not appear in MODS). @onyx sage

#

Okay, so they can go from 100 to 16382 according to that page, and 2024 is available

onyx sage
#

yayy

#

thank you for the help!

thick karma
#

❤️ Good luck!

onyx sage
#

ok it works 80% just gotta get it to place the correct tile now ahhaha

thick karma
#

Haha for what it's worth, #mapping people may have better guidance for you there.

crisp rock
#

potentially silly question but i've not found this for some reason
how does ZombieLore.Speed map to the in-game speeds? in this case i'm trying to check if the zombies are set to be sprinters

slow graniteBOT
#
4ntt. has been warned

Reason: Bad word usage

bright fog
#

And wdym how does it map to the in-game speed ?

#

You mean its outputs what it means ?

crisp rock
#

yeah

bright fog
#

It outputs a number

#

1 to 4

#

I have an excel sheet with it's equivalent name in the sandbox options but not sure if I can access it rn

crisp rock
#

please do if you don't mind

bright fog
#

Check walktype

#

4 is random confirmed

crisp rock
#

thank you very much

bright fog
#

Updating sandbox zombie speed either requires restartintg the save or setting to inactive then active the zombie you update the speed

#

Also allows you to have different speeds for different zombies

crisp rock
#

nah i just need to get it once

crisp rock
#

though honestly sprinters feel like they deserve a soundtrack of their own

bright fog
#

Hmm

#

How do you plan on doing these exactly ?

crisp rock
#

just overwrite the vanilla music director entirely

#

it seems to be fairly simple? like a hundred lines of code in a single lua file

bright fog
#

Fmod ?

crisp rock
#

as for the specific factors that'll play into drama calculation - so far the factors are sleepiness, exertion, panic (fixing the fourth wall with this one), hours survived and zombies killed
the moodle factors are linear but for the hours survived and zombies killed i'm messing around in a graphical calculator to figure out some nice curves

crisp rock
#

im not touching the soundtrack if that's what you're talking about

#

the bit about sprinters needing a separate one was just a comment

bright fog
#

I'm not familiar with how musics are handled but ik for every other sounds it's handled by fmod and to replace the soundtracks or general sounds you need to manually install .bank files

#

And fmod is not exposed so I don't believe you can modify it

crisp rock
#

nah the only thing the director rly does is it picks a track from MusicChoices and calls a function to play said track

bright fog
crisp rock
onyx sage
#

ok to the car modders out there am i correct in thinking that when a item that is on a car like a roofrack is uninstalled is juts vanishes like how the wheels do

crisp rock
bright fog
crisp rock
#

no clue whatsoever

bright fog
onyx sage
#

was gonna basically use the code from KI5 cars, and from what i can tell thats whats happening

past pollen
#

Would anyone be interested in coding a mod that makes all cotton clothing and paper products and twigs compostable to make the compost mechanic in the game more realistic?

#

Also a mechanic that makes worms speed up the composting process