#mod_development
1 messages · Page 30 of 1
I like the way Aquatsar lets you swim for a short period of time
that mechanic in of itself added to zombies would be great
also having zombies destroy ropes
by the way @weak sierra I think this log spam is from your mod, is there any chance of that getting suppressed?
nope i have no control over that once the java takes over
all i can do is invoke the function
sucks but it's what I expected

heh
has anyone done any work with the storm api?
i want to make a mod with it, but there seems to be only one other person who has made a mod with it
nope
L. I don't wanna learn Lua :(

java is a superior looking + functioning lang
I gotta say I also don't like how java looks, but it's better than lua at least
c# all the way 

i don't like having to deal with memory stuff
lua is nice but why does it count from 1
blasphemy
ON G
there's reasons about that but I don't know them
i need my index to start from 0
lua counting from 1 costs me hours of debugging per mod
I think it's something to do with the zero index in C arrays being the size of the array
https://github.com/gerald0mc/SwiftBasicCalculator/blob/main/src/Main.java this isn't any crazy code just showing why i like java
and lua having that same 1-index
anyway wtf are you doing in C# that requires dealing with memory stuff
C# is (not really) just Java but having learned from java's mistakes
C and C++ I can see you having to deal with memory

Python:
java does its job but I don't have to like it
🤝
i really want to make a java project zomboid mod with the storm api
but i have 0 clue how to set it up
someone should make a example mod for it ;)
also the discord for it is dead af
no support
i think there's just not a lot of interest in making mods that won't work on steam workshop
plus, no mods = no examples = no mods
meanwhile c# is like: drop Harmony in place, override things with ease
tbf java mods could likely work on the workshop easily enough if we had a good injection library see me shilling Harmony again
but Java's reflection/injection is horrendous, I've yet to find a single simple library for it
I noticed someone has a fork of storm that they've been keeping updated, I've also considered using it
could you send me a link to it in dms?
does anyone have any good resources for learning how to mod? i have no prior experience and am just now getting into coding but im interested in learning
Is there a way to detect if a player did a critical hit?
There is an event for when a zombie is hit, OnZombieHit maybe. I don't know if it has the outcome info for the hit though
there's an event for OnWeaponHitCharacter
It passes the damage done but not the critical state, though you might be able to get the critical based on the weapons crit mult
your best bet is to start here. It's a lot, but it's at least a reference. https://pzwiki.net/wiki/Modding
Can anyone else confirm that sounds can only be heard by players upto 3 cells away?
btw i don't see that spam on 41.77.3 anymore
so either the updated steam api calls did it or they did somethin about taht
Before I follow this rabbit hole any further, I better try and check if I'm treading old ground. Has anyone here made a mod or know of one that creates a vehicle script procedurally? I want to be able to generate a script at runtime, and either tuck it into the media/scripts/vehicles/ folder, or just feed it directly to the Scriptmanager or something like that
as far as I can tell, the Luafilewriter that PZ provides is sandboxed away from the scripts folder, so I'm really not sure what else to pursue
if vehicle scripts are handled the same, ya
they're in the same folder!
i rlly wish i can aford this game modding seems so cool i have so many darn ideas is there maybe a "free" version if you understand
and i've seen some people doing weird stuff with a ScriptManager class or something, no idea if that's helpful
i just want a "free" version if you understand or anything to mod does anyone know a source?
ya, the ScriptManager is definitely the place to start, the code is just really challenging to read. I'll bug Mx about his transmog mod next time I see him
so if the Luafilewriter can get into scripts, can it get into lua too? could i delete old files from before a restructuring (these don't get automatically deleted on servers) with lua so that there won't be consistency errors?
is there a free version of the earlier builds fo the game i could mod?
I've found if I just write a file directly with the filewriter it ended up in a weird place, lemme just have another look. As far as I know it can't get into the scripts folder, because its root is somewhere else. Unless you can tell the filewriter to go elsewhere, of that I'm not sure
ya, the root folder is %UserProfile%/Zomboid/Lua, so you could mess with your config files, but its miles away from [steamfolder]/common/zomboid/media/scripts
i guess we'll have to ask mx sometime
dms are closed 😭
The ModFileWriter is rooted at the directory of the modid you provide it. Idk if that's anchored in the symlink to the workshop inside the game's dir inside the steam folder or inside the workshop dir in the steam folder
oh ok, I was using the Filewriter from the global getFileWriter() function, I didn't know if there was another
I assume the mod one would be able to access the scripts folder in my own mod, which would be fine, as long as its possible to reload scripts from it on the fly
will probably have to write my own parser/serializer, but I guess thats not too bad
getModFileWriter() iirc
having trouble with clientcommands
Events.OnClientCommand.Add(function(moduleName, command, player, args)
if moduleName == "UdderlyVehicleRespawn" then
if UdderlyVehicleRespawn.Commands[command] then
UdderlyVehicleRespawn.Commands[command](player, args)
else
print("[UdderlyVehicleRespawn] Unknown command \""..command.."\" from player \""..player:getUsername().."\"!")
end
end
end)```
should be able to read the file into a string and then pass that string to one of the lua load functions
this is my receiving end
and..
it doesn't arrive there from what i can tell
the sending end..
function UdderlyVehicleRespawn.SpawnVehicle(vehicleType, direction, X, Y)
sendClientCommand(player, "UdderlyVehicleRespawn", "SpawnVehicle",
{
vehicleToSpawn = vehicleType,
spawnFacing = direction, --UdderlyVehicleRespawn.GetViaReflection(zoneToSpawnIn, "public IsoDirections dir"),
x = X,
y = Y,
})
end
function UdderlyVehicleRespawn.RemoveVehicle(vehicle)
sendClientCommand(player, "UdderlyVehicleRespawn", "RemoveVehicle",
{
id = vehicle:getId()
})
end```
both commands are defined, and have messages that would show if they run
i see neither those nor the "Unknown command" message
am planning to add a debug line to the OnClientCommand handler but i am suspicious something else is wrong
I assume you're not making the same mistake I did the other day and are looking in the right console files for your prints
im looking in server-console.txt
it's a dedicated local server
i see other things of relevance for the session
i see the mod initialize at the top
I'm fairly new to lua, is the way you've formatted the args table correct? No square braces for the keys or anything like that required?
it's being sent as a table
and on the other end "args" is a table
the keying is key = value,
for shits and giggles here's the commands code
UdderlyVehicleRespawn.Commands["SpawnVehicle"] = function(player, args)
local vehicleToSpawn = args["vehicleToSpawn"]
local spawnFacing = args["spawnFacing"]
local x = args["x"]
local y = args["y"]
local cell = player:getCell()
local squareToSpawnAt = cell:getOrCreateGridSquare(x, y, 0)
print("[UdderlyVehicleRespawn] Spawning \""..vehicleToSpawn.."\" at "..x..", "..y.." for player \""..player:getUsername().."\".")
addVehicleDebug(vehicleToSpawn, spawnFacing, nil, squareToSpawnAt)
end
UdderlyVehicleRespawn.Commands["RemoveVehicle"] = function(player, args)
local id = args["id"]
local vehicle = getVehicleById(id)
print("[UdderlyVehicleRespawn] Removing vehicle \""..id.."\" for player \""..player:getUsername().."\".")
vehicle:permanentlyRemove()
end```
but again if it were having trouble pulling data out it'd have an error
and/or show a message
it's acting like it never received anythin
what if we look upstream, are you sure you're actually calling your spawnvehicle function?
on the client end i see the "Spawning 1 vehicle" message
which indicates we are getting to this bit of code..
looks
ok no that indicates it's put into a table
looks more
ah yeah
there t s
if (vehicleCountToSpawn > 0) then
print("[UdderlyVehicleRespawn] Spawning "..vehicleCountToSpawn.." vehicles in cell "..cellx.."x"..celly.."..")
--UdderlyVehicleRespawn.SpawnRandomVehiclesAtRandomZonesInCell(cellx, celly, vehicleCountToSpawn)
UdderlyVehicleRespawn.SpawnRandomVehiclesAtRandomZonesInRandomCells(vehicleCountToSpawn)```
see that message pop fne
and that functon wth the extensvely long name calls a series of functions
is a bit of a mouthful, ye
eventually down the line it calls the SpawnVehicle function
anyway
i can put an output line there just to be super certain
my client commands are currently just simple proof of concept sort of things, so my args is instantiated like this:
args = args or {};
if vehicle then
args["_ID"] = vehicle:getId();
end```
a bit too verbose I imagine, but its why I asked if your args table was instantiated properly. I assume it is but when debugging its always a good idea to throw out assumptions
that is equivalent to args = { _ID = vehicle:getId() }
(without the null check ofc)
i based my call format over a known working mod's calls for this purpose
onClientCommand handler is in the shared or server folder?
server, though my understanding is that it is irrelevant
most of the code is in shared
but that is in server
as are the commands
i keep being told the folders mean literally nothing except load order
sometimes is, sometimes isn't. I've had code be non functional because it was in the wrong folder, and also had code run when it shouldn't from the wrong folder.
can try moving the bulk of the code to the client folder next test i suppose
i added debug lines for this test on both ends of the client command send/receive more directly
I wrote a little debug print function that funnels strings I give it to the client so my player can Say it, thats been my most useful code to date, lmao
got tired of having to have two console files open all the time when looking for debug lines
that's a good idea actually, i should write something like that
well i guess therss no free early builds of the gamei can mod huh
there are builds of the game, they aren't "free" so much as "technically available in a grey legality" and while you could mod them to some extent they are likely lacking most hooks and will not match the current documentation or existing mods
modding was expanded greatly later in development
LOG : General , 1664766657850> 4,743,215,613> [UdderlyVehicleRespawn] Spawning 1 vehicles in cell 35x32..
LOG : General , 1664766657851> 4,743,215,613> [UdderlyVehicleRespawn] Sending SpawnVehicle client command.```
on the client
and on the server i see alerts to other commands but none of mine during that time
LOG : General , 1664766567459> 4,743,125,232> [UdderlyVehicleRespawn] OnClientCommand "RespawnINcar_OnStartGame", "true"..
LOG : General , 1664766568096> 4,743,125,869> [UdderlyVehicleRespawn] OnClientCommand "ZA", "createZombieStats"..
LOG : General , 1664766589671> 4,743,147,444> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "getOnlinePlayerVehicleLists"..
LOG : General , 1664766589672> 4,743,147,445> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "writeToLog"..
LOG : General , 1664766614721> 4,743,172,494> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "getOnlinePlayerVehicleLists"..
LOG : General , 1664766614722> 4,743,172,494> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "writeToLog"..
LOG : General , 1664766639715> 4,743,197,488> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "getOnlinePlayerVehicleLists"..
LOG : General , 1664766639715> 4,743,197,488> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "writeToLog"..
LOG : General , 1664766659243> 4,743,217,016> [UdderlyVehicleRespawn] OnClientCommand "ConfigFile", "Load"..
LOG : General , 1664766665080> 4,743,222,853> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "getOnlinePlayerVehicleLists"..
LOG : General , 1664766665081> 4,743,222,854> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "writeToLog"..
LOG : General , 1664766690075> 4,743,247,848> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "getOnlinePlayerVehicleLists"..
LOG : General , 1664766690076> 4,743,247,849> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "writeToLog"..
LOG : General , 1664766715108> 4,743,272,881> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "getOnlinePlayerVehicleLists"..
LOG : General , 1664766715109> 4,743,272,881> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "writeToLog"..
i can only imagine some magic requires it to run from the client folder regardless of what i have been told
well, I assume sendClientCommand would throw some error if it was being called from the wrong side

assuming + PZ = lots of weird failures
lots of things don't work how u'd assume
so.. i'll try it
appreciate it!
my advice would be to look at other mods
simple ones
see how they do what they do
mimic the general patterns/ideas but do not copy directly
i'll try and do that for sure. im not even sure where to start even with that but i found a couple yt vids i think will help
thank you for responding :), yea im just asking because im 3 dollars off on my amazon account cause im tyring to buy a steam gift card to buy project zomboid :)
but thank you again
to virtually nobody's surprise it didn't matter that i moved the code to client folder.
dang
realizes player is nil cuz im not defining it
i guess that might be a problem but it'd be one i'd expect an error about
switches the calls to getPlayer()
that probably matters, ya
did not matter
ill log in in debug mode and poke around at it instead of this slow re-upload and test
but im not real sure what's going wrong here
now that I think about it, doesn't make much sense that the client command has a player input, you'd think that would just get appended by the command system
but ya, F11 that stuff. Although I don't know how to get the breakpoints to work server side, only on client code
i dont even use the f11 menu much i just type the code in debug console
:P
test code
ill try sending commands by hand referencing my global tables
ill try calling the methods
etc
i mostly use f11 menu to view local variables when something breaks
to get a breakpoint i just intentionally make an error happen
what do you do? xD
lmao i never learned to use most of the debugging tools i just do stuff
logs + code changes are all i strictly need
it does, player is an optional variable
yeah there's another variant that doesn't have player
do u still get that info on the other end if you use that?
i think being able to set it directly is probably for splitscreen support
you do
huh
i'm guessing if there's multiple players on one machine it just sends player 1 or something
in the debug console i did sendClientCommand("UdderlyVehicleRespawn", "test", {}) and that transmitted and showed fine
i know other mods use the overload with player just fine
bikinitools for instance
manually called SpawnVehicle command and that worked (errored cuz i left args blank)
very weird
ill try changing the code to use that
i wonder actually, what are you supposed to send in the player field? it can't be the player object right?
that was what i sent, lmao
but yeah
i had the same thought
i can understand that breaking it but not why it's silent about it
the java is usually not shy about spitting errors
public static void sendClientCommand(IsoPlayer var0, String var1, String var2, KahluaTable var3) {
if (var0 != null && var0.isLocalPlayer()) {
if (GameClient.bClient && GameClient.bIngame) {
GameClient.instance.sendClientCommand(var0, var1, var2, var3);
} else {
if (GameServer.bServer) {
throw new IllegalStateException("can't call this function on the server");
}
SinglePlayerClient.sendClientCommand(var0, var1, var2, var3);
}
}
}
var0 was null, the if statement didnt execute true, thus silently fails
though doesnt explain switching to getPlayer() failing
silent errors are not my friend
yeah i shudda thought to look at that tbh
it still doesn't work lol
function UdderlyVehicleRespawn.RemoveVehicle(vehicle)
print("[UdderlyVehicleRespawn] Sending RemoveVehicle client command.")
sendClientCommand("UdderlyVehicleRespawn", "RemoveVehicle",
{
id = vehicle:getId()
})
end```
tries running the function from the debug console
ah can't really i dont know the vehicle id
easier to spawn a vehicle i guess
[UdderlyVehicleRespawn] Spawning "Base.Taxi" at 10646, 9882 for player "UdderlyEvelyn".
spawned a vehicle by hand using the command in the debug console fine
wth
what is this
[UdderlyVehicleRespawn] Sending SpawnVehicle client command.
so i see this in the client log
for the last time it tried to run on its own
function UdderlyVehicleRespawn.SpawnVehicle(vehicleType, direction, X, Y)
print("[UdderlyVehicleRespawn] Sending SpawnVehicle client command.")
sendClientCommand("UdderlyVehicleRespawn", "SpawnVehicle",
{
vehicleToSpawn = vehicleType,
spawnFacing = direction, --UdderlyVehicleRespawn.GetViaReflection(zoneToSpawnIn, "public IsoDirections dir"),
x = X,
y = Y,
})
end```
that is the code for that
sendClientCommand("UdderlyVehicleRespawn", "SpawnVehicle", { vehicleToSpawn = "Base.Taxi", x = 10646, y=9882, spawnFacing = IsoDirections.N, })```
i sent that manually and that worked
i guess it's time to print out the args and see if they are sane
but im not sure how that'd cause a silent failure
it should still register receiving the command
what is this
so something is stopping it from sending the command, somehow
will print all args along the way and print for each call and figure this out
bleh
ohhhh
when i moved it to client
that one took precedence over the one in shared
and my file was still open to that one

so the new edits were not applyin
after applying changes to the other file it works.
time to start adding print() to every line of your file

love when that happens
question, how do I go from an InventoryItem to something like Base.AssaultRifle
getType() probably
there's other ways but that's the most direct
assuming it returns what i think it does
No, getType() is going to call the Java base function.
It pops out whatever the class is (which is probably going to be zombie.inventory.InventoryItem@?????)
I think I'm gonna have to dig down into the InventoryItem's ScriptModule but I have no idea what part of that stores the name
and I haven't yet found the lua that controls the ItemManager for admins
me: opens up ISItemsListTable.lua
also me: does a search for item

answer appears to be: item:getFullName(). zombie.inventory.Item function.
alternatively:
zombie.scripting.objects.BaseScriptObject.module.name + zombie.inventory.Item.name
BaseScriptObject.module is a zombie.scripting.objects.ScriptModule and Item derives from it.
so technically you can item.module.name.."."..item.name in the lua if you really needed to for some reason
it definitely doesn't always do that
for containers for example it returns things like "freezer"
keep in mind they call the "id" of an item the "type"
in pz
...good point, I just realized something else popped out userdata or something like that
still, I needed the module as well, and getFullName does that
Is there an existing function that finds any/all players near to a given zombie or cell?
or within a map region perhaps
hey, i was wondering if theres a way to prevent spears from doing stabbing animation, i'd like it to swing only
is that possible?
if i want to replace a function of a vanilla lua file Fishing/BuildingObjects/FishingNet.lua do i have to recreate the same folder structure or can i simply put it in lua/server/patches/FishingNetPatch.lua and import the function and replace it?
eg. does my FishingNetPatch.lua needs to be in the folder server/Fishing/BuildingObjects like the OG or can i place it wherever i like server/patches
it's only irrelevant when playing SP
getFullType()
if it isn't a local function, you can just overwrite it. just use a require statement to make sure your file loads after it
interesting. Any reason to use this over getFullName() that you know of?
thank you 🙂
just that its the proper function for inventory items. getFullName is a bit weird. I do see it being used alot for movables, and for vehicles which seems weird. from the java, getFullName seems like a generic for the Item class. but the getfulltype belongs to InventoryItem. You are more likely to get hard to debug errors in the case that you accidentally call getfullname on something that isn't a inventoryItem. basically just cleanliness would prefer using the getfulltype()
I don't expect any errors happening, but it could happen
Noted. It does seem like the better choice since it's defined in the inventoryitem class
and it seems like Inventoryitem overwrites module anyway
...wait InventoryItem doesn't derive from anything
so that negates the entire chain I found
no, but it just has item as a attribute
Right, right
okay... I think I see what's going on here
Items are (probably?) part of the prototype process, and when spawned in, get created as an InventoryItem
yup
somehow I missed that when doing my initial dive.
if I had to guess, it also probably has a role in storing info for when the item is converted back and forth between a worldinventoryItem and a InventoryItem
interesting, I didn't even know about that
oh I see why I got confused - the Item List Viewer works with items, which interacts with the item registry
which is where I first found the function
damn shame though. On the other hand, I could probably make an Item that I wanted and copy stats from that......
huh, actually inventoryItem also has a worlditem field which contains a isoWorldInventoryObject. I wonder if that always holds the javaobject for that item. If it does, then we can potentially store modData for inventoryItems without it getting wiped by using the InventoryItem.getWorldItem():getModData()
because it was always annoying that using the moddata of inventoryItems wouldn't save
ooh. That'd be good for my use case, since I really only need the conversion once. Let me know if it pans out.
Looking for a mod that adds the ability to write newspapers/comic books, is this possible?
reasons I hate Lua: ~= is the "not equal" operator
depends on complexity. If you just mean take paper and pen and make a new book, I don't see why not.
Saw a post once on facebook that was about someone being a base rat and just writing comic books all day
yeah, that sounds like you'd just need to add a recipe for it, no fancy lua needed
Just wondering what the mod is that does this
not enough of a clue to track it down, sorry
more digging into that you might find interesting.
START ITEM #1 - table 0x1862903716.
items : table 0x162141867.
count : 2.
equipped : false.
inHotbar : true.
invPanel : table 0x826009165.
name : hotbar:M16 Assault Rifle.
cat : Weapon.
weight : 5.675000190734863.
1 : zombie.inventory.types.HandWeapon@1a5be0e3.
FType(): Base.AssaultRifle.
Module : nil.
Name : nil.
Type : nil.
FType : nil.
...I'm dumb. Those are protected values. No WONDER the Lua can't get at them
What do this script items properties do?
AimingPerkCritModifier
AimingPerkRangeModifier
AimingPerkHitChanceModifier
AimingPerkMinAngleModifier
they all affect how much your aiming skill improves your shooting with that gun
From lua, is there a way to use java reflection to get a handle to a class object that isn't directly exposed? LuaManager.GlobalObject has enough to get field values and invoke methods (and it works fine for java types already exposed in lua), but I see no way to directly lookup a java.lang.Class from a string e.g. if I wanted to create instances of a java enum
Try this
Actually, that wouldn't work because the methods to lookup fields and methods in LuaManager.GlobalObject take an Object as a parameter, not a Class. Hrm.. I guess I have to find some round about way to get a hold of an instance
getClassField sets the property of an item to exposed, according to the java code I read
Right. That works fine when you have an Object. I don't. That's my issue atm
Oh, 🤔
For example, I'm trying to get an instance of an enum value (the type checker between lua and java doesn't automatically convert an int to an enum, unfortunately)
i am gonna keep talking storm api until it starts to become a widely used modding api in zomboid
there is literally 1 other person on github who has uploaded a mod 💀
where does the game store the moddata?
probably in one of the binary files in the map bins
Couple of questions:
1- How do I check whether the players's character is male or female?
2- How do I add a sound source that can be heard by zombies in x distance?
Is it possible to get the getDisplayName always in a set language? 🤔 Like, always english, or alway italian, etc etc?
getText will get the translated version of the text
But what If I want the getText in a different language?
Or atleast always in english
getText will give the text, in the current language
if you want a different language, you will probably need to check the java decompile for that
there is a Translator.java which probably will have a function for it
Because my code
local displayName = item:getDisplayName()
Is generating the DisplayName also in the game selected version, and this is f-ing up my mod if a server has a different language than the client
hmm, I thought getDisplayName() gave the original name but I guess not if that is what is happening
Yeah, I tought so,
local allItems = sm:getAllItems()
local item = allItems:get(i);
local displayName = item:getDisplayName()
Damn, the game automatically translates it once is loaded 😦
java\scripting\objects\Item.java
public void DoParam(String var1) {
....
} else if (var3.trim().equalsIgnoreCase("DisplayName")) {
this.DisplayName = Translator.getDisplayItemName(var4.trim());
this.DisplayName = Translator.getItemNameFromFullType(this.getFullName());
Thats a pretty rough I think the proper way would be to generate the translation files. although that's a whole other thing you would need to output
I do not envy you to have to solve this
yeah, I went with ha different approach
although, you could maybe just give them all a simpler recipe name. just Give cosmetic version
people can still use them by right clicking the item
local displayName = 'Clothing' --item:getDisplayName() in my generator
In my items fix
function ApplyItemsFix()
local sm = getScriptManager();
local allItems = sm:getAllItems()
local size = allItems:size() - 1;
print('-------START ApplyItemsFix--------')
for i = 0, size do
local item = allItems:get(i);
-- I need to use tostring, getType returns a Java Enum
local isTransmogged = item:getModuleName() == "TransmogV2"
local nameToFind = string.gsub(item:getName(), "_", ".", 1) .. ''
local originalItem = sm:FindItem(nameToFind)
if isTransmogged and originalItem then
-- print('nameToFind'..nameToFind)
item:setClothingItemAsset(originalItem:getClothingItemAsset())
-- Needd to avoid problems :-/ with different language from server to client :-/
item:setDisplayName(originalItem:getDisplayName())
end
end
-- Good old trick to force the refresh
local player = getPlayer();
player:resetModelNextFrame();
end
Events.OnLoad.Add(ApplyItemsFix);
I doubt people would be searching for the item in the craftingUI
Any idea about this, gentlemen?
use the addsound function
It doesn't seem to let me configure how far the sound travels
no it is a different addsound in the luamanager
it is used alot in the vanilla lua code
I suggest you check addSound decompile, or check the uses of it in vanilla lua code
Where can I find it in vanilla code? Any particular files to check?
😦
my script was working onlocal hosted server but as soon as i tried it on mp server it gets very messy the script only writes the ini file on the local ... tried using sendclient and this happened 😦
open notepad++ or any ide in the vanilla lua files, then just control F for it
Doesn't that search within the file itself and not within all files?
nvm
you can tell notepad+++ or an ide to search in your project folder
😵💫 guess its time to give and try again tommorow
hey guys! I tried to take a look at caps
and it all seems good but whenever I try to wear it this happens

New tooltip 😄
Is anyone doing anything with storm api?
nice, I can't remember which weapon tooltip mod I'm using, but being able to see brita's weapon's actual stats has made me make very different choices as to which guns to carry around
Yeah, I'm making a new tooltip mod because of Firearms41 and how crap 99% of the guns are in that mod 😕
Atleast now I know how little damage I'm doing lol
Can you just make a mod that shows all gun stats ?
Not for certain mods
But for all of em
Yeah, that's what I'm doing rn
Swag
Excited to see that. I like the way you formatted it. I assume the left column is the default stats, and the right column is its current condition?
Left is the current stats, right is the stats of the other gun
oh, you're comparing them? That's neat. Current stats of what's in your hand?
Stats of the selected weapon in the inventory
guys is there any mod in which u can craft your own fire weapons?
that's even easier. Now, the stats in your picture are the same, but the guns are different. What is that laser doing?
Vanilla Laser adds 5%, but with aiming 10, you hit the max accuracy which is 95
what the F are these stats dude!
This is with aiming 8 😮
Does anyone know the effect of
AimingTime
ReloadTime
RecoilDelay
and if they are in seconds or a different time unit?
if you hit the max on a stat you should color it differently
Good idea
hey! i'm trying to get all Drainable items when a zombie dies but never receive any items. i'm checking the bodies but there are definitely Drainable items in there (Lighters, Matches,...). when i get all items from the container and check for :IsDrainable() there are some items of that type but i can't check which because each and every method returns null as a result. The lua code is located under server. I'm doing the same with Clothing and Weapons but this works as expected. Is anything different when handling a Drainable?
Events.onZombidDead:addListener(function(zombie)
if zombie == nil then
return
end
local itemContainer = zombie:getInventory()
local items = itemContainer:getItemsFromCategory(ItemType.Drainable:name())
different units. I havent messed with the b41 stuff & how RecoilDelay plays with the anim, but b40 Recoil + swingtime define the RoF... ReloadTime is for timed actions (modified by skill lvl)
AimingTime is poorly named..its not actually a 'time' at all. As the player moves around, a aiming penalty builds up (and decreases as the player stands still), reducing the hit chance. AimingTime is a reduction on that penalty (higher = better, easier to shoot moving)
Thank you fenris
so aiming time is a cap on the penalty, or a multiplier of some kind?
its basically works like a cap
theres already a cap, but it reduces it to a lower value
what is the default cap based on?
you've written Events.onZombidDead
idr the exact value, i'd have to dig through my notes but the default is just a hardcoded value
for all weapons? I guess thats my real question
just firearms unless somethings changed...if you play with target highlighting on you can see the movement penalty change
least vaguely see it as it goes red > green etc
but like, does a shotgun and a pistol have the same default unmodified cap?
ya
yeah sorry i'm using pipewrench to write mods in TypeScript and they have a typo in the event, it works since all the code is executed in the listener
huh, that seems kinda weird
should be the same across all firearms, which is fine. the individual firearm's aimingtime stat handles reduction on that cap
so the firearm has an aiming time, and I'm assuming your aiming skill modifies that as well?
or does it just do accuracy?
ORGM used to do it mostly by barrel length and weight...lighter shorter guns (pistols, smgs etc) would get higher aimingtime for easier movement, building clearing etc
i honestly cant remember if skill modifies it, i'd have to recheck
Is there a guide to make traits?
Hey, is there any better way to find out what mods are conflicting other than disabling bit by bit?
looks like it does. (aiming skill modifies). going through my old code to display it:
-- hit chance
local beenMoving = player:getBeenMovingFor()
local aimingPerk = player:getPerkLevel(Perks.Aiming)
local hitChanceMod = item:getHitChance()
hitChanceMod = hitChanceMod + item:getAimingPerkHitChanceModifier() * aimingPerk
local hitChancePenalty = 0
if player:IsAiming() and beenMoving > item:getAimingTime() + aimingPerk * 2 then
hitChancePenalty = (beenMoving - (item:getAimingTime() + aimingPerk * 2)) * -1
end
basically:
player:getBeenMovingFor() - (item:getAimingTime() + player:getPerkLevel(Perks.Aiming) * 2)
though this maybe outdated now. would have to dig through the decompiled stuff
It's still fairly accurate
if (var2.isRanged() && var1.getBeenMovingFor() > (float)(var2.getAimingTime() + var1.getPerkLevel(PerkFactory.Perks.Aiming))) {
var13 = (int)((float)var13 - (var1.getBeenMovingFor() - (float)(var2.getAimingTime() + var1.getPerkLevel(PerkFactory.Perks.Aiming))));
}
I think you can check in the pinned message of #mod_support
so a theoretical terrible weapon with a 0 aiming time would need you to be moving for 20 units of time before you get a penalty at aiming skill 10, equal to whatever is over that cap
but the time unit isn't seconds? Is it ticks?
looking at the code Mx posted (its more relevant then my old b40), then no...you'd have .getBeenMovingFor() > 10 for the penalty to kick in with 0 aimingtime and skill 10 (the *2 multiplier seems no longer there)
if you wanted to find the exact units you'd have to check the code where its getting incremented, personally i find it more helpful not to think of it as a time unit at all
with my old testing it would hit its cap (might have been 95? idr now) after about 5 seconds of movement, and take about the same time to decrease
There are a couple of extra debuff if you are walking tho
if (var2.isRanged() && var1.getBeenMovingFor() > (float)(var2.getAimingTime() + var1.getPerkLevel(PerkFactory.Perks.Aiming))) {
var13 = (int)((float)var13 - (var1.getBeenMovingFor() - (float)(var2.getAimingTime() + var1.getPerkLevel(PerkFactory.Perks.Aiming))));
}
if (var3.getObject() instanceof IsoPlayer) {
IsoPlayer var16 = (IsoPlayer)var3.getObject();
if (var16.isPlayerMoving()) {
var13 -= 5;
}
if (var16.isRunning()) {
var13 -= 10;
}
if (var16.isSprinting()) {
var13 -= 15;
}
}```
Yo wtf
ya thats new (well, new for 41 vs 40)
yep, extra 20 hitchance for marksman. disabled trait lol
ya profession trait thats not given to anything anymore. been disabled for ages. used to use it for sniper professions on our server though
Interesting, I'm surprised is still there
wouldnt be surprised if it makes it back in there when npcs arrive
in B42? 🤔
ya
That will be truly interesting
Can anyone teach me how can I use just some things from a mod?
https://steamcommunity.com/sharedfiles/filedetails/?id=2688737276 I want only the elbow and knee pads from this mod, for example
You should start by asking the mod maker if you can use their models first
Or check their license
Is there an existing way to find any/all nearby players to a zombie? Perhaps a way to enumerate players in active regions near the zombie? Or just need to iterate over players and try to estimate based on distance?
Or you can try the hard painfull way of trying to learn how to do 3d and then realize it's too much of a hassle and go back to write only code and ruin your dreams of modding
well, it's only for myself playing singleplayer and the mod author seems to not have been around for a while
but thanks
Then you should be fine by making a copy of the mod and editing it
I'm able to add mods mid-save right?
(of course heavily dependent on the type of mod and what it changes I assume
dislaik was in here giving tutorials like 3-4 days ago
lel
someone should make a mod in PZ where you can hug people to be less sad
people are trying to hug you ingame all the time already
yes but also i need consensual hugs
not zombie hugs
what's the function for controlling player's vision cone and accuracy?
Anyone have a quintessential CDDA mod list? Still enjoying PZ, but unfortunately CDDA has spoiled me. I've yet to fiddle with Hydrocraft, but that paired with CDDA Zombies + Brita's + Armory + NPCs + Quests looks like it'll fix a lot of those desires and make the game feel a lot more lively/dangerous/challenging.
I'm already at the point where I've secured an enormous warehouse base and subsist off of foraging/trapping/water barrels.
This channel is unfortunately named
Is #mod_support more appropriate for those general questions? I guess, 'mod_discussion/recommendation ' would be more ideal to create (I'm assuming I'm not the first person).
haha, they should really just call this one mod_dev, but ya I think the support channel is for talking about mods. I'd help you but I don't even know what CDDA is
Hey guys. I want to try making a mod that makes seasons last 1 month instead of 3. But I wasn't able to find seasons logic anywhere in lua code. Is it hardcoded in java code, or did I miss something?
I think I've seen a mod like that, or maybe it was just a config option ? Don't remember
@astral dune there are several mods that make seasons shorter by skipping days. But they all have issues, like lag at the end of each month or messing up zombie loot tables with daysSurvived.
Is there a way to give weapons a condition where its only usable if you have a certain level of weapon skill?
oo this looks nice
grats
Congrats!
oh, this doesn't do what I assumed it would, these are neat features
how do you tell if a vehicle hasn't been seen in a while?
it tracks it
attaching a timestamp?
yeah
configurable distance at configurable client-side polling interval
(the polling is clientside not the configuration lol)
thats pretty handy. I've been looking for a way to figure out when a vehicle has been loaded, but this is the "scan all vehicles loaded" code you were talking about the other day isn't it?
👉 👈
oh i am not doing that
im just doing distance to target
and presuming it is "seen"
cheap check
after all ur viewing it from the sky
im more concerned with the PLAYER seeing it than the character
haha, I was mulling over what it would take to alter a vehicles model when it gets loaded to the client, before the player can see it, still don't think its possible
what are you trying to do with that?
stick a turbo out of the hood or attach plating to vanilla vehicles
lol son of a bitch last minute changes produce error, ah well ill fix.
essentially any visual change you'd want to make to a vehicle based on tags
if you just want to change a vehicle's model in lua, just hook into engine oncreate
look at tread's fuel type framework for how to do that generally speaking
I have a little problem that I dont understand why is not working
I did a mod with other things, but including a translate files for the VHS
However, the game is showing the original, untranslated name
Any ideas why?
is it on line 1?
What you mean on line 1?
like the first line of the translation file?
My file goes like this
oh then i don't know
the one that adds diesel? alright
does that function fire every time the vehicle is loaded, or just when its created?
just when it's created
ah ya, so those changes would apply to every vehicle instead of one particular one
i may have misinterpreted what you meant
it's fired the first time each particular instance of that vehicle loads
like, the first time you come across a sportscar, but not every sportscar?
it's just every time a vehicle spawns
i used it to change certain vehicles' skins based on their spawn location, for example
right, so I think we were talking about the same thing after all, assuming by "spawn" you mean the original creation of a new vehicle on the map
although now that i'm looking back at it
i set mod data and checked it (so that the code wouldn't re-run), so maybe it is every time it loads
i don't remember testing if that was necessary or not
Does pz recycle zombies in an object pool or something tricky? It seems like mod data I put on zombies sometimes shifts around to another zombie when I walk some distance away
interesting, when I get home I'll hook into that event and see when it fires. If an engine is "created" every time that vehicle comes into view, then I could certainly use it for what I want. If its just new vehicles then I can't
IIRC they do teleport zombies around from time to time, not sure why. Are you sure its a different zombie?
you were trying to add armour to vanilla vehicles right?
essentially I want to add all kinds of visible attachments, by the player, with a mechanics like action, and have them be visible when the vehicle comes into sight, and not pop in once you touch the car
yeah you can just give the part a model
can you give a vehicle a part it isn't scripted to have?
Well, the clothes definitely swapped if nothing else 😂
I had a name tag on two zombies (set via mod data), one in a bathrobe outfit and other in an armycamogreen outfit. I walked a screen or two away, and when I came back, the bathrobe wearing zombie was named soldier and the armycamogreen outfit wearer had the bathrobe Z's old name
yeah, my mod does this
i create a template vehicle with all the parts
template vehicle CarNormal_Upgrades
{
part Cowcatcher
{
model
{
file = Vehicles_CarNormal_Cowcatcher,
}
etc etc
and just use vehicletweaker to add the template to the vehicle script
TweakVehicle('Base.CarNormal', 'template', 'CarNormal_Upgrades')
interesting. On that note, how do you handle something like a cowcatcher? Are you comparing every part's condition with a stored value every tick and rolling back changes? thats the only thing I've seen so far and seems like that would be a bad performance hit
yeah
that is weird. Wish I could help
there's also a case where you can deal enough much damage to a window in one hit that it breaks and that sort of messes up that entire process (since windows just get removed when they run out of durability)
I should probably have a closer look at tweakvehicle, I wonder if it already does when I'm intending to do
ya, I noticed that with some vehicles
i think that's why the autotsar vehicles just set your parts to 100% with protection
There is an event that fires when you hit an obstacle rather than a zombie, which I think is the only way you could do so much damage as to blow up a window, probably could leverage that
oh there is?
actually its not an event, but yes the damage when you hit a tree or another car is calculated lua-side, so you can hook into it
i don't think zombies damage windows so that's a much better idea for those parts
don't they smash side windows?
oh that's true...
as far as I know, they do. You even have a chance of dying while inside your vehicle if your side window is smashed (and there are a lot of zombies around, obv)
i was only thinking of collisions
ya, they can get you if there aren't windows in the way, and I could have sworn the windshield will get damaged with the hood when you hit one, but I don't know for sure
but ya, by hooking the function, I think its called Crash, I've been able to reliably block all damage from collisions with everything except players/zombs
actually yeah they might damage windscreens u_u
i wonder how often the part update functions are actually called
ya, I dunno. Tried hooking them but it didn't seem to work, I imagine the java doesn't call the lua side for that
Would be nice if anyone knows which functions to use to be able to control the player's vision cone and his accuracy when firing/using melee weapons (chance to miss the swing). I can't find any reference to them in the APIs or vanilla files so far
Its typically altered by aiming a gun, right? If so I'd look there. I've never looked into it. Oh, there is also a mod that messes with your screen if your glasses fall off, but I think they're custom shaders
yeah that just uses the vision blur from foraging
I haven't tried making a far-sighted character with that mod, can it still use the foraging shader for that
?
glasses fall off way too easily, and they break all the time. After carrying half a dozen glasses around all the time I got tired of that mod pretty quick, lol
i think the way far sighted works is your screen gets blurrier the more you zoom in
@astral dune can you reference me to that mod
Thanks!
So, I released my new weapons stats tooltip in my QOL Pack
https://steamcommunity.com/sharedfiles/filedetails/?id=2871025172
that was quick
Speedy modder
nice, how does it play with other mods that add extra tooltips below the items?
i don't think i have another that would affect weapons but im sure they're out there
think ill add that to my serv
How difficult would it be to have the character models of certain zombies scaled in size in some dimension. For example, if you wanted certain zombies to be short. I imagine that'd be a significant amount of work because you'd need to manually create a short model as well as 'short' versions of the clothing/weapons? Or is there a simpler way to do said scaling via lua I'm overlooking?
hello i have two questions:
is the commanders hobbies mod working ?
second any suggestion on more mods that add things to collect ?
it involves making a whole new zombie model and making new clothing for it
you could probably distort them to some extent without doing that but for it to look good..
AuthenticPeach did just that for fat/thin zombies
the former
so i assume they considered just distorting the size without new rigging/models
and thought it was inadequate (or it was impossible
)
i know nothing more about that though
if you find something lmk
hey @bronze yoke I forgot to ask you earlier, what is your mod that does the vehicle template stuff? I'd like to have a look at it
it's not finished yet
oh, bummer
the full extent of it it is just to add armour to vanilla vehicles
but since modelling isn't my favourite it's going slow
oh interesting. But your concept has been working? I will likely try to do my thing the same way, hopefully we can find a way to keep it intercompatiible
you said you were using VehicleTweaker as a requirement, right? I was just about to look at it now
Just made my 3rd mod!
https://steamcommunity.com/sharedfiles/filedetails/?id=2871038554
Not as perfect as I initially expected it to be but ye hopefully I can improve that in future updates lol
nice!
Thanks. Do you happen to know the name of the mod of theirs has fat/thin zombies? Isn't obvious looking at the list of mods showing up in steam workshop search (and steam is displaying some error when trying to view their profile's full workshop list for some reason)
Does anyone know the max value for the script sound clip property distanceMax?
Not sure if there is a way to easily debug the distance a sound can be heard from but there is a max that I cannot seem to find in the java source.
authentic z. they created clothing items that make the zombies look fat
authentic z
im not sure but i think i saw it from konijima's mod that it was set to either 3500 or 5k not sure if thats the max tho.. dont take my word for it tho.. better to double check
Been looking at Chucks Expanded Helicopters. He has some of the script sounds set to distances that I dont think can be obtained.
can't seem to get ahold of a string containing the contents of a vanilla vehicle script from the scriptmanager or the vehiclescript itself. Anyone know if its possible?
add all the properties to a table using tostring?
Is it possible, as a server to send info to a client before it can log in? 🤔
Maybe it can be done at the point OnLoginState is triggered?
I suppose I could try to recreate the script text by writing a serializer of the VehicleScript object, but I was hoping for something simpler than that
🤔 Sounds like a good idea
Cause I'm considering to make my mod receive the TransmogItems.txt from the server if the mod is used in MP, this should fix sync issues
they arent stored as strings anywhere if i remember right, they just get parsed into the fields on loading the files
thats a bummer, but not totally unexpected. If I can get a hold of all of the fields I guess I can serialize it
is there a reason you can't use vehicle tweaker?
vehicle tweaker tweaks all vehicles of a particular type. I want to change the properties of one specific instance of a vehicle
I'd like to then export this custom script to a file name tagged with the vehicles sqlID so that the game will automatically load it later
otherwise, if I can figure out how to get the script manager to make a copy of a script that I can then tweak, I suppose I could do it at boot from data stored in the global moddata
I'm open to suggestions on other ways to achieve this, of course
so you sort of want unique variants of vehicles that have altered scripts?
yes. So for example I take a particular Chevalier Cossette with ID 252, and alter its Engine Power to 800hp, then write out a script called vehicle_car_sports_252.txt with that change made
and of course change the script of that one sports car to be the new, revised one, leaving all the other sportscars alone
seems excessive. vehicle:setEngineFeature(quality, loudness, power) not working?
nope, hence why I have to dive down this rabbit hole
Indie Stone has confirmed that it doesn't work, intentionally as they put some test variable in there to try out the new engine sounds
said they "may" revert it in build 42, so until then I gotta hack my way around it
you can see for yourself in CarController.control_ForwardNew() these two lines"
var13 = (float)this.vehicleObject.getEnginePower();
var13 = this.vehicleObject.getScript().getEngineForce();
so the engine power set by the engine feature function just gets immediately overwritten by the default engineforce from the script
this is also why reductions in engine power based on engine quality don't actually work, and I suspect why the enginepower shown in the mechanics ui reverts to max after you've driven the vehicle once
funnily enough, this isn't done in the code for reversing, just driving forward.
personally i'd wait til it gets fixed & theres a proper method of setting the power instead of using some extreme hack method.
this ruins a WIP mod i started ages ago... but i cant complain not like i've been active with it lately
I would like to have this functionality now or soon, and since I don't know when 42 is coming out or if they'll remember to fix it by then, I don't have much choice but to move forward with a hack
I've considered even using Storm and trying to fix it at the java level myself
I would likely wait until the fix is in before releasing the mod publicly though
Are there any events that I can send/receive from the server before this happens?
Force disconnect [checksum-File doesn't match the one on the server:
I need it for my mod to get the server to send me correct script items
seems like this is relevant to me too
I assume its your transmogItems.txt that isn't matching?
Recompiled the car controller class to fix to the EnginePower issue 😏
Now I can build my mod and test it against what I assume the code will look like in build 42, rather than try to mess with scripts any further
Thats a weight off 😂
5000hp cossette is a little hard to control, lel
anyone know of a mod that where players can rank up and every milestone be rewarded.
that sounds horrifying, please send a video of it
haha I don't have any video capture software
did just find this tree though, I guess its wondering how I hit it at 150mph and took no damage
good times, huh?
its a little weird going through other people's mods to see what sort of things they do
I hear that. I was personally shocked when I saw how simple ItemTweaker was, for example
Now I'm working on basically re-implementing it except working on existing items too 
actually that brings up a good point, how do I use the Lua debugger?
what are you trying to do?
with the debugger? I just want to get more info on tables without having to resort to this sort of thing:
actually... I wonder...
right, well as long as the code is running client-side, and you have the -debug tag set, then hitting F11 will bring up a window that you can search for your lua files in and set breakpoints
lol, setting a car to weight 1lb also makes it undrivable. This is pretty fun to mess around with ngl

it does reset its weight after a few seconds, I don't know if its a sync with the server or what that's causing it
thats if you set its current mass directly. Set the weight of the frame to 1lb and it stays that way, you just get a couple hundred lbs of parts added to it on the next sync
Does anyone know of a good way to hash a lua table?
The contents? Or the object itself? If the object, the address may be sufficient, depending on your requirements
if the contents, pick your favorite hash, and recursively hashing the contents ought to work
The contents, mostly. I need some way to identify if the changes in the current table are the same as before, since there's a chance I can save the "has been modified" state between saves.
does Lua have any hashes? Or can I use a java hash inside of Lua?
For java objects, you might can use the hash method on exposed objects
For lua objects, you'll probably have to roll your own (bc you have to roll everything on your on in lua 😅 )
Good afternoon everyone, let me introduce myself my name is Henry. I am looking for people who can help me with a server project that I have, I wanted to know if there is anyone interested in doing scripting work, of course I am not looking for something free, but I am willing to pay for these services.
I'm doing a crazy project with a friend and we need a programmer to make a command mod for the role play and create some respawn systems, shops and other things inspired by FIVEM and SAMP.
The knowledge required to make these systems seems to require advanced knowledge (I don't know how PZ scripting works)
If this project succeeds, we plan to make it the foundation for these types of servers in the Workshop. It's a very ambitious project haha, but we can make PZ the perfect roleplaying game.
Greetings. 🙂
I'm working on an RP Framework, but I don't think it will be available for a while (btw I was from ESX Team jeje)
We are using several modded maps and Britas armor mod for our dedicated server. We are also using a mod that reduces the rarity of the overall server to extremely rare. Now, Some members have reached out to me that the loot amount of the modded maps is way too much and completely different than vanilla map location, as well as the military zombies drop too much gear.
I suspect the manual loot distribution of these mods are the cause of the problem. What do you guys think? And also what can I do to reduce the the amount then?
I'm trying to use this events but I'm getting no logs no anything 😦
Events.OnLoginState.Add(function ()
print('Events.OnLoginState')
end);
Events.OnLoginStateSuccess.Add(function ()
print('Events.OnLoginStateSuccess')
end);
Also for some damn reason my NoSteam Test server is not loading the mod I'm trying to use 😦
Okay friends
I don't get making a custom profession. I've got it to show up but for some reason the traits I assign can be removed again and then double themselves in the list
All the vanilla professions come with "locked" traits, so how does one achieve that?
For example, here you can see that I'm able to change the traits around
While in this one it's not able to be removed
Am I like, missing something?
local soldier = ProfessionFactory.addProfession("soldier", "New Hope Army Soldier", "profession_veteran2", 2);
soldier:addXPBoost(Perks.Aiming, 5)
soldier:addXPBoost(Perks.Reloading, 5)
soldier:addXPBoost(Perks.SmallBlade, 5)
soldier:addFreeTrait("Brave");
soldier:addFreeTrait("Smoker");
soldier:addFreeTrait("Dextrous");
soldier:addFreeTrait("SlowHealer");
local chef = ProfessionFactory.addProfession("chef", getText("UI_prof_Chef"), "profession_chef2", -4);
chef:addXPBoost(Perks.Cooking, 3)
chef:addXPBoost(Perks.Maintenance, 1)
chef:addXPBoost(Perks.SmallBlade, 1)
chef:getFreeRecipes():add("Make Cake Batter");
chef:getFreeRecipes():add("Make Pie Dough");
chef:getFreeRecipes():add("Make Bread Dough");
chef:getFreeRecipes():add("Make Biscuits");
chef:getFreeRecipes():add("Make Chocolate Cookie Dough");
chef:getFreeRecipes():add("Make Chocolate Chip Cookie Dough");
chef:getFreeRecipes():add("Make Oatmeal Cookie Dough");
chef:getFreeRecipes():add("Make Shortbread Cookie Dough");
chef:getFreeRecipes():add("Make Sugar Cookie Dough");
chef:getFreeRecipes():add("Make Pizza");
chef:addFreeTrait("Cook2");
Like, I don't get it? it's basically the same thing, how does it define to be locked
If you have an idea or solution for this, please DM me ♥️
Anyone here open to make me Vehicle or Weapon mods - This is for commission
I'm one who commissioned
Autotsar Tuning Atelier - Bus
True Actions - Lying and Sitting
Autotsar Tuning Atelier - Jaap Wrungel
ZuperCart - Carts & Trolleys
Just to name a few for the PZ community to enjoy 😄
If you are open to work on a project with me please do DM me of your mod samples
I dont think they are marked as locked. there are 2 traits, and they are mutually exclusive. the cook trait to select is "Cook", while the free one you get from the profession is "Cook2". so "Cook2" is a trait, that you cannot select, while "cook" is one you can select. if you have "cook2" from a profesion, because it is mutually exclusive with "cook", "cook" is removed from the selections as you cannot select it any more.
So I assume I can make it Brave2?
and Smoker2?
The funny thing actually
You can select Cook on other professions
This is all a bit confusing
so the addTrait call which is creating the trait I think, is what defines if it is selectable or not
I know how to make multiple tiles wide moveables, but is there a way to make moveable that is two tiles high? I tried making single square moveable and then adding "second storey" using OnObjectAdded but that doesn't work because gridSquare above initial moveable base doesn't exist until after execution of OnObjectAdded.
TraitFactory.addTrait("Cook2", getText("UI_trait_Cook"), 0, getText("UI_trait_Cook2Desc"), true);
local cook = TraitFactory.addTrait("Cook", getText("UI_trait_Cook"), 6, getText("UI_trait_CookDesc"), false);
the final boolean at the end tells the constructor if that is a profession or not
so I think you just need to make the new traits, which true at the end to stop it being selectable
Events.OnLoginState.Add(function()
print('MxEvents.OnLoginState')
end);
Events.OnLoginStateSuccess.Add(function()
print('MxEvents.OnLoginStateSuccess')
end);
Events.OnConnectionStateChanged.Add(function(state, message)
print('MxEvents.OnConnectionStateChanged')
print("state" .. tostring(state))
print("message" .. tostring(message))
end)
Events.OnConnected.Add(function()
print('Events.OnConnected')
end)
FYI: Events.OnConnectionStateChanged Is triggered before the game checks for the checksum 👀
LOG : General , 1664883343932> 0> MxEvents.OnConnectionStateChanged
LOG : General , 1664883343932> 0> stateConnected
LOG : General , 1664883343932> 0> messagenil
I think I found a way to do it, does anyone know how to create a new option inside
getServerOptions() ?
I think I can read the server settings before the server boots you for having the wrong file
LOG : General , 1664885668781> 170,072,310> LOGGED INTO : 362 millisecond
LOG : General , 1664885668782> 170,072,310> ConnectToServerState: Start
LOG : General , 1664885668798> 170,072,327> ConnectToServerState: TestTCP
LOG : General , 1664885668832> 170,072,360> MxEvents.OnConnectionStateChanged
LOG : General , 1664885668832> 170,072,360> stateConnected
LOG : General , 1664885668832> 170,072,360> messagenil
LOG : General , 1664885668832> 170,072,361> getServerOptions()zombie.network.ServerOptions@1eb7fdf0
LOG : General , 1664885668832> 170,072,361> getServerOptions():getOption("SpawnItems")Base.Belt
LOG : General , 1664885668832> 170,072,361> Connected,nil
👆 It did log in, and then it got booted Connected,nil for having wrong check sum
I'm planning to do something like this
Events.OnConnectionStateChanged.Add(function(state, message)
print('MxEvents.OnConnectionStateChanged')
print("state" .. tostring(state))
print("message" .. tostring(message))
sendClientCommand("Test", "SimplePrint", {
playerId = 'Penis OnConnectionStateChanged'
});
print('getServerOptions()'..tostring(getServerOptions()))
print('getServerOptions():getOption("CustomOptionNameHere")'..tostring(getServerOptions():getOption("CustomOptionNameHere")))
end)
Anyone knows how to get clients x,y coords?
I think I found a way to do it, does anyone know how to create a new option inside
getServerOptions() ?
that is the ini file settings isn't it?
you'd wanna read the code in the decompile, but i would assume it's hardcoded - if not then perhaps try just adding settings to the ini file and see if it parses them 
i dont think ur gonna be able to programmatically do that from within a mod tho
I have a feeling that getServerOptions returns the sandbox options of the server 🤔
🤔 does it wait for whatever you do during that event before firing the next one? Or do you essentially have a time limit to get synced before getting booted? lol
As far as I'm aware you gotta be quick and lucky 😕
But it's quite reliable
I'm looking if I can put the entire txt into a server option
hmm, ya that makes sense. Zomboid events aren't like Minecraft events, you have no control over them or their flow
Yeah
I assume sandbox options have to be synced, and we know they can be changed while the server is running, I wonder how big a string you can cram in one
I guess it's time to find out 😄
Is it possible to edit jog/sprint speed on items for mods? i.e making certain sneakers run faster, and if so is there a cap on what works and what doesn't? Thirdly, are there any mods presently available which already enhance these things? Thanks. just curious about it 🙂
you can yes
there's a run speed modifier stat
unaware of any cap and unaware of mods that mess with that as a goal but many mods have items or modifications to existing items as part of what they do
not sure if they modify that specificallyu
wasn't the run speed modifier on clothing disabled?
hmmm i dont know personally, it seems interesting to figure it out and mess with it some thats why i am curious if something like that exists or is an option to work with
Hello, I need a little help here..
How do I :AddItem("..") with two different getModDatas in it?
For example I'd like to spawn a paper that has getModData().isInfected = player:getBodyDamage():isInfected(); and getModData().isInfectionRate = FIL_InfectionRate(player);
this is the current code but I assume it'll spawn in two syringes with two separate ModData()s
that looks fine to me
But won't it give me two syringes? I need one with both modDatas on it..
why would it? you're only calling additem once
Hmm-- that confuses me now. Does it call it from local FIL_bloodsample = player:getInventory():AddItem("LabItems.CmpSyringeWithBlood"); and spawn in one
or from two separate FIL_bloodsample below?
the line ```lua
local FIL_bloodsample = player:getInventory():AddItem("LabItems.CmpSyringWithBlood");
That makes sense-- THANKS A LOT! ❤️
Does anyone know why I can't access this sandbox option? I keep getting nil
print('TransmogV2.TransmoggedItemsList'..tostring(getServerOptions():getOption("TransmogV2.TransmoggedItemsList")))
VERSION = 1,
option TransmogV2.TransmoggedItemsList
{
type = string, min = 1, max = 10000, default = NoValue,
page = TransmogV2, translation = TransmoggedItemsList,
}
It does appear in the sandbox options tho 🤔
when are you printing it? and why are you setting a min/max for a string?
no idea if the latter could actually cause problems it just seems weird
min and max was old stuff, I forgot to remove it
if i remember what you were talking about earlier, you're trying to use this when the client first connects right? sandbox options probably aren't initialised yet
are you printing it from the client?
Fair warning, I'm told that InventoryItems don't keep their ModData on a reload
LOG : General , 1664899992109> 184,397,648> LOGGED INTO : 961 millisecond
LOG : General , 1664899992110> 184,397,649> ConnectToServerState: Start
LOG : General , 1664899992126> 184,397,665> ConnectToServerState: TestTCP
LOG : General , 1664899992160> 184,397,699> MxEvents.OnConnectionStateChanged
LOG : General , 1664899992160> 184,397,699> stateConnected
LOG : General , 1664899992161> 184,397,699> messagenil
LOG : General , 1664899992161> 184,397,700> getServerOptions():getOption("SpawnItems")
LOG : General , 1664899992161> 184,397,700> MxSandboxVarstable 0x1575629001
LOG : General , 1664899992162> 184,397,701> MxSandboxVarsNoValue
Maybe maybe it works 👀
print('-------END TransmogV2 Done--------')
print('MxSandboxVars'..tostring(SandboxVars))
-- tostring(getServerOptions():getOption("DoLuaChecksum")) == "true"
print('TransmogV2.TransmoggedItemsList'..tostring(getServerOptions():getOption("TransmogV2.TransmoggedItemsList")))
-- getServerOptions():getOptionByName("TransmogV2.TransmoggedItemsList"):setValue(workshopIDsString)
end
Events.OnGameBoot.Add(generateTransmog);
Events.OnConnectionStateChanged.Add(function(state, message)
print('MxEvents.OnConnectionStateChanged')
print("state" .. tostring(state))
print("message" .. tostring(message))
print('getServerOptions():getOption("SpawnItems")'..tostring(getServerOptions():getOption("SpawnItems")))
print('MxSandboxVars'..tostring(SandboxVars))
print('MxSandboxVars'..tostring(SandboxVars.TransmogV2.TransmoggedItemsList))
-- tostring(getServerOptions():getOption("DoLuaChecksum")) == "true"
print('TransmogV2.TransmoggedItemsList'..tostring(getServerOptions():getOption("TransmogV2.TransmoggedItemsList")))
hell yeah
Too bad that I have to leave right now
FUUUUUUUUUUUUUUUUCK
💔
I'll try to get this shit up when im back
Reload as in relog or server restart? or both?
or smt else?
the data isn't saved, so server reboot or save game load or whatever
Thanks for sharing that with me
I believe the current workaround most people use is to save the moddata in the globalmoddata, but I haven't tried it myself yet so I don't know the particulars.
Do you know how it's possible do edit the globalmoddata?
maybe a silly question but is there someone/some place to look for custom mods to be made ?
You can ask here maybe you will find someone
local source = getPlayer();
local x = source:getX();
local y = source:getY();
well would anyone be interesting in seeing if you can give clothes certain boosts like a bonus runspeed?
It's already possible
how ?
and can you increase that speed buff ? (sorry in case i am asking silly questions, very new to it )
Unfortunately no, but I know its possible.
it was my understanding that the clothing speed modifiers (or at least the ones for shoes) had been disabled at some point in build 41's development
I think the Sneaker speed buff is disabled.
Bruh 😦 I have been using sneakers in my char for no reason 😦
yeah i got placebo'd so hard by it
same, lol
Uncle dane life is pain

So, the game just updated, and changed the body location and the Alice pack
Goddammit the timing

print(getPlayer():getX());
print(getPlayer():getY());
@astral dune Items save mod data just fine, I use it for my skill journal mod and a few others.
You can't save object references though - which may have been what you tried(?)
Only numbers, strings, booleans, and tables
Like I said, haven't tried it myself, just been told as much by several other modders
the only thing I've tried is attaching mod data to a vehicle, which doesn't save either.
Just trying to give a heads up
mod data on a vehicle certainly does save
All objects have a mod data list - and they should all work/save
as chuck says, object references can't be saved, it's just not possible
It's probably one of the strongest tools modders have to use
I can save moddata on a vehicle by adding it to a part, but to the vehicle itself didn't appear to work 🤷♂️
I'd be curious to check that out
I was told it wasn't possible so I didn't look any deeper, but its possible I attempted it before getting into client commands
Ah
i have a mod that partially relies on a boolean moddata being set on vehicles and it passed all my testing
Transmitting mod data requires a function
Players can't transmit their modData
Everything else works in transmit
Hey Chuck, do you know the max value for maxdistance is for sounds?
There isn't one
I have been testing and there seems to be one
Sounds can be scripted like items can
can only get sounds upto 3 cells away
I'm unclear on what the transmit functions actually do. The ones on vehicle parts are only for server->client, but are also seemingly unreliable
right
You can set the max distance and other features there
I believe the issue with the vehicles is that they dont have a moddata, since moddata belongs to isoObjects, gametime, and isoplayers, whereas vehicles are have their own object that doesn't inherit from those
I was looking at your code to see how you did it but I cant hear them beyond 3 cells
Vehicles afaik have issues updating their part damage with transmit -- but there's a specific function for transmitting modData
transmitting in which direction?
I think I set the max to also taper
yup with is3d
if it was it's still displayed
I turned it off for testing
The function actually makes it transmit to the other side depending on origin
i'm pretty sure it was just disabled java side, so by all appearances it still works
how do you change the item type...i have a shop mod that doesnt yet support literature items and i have another mod thats literature.....i need it to be an item
Sneaker speed I think still makes players faster but does nothing for Zombies
I tried making faster zombies
my information could be out of date, but i mostly follow the patch notes and i never saw them change it
Ive been testing like so...
2 clients across the map moving them in closer to eachother
there is a specific function to transmit vehicle moddata, in both directions, but players can't use it?
The function is for all objects, but isoPlayers' seems broken
There isn't a defined "not allow"
Just seems to not work
I would assume it has to do with player references in MP
🤷♂️
so if you want to transmit back from the client, you have to set up a client command to do it?
You would have to call it on the server code
the only way I'm aware to do that based on something happening on the client is a client command
I'm also told the folders are fake and don't actually work as you'd expect. I've found weird things, like code that can only be put in the server folder or it won't run, but if you check where its running at runtime it only runs on the client
Those folders are not fake
Who are these modders lol
It's confusing but they certainly do function
i don't know anything about code only working in certain folders, but server definitely runs on the client too
It runs on client if in SP
In MP it's not supposed to be callable but the raw Lua still runs
I think
when i've put a print before an isClient() on a dedicated server it shows up in my console
ZombiePopulationWindow.OnOpenPanel();
this wold be useful cuz u get to see the sound wave
I'll have to go back and look, but there was a function or event I could not access from the client, so I had to put it in the server folder. When I actually ran the code, I used isClient() and isServer() to try and check where its running, and only came back as the client
Wahhh, thanks man
But clients shouldn't get their own "server"
Ive been trying to find a better way to debug sound
hmm... i haven't observed that at all
The host is a client and the server
At least from what I saw when hosting from main menu
my testing was on a dedicated server
i made a chart for this the other day, hold on
these were my findings
I would assume the dedicated machine would take the place of a host connection too
I definitely never get isClient() and isServer() as true at the same time
and I host from the main menu from most of my testing
hmm... i'll give it another test
You could get it as true if the file is in shared I think
then about the 3d im also interested to find out about this..i tried to do this on a mp server asking them if the sound moved from left to right (didnt work for me but theres a chance that the player i asked isnt weaking stereo headset or room speakers isnt set to actualy have left and right sound) or the distance made a difference on the volume(nope didnt work too)
I assume shared code should still only be one or the other depending on where it was called from
By default I think shared code gets called as the hosts client
You'd have to use commands to flip it to server
I used to use shared exclusively cause I didn't know better
Same, also set volume to same as maxdistance to test
To be honest, shared should only be used lightly
I use it when its code I need on both sides
what are your trying to make ?
yeah i try to use server and client as much as i can
An alarm that can be heard across the map
I could send a sound to everyone but i want it directional
yup
But I draw a box around all players and use +/- 200 tiles for events
ahhh
The air raid also doesn't move or shouldnt
@weak sierra when you tested saving ModData to InventoryItems, was it server-side?
There seems to be a set range threshold where the sound wont travel anymore. Whats weird is when i move in that threshold I can heard the sound 15 seconds later as if it was just fired.
doppler effect
Try turning off reverb and 3D?
Yup, done that.
There's also a minimum distance
FMOD is kind of a nest
Could be a defined max in the java
If you can figure out a max range you could make the audio specific to each person
What im currently trying to track down now - looking through the java
Lowering the volume and setting a similar angled position
interesting
okay i finished testing this, co-op hosts do seem to actually be a client and a server separately (as you'd expect), however the client definitely does run code in lua/server/
said /server/ code is still isClient==true and isServer==false when it runs, right?
yeah
In my named lit mod I use modData without calling transmit and it seems to know to do it automatically
(isClient() and isServer()) never returns true, unlike what my chart showed
something definitely isn't adding up
is server returns false in /server/ and while hosting?
Doesn't isServer/isClient refer to the connection?
ahhh take at look at the script from "here they come" by SpoutNick
u might want to use it as reference as to how he was able to spawn the horde from a certain direction
https://github.com/spoutnickgp/zomboid-mod-here-they-come
but i dont think the sound from is 3d tho
but atleast you might get something ideas
hope that helps
it returns true in coop-console.txt and false in console.txt
so yes, probably
yeah definitely
What isn't what you expected?
Dedicated returns similar outcomes right?
Or is dedicated only isServer true
i expected that a hosted server would return (isClient() and isServer()) == true on the server side
i thought i had tested that, but i must've misremembered
Yeah, it's weird to think about but it's definitely two instances or objects
perhaps my test was actually isClient() and isServer() separately, which would seem the same but it isn't
Shared should also be isClient true by default if I recall
i'll move the test into all three folders
I really wish I was at home to test this, cuz you're the only person I've seen say it works. Well, there was an argument the other day and then the person who thought it worked tried again and found it didn't. I really was under the impression that modData not persisting on inventoryitems was the consensus
modData will persist
Modified data will not
I.e.: changing certain values
The save code only looks for things that would normally change from vanilla
But modData should always save
Perhaps the conversation was about changing variables?
I get around the variable changes issue using modData
Reapplying variables based on matching modData values
So modData definitely works
If you can link the convo I can read through it
sendClientCommand(player, "mydata", "mydata", someData)
can i put this on the shared folder?
cuz if icant then id have to send to client then send back to server i thjink
nope, they return the same values in all three folders
Odd
Oh... From an attachment hmmm
That might be the issue
Attachments are their own objects, that are created on load
Perhaps they're saving the modData on the attachment object and not the actual item
I'd have to look
their example was based on that backpack attachment mod ya, but I don't think that was the only place
i have heard about vehicle moddata not working from a lot of places, so while it hasn't been my personal experience there must be a source of that confusion
this is the code that proved to me that saving modData() to vehicles doesn't work, again may be related to Chuck saying that transmit is borked from the client side
local data = vehicle:getModData();
if data.touched == nil then
character:Say("New Vehicle", 0.0, 1.0, 1.0, UIFont.Small, 60.0, "radio")
data.touched = 1;
vehicle:transmitModData();
else
character:Say("Old Vehicle", 0.0, 1.0, 1.0, UIFont.Small, 60.0, "radio")
end
i'd imagine it wouldn't save on the client side actually, aren't vehicles received from the server completely? the client probably doesn't even save them
which is why I used transmitModData() with the impression that it would get to the server to be saved
yeah, maybe that function doesn't work properly with vehicles or something
I'm told vehicles don't actually inherit from isoObject, so the modData acts differently, but given this conversation I don't have any idea what's true anymore, and I can't check from here, haha
LOL i feel the same way
i went from a brief moment of confidence to once again having no idea how the client-server separation works in this game
From rooting around in the Java I've found that a lot of times things you think you can set get blasted out and replaced by magic numbers somewhere in a method you didn't even expect to get called
for example, did you know there is a hard and fast limit on how much friction a tire can have?
Its not in the poorly placed InventoryItem.setWheelFriction method, but in a updatePartStats function called seemingly randomly
also, every single InventoryItem having wheel friction and suspension compression etc, is just hilarious.
vehicles in particular have some insane properties
there's a static called YURI_FORCE_FIELD, what on earth does that do
lol ya I get a chuckle every time I come across it
Actually thinking about wheel friction, the game calculates an overall wheelfriction rating for the vehicle based on the stats of all your tires, it doesn't actually use different wheel frictions in the physics afaik
it determines what is a tire or not by whether or not the part has a wheelfriction >0 which means two things
- You could give your windshield a wheel friction rating and it would effect how your vehicle runs
- Modded vehicles that have spots for spare tires also effect the vehicle if you put a tire in there of a different quality than the ones actually on the ground. If its a bad tire you're better off putting it in the trunk
oh my god lol
Thats great, Can i see your work?
Honestly, there is not much to show, most of the stuff is recycle of ESX adapted to PZ, how HTML doesn't exist here, a lot of things are more tedious to do, also I will use the default db (SQLite) to save things
Although most of the things are already implemented by the game itself, just have to make a couple of adjustments.
🤔 is it possible to set up a dedicated server and client on the same computer, and be certain they're not looking in the same scripts folders?
So in testing the isClient() and isServer() confusion from the earlier conversation, I'm seeing the following:
In SP, pz is running as a single process. Both isClient() and isServer() are false. No surprises there.
When coop hosting MP,
-
pz runs two separate lua environments -- Actually, it forks a separate process running java.exe to run
zombie.network.GameServer, so in fact a separate process space.
-In the client process,isClient()istrueandisServer()isfalse.
-In the server process,isClient()isfalseandisServer()istrue.
-The lua environment on the client loadsshared/thenclient/thenserver/.
-The lua env on the server loadsshared/thenserver/(it skips lua files inclient/).
-Each environment has its own_Gas you might expect.
-The list of events that are registered are equivalent on server-side and client-side. However, theEventstable and its values are separate.
--Interestingly,Events.OnTickis raised roughly every frame on the client, and it is raised 10 times per second on the server. -
Dedicated server MP seems to function nearly identically to coop hosted MP, except of course the java process that runs
zombie.network.GameServeris started manually, instead of forked fromProjectZomboid.exe.
shouldRunServerCode = function()
-- | isClient() | isServer() |
-- Singleplayer | false | false |
-- Multiplayer Client | true | false |
-- Co-op Host (client process) | true | false |
-- Co-op Host (server process) | false | true |
-- Dedicated Server | false | true |
--
-- This is a single player game or is a coop host server process or is a dedicated server
return not isClient()
end
shouldRunClientCode = function()
-- This is a single player game or is a coop host client process or is a client connected to a remote server
return not isServer()
end
good work 😮
thanks a lot for that!
if the list of the events is the same, why is the content of the Events table different?
I don't know if its my browser, or the discord browser app or what, but when I click that link it doesn't actually show me which post you're referring to
Events is a global table (it is in _G). In each process, it is simply initialized with the same events (both have onKeyPress, etc, even though it is only useful on the client-side). In other words, the event names are the same in each Events, even though the events are raised separately (the server raises its events in its process space and the client raises its events in its process space)
@astral dune it is a link to this. Sometimes discord is wonky with url links
hmm, I'm certain that I've tried to add to an event and gotten errors that it doesn't exist in that context
that reply also doesn't take me to the comment, its several pages up from where discord goes when I click it, lol, but yes I can see the pin
Hmm.. It's possible more events are added after I compared the two. I printed out the Events table during the shared/ lua files getting loaded, so that's relatively early
could be an anticheat measure
thanks for that post Chuck 🙂 I'm gonna go chaotic evil and see what level of desync the server/client will tolerate or allow
Another option is to sandbox the processes if you need something to, for example, have a different set of workshop mods subscribed via steam (e.g. use linux namespaces or on windows that sandboxie tool).
From what I understand, if you have scripts on your client that aren't on the server, it kicks you when you try to connect. But what about after that? Can you load a script clientside without the server getting upset? Could you turn a van on the client into a sports car while the server still thinks its a van? that sort of stuff
I'm just worried I'll get fake results because both the client and server are actually looking in the same folder. Looks like what was posted is the fix for that though
¿ESX Team?
almost definitely no
i mean that would be the most simple way of hacking right? surely you can't
*maybe* scripts wouldn't be vetted as much as lua... but i'm still sceptical
You can't get it to load a script after launch just by putting files in the folder, it would have to be loaded by a mod of some kind, which are verified at launch
its potentially possible
ESX is the organization behind the RP framework on Fivem
it's worth a try i guess but i'm sure anti-cheat would pick it up
of course, at the moment a lot of people play with anti-cheat off anyway...
yes, anticheat would likely be a problem, which is why I completely disable it
Lol, ¿hablas español puede ser?
Yep, but only english this channel
Does anyone know how can I fetch a list of the magazines/VHS my character has learned from?
can someone with the debug flag and a session set up hop into the Lua debugger and see if you can access Java's String:hashcode() method? https://www.w3schools.com/java/ref_string_hashcode.asp
I don't have it open atm, but when I was looking into calling Methods via reflection yesterday, I noticed that Method is only exposed when -debug is set
hm...
Implying even if it is invokable when -debug is set, it may not be in a normal game (I didn't verify this, just a hunch)
all I really need to be able to do is convert a lua string to a Java string, and then hashcode is exposed
I'll try real quick
Looks like kahlua converts java.lang.String into native lua strings
hrm, maybe it converts native strings back to java.lang.String in a way that the reflection functions work well though



appreciate it