#mod_development
1 messages ยท Page 49 of 1
hmmm, I haven't used sandboxvars very much, just experimented a little bit. At what point are they loaded? Is this file loaded before then?
this file is before, but the default value should still be loaded
I assume it must be or you'd get an error just calling the values. Just spitballing
they are initialized well before a client lua script runs
yeah the table would be wrong
gonna go with "you need a max value" and see whre i get with that
yeah, that's another thing that i can't say with confidence you need, but not something i've seen one without
i feel like ive seen it but 
actually i feel like i might have tried it before and had problems...? not sure on that
yup literally just "u need a max value or it silently goes nil"
this is the kind of thing that would be nice to see a warning in the log for.
thanks for the assistance to everyone who did just assist, esp albion and anonymous who got me over the finish line there.
always some dumb little problem with me and this game lol
troubleshooting is fun when it's not your own code
I've been trying to fix a problem I can't replicate

more trait's quick worker when set to high in sandbox supposedly breaks with skill recovery journal when the speed modifiers are also high
have yet to replicate it myself
the changes quick worker does to timed actions is also pretty odd
if delta < 0.99 - (modifier * 0.01) then
--Don't overshoot it.
action:setCurrentTime((action:getCurrentTime() + modifier * multiplier));
end
my guess would be the current time is hitting 0 and ending the action
the reports are that they stop writing/reading immediately
hmm I wonder if it's a load order issue in MP
@bronze yoke ppl are reporting tainted plumbed sinks since 41.78 dropped
reports are up to two so it ain't isolated
oh, i may have forgotten to tell you that filters went out around the same time
them not being tainted always seemed like an oversight...
as far as i know, this update fixes all those weirdly major bugs with rain barrels too
also those weird metal barrels turned out to be an unused vanilla thing, maybe a mod or map spawning them
i made sure they were supported too anyway
so does the water from them come out clean or tainted?
lol
since they are for some reason clean directly
tbh i wish they just acted normal
steel doesn't clean water either ๐
the tainted status will be whatever is in the barrel unless you have a filter
...maybe i forgot to extend some of the features to the metal ones...
even though they use mostly the same code, they're entirely separate, and they weren't really my priority... oops
I dis agree
I'm trying to edit the loot rarity of a mod so it has wayy reduced chances. Would I go into server/items and reduce the ProceduralDistributions chances, or go to scripts and lower the weight per item? neither seems to do anything when I try it.
means i can patch the unused vanilla barrels if need be :)
i believe
to be tainted
i'm not sure what you mean by that
oh i remember now, i didn't experience that problem on my end
i really don't see why a mod would interfere with that either though...
it may have been a part of the general bugginess of global objects in multiplayer that i had to sort out though, so they may work properly now
sqlite?
If the procedural distribution table has a junk table move it to that.
Zombie population inflates and creates an "invisible floor" for loot spawn chances. However, junk tables are exempt from that factor.
Ye. I hate my mobile device's keybrd
Hehe too lazy to correct my typos and grammar at times . Esp if i just woke up.
Good day yall ๐ซก
Dislaik posted the exact method
You may want to use the search button
how do you replace a base game item with your own?
how does doorPart:getDoor() work
anyone have any idea why blood intensity on a car seems to be capped at 0.04? The clamp in this code must be doing it but it doesn't make sense to me
public void setBloodIntensity(String var1, float var2) {
byte var3 = (byte)((int)(PZMath.clamp(var2, 0.0F, 1.0F) * 100.0F));
if (!this.bloodIntensity.containsKey(var1) || var3 != (Byte)this.bloodIntensity.get(var1)) {
this.bloodIntensity.put(var1, var3);
this.doBloodOverlay();
this.transmitBlood();
}
}
public float getBloodIntensity(String var1) {
return (float)((Byte)this.bloodIntensity.getOrDefault(var1, BYTE_ZERO) & 255) / 100.0F;
}
this is called when you hit a zombie at speed in a vehicle
float var3 = this.getBloodIntensity("Front");
this.setBloodIntensity("Front", var3 + 0.01F);
so it should increase by 0.01 every time (although there is RNG involved in whether the damage happens at all)
however in testing I can run over countless zombies and it never goes over 0.0399999999
it must be getting capped elsewhere, cuz as you say those two functions alone aren't doing it
yeah i'm seeing the same thing happen
I thought maybe it was the byte to float conversion, but if that was the case, manually setting and getting the intensity shouldn't work either, but they seem to
when i do this manually, i reach a different cap
so i'm guessing it's some weird conversion or rounding thing
strange that blood intensity works at all when it seems to only hit 4%
setting it to 100 definitely make a bigger mess
hmmm maybe this is actually a bug
hitting a zombie with 100% blood on my hood had it revert back to 4%
interesting
if i increase the increment to 0.02 it goes all the way to 1
i think it's probably to do with the division in getBloodIntensity()
they're being stored as a byte, so the precision is pretty low
the different cap reached when i do it through lua is probably just some conversion nonsense
trying to run it through an online java compiler to see if I can recreate it
as i thought - if you push it past this value, hitting zombies contributes to it again
it just gets stuck on that value because of some rounding limitation i guess
ya, maybe. Can't recreate it outside of PZ, so its weird. Although I had to write my own clamp function... I'll have a look at that
nah, their clamp function is super basic
i don't think the setter is likely to be at fault here
its one or the other. My decompiled PZ just has bloodIntensity as a HashMap, which in modern versions of Java is invalid, afaik. My test code I had to use HashMap<String,Byte>, which makes some of those casts redundant. But of course I'm not looking at real source code so who knows what the actual implementation is
I'll just throw it on the bug forum and manipulate it myself for my purposes to get past this roadblock, haha
i wonder why they chose to do it this way
i would've thought it'd be simpler to just use 0-100 int values than store a 0-100 int but have everything pretend it's a 0-1 float
ya, casting between floating numbers, then casting to a byte for storage... just use the byte. the & 255 is expecially weird, that doesn't do anything
yeah i don't write java so i was a little puzzled what that was meant to mean, i guessed it was literally a bitwise and which is... great lol
i don't know what it is so i'm just going to pretend it's not there
ya, its a bitwise and. Taking a byte and doing a bitwise and with 255 does literally nothing, lmao
i'm aware! which is why i assumed i must be wrong and decided to ignore it lol
there must be a reason it's written the way it is but i sure don't get it
you said you were able to go over the 0.0399 cap? manually with adding 0.01 or did you actually hit zombies?
if i manually added 0.01 it reached a different cap, i'm guessing because of lua number to java float (or vice versa) conversion
and if i manually added it just to push it over the cap, hitting zombies would continue increasing it
hmm, are you on the unstable branch? I'm using the released build and it doesn't do that
there isn't an unstable branch right now is there?
any value over the cap reverts to the cap the first time I hit a zombie
are you testing in singleplayer?
that's it then isn't it
you're modifying it on your client, when you hit zombies the server synchronises the real value back to you
hmm yes, and transmitBlood() looks like it only goes one way
yeah you need to use a client command
i would generally always expect modifying things on the client not to work
Anyone got a modlist of their own they're willing to share?
most vehicle stuff is client only, damage seems to be the exception
yep, checking if the blood value is 0.04 and bumping it up on the server fixes the issue. Definitely a bug
gets stuck at 0.2599999 lol
Item tweaker
Its either you learn or you hire
#mod_support try here
i wouldn't recommend using item tweaker, it's not really much simpler than using doparam and it spams prints, causing a lot of startup lag
Nobody needs to use ItemTweaker, DoParam works, is simpler, and isn't subject to multiple modID issues.
Back when I was a modder, it took all of 5 minutes after MP dropped for Soul Filcher and I to realize that using Item Tweaker as a dependency wasn't viable, and we modified both of our bodies of work accordingly.
Just use DoParam, please 
item tweaker used to be a good thing, but people uploaded their modified versions with the same modID and now it's just a white hole of bug reports on account of that. (FYI using requires/dependencies for mods is absolutely a gongshow and isn't practically sustainable on account of the re-upload issue, among other issues, IMO)
local scriptItem = ScriptManager.instance:getItem("Base.EngineerMagazine2")
if scriptItem then
scriptItem:DoParam("TeachedRecipes = Make Smoke Bomb;Make Improvised Gas Mask")
end
local item = ScriptManager.instance:getItem("Base.Vest_BulletArmy")
if item then
item:DoParam("Weight = 8")
end
local item = ScriptManager.instance:getItem("Base.Vest_BulletCivilian")
if item then
item:DoParam("Weight = 8")
end
local item = ScriptManager.instance:getItem("Base.Vest_BulletPolice")
if item then
item:DoParam("Weight = 8")
end
local item = ScriptManager.instance:getItem("Base.Hat_Army")
if item then
item:DoParam("BulletDefense = 100")
end
local item = ScriptManager.instance:getItem("Base.Hat_GasMask")
if item then
item:DoParam("BiteDefense = 25")
item:DoParam("ScratchDefense = 30")
end
local item = ScriptManager.instance:getItem("Base.AssaultRifle")
if item then
item:DoParam("MinDamage = 0.8")
item:DoParam("MaxDamage = 1.4")
end```
In the process of cataloguing a bug, Blair, is the forum still the best place to report that stuff?
When I play with a good amount of mods for like 2 or so hours (irl hours) I start to lag pretty badly. Is there any way to fix this? Can I allocate more ram from steam to pz to make it run better?
may i ask what is DoParam? I havent been able to find any information on what it actually does.
it's basically a way to edit an item's script at runtime, it applies the script line you put into it
it's most useful for editing items from vanilla/other mods, as you don't need to overwrite items or files entirely, which will inevitably lead to incompatibility
It does everything that ItemTweaker does, but in a more straighforward fashion that isn't vulnerable to the fact that there are 13 listed unauthorized re-uploads of ItemTweaker, not including the private/hidden workshop items.
I hate to piss on anyone's subs, but the re-uploaders ruined ItemTweaker's utility.
Also, please do not re-upload your mod pack or modified version of existing mods with the same modID as existing mod because that causes no end of bug report/tech support/lua mismatch headaches.
And also is a jerk move. Just, please, change the modID. PLEASE.
thank you
Are there any techniques for 3d modelling clothes that would make them look more in-line with the vanilla clothes?
i always use the vanilla clothes models as a base
its a complete nightmare otherwise, since you have to match the uvs up to the base model
Ah, I didn't know that
I'm currently working on this, it's sort of a shoulder cape type thing
I've done some 3d modelling in the past, but never clothing
if you dont mind, can you tell me how it works because https://projectzomboid.com/modding/zombie/scripting/objects/Item.html#DoParam(java.lang.String) only specifies that it requires a string and not what to put in the string. I have searched in many other websites to no luck aswell
declaration: package: zombie.scripting.objects, class: Item
by changing the modid I risk losing / resetting map tiles.
depends on what it is.
if your mod adds a context menu option it doesn't matter at all
if it adds items it does
etc
also depends on whether the mod you have replaced is a dependency for other mods
If I do this, can I still build off of them and do things like the image I posted above?
it will still cause issues even if your mod is meant to be a replacement for the original mod, if that's what you're getting at
Look at my provided examples as practical examples of how it works; it replaces the entire specific item parameter when used properly.
thank you
all I'm getting at is requires(ModA) or IsModLoaded(ModA) is not going to work if you've renamed your version to ModA2, so while there may be some drama around keeping the same mod ID you don't really have much choice if you want it to slot in
better to write a patch if possible, but i imagine that is likely a big part of why blair called dependencies unsustainable - i'm starting to feel the same way myself
not changing modid keeps the require working too
win win
@willow estuary require doesn't order mods on server like it does with SP? They need to be set up manually in right order.
Yes, that is one more reason why I consider requires to be unsustainable.
requires also fail fuckin constantly
The fact of the matter is that there are enough 12 year olds setting up PZ servers, that requires/dependencies, or anything that involves reading instructions, is unsustainable IMO.
No shade at kids, they're literally the future and are smarter than us old timers if anything, just trying to illustrate a broad issue facing the modding community?
lol
one of my mods has to be written to be compatible with both profession framework and a deprecated version of it that's missing several features and has no new features of its own, it's a total joke
that one does have its own mod id, but it overwrites every file and would use the same globals anyway...
Yes, the profession framework debacle was one of the foundational experiences in me realizing that dependencies are unsustainable.
"I literally can not use this mod because there's two different versions of it with the same modID on the workshop"
i'd have that 2nd profession framework pulled if there werent so many mods requiring it ๐
Please just report it and burn the stump off of the hydra's head.
i have for the longest time gone "lockpicking looks cool.. why the fuck do i need a framework for professions to use it?"
and refused to
and the name is so misleading, i think a lot of people assume it's the newer/better version
I havent encountered any problems like this but when i do ill go back to this conversation by searching hydra's head
Lol
PF simplified adding professions/traits (pretty massively IMO) so lockpicking probably added one of those. never looked at it so cant say
that lockpicking mod is real nice. BetterLockpicking right? I like the minigame
i've definitely become a lot more dependency negative in recent months, but... profession framework can stay, for now at least
it's just such a huge convenience
luckily, only one of my mods is actually affected by that conflict, and it was simple to resolve
should I keep this as a plane, or give it some thickness?
I don't know how zomboid handles planes
I know of some mods that add capes and stuff and it seems like they just use planes
In this case the best response I could make would be to ask you to reconsider that policy.
But in doing so you are potentially creating bug reports for the original mod author, and I wouldn't wish that on my worst enemy?
he's made me coauthor, but only he can push updates.
I am my own worst enemy then?
aren't we all
I don't see Steam ever changing this- but if he's not using 2FA or is willing to turn it off you can actually set up a GitHub repo to upload to the workshop via a GitHub Action command.
is there a guide for this? We already use GitHub.
There's a pz community mod that does this but schedules/interest was hard to maintain
I can try to help in like 6 hours
But I just googled "GitHub Action steam workshop upload"
And modified those commands
Again, it requires 2FA to be disabled on the steam acc - so not recommended
For the pz community thing we made a dummy acc
Also, not an issue for you - but there isn't a way to create new listings via GitHub that I'm aware of so it does still require human touch to set up the initial workshop page - for anyone else curious
I wasn't aware one could reuse modIDs - I assumed it had to match the appID from steam
Does anyone know if it's possible to extend the discord support from the base game, to allow PZ to support threads?
Right now it seems to only support channels, I assumed it would just work as the urls are the same:
Channel URL: https://discord.com/channels/136501320340209664/986948930740813864
Thread URL: https://discord.com/channels/136501320340209664/1040494980675936256
But apparently it's not. I've made sure to create a bot with access to threads but the server log simply shows
LOG : Network , 1668157324622> 459,395,478> DISCORD: channel with ID "[omitted]" not found
([omitted] added by myself in place of the ID ๐ )
most bots and bot libraries kinda suck with newer discord features, PZ included. There's a lot of drama around this that I won't get into here but basically the answer is a "probably not unless you're really lucky"
The bot is not the problem. It's a new one with simply access to the right features. The problem is how PZ try and interact with it. With threads being kinda "new" in terms of GA feature, it was expected that it wouldn't work but I cannot find anything online in terms of "is this a moddable part of PZ?". I feel like "no" is the answer but it would be good to have someone from Indie Stone confirm it and, if that's the case, consider allowing it maybe? That would lift an "optional" feature out of their shoulders.
yeah, that's what I mean
oh alright sorry, i misunderstood then
discord bot libraries that PZ would consume don't support newer features
most bot library devs just quit developing a couple of years ago
and any features since then have minimal support
what's the load order for lua files?
can my lua files load before base game files if they're named wrong?
yeah, it looks like load order is alphabetical which can cause my mod's files to load before vanilla's files
is this intentional?
ah nvm, there's a mod that's not mine that's broken!
quick question on the EatType am i limited to the exsiting EatType animations? or can i just use any other animations like for example BuildLow
Decided to expand upon my mod a bit more and experiment with the idea of making it more creative and abstract in terms of the page for the mod, intentional keeping thing vague and intriguing Decided to experiment with audio-based storytelling based on my mod for Project Zomboid called "Lingering Whispers...", here is my result, would love to know what people think https://youtu.be/LVidUx5lf3I Made a teaser trailer of sorts, let me know what you guys think of it haha
Wasn't there a recent Zombie film that had zombies repeat their final thoughts over and over?
Might give you some inspiration
Some of the lines were innocuous and it made it more creepy
Wish I could recall the name
Is there a lua way to be able to overwrite a tiles property permanently?
Like it's isoflags?
Ah so uour the one who made that. Im the guy who contacted the orig author and you an his mods comment page
There ase set properties that isnt iso flag
Havent checked iso flag yet
But pretty much yeah
That's isoFlags pretty sure
Ok ๐
So how can i modify it like as the game load all tiles ingame that already exsist changes
I did something for a guy a while back
I want to help sir daddy dirk
You can use the load square event
He wants to modify one particular sprite not yet sure what
Just don't put a print on the functiob
Is it the twig sprites not being able to be picked up?
--ObjectTypes
-- "normal", "jukebox", "wall", "stairsTW", "stairsTN", "stairsMW", "stairsMN", "stairsBW", "stairsBN", "UNUSED9", "UNUSED10",
-- "doorW", "doorN", "lightswitch", "radio", "curtainN", "curtainS", "curtainW", "curtainE", "doorFrW", "doorFrN", "tree",
-- "windowFN", "windowFW", "UNUSED24", "WestRoofB", "WestRoofM", "WestRoofT", "isMoveAbleObject",
--FlagTypes
-- "collideW", "collideN", "solidfloor", "noStart", "windowW", "windowN", "hidewalls", "exterior", "NoWallLighting",
-- "doorW", "doorN", "transparentW", "transparentN", "WallOverlay", "FloorOverlay", "vegitation", "burning", "burntOut",
-- "unflamable", "cutW", "cutN", "tableN", "tableNW", "tableW", "tableSW", "tableS", "tableSE", "tableE", "tableNE",
-- "halfheight", "HasRainSplashes", "HasRaindrop", "solid", "trans", "pushable", "solidtrans", "invisible", "floorS",
-- "floorE", "shelfS", "shelfE", "alwaysDraw", "ontable", "transparentFloor", "climbSheetW", "climbSheetN", "climbSheetTopN",
-- "climbSheetTopW", "attachtostairs", "sheetCurtains", "waterPiped", "HoppableN", "HoppableW", "bed", "blueprint",
-- "canPathW", "canPathN", "blocksight", "climbSheetE", "climbSheetS", "climbSheetTopE", "climbSheetTopS", "makeWindowInvincible",
-- "water", "canBeCut", "canBeRemoved", "taintedWater", "smoke", "attachedN", "attachedS", "attachedE", "attachedW",
-- "attachedFloor", "attachedSurface", "attachedCeiling", "attachedNW", "ForceAmbient", "WallSE", "WindowN", "WindowW",
-- "FloorHeightOneThird", "FloorHeightTwoThirds", "CantClimb", "diamondFloor", "attachedSE", "TallHoppableW", "WallWTrans",
-- "TallHoppableN", "WallNTrans", "container", "DoorWallW", "DoorWallN", "WallW", "WallN", "WallNW", "SpearOnlyAttackThrough", "forceRender"
local specialOverrideExceptions = {"IsoCurtain","IsoDoor","IsoWindow","IsoBarricade","IsoLightSwitch"}
---Vanilla has a getFloor but it causes layering issues if there's objects over the floor - like walls
---@param isoGridSquare IsoGridSquare
local function ifFlagTypeGetObject(isoGridSquare, isoFlagType)
local isoObjects = isoGridSquare:getObjects()
local objWithFlagFound
local lastSpriteObject
if isoFlagType == IsoFlagType.solidfloor and isoGridSquare:getProperties():Is("BlocksPlacement") then return end
for i=0, isoObjects:size()-1 do
---@type IsoObject
local isoObj = isoObjects:get(i)
if isoObj then
local isoObjSprite = isoObj:getSprite()
local isoObjSpriteName = isoObjSprite:getName()
if isoObjSprite and isoObjSpriteName then
if isoObj:getType()==IsoObjectType.wall and string.find(isoObjSpriteName, "roofs") then
else
if isoObjSprite:getProperties():Is(isoFlagType) then
objWithFlagFound = true
lastSpriteObject = i
end
if objWithFlagFound then
if (not isoGridSquare:getProperties():Is("IsMoveAble")) then
lastSpriteObject = i
end
for _,type in pairs(specialOverrideExceptions) do
if instanceof(isoObj, type) then
lastSpriteObject = i
end
end
end
end
end
end
end
if objWithFlagFound and lastSpriteObject then
return isoObjects:get(lastSpriteObject)
end
end
This function scans through objects on a tile and looks for flag types
there is a setproperties function
you'll have to cannibalize this to make it do what you want
I included the flag types I have as a comment to assist
I could have sworn I had a thing that set flag types though
let me check again
lmk if it helps or doesn't, I'll try to strip off the extra bits
This was also done specifically for grass/vines/etc
So if you already have a way to reference the box you can probably skip a few steps
Also, wait
you wanted cars to pass through - like mailboxes?
as in break them?
woah what the F you didnt need to write it lol i was mearly asking if theres a way. like a snippet would be nice
but thanks alot man
this is old stuff
ow ok but still thanks alot
i just need top modify it and with your permission
ofcourse
but this may not do what you need without modifying it
I also seethere's a isoproperty called 'hitbycar' but I dont see where it leaves behind something else
"HitByCar"
here we go
yep yep i got that ๐ i will first need to check isoflag cuz i think poltergeist mentioned it was temporary
public void HitByVehicle(BaseVehicle var1, float var2) {
short var3 = this.Damage;
this.Damage = (short)((int)((double)this.Damage - (double)var2 * 0.1D));
BaseSoundEmitter var4 = IsoWorld.instance.getFreeEmitter((float)this.square.x + 0.5F, (float)this.square.y + 0.5F, (float)this.square.z);
long var5 = var4.playSound("VehicleHitObject");
var4.setParameterValue(var5, FMODManager.instance.getParameterDescription("VehicleSpeed"), var1.getCurrentSpeedKmHour());
WorldSoundManager.instance.addSound((Object)null, this.square.getX(), this.square.getY(), this.square.getZ(), 20, 20, true, 4.0F, 15.0F);
if (this.getProperties().Is("HitByCar") && this.getSprite().getProperties().Val("DamagedSprite") != null && !this.getSprite().getProperties().Val("DamagedSprite").equals("") && this.Damage <= 90 && var3 > 90) {
this.setSprite(IsoSpriteManager.instance.getSprite(this.getSprite().getProperties().Val("DamagedSprite")));
if (this.getSprite().getProperties().Is("StopCar")) {
this.getSprite().setType(IsoObjectType.isMoveAbleObject);
} else {
this.getSprite().setType(IsoObjectType.MAX);
}
if (this instanceof IsoThumpable) {
((IsoThumpable)this).setBlockAllTheSquare(false);
}
if (GameServer.bServer) {
this.transmitUpdatedSpriteToClients();
}
this.getSquare().RecalcProperties();
this.Damage = 50;
}
if (this.Damage <= 40 && this.getProperties().Is("HitByCar") && !BrokenFences.getInstance().isBreakableObject(this)) {
this.getSquare().transmitRemoveItemFromSquare(this);
}
}
So my above code isn't needed
you guys should be able to apply a damagedsprite property to the boxes
and add the hitbycar property too
shame there isn't a lua event
would be a bit more manageable
i kinda dont get.. i know your saying to apply the this.getSprite().getProperties().Is("StopCar")
but how do i apply it to all the sprites permanently
cuz if i dont figure this out then ill have to use an ontick event
that checks tiles around the player
so this code is still relevant yeah?
Question, if the sprite info is changed in the map editor would that apply retroactively?
The function I gave you grabs the highest object with exceptions
it's strictly for layering
but it parses through a tiles' objects based on isoproperties and sprites
Also worth noting idk if flag changes get saved
chances are for the sake of savegame bloat it relies on the sprite
which is why I asked if it were possible to change the vanilla sprite's properties instead
@ancient grail ```lua
---@param isoGridSquare IsoGridSquare
local function alterObject(isoGridSquare, spriteName)
local isoObjects = isoGridSquare:getObjects()
for i=0, isoObjects:size()-1 do
---@type IsoObject
local isoObj = isoObjects:get(i)
if isoObj then
if not isoObj:getModData()["checkForAlterObject"] then
isoObj:getModData()["checkForAlterObject"] = true
local isoObjSprite = isoObj:getSprite()
local isoObjSpriteName = isoObjSprite:getName()
if isoObjSprite and isoObjSpriteName then
if isoObjSpriteName==spriteName then
isoObjSprite:getProperties():Set("HitByCar")
isoObjSprite:getProperties():Set("DamagedSprite", "damaged_box_sprite", false)
end
end
end
end
end
end
Not tested
also not sure if the changes are permanent either
you would need a damaged box sprite for this to work btw
you can also stick anything in as well'
ow thnx alot sir!
ill test it soon
ill just send it to daddy dirk and tell him its from you ๐
alterObject(isoGridSquare, "trashcontainers_01_24")
alterObject(isoGridSquare, "trashcontainers_01_25")
alterObject(isoGridSquare, "trashcontainers_01_26")
alterObject(isoGridSquare, "trashcontainers_01_27")
heres how to use it irght?
try getting the spritename to know
so i make an event?
function doAlterTrashbox()
alterObject(isoGridSquare, "trashcontainers_01_24")
alterObject(isoGridSquare, "trashcontainers_01_25")
alterObject(isoGridSquare, "trashcontainers_01_26")
alterObject(isoGridSquare, "trashcontainers_01_27")
end
Events.LoadGridsquare.Add(doAlterTrashbox);
quick question
yeah
is this only for adding more crushable objects?
no this is just so that the car can passthru
or would he want to be able to do this for other changes?
this would destroy the object
and replace it with a damaged version
like mailboxes, fences, traffic things that aren't cones
google says they're traffic barrels
ahh ok then
I dont think there's a way to make something only passable by car
but your function seems to be missing a param
?
like what it will look like?
i think i know how tho
---@param isoGridSquare IsoGridSquare
local function alterObject(isoGridSquare, spriteName, damaged_box_sprite)
local isoObjects = isoGridSquare:getObjects()
for i=0, isoObjects:size()-1 do
---@type IsoObject
local isoObj = isoObjects:get(i)
if isoObj then
if not isoObj:getModData()["checkForAlterObject"] then
isoObj:getModData()["checkForAlterObject"] = true
local isoObjSprite = isoObj:getSprite()
local isoObjSpriteName = isoObjSprite:getName()
if isoObjSprite and isoObjSpriteName then
if isoObjSpriteName==spriteName then
isoObjSprite:getProperties():Set("HitByCar")
isoObjSprite:getProperties():Set("DamagedSprite", "damaged_box_sprite", false)
end
end
end
end
end
end
function doAlterTrashbox()
local damaged_box_sprite="ddd_dmgsprites_01_1"
alterObject(isoGridSquare, "trashcontainers_01_24", damaged_box_sprite)
alterObject(isoGridSquare, "trashcontainers_01_25", damaged_box_sprite)
alterObject(isoGridSquare, "trashcontainers_01_26", damaged_box_sprite)
alterObject(isoGridSquare, "trashcontainers_01_27", damaged_box_sprite)
end
Events.LoadGridsquare.Add(doAlterTrashbox);
@viral compass sir heres the thing you need .. credit goes 100% to chuck ๐
ow this is still missing the dmg sprite
since theres no such thing
i left it blank
local setHitByCar = {}
setHitByCar.applyTo = { ["trashcontainers_01_24"]="ddd_dmgsprites_01_1",
["trashcontainers_01_25"]="ddd_dmgsprites_01_1",
["trashcontainers_01_26"]="ddd_dmgsprites_01_1",
["trashcontainers_01_27"]="ddd_dmgsprites_01_1", }
---@param isoGridSquare IsoGridSquare
function setHitByCar.apply(isoGridSquare)
local isoObjects = isoGridSquare:getObjects()
for i=0, isoObjects:size()-1 do
---@type IsoObject
local isoObj = isoObjects:get(i)
if isoObj then
if not isoObj:getModData()["checkForSetHitByCar"] then
isoObj:getModData()["checkForSetHitByCar"] = true
local isoObjSprite = isoObj:getSprite()
local isoObjSpriteName = isoObjSprite:getName()
if isoObjSprite and isoObjSpriteName then
local damagedSprite = setHitByCar.applyTo[isoObjSpriteName]
if damagedSprite then
isoObjSprite:getProperties():Set("HitByCar")
isoObjSprite:getProperties():Set("DamagedSprite", damagedSprite, false)
end
end
end
end
end
end
Events.LoadGridsquare.Add(setHitByCar.apply)
This will let you set the sprites and damaged in the list
if this works - testing other stuff atm
modified this too
Your snippet wouldnt work atm
added the sprites you mentioned to mine
using the list should avoid calling the scan multiple times per square
also, just an fyi setting local inside the function would make it inaccessible inside of another function
- the variable is a string in the other function
So changing tile properties in the map maker should be a better approach for custom tiles
Im not sure if changing the tiles for vanilla would work when loading an old save but it should also apply to a new one
Quick question: Lua is not a language I develop with, I need to pass parameters to a variable hooked into an Event.
Something like:
local function something(yada)
-- stuff here
end
Event.Every10Minutes.Add(something('something_here'))
However, I understood that that format is not working / not correct
Is there a way to do that? maybe something like Event.Every10Minutes.Add(function[, params])?
Thx guys!
Does anyone know if there is a chance to completely remove Brita's weapons loot from zombies? Very important 
When you add functions to Events you can't pass parameters
Event.Every10Minutes.Add(something)
Where something is the function
What format/order yada takes depends on the java side of the hook
Some hooks don't have any arguments
In other words - when you use Events.thing.Add(funtionName), anytime the hook is called on in java, it supplies the arguments that passes onto your function.
Also it's EveryTenMinutes
Only used once in GameTime.java with no arguments - ```java
LuaEventManager.triggerEvent("EveryTenMinutes");
you can use a local param inside your file or something like
Events.EveryTenMinutes.Add(function()myfunction(param) end)
gotcha, thanks ๐
If anyone uses vehicle recycling, its borked atm cause of the propane change. Since NoctisFalcon hasnt been on in a pretty long while, I made a quick fix. Should just decrease the cost by a factor of 10 to match the torches. https://steamcommunity.com/sharedfiles/filedetails/?id=2887190684
Can someone tells me why am I stoopid and cannot see the file content loaded inside the debugger?
also, how can I print out something in the command console from my mod? Can't seem to find a documentation for that ๐ฉ
print(variable)
Anyone know how to get a lot of mods and not start getting laggy after a couple hours of playing?
Do I need to put more ram into the game?
@lyric bolt There is Simple Vehicle Recycling that uses vanilla action.
Oh, I didnt see that one
what is the difference between writing the code in "lua folder" vs "script folder"
lua is only for lua codes and scripts are for register items, models, sounds, etc via text file (writing in code format)
mm so a code to modify the damage in a weapon should be in "scripts" and a code to spawn a weapon on-key-press on "lua" ?
@ruby urchin or could you give me an example ?
yeah, It could be said
No need create code to spawn the weapon, you can spawn via debug mode
ty
sorry for asking again but... is this something normal or common?
I realized that started to happen in the new updates, I get it when I have a syntax error or something like that
dang it, go figure now what it is ๐
happn to me too .. its weird
local shotgun = InventoryItemFactory.CreateItem("Base.DoubleBarrelShotgun");
shotgun:setTooltip("initially has 6 chambered shells");
shotgun:setClipSize(6);
shotgun:setCurrentAmmoCount(60);
shotgun:setRoundChambered(true);
shotgun:setAimingTime(90);
shotgun:setMinDamage(5)
shotgun:setMaxDamage(12);
shotgun:setName("SOS ToxSicK Event Shotgun");
getPlayer():getInventory():AddItem(shotgun);
do this using lua console
Is it possible to replace an items sprite with tile sprite and vice versa
Using debug
Just curious
Altho i think its possible to change item sprite using any png
For a mod that need to alter the zombies behaviour I'm creating the "init" file on the lua/server directory. As I want it to work also for single player, should I create an initialization script in the lua/client as well and maybe move the common parts into lua/shared?
Specifically, the kickstart of the mod is bound to Events.OnServerStarted but I think that if you play single player that event doesn't trigger (unless you host locally of course). Is there an Event that is better for when it's meant to detect a single player session starting?
files in the server folder are loaded on the client, so you don't need to worry about singleplayer
Generally speaking, a good diagram of the lifecycle of the Events would be greatly appreciated. The wiki have only some of them and the order with which they are invoked (or even in which use case) is not indicated
OnGameStart is usually used for stuff like this, but i'm not sure when you need it exactly
alright, so I maybe just need to detect if it's currently running on a client or not, because if I run only Events.OnServerStarted, in single player it won't start at all
perfect OnGameStart it is then
Just as soon as the game has loaded everything, ideally either just before or after the player click to "enter"
that fires after the click, i think
it will need to change zombies behaviour so it needs them to be loaded in the cell at least ๐
it's more than enough then ๐
thanks โค๏ธ
i suggest that you refer to other zed alternating mods
alot of them
to check how they tiggered it
There's an OnZombieUpdate event
that's what I used
although getting reliable AI to work is a bit of a mess
tho you managed to pull it off
yeah, but it's not something I'd recommend for a first outing into PZ modding
just curious.. this is not important...
i noticed
ProfessionFactory.addProfession("mechanics", getText("UI_prof_Mechanics"), "profession_mechanic", -4);
doesnt have a removeProfession() counterpart
most certainly not
a lot of things can't be undone once they're put into the profession factory
wouldn't be surprised if removing a profession isn't possible
yeah i guess your right
you'd have to get the ui to hide it or something
RBBasic:getSurvivorProfession():get(i)
ithink udderlyevelyn may have done this as i recall she mentioned that she replaced every
oooo its trait
not profession so nevermind
Pretty sure you can probably use an inherited remove(
Also probably better off hiding it in the UI
you guys think the vision is handled on the java side? i wanted to make a mod that allows dbg and admin see everything
behindwalls and behind you
or maybe make like a camera offset to character mod
like the plaeyr isnt moving but the camera is
would be a better observer mode i think
cant seem to find it anywhere excpt isbaseicon
but thats related to foraging
So far i looked there is a calculatevisioncone but its not accesible through lua or atleast no luamethod to get it
Thanks
I knew it but I really had to ask
I was thinking of the fact that when you player turns onto zed the camera still follows it around despite it being a zed
And thats a diffrent iso i think
Also i noticed
When someone kills ur zed and pickup your corpse
The cam will now follow the player
And the vision cone is then transfered
To the zed then to the player
If im not mistaken
Do you mind sharing which mod have you made? I'm trying to make a mix-up between Random Zombies and Night Sprinters. basically, having the logic of Random Zombies but with two alternating schedules. One for night and one for the day. The alternating schedule is there. To apply the distribution I'm getting the zombie in a cell that is activated by a player presence and applying it one-by-one but the actual logic of the distribution is kinda overly complicated in my opinion (for Random Zombies) but I can't be sure because Lua is not really my bread and butter (I'm a software engineer but never really worked with Lua, more like js/node/typescript). On top of that, I need to find the better (aka less heavy) way to update the zombies because Random Zombies uses OnTick which is definitely CPU intensive, especially with big hordes.
https://steamcommunity.com/sharedfiles/filedetails/?id=2580001162 This is the mod that has the ZombieAI
ah man, I love that mod. Big props to you ๐
You probably dont have to worry about the actual tricky bits with outfits and items
hehe, thanks
I'll check out the logic for the zombies yeah ๐
Random Zombies as in some shamble, some walk, some sprint?
But then at night they all sprint?
yes
well
random zombies have some shambles, crawl, sprint, etc
night sprinters everyone simply sprint at night
does the randomness have to be consistent from play throughs?
I wanted to make it as:
day: choose your distribution
night: choose your other distribution (can be the same)
like does it matter if from day to day the same zombie could be doing different things?
ah
I'd say that a zombie should stay "crawler" as long as it's in your view and at least a bit after that or it would be really anger inducing if you turn around and that crawler start to sprint ๐ (altough, also cool)
The issue I've seen with zombies, and others have had similar problems, is that when they're saved/loaded alot of data is not kept - including modData
Also altering the zombie doesn't change for the most part
If you look in SWH, I had to assign an embedded weapon to act as the AI token, and also assign which outfits get 100% to embed the token
I need to double check how Random Zombies does it because, sprinters usually just die as they reach you quite fast. The rest, you either tend to kill them or you loose them. And if you cut them loose, you don't really care if you meet them again after a couple of in game hours and now they are shambler for example
I'll check your solution as well
My solution wouldn't really work for random speed zombies
Also, speed might be one of the variables that saves
so the worry from me might be moot
It's fine, right now I'm in a phase in which I just need to see some mods doing some "serious" coding so I can understand how to properly work with Lua in PZ
Lua is very simple, I'm sure you'll catch on fast
There is also this: https://www.lua.org/demo.html
For practicing syntax and logic stuff
alright, I'll take a break and look into it a little more tomorrow, thanks for the chat and suggestion/hints/etc ๐
np
hey is there an easy way to "rework" one weapon to create a modd? (I don't want to go to the actual game scripts folder an tweak the stats, but I don't know wich every single thing should I copy and paste on another folder to create "the modd" that modifies that weapon)
This is my reply to dislaik's advice to you , u must have missed it
But if you want a more permanent solution
Check out sir blairs post earlier about overwritting
oh bummer, kahlua probably doesn't have the __len metamethod. dangit
I have a feeling you wont be able to see my reply again..
Owell ๐ฎโ๐จ
When i tried to mess with lua outside of pz i learned alot and was then able to apply it to pz. So evrything became so much easier
instead of overwriting the script, you should write a lua script like this:
local item = getScriptManager():getItem('Base.ItemName')
if item then
item:DoParam('MinDamage = 0.2')
item:DoParam('MaxDamage = 0.7')
-- etc
end
DoParam is just like adding a line to that item's script, but won't cause compatibility issues
Same thing you sent me earlier . Btw want able to return anything with recipe arrays
@ancient grail srr i do it, but not sure how i would go doing all the changes that i want on that way.
1.- needs to get the %weight on my character, and the lowest it is then dmg of the weapon "heavy weapons" should increase
2.-needs to get the %stamina on my character, and the lowest it is then the critical chance, attkspeed of the "heavy weapons" should decrease
3.-character cannot use it if he is "really" hungry
so it*
I think it should have a require line or something
oh that's a lot more complicated... are you familiar with lua/programming?
i don't know what you meant here
not lua but i'm familiar with c++
Ah forgive me. It was hi117
Lol too sleepy iguess. Going to bed now for reals. Have a good one guys
Have a good one
Hey, does Distributions only examine Distributions[1] or does it examine all elements in the table?
like if someone does this, does it just break loot in PZ? table.insert(Distributions, 1, distributionTable);
-- the games distribition table should always be the first in table. yeah this seems like it might break stuff
Normally it shouldn't be 1, but I think I've seen that before without error.
merge code should still work
not necessarily, best practice would be to append to the table not jam yourself into the #1 slot
is that the only part that messes the distributions?
uhh I don't understand the question
I'm working on an incompatibility with my mod patching the distribution table and brita's
brita's uses table.insert which causes the table to just not be there anymore basically
nah, its brita's being bugged, issue resolved tyvm
I mean as long as I've been playing that mod has always been bugged.
(and my mod tbf, I could probably also append to the end but they should too. we're both wrong lol)
are you looking for inventoryfemale?
yep
among other stuff, there's a few things that break
the entire table gets messed up until mergeDistributions is called
local target = {"inventorymale","inventoryfemale"}
for _,v in ipairs(target) do
for _,i in ipairs(items) do
table.insert(SuburbsDistributions["all"][v]["items"],i)
end
end
this is in my old files
Hey- Anyone know of any tool / framework to make recipes faster than typing them all out every single time?
not a framework, but you can edit recipes through lua in a loop
including adding your own
SuburbsDistributions is the table I use because people bump Distributions[1]
it's the same table
the better way would be to append to the table btw
since zomboid merges the tables after load anyway
sure, but there some things that didn't work like that so better do it yourself
?
don't remember now
it seems like MergeDistributionRecursive would handle all use cases
including partial patching
does anyone know how to get this type of sandbox option? (That hides other options)
https://projectzomboid.com/modding/zombie/scripting/ScriptManager.html has some fields and functions that might help with this
declaration: package: zombie.scripting, class: ScriptManager
Boolean?
yes, but it's a checkmark that disables other options
does it do procedural tables?
?
just look at SuburbsDistributions.lua's mergeDistributions and MergeDistributionRecursive functions
I don't see ProceduralDistributions in that file
well, MergeDistributionRecursive can be called by your code and should work with any table
i don't think you can do that
i'd have a look at the ui lua, that page is probably somewhat hardcoded
I already looked, couldn't find anything related to it. Fairly certain it's a recently added thing, as I don't remember seeing it before.
no that's been there since at least b40
How would I use this?
no idea, im figuring this out myself for some stuff ngl
lmfao fair enough. I wish that ItemZed was working, because that would be so incredibly helpful
tbh eventually im planning on ditching scripts entirely and using lua to define everything
Trying to work on a bunch of recipes for a big server I am a part of, goal is to 'Craft everything' so I really dont want to have to do all of that by hand lmao
any reason why that would be prefered?
there's just better support for automatic formatting, I can do loops, etc
i've been tempted to do that myself, i always end up doing weird conditional stuff no matter what so i might as well just make lua the entire process
its also less confusing since you don't need to deal with the import system
hey, can i make weapos hit faster? or animations dosen't allow it to happend?
Did something change on the require for 41.78?
I am having this error
-----------------------------------------
function: ExpandedHelicopter01c_MainCore.lua -- file: ExpandedHelicopter01c_MainCore.lua line # 10 | MOD: Expanded Helicopter Events
Callframe at: require
function: cmd_helicoptero.lua -- file: cmd_helicoptero.lua line # 4 | MOD: ExtrasDescoladosCMDHELI.```
But I changed nothing on my code yet
To be fair, I am requiring a file from another mod
That is loaded before my mod
weird, nothing changed that i heard about, and require has seemed fine for me recently - can we see the relevant code?
require 'lua_server_commands'
require 'cmd_utils'
require "ExpandedHelicopter00a_Util"
require 'ExpandedHelicopter01c_MainCore'
require "ExpandedHelicopter06_EventScheduler"
local EHETI_eHeliEvent_ScheduleNew = eHeliEvent_ScheduleNew <<< Line 10 is this
function eHeliEvent_ScheduleNew(startDay, startTime, preset)
end
AFAIK nothing changed neither on my mod or EHE mod
i can't see any reason that would cause an error...
the 'callframe at: require' is weird, require is allowed to fail
Maybe because its now single quote instead of double?
i use single quotes exclusively and i've never had any trouble
Honestly dont understand what changed
which folder is this file in?
one question, whats this error?
Cannot invoke "se.krka.kahlua.vm.KahluaTable.len()" because "<local2>" is null
bc i get it everywhere
looks like java used the wrong way.
you're not looking in the right file?
Those are done entirely in lua
Can you provide the error?
it's line 10 of a file in server folder, which has eHelicopter:new()
doesn't seem like that is defined yet at that point
hi and buenas noches, i want to start modding from this game, where can i start?, i mean, what programs to use, what languaje and frameworks the game use and so on, i already have experience programing in c, c#, java, typescript and others
its pretty much entirely lua for code, and you can use whatever program you like. I use intellij IDEA, but I've seen everything from notepad to VsCode on here
lua
intellij IDEA is powerfull but man its so complicated sometimes
I guess, if you're trying to do some Gradle stuff or whatever. As just a basic IDE with code highlighting it does the job with no hassle
ok i understand, but I meant if there is any software like the Project Zomboid Modding tools from steam or another one, i already use the jetbrains collection
I believe the modding tools are mostly for models and textures, haven't looked at them yet myself
intellij uses an entire extra gigabyte of ram than vsc on my machine, so i don't really have much choice
I'm also new to the whole pz modding thing, but it seems like the modding tools on Steam are just for mapping
You should probably learn to use Blender or some other equivalent modelling software
Ah, he may be trying to load that file before the file that defines that table/class is loaded
ok thanks!, im gonna start with lua and see what can i do later
@topaz lark That one of the best guide out there https://github.com/FWolfe/Zomboid-Modding-Guide
https://github.com/MrBounty/PZ-Mod---Doc this one has some good tips too
And one of the best tip is : check other mods to see how they do what they do. A bunch of them are well commented
I'll keep an eye on him, gracias!
Is the creator of Skill Recovery Journal active in here?
isn't that Chuck?
idk haha, I'm just looking for some assistance in fixing better literacy to work with SRJ for our server.
and considering they just pulled better literacy, I may take it over since i've been patching it for our server anywho
i'd better make sure my mod works with skill journals ๐
Is it? Ow
does anyone know if rawget works in PZ's lua?
Iโll ask here too, and see if someone might be able to point me in the right direction.
The literacy mod is over writing the ISReadABook.lua and it adds pages to every piece of literature and then based on a characaters literacy skill it adjusts the read time.
The Skill Journal is using their own :update() and :new() but they're doing it in their own file reading/Skill Recovery Journal Read.lua
Is there a way that I can do something like
end```
To call the code in the skill recovery journal file so it just does that instead of doing all the code in ISReadABook.lua
It seems to, yea
nice
if it's not too much work, you should rewrite it not to overwrite the entire file, it's going to cause endless problems as long as it works that way
i have a question for folks who know things about true music: do you know if it's possible for cassettes/vinyls to 'overwrite' or push other, potentially more valuable loot out of the table? how exactly does loot spawning work in that regard?
It touches every piece of literature in the game, is it possible to still retain that functionality doing that?
i have a mod that's very similar to better literacy
it doesn't overwrite anything, and works perfectly
Our serverโs difficulty is balanced completely around BL and SRJ so I just want them to play nice haha.
it's just a really bad idea to override things in general
I completely agree
apart from some vanilla functions that have a massive amount of code in them there's rarely a good reason to, and from what i know of what better literacy does it really doesn't need to at all
They also overwrite the entire definition for every book, and thatโs how they added more books
So when .73 dropped and the new cooking recipes came outโฆ
hey @bronze yoke the literacy mod i use is actually yours ๐ I was checking my modlist to see which one I used ๐ great mod btw
Link yours Albion, Iโll take a look
aw thank you ^_^ look forward to a huge update soon
And yours works with SRJ?
btw i make the I don't need a lighter mod, and the more recent I Might Need A Lighter, I'm open to any feedback ๐
Since youโre not overwriting IsReadABook it probably does
so i've noticed that sometime in the past couple of pz updates, something changed or broke in loot distribution--or at least so it seems. i'm having a weird problem where i have a mod that has a sandbox setting that multiplies the loot distribution chance, and if i set that to 0, i can see in loot zed that the items have a 0% chance to spawn but still spawn at the same rate as if the values were totally unmodified
oooh i haven't gotten to try it yet but i might need a lighter looks great
as a long time i don't need a lighter user
is anyone else having issues like this/does anyone else know loot distribution well enough to help me with this concern? i'm not really a modder at all lol
i don't use srj myself, but i've never heard of any bug reports to do with it
Since you built it out correctly I bet it runs fine
Well it's pretty much a V2 with all the feedback i got, sandbox options, etc. the goal is to balance it a bit more. As it was my first mod I rewrote a good chunk of it too ๐
keep up the great work!
Weโve had some odd spawning issues where some things set not to spawn, but theyโre incredibly rare, but nothing Iโve been exceptionally worried about
likely, the distributions are being set after the java reads them, so they don't actually work consistently
that's interesting and frustrating, because this used to work just fine
unless that mod has a specific solution to this, sandbox options load after distributions are read
except sometimes they don't, i'm not sure what the exact rules for it are, but it often leads mod makers to think it always works when it doesn't
hmm. in that case, i guess the best way to do this would be to make a patch that overrides the original distributions
not as much flexibility but it could serve the same function
all you actually need to do is make sure the sandbox options are loaded before the distributions are added to the table, and that ItemPickerJava.Parse() is called after that
hmm
that's a little above my paygrade ๐ i'm only barely a modder trying to kludge something together with true music
if I had a file called foo_bar.lua that contained something like
local bar = {}
bar.test = "test"
return bar
and then wanted to use it in another file, what is the proper syntax for require?
require("foo_bar.lua")
require("foo_bar")
require("bar")
something else?
require("foo_bar")
although i think you need to assign it to a variable
like bar = require 'foo_bar'
oh ok, should probably make that local too
of course
It is I, the author of skill recovery journal
you sometimes have to put a folder name in the require as well, right
I already do this
yeah, it's the path after lua/client/ (or shared or server)
if anyone could explain to me like i'm five how to force the sandbox settings to be loaded before the loot distribution tables for this mod are, that would be very helpful :)
oh ok, so only if I've added a subfolder
which event are the distribution tables set on?
lmao lea i'm trying to figure out the same thing
oh they're just out there... that's difficult
yeahhh that's how true music does it
I don't think there's an event - isn't on Lua load?
distributions aren't merged immediately
there's even a pre and post distribution load event
modifying the chance in the distribution code doesn't do anything either for me (maybe that's already established)
i would override the file, put them on an event that happens after sandbox options set (i use OnInitGlobalModData), and then call ItemPickerJava.Parse() at the end
Odd itโs not working on our server, I blame literacy. I think weโre going to just rip off the bandaid and move to Albionโs mod, weโre testing it now
i hate to just continuously go 'ok but simplify it further' but i really can't stress enough that i genuinely don't know how to code ;w; i'm a pathetic helpless little babey who knows nothing, so if you could walk me through that in more depth i'd be grateful!
you can also force the sandbox options to load early, but it's not as good of an idea as it reads from the file (much laggier) and probably won't work in singleplayer
I did push an update that forces a time as other mods also cause issues
Honestly getting tired of the bug reports - might drop isRead
All the code you have to set the loot distribution, wrap it in a function that is called on the OnInitGlobalModData event e.g. ```lua
Events.OnInitGlobalModData.Add(function()
-- Set loot tables here
end)
Events.OnInintGlobalModData.Add(function()
-- loot table stuff
ItemPickerJava.Parse()
end)
i was going to pastebin it to confirm that it looked right but just one of these distribution files exceeds their max limit LMAO
lookin right?
think so!
thanks a ton for the help you guys! this is a super big deal for this mod and the folks who use it will be happy that this feature is functional :)
i'll give it a test run
I was gonna put this on the steam page, and you might already know this, but it might make updating the mod with new songs less annoying if you made a function to add it to the loot table and then just called it for each song
something like function registerLoot(item, chance, allocation) table.insert(ProceduralDistributions.list[allocation].items, item); table.insert(ProceduralDistributions.list[allocation].items, chance); end
would be a pain to move everything over to that though
honestly adding new songs isn't really all that hard anyway
just a few copy+paste and find+replace operations
Does the ItemPickerJava normally parse the tables prior to OnInitGlobalModData?
yeah, the problem is item picker java parses before sandbox options are loaded
ok, fair enough
Ah okay
when i add new songs i literally just whack them onto the end of the existing files lol
super ez
or sometimes anyway, sometimes it worked but it wasn't 100% of the time
Yea, that whole order of loading sandbox vars is a pain
albion you're super helpful, so thank you again! and tyrir this is like the third time you've been a huge help to me
big ups to both of you <3
^_^
i do have a second lil question that kinda goes along with this: should i worry about over-crowding loot tables with music? with the distribution the way it is, are cassettes/vinyls able to crowd out other, more valuable loot?
if that's the case i'll probably set the default loot values much lower
yeah, they do
i wrote a whole fancy script for my literacy mod that makes sure that skill books have the same chance of spawning no matter how many you have enabled, and then i realised everyone uses true music anyway and that it will just make them way rarer than if you have it turned off U_U
ahh darn, in that case i'll probably set the default sandbox values much lower
i wish i could make it spawn a ton without crowding other stuff out, but oh well
you can probably increase the total rolls to compensate or something, but i've never played with it
maybe i'll add to that script to make it multiply the book spawn weight based on the total weight of the container compared to what it should be in vanilla...
you ever write a piece of code that seems really good and just feel smug about it?
that's like 70% of why i program
lol
very possible! lemme give it another go
you could check if the spawn chance is 0 and just not add the item to the table
AH HA, ok that's totally what it is
i was just putting it at 0 to test, so 0 not being allowed isn't really relevant to my use case
loot seems much rarer with a low number as it should be
thank you again for the help albion!!
haha glad that worked, i was scared for a moment that my mods weren't actually working as i thought either ๐
with spawn chance stuff you can only ever be about 70% sure it's working
my pride and joy.. restored to full functionality... yipee
nice!
Hello, how do I make a helmet compatible with the susceptible mod?
I'm moving some code from client side to server side. it used to run OnPlayerUpdate, what would be roughly equivalent on the server if I want it to run every cycle? OnTick?
yea
OnTick is raised 10 times a second on the server-side, so less frequent than client-side where it is tied to fps
well that's good. As long as nothing happens in between ticks
this isn't your issue though, this is just other lazy mod authors overwriting isRead instead of doing it the right way.
Ah
What mod is it
I can add it to my list
I have an on going mod list that I call require on
To load first
So I can override them
better literacy, but it sounds like the developer of that mod wants to fix it themselves
Is that slime's mod?
I wonder why we dont see the other developers around mod chat. Ive only talked to theZ the developer of door remote / turret mod
But he said his not active on discord.
i think so!
I think I am?
the error technically points to the expanded helicopter events file, but i checked and there isn't anything of note on that line that should break anything
especially since ehe wasn't updated when the problem appeared
-----------------------------------------
function: ExpandedHelicopter01c_MainCore.lua -- file: ExpandedHelicopter01c_MainCore.lua line # 10 | MOD: Expanded Helicopter Events
Callframe at: require
function: cmd_helicoptero.lua -- file: cmd_helicoptero.lua line # 4 | MOD: ExtrasDescoladosCMDHELI
ERROR: General , 1668211925499> 249.385.395> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index of non-table at KahluaUtil.fail line:82.
ERROR: General , 1668211925500> 249.385.396> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index of non-table
<kalua errors here>
at java.base/java.lang.Thread.run(Unknown Source)
LOG : General , 1668211925505> 249.385.401> -----------------------------------------
STACK TRACE
-----------------------------------------
function: ExpandedHelicopter01c_MainCore.lua -- file: ExpandedHelicopter01c_MainCore.lua line # 10 | MOD: Expanded Helicopter Events
Callframe at: require
function: cmd_helicoptero.lua -- file: cmd_helicoptero.lua line # 4 | MOD: ExtrasDescoladosCMDHELI
nov. 11, 2022 9:12:05 PM zombie.Lua.LuaManager RunLuaInternal
GRAVE: at ExpandedHelicopter01c_MainCore.lua:10```
Oh, I know what happened, now that I ran it
Dang it
attempted index of non-table
I cannot fix this
I need to find Jab
There is a mod, called LuaServerCommands
That requires patching a file on the server at the Zombie folder
It probably changed enough so it doesnt work anymore with the last patch
I think Ill need to learn java to fix that
Is it not just a table/class that's not yet defined but expected to be defined at line 10 of ExpandedHelicopter01c_MainCore.lua?
I didnt change the mod
At all
All I did was update the server and reapply the patch
It stopped working with the update
The ONLY thing I changed was the server version, basically
So yea, got a project
line 10 is
function eHelicopter:new()
but eHolicopter is defined here:```
./mods/Expanded Helicopter Events/media/lua/server/ExpandedHelicopter01a_MainVariables.lua:eHelicopter = {}
Looks like you are requiring `ExpandedHelicopter01c_MainCore` in such a way that its prerequisite lua files aren't loaded
But it should obey the order on the Mods in the .ini file, right?
So technically, as long EHE is before CMDHELI, it SHOULD work, right?
nope
@bronze yoke are you considering adding options for different skill multipliers that the books give?
what do you mean by that?
hmm, how to explain it
the literacy skill itself would affect the multiplier that the skill gives you. So at Literacy 5 and below you get vanilla multipliers, but at literacy 10 you get a huge multiplier.
oh like better literacy? i excluded that because i didn't really like it from a balance stand point (and i need some excuse to call it not a total ripoff) but if that would be useful to you i could add it
i have a massive update that's just missing a little bit of content before i push it, and at this point i'm having fun just seeing how long i can make the changelog, so feature requests are good
yea, we use that at the core of ours
We wanted higher multipliers because of no disassembling, so those first few levels are really tough, unless you have the books.
oh that makes sense, it'd be almost mandatory then
which is why we're pulling our hair out!
hahaha
we only return 35% xp back with the skill journal and only crafting skills for the same reason
question, if i wanted to make it to where a sound alert triggered on the first snow... how how i do that via a mod?
are you adding walking with lit 9-10 while reading with your update?
yeah, another feature i don't personally like but have added as an option
it doesn't add much but flavor imo haha
this update is getting pretty huge, the changelog is over half a page long now and it's just short notes ๐จ
That's awesome! Also, I don't think the creator of Better Literacy probably won't care since he pulled the mod, so it's your call haha.
they don't seem too active anyway, i doubt they'd get mad at me for it
well, if you think the multiplier changes are something you'll add, we'll start moving to rip the band aid off and swap to your mod.
yeah i'm dropping it in now, it's hopefully pretty simple to add
it won't come out until the big update is done though
How long are you thinking? About a week?
i'm not sure, it was supposed to come out like three months ago LOL

basically, my mod doesn't have literacy skill books like better literacy does, it was originally balanced without them
i decided it'd be a bit better balanced to have them, but the reason i didn't have them is it didn't make much sense to me, so i made them vhs tapes instead
but when you have vhs tapes... you have to write dialogue for the vhs tapes
i've been putting that off for about three months and that's why this update is so huge LOL
aaaaah, ok
I wish I knew enough to know how to limp Better Literacy until yours is ready.
Also, your concept is really neat, and now I'm super excited to replace better lit with it.
if you're using a dedicated server, i think moving better literacy before the skill journal mod in the load order might fix your issues
ah... i thought it probably wasn't that because the issue appeared suddenly
no, better lit overwrites the isRead and per chuck anything that changes reading speed breaks the SJ
the hope is that if it overwrites isread before chuck's mod hooks it it doesn't really matter
oh but if reading speed breaks it that's a problem...
i'll make sure they're compatible before i release
i got one of six tapes done today, which technically puts me on pace to finish sometime in 2025 but i'd bet it'll be a little bit earlier than that
your mod works with SJ right now
oh good! i don't see why this update would break that
yea, we tested it cause you mentioned you hadn't earlier
Episode 1 better be teaching how to read the ABCs hahaha
haha yeah i've moved the literacy magazine to the vhs system as well (that's why there's six tapes total) and that's the one i wrote today
i wouldn't expect them to be too spectacular, i really wanted to make sure they fit the vanilla style but at this point i just want to get them out
The update to SRJ today should prevent speed related issues
At least it fixed more traits, soto, and another mod I wasn't aware of
The solution for more traits was to reset the current time on the action every tick
Having SRJ loaded after should fix the rest I imagine
It's not even really worth spending time on better literacy since it's gone. So, we're absolutely swapping to albions mod, but will probably wait till the update if we can get better lit to limp along until then. I just really don't want to deal with the players crying even harder about no disassembling.
yea, better lit is still broken with the SJ. I don't really want to spend time on making this work, so we may just deal with the fallout
On our previous i made an unlisted version of your mod
Basically what i did was a replica called event recovery journal
Basically to create another journal
So that we dont need to change the default percent of the journal
The srj is configured to give only 50% and the replica was configured to 100% and is consumable and non craftable
Just so we can use it during pvp events
Hehe it was an unlisted mod but. Sorry if wasnt able to ask for permission
We dont have a server anymore so theres nothing to worry abt that
So perhaps you might consider doing this for pvp servers out there idk
If i knew how to modify moddata back then imight havejust spawned a journal with that setting lol
Hey where are mod configuration options actually stored? Like I am trying to find where autoloot stores it because it keeps overwriting it... I have this issue with a few mods at times
having a hell of a time trying to fix a rounding error on the lua side, or more specifically detecting when its about to happen. Is there any way to tell the Java to do some math and return the answer, rather than doing the math in lua?
is this about the blood intensity thing?
ya, I can't find a way to know when its going to get stuck. Only thing I can think of just doubling the rate of increase to hopefully bypass it getting stuck altogether
all i think you can do is watch the blood intensity and bump it over when it's going to get stuck
that would require me knowing when its going to happen, which is the problem. I know when it happens on my computer, but I have a feeling it may depend on what version of java people are running
for example, if I run it in rextester, which has openjdk 11.0.5 in it, the math gets stuck at 0.0499999 instead of the 0.039999 that it does on my machine locally running oracle java 18
Pretty sure pz bundles its own version of java so the system's java shouldn't have that effect
yeah i've seen something like that in the files
they bundle the java runtime? thats kinda weird but it would be helpful in this case
Yea, I presume it is in jre/ and jre64/
What's the rounding error you are encountering on the lua side?
the rounding error is actually on the java side, I can't recreate in on the lua side so I can't detect when its about to happen
the blood intensity on a vehicle is increased by 0.01F, then cast to an int, then a byte, and then stored, lol
it always happens at the same time so i don't think you need to
it happens at 0.04, then 0.08, then 0.25, 0.28, 0.31 etc etc all the way up to about 0.60, after that it works all the way up to 1.0
as long as I can be pretty certain all those break points are the same for everyone, I can hardcode bypasses for each, ya
hmm i'm not sure i experienced most of those actually
i don't think i pushed it all the way to 1.0 but i remember it being pretty unobstructed after i pushed it over 0.04
I think I'm making up the 0.08, it doesn't happen again until 0.25ish
this is of course letting the java increase it with an actual collision, increasing it manually on the lua side by 0.01d doesn't do the same thing
mine gets stuck at 0.04, 0.26, 0.29, 0.39, 0.42, 0.45, 0.48, and then i hit a street post
lol
0.04, 0.26, 0.29, 0.39, 0.42, 0.45, 0.48, 0.52-0.53, 0.58-0.59
so I think it matches
Ladies and Gentlemen, we gottem
I made the basic object now I just need to colour it
uv mapping seems so difficult I just want to colour faces
anyone knows how i can simulate the zed corpse quezy effect
without adding actualy number of corpse on the scene
Would it be possible drop corpse and make their sprite invi
Ahh if i can set it to nil just turn their skin into a blank png
Hmmm that might work
Im afraid you might be lost sir hehe
#modeling
However i believe you can just paint on it and export as x file
Not really sure
Or just get the uv auto unwrap and just fill the whole png with 1 solid color
Everyone seems to be asleep ... 

I'm still plugging away, but its probably best to stop, lol
you can set the sick value on player, is this for debug?
now I have to figure out how to program the .fbx file into project zomboid ๐ญ
i know but i kinda thought it wouuld be easier to ustilize the working mask mod instead
and just add the corpse so that it detects it?
i think its code uses the vanila sickness
try opening an fbx first then see where you go from there
afik you should have the transfor applied
like make it 0,0,0
but im not realyy 100% certain
also im looking at the vanilla lua searching for how to get the variable for if the hazmat has hole
Hey, I was just curious if anyone know a mod that allows you to bed rest? My character is sick and I'd like for him to just lay in bed all day to rest
but all i see is
function functioname(clothing, parts)
so how do i get the clothing without having to add it withing the function parenthesis
๐ตโ๐ซ
for i=1, #parts do
local part = parts[i];
local hole = clothing:getVisual():getHole(part) > 0;
local patch = clothing:getPatchType(part);
this is al sort of confusion
i just wanted to check if the hazmat has hole
------------------------ check holes ---------------------------
function isHazmat(clothing, parts)
local items = getPlayer():getWornItems()
for i = 0, items:size() - 1 do
local item = items:getItemByIndex(i)
if hazmatList[item:getFullType()] then
if isDebugEnabled() then
print(hazmatList[item:getFullType()])
print(item)
end
for i=1, #parts do
local part = parts[i];
if item:getVisual():getHole(part) > 0 then
return true
end
end
end
Probably use
#mod_support
But if you have sleep enabled then just sleep i guess
Idk if that will cure the sickness
If not then perhaps thats a good mod idea
ope yeah wrong chat, im sorry
No worries friend
well, the tooltip has already run the code so you can grab the value from there, lol?
also there's a getHolesNumber but I haven't modded clothes
Can anyone make a 25% zoom mod I just wanna see the little details better mainly jewelry and make up.
and nude textures
does anyone know how I can make this better since if 0 == 0 just seems stupid
it works tho
if true then
Oh, so math.random() doesn't work? Should i use ZombRand()?
so I just do this
yes works, 99% of times
is there another way where I dont have to use if?
just delete that line and one end
ah Ive tried that before and it somehow broke everything
How do I get a ZombRand() out of an array?
local testArr = {"ABOBA", "BOOBA", "POOP"}
local randVal = ZombRand(#testArr)
print(randVal)
Currently it prints only the index... But I need the string itself
testArr[randVal]
local testArr = {"ABOBA", "BOOBA", "POOP"}
local randVal = ZombRand(1, #testArr+1)
print(testArr[randVal])
Oh, right.
So it gets nil in case I don't start the indexing from 1st element
Yea lua starts with 1 instead of 0 like any other languagea for indexing arrays
say i want to store a string on a player, and have another player view said player's associated string. could i accomplish this without using global moddata?
the implementation that comes to mind (bad) is a sendclientcommand that checks the player's username to a list, then grabs the associated entry. i'm looking to implement player portraits for an rp server
If i have 2 mods (mod a and mod b) that both set player inventory weight limit, is there any way to interrupt specific function that is in mod b from mod a?
yes
If the functions are global, you can call on them to overwrite them entirely or overload them by storing the first
if they're not global you can name the file the same name and I believe it should overwrite the entire other file.
hmm
what if file in question has a bunch of other stuff
wouldn't overwriting it break the mod b
cuz unfortunately its local function
just remove if statement lol
You'd have to replace the other file entirely - this is assuming the first mod author isn't around and can't help you out a bit.
What exactly are you trying to do? Perhaps you are going down a more difficult route
both mods do player:setMaxWeightBase every 10 min. I have access to development of mod a and don't have access to mod b, and it also was updated last time like 9 months ago so mod author is not exactly active
if mod b would be active it'd be a simple issue of adding and not getActivatedMods():contains(mod a) then to the function that sets weight
Yes I did that first then all hell let loose
and then i'd be able to make everything work in mod a
wdym? what there can going wrong xp
if remove if statement then will change literally nothing
Everything broke
then u do change smth else
cos ur statement always equals true so nothing change
Thats what I was trying to do I already did the first advice someone gave me
yeah that if statement seems completely superfluous. What's the error message when you remove the if ?
If you want your mod to load after you can set a require on the basis the other mod is active
Why do you need to make the function that will always return true? You can just remove the function. Thats what he is saying
Alternatively you can offset the other mod within your mod
Not sure what mods your talking about but if one mod is adding such and such to weight's function you can just undo it
Can u show the code you did that resulted the error when u remove the if statement? You might have forgotten to remove the end too
I the case of my mod Rebalanced Calories - the vanilla calorie method isnt exposed or hookable
you could write if(true) that would be the same ๐
Yeah thats what I did at first and it broke and now Im just keeping the saying if it works dont fix it
problem is that mod b set weight executes after mod a
So I recreated the calculations of vanilla and only apply the differnce
You can literally force mod a to wait for mod b if you chose
Can't do it other way around tho
Might not be broken but also not optimized . Alot of codes arent but what you are doing with the if statement isnt necessary. Its pointless tbh
If statement
end
Remove both
It wont cause error
You can check for active mod IDs and run require on the file(s) name
but won't it make mod a require mod b?
No
Pls show how you removed it and how it returned an error im sure we will figure out why from there
That's why you're checking for active mod IDs
Yeah Ill try again later Im about to sleep atm
It's a soft integration
getActivatedMods():contains("DynamicTraits")
I do this for mods that cause load order issues or are just overwriting shit with no concern
Sample
Turns my bug reports into their big reports
i tried it
local crossRefMods = {
["CatsWalkWhileReadMod"]="ReadFasterWhenSitting",
["CatsReadMod"]="ReadFasterWhenSitting",
["CatsReadMod(slower)"]="ReadFasterWhenSitting",
["SnakeUtilsPack"]="tooltip",
["nicocokoSpeedReading"]="TimedActions/NSRReadABook",
}
local loadedModIDs = {}
local activeModIDs = getActivatedMods()
for i=1, activeModIDs:size() do
local modID = activeModIDs:get(i-1)
if crossRefMods[modID] and not loadedModIDs[modID] then
require (crossRefMods[modID])
loadedModIDs[modID] = true
end
end
This system only handles 1 file per mod

You can probably trim it down if you don't plan to add more mods to it
This would go above your code
could I pm you for you to help dumb it down for my smoll brain? Barely have experience in lua so would need a bit of help
so we dont spam here
The way require "filename" works is that the folder structure needs to be listed - except for the server/client/shared part
also no file type
Looks good
If you have the mod installed then require that mods lua file onto your code
require forces a pause on anything after it
it looks for the file being called on
so it would load the other mod first
I honestly still don't get it 
unfortunately there is no reverse function
You would have to check the mods itself to get the actual lua files name and dir
["nicocokoSpeedReading"]="TimedActions/NSRReadABook",
Lets put it into an example your familiar with
What mods are you working on and whats reference?
/client/ TimedActions/NSRReadABook .lua
you ignore the client/server/shared part of the file path, and ditch the file type
You have to open up the other mod
gimme a sec, I'll write it up and will send in a sec
so i get this, right?
local crossRefMods = {
["DracoExpandedTraits"]="EventHandlers",
["ToadTraits"]="MoreTraits",
}
local loadedModIDs = {}
local activeModIDs = getActivatedMods()
for i=1, activeModIDs:size() do
local modID = activeModIDs:get(i-1)
if crossRefMods[modID] and not loadedModIDs[modID] then
require (crossRefMods[modID])
loadedModIDs[modID] = true
end
end
both of those luas are in client folders
so i drop path beforehand and drop extension as you said
does that make MoreTraits.lua run after EventHandlers.lua?
no
whatever ids and file names you put in will be ran before the rest of the file that code is in
normally requires don't have all the extra bits
Notice the require at the top for a vanilla file
All the extra stuff is doing is making it conditional that the other mod is there
you can technically drop the loadedID stuff - that's more for me to use on separate checks
like in other functions I do if loadedModIDs[modID] then specific stuff
so if I put this @ start of my lua EventHandlers.lua will be ran before the rest of the file, right?
local crossRefMods = {
["DracoExpandedTraits"]="EventHandlers",
}
local activeModIDs = getActivatedMods()
for i=1, activeModIDs:size() do
local modID = activeModIDs:get(i-1)
if crossRefMods[modID] then
require (crossRefMods[modID])
loadedModIDs[modID] = true
end
end
yes
If you need more than 1 file per mod I can adjust the code
cuz then i can just overwrite whatever it does to base weight
I haven't yet so I never bothered
nah, literally only that one
Yep, if it adds 1 you can just do -1
in your function you might need to do something like
if loadedModIDs["DracoExpandedTraits"] then
to add specific changes / offsets
yea
if getActivatedMods():contains("DracoExpandedTraits") and player:HasTrait("Hoarder") then
I assume he has a trait that causes more weightloss than you'd like?
nah, both mods have perks that increase max carry weight
and people are abusing it?
so i want to make them work together
no

i should make sandbox setting that enables their stacking so ppl can opt in to use it 
When the trait is applied can't you just do something like maxcapacity = maxcapacity * 1.5 or whatever rather than a fixed number?
that's what i'mma do
ah, and his mod uses a fixed number
function checkWeight()
local player = getPlayer();
local strength = player:getPerkLevel(Perks.Strength);
local mule = 10;
local mouse = 6;
local default = 8;
local globalmod = 0;
if SandboxVars.MoreTraits.WeightPackMule then
mule = SandboxVars.MoreTraits.WeightPackMule;
end
if SandboxVars.MoreTraits.WeightPackMouse then
mouse = SandboxVars.MoreTraits.WeightPackMouse;
end
if SandboxVars.MoreTraits.WeightDefault then
default = SandboxVars.MoreTraits.WeightDefault;
end
if SandboxVars.MoreTraits.WeightGlobalMod then
globalmod = SandboxVars.MoreTraits.WeightGlobalMod;
end
local muleMaxWeightbonus = math.floor(mule + strength / 5 + globalmod);
local mouseMaxWeightbonus = math.floor(mouse + globalmod);
local defaultMaxWeightbonus = math.floor(default + globalmod);
if player:HasTrait("packmule") then
player:setMaxWeightBase(muleMaxWeightbonus);
elseif player:HasTrait("packmouse") then
player:setMaxWeightBase(mouseMaxWeightbonus);
else
player:setMaxWeightBase(defaultMaxWeightbonus);
end
if getActivatedMods():contains("DracoExpandedTraits") and player:HasTrait("Hoarder") then
player:setMaxWeightBase(math.floor(player:getMaxWeightBase() * 1.25))
end
end
๐
will check if it works and stuff and then add sandbox option for it to stack
Oh this is an ongoing check
every 10 min
why not on player update?
you're using Events.EveryTenMinutes.Add( ?
On player update is every tick I believe
why would i do it on every tick
It related to player's stats
well ye but 10 in-game minutes is fairly short time
true
so whey make code run hundreds times more
if u can make it run once every 0.5-2 min
depending on day length ofc
If you're worried about optimizing you can store the strength and compare it
nah, every 10 works just fine
but I doubt people would notice any issues
^
I just like sticking everything in OnTick and Updates
optimizations don't go brrrrr 

