Should be mentioned that the github for the simple UI mod has a guide for how to do basic UI stuff, even without the mod. I've been relying on it heavily the past few coding sessions
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/Make an custom UI.md
#mod_development
1 messages · Page 39 of 1
is there a way to load a separate texture for the male/female model of a given outfit?
i dont think so unfortunately
Could you not check the characters gender when equiping the item and replace the item before running the equip script? (Not the same thing but it might be a usable workaround.)
I was hoping to keep this a simple texture replacement.
i would not think so, but who knows
i would expect it stops cold after the radius
but i do not know that for a fact
Got it, ty! I'll try to push the update this week on the STALKER Armor Pack and see if it works. Although I'll have to wait for people to report if it works, since I do not have a linux machine.
can always set up a vm
linux is free after all
also there's WSL/WSL2
if u use win10/11
I'll see what I can do. Thanks!
ow wow thank you!! 🙂
Does anyone know why ModData.transmit if used in the server folder, starts spamming transmits like hell?
Is it because I was hosting using the "host" button instead of an actual server?
maybe, if ur doing something like that ur both client and server
but i think host button is still separate..
only coop is unified totally
mm
idk 
Being in the folder doesn't mean only the server will run it. server/ scripts are loaded for both client and server
This is annoying because I need a way to sync the moddata and ModData.transmit is supposed to send a message to all client when used in the server folder, according to this document: https://github.com/MrBounty/PZ-Mod---Doc/blob/main/How to use global modData.md
Still need to code lua files in server/ such that only the server (or client, or singleplayer, whichever you want) will run it
Oh, so I still need to check for 'isClient' and 'isServer'?
This gives an overview of which lua files are loaded when by client/server
ya, the folder the code is in has little to do with which side of the client/server divide it runs on, aside from the client folder not being loaded on the server
So, I updated my code, and it seeems to work
local function onServerReceiveGlobalModData(module, packet)
if not string.find(module, "FactionMap_") or module == "FactionMap_None" then
return
end
if not packet then
return
end
ModData.add(module, packet)
print('onServerReceiveGlobalModData')
print('isServer()'..tostring(isServer()))
if not isServer() then
return
end
ModData.transmit(module)
end
Events.OnReceiveGlobalModData.Add(onServerReceiveGlobalModData);
ISChat.instance.servermsgTimer = 5000; ISChat.instance.servermsg = "Hello there"
Random little 2 liner to get a message to appear on the screen
I'll kiss you
oh thats interesting, I've been struggling with getting servermsg working without using the server command, which only works for admins
Mm, should be able to send a command to all clients and run those 2 lines to make a message appear temporarily
thank you! this is useful
same
the way i achieved this was SO much more complicated
lmao
function UdderlyUpToDate.message(msg, isAlert)
local chatMsg =
{
getTextWithPrefix = function(self)
return msg
end,
getText = function(self)
return msg
end,
setText = function(self, newMsg)
msg = newMsg
end,
isOverHeadSpeech = function() return not isAlert end,
isServerAlert = function() return isAlert end,
isShowAuthor = function() return false end,
isServerAuthor = function() return true end,
getAuthor = function() return "SERVER" end
}
chatMsg.__index = chatMsg
if not isAlert then
msg = "[Server] "..msg
end
ISChat.addLineInChat(setmetatable({ msg = msg.."\t" }, chatMsg), 0)
end```
granted this can technically do more
but
yeah
I assume so, don't understand a line of it
it basically inserts an actual message into the chat box record
I was looking at how those messages are implemented. They basically call those 2 lines
which is how the normal servermsg works
mine will let u send normal messages and/or both at once like a normal servermsg
Holy shit I just DID IT
that one is way easier if all u need is the servermsg on screen
A Sync'd map between all faction MEMBERS! :WOOOOOOOOOOO
is transmitting a message over a certain radio frequency easy? 🤔
Tyrir i'll kiss you man
I had issues only now lol, I'm encoding the gif to show it working ,I need a minute tho
Now, if only I knew someone who knows how to use tilezed I could make an "immersive" version of it
try the mapping server
or #mapping
i havent dipped into that but i will be in the near future
i got everything ready
Hey, I'm starting with my first mod and I'm having trouble getting the listener to pick up the command. Can anyone take a quick look and let me know what I'm missing? The code runs and sends off the send client command but the litsener never picks it up.
First File:
...
sendClientCommand(player, "LB", "addItemtoInv", requestedItems )
...```
APB_ClientCommands.lua (Second File)
function Commands.addItemtoInv(player, args)
for k,v in pairs(args) do
player:getInventory():AddItem(k, v)
end
end
APBCommands.onClientCommand = function(module, command, player, args)
if module == 'LB' and Commands[command] then
Commands[command](player, args)
end
end
Events.OnClientCommand.Add(APBCommands.onClientCommand)
@weak sierra
this is really neat!
OMG it's SEPARATE
MP and synced map for the factions, truly my second hardest mod to develop 😅 goddamn map apis
that's even BETTER
holy fuck yes
you make some of the best things
this and proximity inventory
Aww thank you dear
Now I only need to spend the next 20 hours figuring out the name for this mod 😅
*name yes
hm
Separate Shared Faction Map
Additional Shared Faction Map
Faction-Synchronized Second Map
Faction Map
Faction Map sounds very straight forward
i think, honestly, faction map gets it across
yeah
it makes u go "that could be X" without being too wordy
There is an issue tho 😕
I need to make it compatible with the sliders mod 
ye
shit ima have to get zero in on this too aren't i
the radar mod
that person is making a POI system soon
with their own symbol stuff
the wat 👀
is name on map but more complex
i dont use that cuz the UI fucks up with other map symbol mods
Is there an alternative to this one?

we do as well
My mod should be compatible with that one 🤔
I use it tho 👀
i think zero is making their own symbol rendering cuz they tend ot overcomplicate things
so compat with POI system + ur mod will probably be a thing

Maybe I can get in touch with this guy and we can merge mods 🤔
Having multiple layers on the map is quite POG imho (in my case the vanilla and faction layer)
do either of you guys have a second to peak at my question above? I'm sure it's something rather simple that I'm missing D:
Are you sure APB_ClientCommands.lua is loaded on the server?
Sorry mate, I barelly got my shit working, I don't really work with client commands 😅
it's listed in debug menu and there are no errors on it.
what folder is it in?
they're both in server
it's being called by a recipe and everything works up to the sendclientcommand and then it just ends
if you put a breakpoint there and look, do player and requestedItems both contain something?
yes, they both do, I've confirmed
function Recipe.OnCreate.LB_OpenBox(items, result, player)
local lootBox = items:get(0)
local modData = lootBox:getModData()
local requestedItems = {}
if (modData.LootBoxID == "knight_box") then
requestedItems = knightBox();
end
sendClientCommand(player, "LB", "addItemtoInv", requestedItems )
end```
The table APBCommands also exists right, you aren't getting any errors in your logs?
let me double check
LOG : Lua , 1666250748799> 0> Loading: C:/Users/fallen/Zomboid/mods/APB_LootBoxes/media/lua/server/APB_ClientCommands.lua
yea, no errors
guys know which file spawns the zeds and will it be possible to create a mod that affects their behavior
like they smoke cigarette when idle
or dance
I'll have to double check for the table, I don't remember seeing it. but so far as I can tell the listener doesn't even pick up the command
@empty cove
they have a framework mod called simplify
idk if u wanna mess with that or not
ill use both mods so when the POIs come out i just wanna make sure they dont break each other
lol
if you remembered to put something like APBCommands = {} in that file then you should be fine
@sour island If I recall correctly you were interested in the code that writes map markers right?
Yea, that’s in there.
I would do something like
APBCommands.onClientCommand = function(module, command, player, args)
print(string.format("Command %s called in module %s", command, module))
if module == 'LB' and Commands[command] then
print(string.format("Command %s exists in module LB, calling", command))
Commands[command](player, args)
end
end
just to see if the event is being called at all
Long story short, the syntax looks right
you can also try this and add some prints to check if it's called
local onClientCommand = function(module, command, player, args)
if Commands[module] and Commands[module][command] then
Commands[module][command](player, args)
end
end
Events.OnClientCommand.Add(onClientCommand )
Ok, I’ll try this when I’m back at my testing machine. I put break points in the onClientCommand and it wasn’t hitting them, but it may not work the way I think it does.
breakpoints on server-side code don't work, unfortunately
Aaahhh, ok
Also inventory is client-side, I think, no?
Yep it is
you can't add something to someone's inventory on the server? lmao
I’m pretty sure you can
I presumed he was doing some action client-side and was trying to make stuff appear in the inventory when it occurred
Mm, I've never tried that. I don't know :)
I’m trying to have them interact with an item and then spawn multiple items in their inventory
let me try it real quick. Now I'm curious :p
The way I’m doing it should work
What are the two parameters you pass to AddItem?
Doesn't work when I run it server-side```lua
r'print(getPlayerByOnlineID(0):getInventory():AddItem("Base.Pen",1))'
r is my remote console
works locally though
prints out true though 
Yeah, I was going to sit down and figure out how to make large circles on the map for expanded helis - like a possible area of crash kind of thing.
Any way to hide or relocate the mouse cursor using Lua?
Tried setMouseXY(0, 0) and seem to be getting ignored.
I’ve seen other mods do this, which is what I’m basing my code off of
Is debug console considered client or server side? I did a getPlayer().getInventory().addItem(“223Clip”, 1) via that and it worked.
client-side
Also keep in mind on which side you are doing print
client side will end up in console.txt and the console
server side will end up in server-console.txt (or coop-console.txt if coop hosting)
i loved EHE but im so afraid to put it on my server again
the last time i ran it i got hordes of 1000 zombies at chokepoints
more even
nuff to drop FPS to 1-2
heh
i did have redistribute time high at the time tho
maybe my own fault
We had the same experience
So in that case, is what I’m trying to do possible? Or am I going about it the wrong way.
@weak sierra it's live!
https://steamcommunity.com/sharedfiles/filedetails/?id=2877685881
I also left a thank you to tyrir for the help 
That function you are using to add an item into an online player's inventory doesn't appear to work when run on the server, so it doesn't seem like an approach that will work. However, to answer your original question, you can verify your code is being called server-side by adding print statements and watching the Zomboid/server-console.txt output
Given that the player that opens the box is the one that should have the items added to their inv, I don't see a good reason why not to just run that client-side. If for some reason you wanted to spawn an item in a player's inventory in another client, you could send a message to the server that sends another message to the client with the target player, and then call that AddItem function in a client-side command. That seems to not be your use-case however, as I understand it
Correct, I was just pondering that, is there any security concerns in doing that? Would I then just move the file to the client folder?
God send, thank you so much <3
?!
Plenty of security concerns, but those are mainly handwaved away since these are pz mods 
Hackers gonna hack haha
lua checksum in theory would guarantee integrity of your code, but it only does so much
True, thanks for all your help!
Can give you latest version if you want. Let me try to fix it up a bit, was in middle of trying to get color to work
@astral dune and @ruby urchin thank you as well.
Colour would be awesome. Could you dm it to me?
np, sorry I didn't catch the clientside thing, I've only worked with vehicles 😭 (which coincidentally is almost all clientside as well)
No worries, this is all new to me, and there’s only so much you can learn through reverse engineering
im alrady testing it on my test server
:p
it'll be rolled out live in a few mins to my server if nothing breaks
maybe the one i linked earlier :P
Send me the link again pls, I'll look into it
also i really need a way to change either the default or by-item material of UniversalRepairAnything
adding magazine-based padded gloves to my server
creates a pipeline to turn magazines into leather
cloth masks? they're leather
etc..
ill need to look into patching this cuz this is worse with craftables that are cheap
heh
christ that mod is so small
i had no idea
The universal fix?
yeah
hey so when i put mods in my game they dont show up like at all
like im not sure if its the mods glitching together but i wouldnt think so
i thought there was more to something being repairable
lol
i.. if i patch this, @gilded hawk
it'll basically be the whole mod
function RepairAnythingCore()
local items = getAllItems();
for i = 0, items:size() - 1 do
local item = items:get(i);
local fabricType = item:getFabricType();
-- NbrOfCoveredParts from java\inventory\types\Clothing.java
local NbrOfCoveredParts = BloodClothingType.getCoveredPartCount(item:getBloodClothingType())
if fabricType == nil and NbrOfCoveredParts > 0 then
item:DoParam("FabricType = Leather");
end
end
end
Events.OnGameBoot.Add(RepairAnythingCore)
it's so tiny
i wanna try with cloth as default
i didnt post changed
the alternative is to patch every item i dont want to be leather by default
lol
not sure which way makes more sense atm
guessing this patches more things that make sense than not
since my experience has been "this is fine"
cept a few
I have another mod wip about this stuff, but im a bit busy rn trying to compress a damn gif under 2MB
I could make a mod that makes cloth the default, but then fixing a lot of stuff becomes stupid easy
I'll paste it here in case anyone else could use it
cheers mandam
Some of the text size and color is still not quite right, but it the text mostly functions
local processMessage = function(line, printer)
printer(line)
end
local myTabID = harrisonUtils.addChatTab("my new tab title", "my custom chat", "/radio", "/r", processMessage, true)
If you set the 6th param to true, it will make the chat window / tabs work in single player. Can ignore passing that parameter otherwise
I'm trying to create a new procedural generation tag and a distribution callup for a mod. Do I include the scripts in the ModDistribution.lua?
I have
ProceduralDistributions = {};
ProceduralDistributions.list = {
SwordCrate = {
rolls = 3,
items = {
"Sword", 1000,
},
},
}
table.insert(ProceduralDistributions.list, distributionTable);
and
Distributions = Distributions or {};
local distributionTable = {
all = {
displaycase = {
procedural = true,
procList = {
{name="SwordCrate", min=0, max=99, forceForRooms="gallery"},
}
},
}
table.insert(Distributions, 1, distributionTable);
and i'm not sure how I go about adding these to the game
Can you somehow get the real life date a world was created? My problem is that I added a sandbox option which if enabled, a ContextMenu option would only appear for admins, like so:
if canBeRenamed then
if SandboxVars.EverythingHasAName.OnlyAdminCanRename then
if isAdmin() or isDebugEnabled() then
context:addOption(getText("ContextMenu_renameButton"), canBeRenamed, ISRenameEverything.onRenameItem, player);```
The option is defaulted to false. However, currently, the problem is that worlds which were created before the update somehow got the option defaulted to true. Can I fetch a world real life creation date and make the option appear anyways if the world was created prior to that date?
When making recipes that require more than one level in a given skill - how do I do that?
SkillRequired:Electricity=4;Metalworking=2,
This only shows Electricity
After 30 minutes of pain, I managed to get a damn gif uploaded here
https://steamcommunity.com/sharedfiles/filedetails/?id=2877685881
What are some good rebalancing mods? I'm looking for a mod that nerfs catching a cold specifically
In singleplayer, the save name is set to the create timestamp. I think it might keep the timestamp for other uses, but I can't remember now
Will look into that, thanks
getWorld():getWorld()```
Check the methods on the object returned by `getWorld()`
ah apparently there's no need. I realised I made my code to add the context option only if the option was set to True and if the player was admin, and never really added anything if the option was False lol
Thanks for the help though!
has anyone done a believable smoke animation? Or a smoke animation at all?
A very easy solution would be to give yourself extra points in the sandbox to take outdoorsman. Alternatively you could give yourself the trait through CheatMenu
yes!
So final answer is no way to hide mouse pointer (programmatically) of all the things? And no way to send it a move signal?
@gilded hawk How do you launch the game twice (probably local co-op) without steam getting offended?
I'm using No steam setting, I will make a video about this settings at some point
Inspired by client-server guide by Dislaik
I know how to enable it on dedicated server but not at all on local 😅 Is it a steam launch parameter? that sounds weird
cool, thank you!
How would I create looping sound that kept playing until something is turned off? Like the refrigerators currently.
I've gotten as far as gotten cell:playSound() but unsure how I'll make it loop.
If you want I can show you in VC I got some free time
That's very very nice of you but I don't want to take your time and I can wait for the explanatory video! I still have more to learn before I move on to multiplayer stuff 😉
Yes. -nosteam
However, you cannot launch more than once from Steam anyway because of how Steam's Play button tracks the games it launches. So put -nosteam in the Target of your exe's properties and open it directly to run copies.
I haven't seen one but if you make one I'd run it!
assuming we can add billboard sprites with transparency... and that's a big assumption... it shouldn't be too bad to make. I just didn't want to reinvent the wheel if someone had already done it.
local function preDistributionMerge()
ProceduralDistributions.list.SwordCrate = {
rolls = 4,
items = {
"Sword", 1000,
},
}
end
Events.OnPreDistributionMerge.Add(preDistributionMerge);
local distributionTable = {
Gallery = {
displaycase = {
procedural = true,
procList = SwordCrate", min=0, max=99, weightChance=100},
}
},
}
table.insert(Distributions, 1, distributionTable);
I added this to my distribution file but I am not getting spawns in. Does anyone have any ideas why?
what bloodlocation do i do to assign a piece of clothing to just forearms
or does that not exist
and that's why this person made it be "jacket" and invented the idea that "you're blocking with them"
can i just.. LeftForearm
and RightForearm

tries
😭
tfw when rereading your options 40 times doesn't change anything
another thing made by djvirus that i don't wanna use because it's split into left and right models for asymmetry which the game is not designed for, lovely then
😔
cant stand having each hand armor give both hands armor
and LowerArms is not side-based
ah well
@weak sierra @gilded hawk
Yeap can merge, it's basically a matter of switching the rendering layer between personal symbols layer / faction symbols layer.
The new rendering system will be done soon. Will inform you two once it's done.
Reason why there's a need for your own symbol rendering system is because vanilla map rendering system itself is a mess. There's a potential compatibility issue with map related mods that needs to be considered. Symbols addon is a good example where you might interfere with each other's override for symbols definition / rendering so it's better to avoid this mess by using separate rendering system.
I don't recommend you to use the 'simplify' framework available at the workshop atm. It is outdated. New version works differently so that I can easily access my own string library through any string methods instead of interfering with vanilla string plus supporting pseudo overloaded functions.
who is gerald0mc?
i am trying to make storm mods and i saw his github guide thing
but i can't find his discord
look up mods about it on steam workshop\
and then look at the code
you can get an idea
sounds good, and i look forward to being able to deploy all of these nice map mods at once :)
if either of u need anything codewise lmk
a cause i would very much spend some time on
look at existing mods, yes, like player999 says
whatever the closest thing is to what you want to do
poke around at it
then ask questions, and use these docs
Javadoc Project Zomboid Modding API package index
i know it says 41.65 but they are the most up-to-date docs around and hardly anything has changed
the ones with no version number are in fact older
some notes on the new OnPlayerGetDamage event in 41.78:
the arguments passed are the player being damaged, the type of damage as a string, and the amount of damage
the event is triggered OnPlayerUpdate for every body part that is being damaged, as well as the BodyDamage itself, each possible trigger raising its own event (for example, if you are both sick and bleeding, the event will be called twice on that update)
the damage types that i've seen are:
POISON, HUNGRY, SICK, BLEEDING, THIRST, HEAVYLOAD, INFECTION, CARHITDAMAGE, FALLDOWN, FIRE, WEAPONHIT, LOWWEIGHT, CARCRASHDAMAGE
weapon damage (WEAPONHIT) events are triggered by zombies as well as players
the event is only called on the client, except for these weapon damage events, which are called on both
I do wanna ask here before I actually attempt it, but has anyone made like a weapon "killcount" mod?
NOT the mod that shows kill count with things like cars, weapons on the info tab, since that's for ANY weapon
I guess more specifically, in TF2 there are Strange quality weapons that track kills, I want to know if anyone has SPECIFICALLY made it so a weapon can track it's own kills.
So I could say give someone my 1k kills Katana and a friend can possibly level it and get it to 2k.
CARHITDAMAGE 👀 👀 👀 👀 👀 👀
unfortunately this is the damage taken from being hit by a car, not being hit in a car
i'll have a quick look if there's anything like that though
CARCRASHDAMAGE
I don't suppose the OnPlayerGetDamage event has a reference to the vehicle? I guess not, you said it was the character, a string and an amount
still, could probably use it
well you can just :getVehicle() at that point
ya, its client side so assumptions could be made
what if its split screen and all 4 players are driving 🤔
lol
huh? getVehicle() returns the vehicle of a specific player
CARCRASHDAMAGE will only be triggered by a player in a vehicle, so... easy
yes, but CARHITDAMAGE I'd be looking for is on a zombie. you said zombies taking damage triggers these events too right?
or is it just the weapon one?
you'd have to test that yourself, i don't really know how the java works
someone with a proper decompiler should search the whole codebase for this event too, for some reason every java decompiler i can find mysteriously doesn't work at all on my computer so i'm using an online decompiler and searching individual files that seem like they would have it
I've had good luck with the capsid tool but I haven't used it since 41.71-3, I'll have to give it a go again tomorrow
I assume CARCRASHDAMAGE is the damage a player takes when they hit something like a tree in their car. At least up until now that's what they a Crash was in the code
that, and anything else that calls damagePlayers() (if there are others)
is 41.78 the unstable build?
If will be questions about new event OnPlayerGetDamage - you can ask me. Also if will be suggestions, bugs - write me 🙂
we've both just been looking for a way to hook into the moment vehicles get damaged, we hoped this might give us a workaround (as the driver usually gets damaged when the vehicle does) but i'm not sure it does
yes! Right now if mod developers want to reduce or alter damage caused to a vehicle, they have to scan every tick for changes to the parts and do something about it. Obviously this isn't very performant. Was hoping this event would give us a way to know when damage has happened, and maybe even how much, without having to scan the car parts constantly
For vehicle in future we will add better way for add armor and check damage
looking forward to it!
while you're here, may I please beg that you guys fix the vehicle engine power getting overwritten from the script so that we can change it again 🙏
these two lines in CarController.control_ForwardNew() break our ability to change an engine's power
var13 = (float)this.vehicleObject.getEnginePower();
var13 = this.vehicleObject.getScript().getEngineForce();
Do suggestion about this on forum. I will check it when will do vehicle rework in 42 build
There is actually a bug report about it here https://theindiestone.com/forums/index.php?/topic/60431-4173-engine-power-isnt-used/ do you want me to create a different post elsewhere?
The Indie Stone Forums
• Version? 41.73 • Singleplayer/Multiplayer? Tested only in MP • Host or dedicated? Both • Mods? CheatMenu • Old or new save? Both • Reproduction steps: 1. Use whatever tool you have on hand to give a vehicle a really low engine power, like 1hp. I used CheatMenu, then a little custom mod, to the ...
ah, you're right albion, CARHITDAMAGE is for when cars hit players only, not zeds. Guess I'll have to stick with my solution for now. The only damage I currently can't account for is players hitting a car with a weapon, do you deal with that at all?
i'm just reverting damage on part update
ah ok
it seemed like doing anything fancy wouldn't actually pay off
ya, I may be worrying about performance for nothing, I don't know
the part update is pretty infrequent on the scale of game logic so i'm not worried in the least
true, part updates are better than ontick
i think doing it ontick would probably be fine too but i'm staying away from that
I have one function that fires onTick, only when a player is in the car. It checks the blood intensity on the vehicle, which I think is about as fast an operation as I can do
I just went through the Indie Stone's modding policy which can be accessed since the new update to unstable 41.78. Do you think this is more a formality or that it may change smth about how mods can be uploaded to the workshop (i.e. more rules, more control, more restrictions and stuff...)?
I don't know, I haven't seen it
In 41.78, you'll have to accept some user agreement when you start the game. You can also read the policies and there is some section about modding. It sounds reasonable and not in any way restrictive or negative. I am just wondering what other modders think about since it now feels somehow "official" XD
wasn't there already a policy?
uuuhhh.... maybe. but not one you have to accept when starting the game afaik
i'll be the first of many to admit i just clicked agree and moved on without reading anything but i recall reading one in the game directory
this one
The Indie Stone reserve the right to implement any features in the game irrespective of whether mods exist that accomplish the same goal.
[The Indie Stone are free to use any ideas found in user mods, and while we will give credit if we genuinely use ideas directly from mods – we are not required to give credit or remuneration of any kind. This is purely because people may create mods that are already part of the PZ roadmap, and we don’t want to be dragged into ‘this was my idea’ arguments. The Indie Stone will of course fall over themselves to credit any mod author we genuinely use ideas from.]
PZ modders are solely responsible for their mod, including (but not limited to compliance with any hosting platforms (such as Steam Workshop). They are also responsible for obtaining third party consents for any third party materials in the mod. Legally, we have to ask that modders to ‘represent and warrant’ (i.e. promise legally) that their mod is their own original work and any third party contents are fully and properly licensed by the modder.
PZ users are responsible for their usage of PZ mods – we don’t check them and we can’t be responsible for them.
Creation of mods is subject to our modding guidelines, which may be updated from time to time with any technical requirements regarding how PZ mods must work.```
ah ok... the new policy is definitely more detailed than this. is this the full text or just a section?
interesting that the license allows us to distribute the base files, provided that we don't make it open source or put malware in it
wellp, this almost the same that on steam subscriber agreement
this is the full mod section, there's other sections though
and i'm guessing the one in-game is newer
so maybe just ignore this one...?
or like, consider the in-game one more authoritative anyway
this is the current modding policy afaict, and it hasn't been updated since april? or was it updated two weeks ago? Bloody numerical timestamps
yep! seems to be exactly the one you can now also access from the game
i'll give that a read then
its very permissive and fair, I've no problems with it
it says: "Last Updated: 04/10/2022". so either april 10th or october 4th...
given that the devs aren't american, I assume its october 4th
I have this impression too. only thing is their point 2.2.2.... sounds completely reasonable to me but I am wondering whether this might have some impact on the defecation mods or the various nude texture mods in the workshop...
2.2.2. create nor publish content that is objectionable and inappropriate. This includes but is not limited to content that is intentionally offensive, abusive, obscene, discriminatory, racist, pornographic, aimed to harass someone or a group of people, threatening, hateful, xenophobic, invasive to the privacy of another person or group of people, sexist, and/or defamatory.
yes. this
I don't think the mods I mentioned would be subject to this rule but may also be a question of interpretation...
there's nothing new in here that isn't basic responsibility honestly
i'm very happy with this
It does leave it up to the devs' discretion as to what is inappropriate. Nudity seems to be allowed, but I imagine Sex would not be. I think thats fair. If someone really really wants to mod something edgy into the game there is nothing stopping them from just keeping it for personal use or distributing it to small insular communities that want it
and while i didn't expect any less from TIS, seeing an outright statement of 'You own mods that you create.' is very relieving, particularly as some games like to say the opposite
As far as I can tell they're going about things the right way, and we can all be thankful they actually support the modding community instead of claiming to while still leaving their code obfuscated like some companies
agree. this would clearly be over-the-top for the steam workshop
just asking people here since I have a nude texture mod by myself and it was quite some work creating it. XD
It had crossed my mind earlier tbh. Someone here is making/has made a mod that gives zombies lines occasionally like help.. me.. to try and punch up the atmosphere and pathos a little bit. I thought "you know what would really give people conflicted feelings in this game? Make some of the zombies children"
I don't know if they'd allow a mod that adds children to kill
yes, but like all mods is still a little bit in development, haha
hehe yeah
I love the idea, and almost pitched the kid concept when they were here the other day. But it would likely be a tonne of work, if even possible, just to make people sad. lmao
from what i've read, it's just totally impossible right now
I hope you guys figure out a way to add more stories. I really liked the idea that zombies would be able to open the door to their former homes
i saw someone making dogs, so maybe that's changed
yeah. problem is that you cannot add additional 3d character models. so, smaller models are not really possible. you could try adding them but then, all the zombies and all the players will have those models
yeah that's what i'd heard
Dislaik's dog probably will only work in single player right now as far as I understand, I don't know if he's made progress with that. From what I understand that dog is actually animated clothing
that's a quite tricky thing. to overcome the restrictions I mentioned, you can try to make a new character model by just modelling tricky clothing items. afaik the dog creator has also made the dog this way. as Anonymous has pointed out
oh i see, make a clothing item mask the whole body and then animate the item (or at least that's how i imagine it works)
yes I think so
i'll wait for b42 lol that sounds like too much
I would be very surprised if the npc update that adds lifestock doesn't give those tools to modders tbh
yep. something like this. but still a hell lot of work doing this
several month ago, I even asked on the TIS forum what they think about nudity mods (without otherwise sexually explicit content). they answered that they were ok with it...
Alright, free time, one of these mods is getting published tonight dag nabbit...
That's right, I said dag nabbit!
who told you that
well anyway, I have disproven that when I implemented my lady dimitrescu zombie, and fat and skinny zombies in AuthenticZ
When it comes to height, though, you will run into issues. All the hat models are set at certain location offset -so if you make a taller or shorter character, by default, the hat model will stay in the same location as a normal player model. Therefore for taller models, the hat will clip through the head, for shorter the hat will be floating above the head. There are ways around this though, requires a bit of scripting work and some code to automatically change. The vanilla hairstyle system also doesn't work with my method.
didn't you use tricky clothing items for realizing the different body types? I always thought that your fat zeds for example just wear some "fat costume"...
yes
ok. we discussed this workaround later in chat. I just meant that the game comes by default with 2 character models (1 male 1 female) and that it is currently not possible to add an additional model without replacing the vanilla ones.
see here: #mod_development message
but ya... I am well aware that you can do a lot of stuff with tricky clothing models. I used this trick in one of my mods too.
how do i apply/remove effects/statuses? like pain, illness, that kind of thing?
and what does the game refer to them to?
Updates galore!
Hides usernames!
Hides level-up notifications!
Stuff stays hidden after unpausing!
Stuff stays hidden after respawning!
No known conflicts with 70+ mods!
Rebinding and Mod Options!
Disable the controller shortcut entirely if you tend to accidentally press R3!
Disable the hiding of names!
Disable the hiding of notifications!
Rejoice!
https://steamcommunity.com/sharedfiles/filedetails/?id=2875983658
@weak sierra @bronze yoke @gilded hawk @hearty dew
is there any events for eating/consuming items?
I might try decorating function ISEatFoodAction:start() in ISEatFoodAction.lua
What did that used to do for you?
i'm trying to modify/add to stats and things
Like add XP to Strength? Not sure I follow
Hey guys looking for help with a project I'l trying to set up ASAP, time is of the essence. Need lore writers, mappers, (not necessarily but would be helpful) modders, experienced roleplayers, experienced admins and moderators.
pm if interested, complete rendition of vanilla done easy as 123
yoo stop spam pls
sry man wont be another message all love ❤️
actual nicest discord user ever
seriously, though, this is really huge n with the new update and where 42 is headed, this will be the shit.
fuck 10 years later
keep it 1 hunnid
Is there a tutorial how to setup visual studio code so I have full access to code completition at least for the whole lua stuff? I assume for the java "objects" it isn't posible...
Till now I only worked with notepad++. Now I've setup VS Code with my modfolder in the workspace (I didn't understande their concept fully). The code completition now works for my code... but (of course) not for the base lua files from zomboid.
Whyyyyyy are these UI lines so convoluted....????
ISFishingUI.instance[playerIndex + 1]:onClick({internal = "CLOSE"})
Jesus.
Yeah, it's quite convoluted
Haha I am working through my 5th and final mod
For now lol
So close yet so far
Trying to work out the right command for closing context menu right now
Ay nailed it.
This one not so hideous
local contextMenu = getPlayerContextMenu(playerIndex)
if contextMenu:isVisible() then
contextMenu:closeAll()
end
Wish they all looked so reasonable
Would pz_techsupport be the place to report a bug? Several jacket's clothing xmls have m_MasksFolder and m_UnderlayMasksFolder defined to "C:\zomboid\Game\media\textures\[...]" rather than "media\textures\[...]" which makes those mask folder defines invalid.
Doesn't cause any noticeable problems... until you try to apply masking to something that isn't commonly masked. Like shoes with custom models.
Then wearing those jackets will break the masking on the shoes.
Okay! Currently my sort-of-untitled Aiming Hides Everything mod literally hides the following when I aim:
the context menu,
the fishing menu,
the crafting menu,
the mechanics menu,
the inventory menu,
the loot menu,
the info panel (health, etc.),
the debug menu
the debug console (a bit finicky, but mostly works),
the chat box,
the server info box,
the user panel,
the safehouse menus,
the faction menus,
the safe zone menu,
Can anyone think of any in-game pop-ups that could in theory be in the way when you are about to be attacked and could be canceled by aiming? (Manu Menu wouldn't "count" because you cannot aim without modding while in Main Menu.)
Interesting, let me know when you are done 💪
I've managed to do it by adding the "/pathto/projectzomboid\media\lua" folder to the "Workspace: Library" of my plugin (Lua v3.5.6) in VS. If someone knows how to add the exposed java stuff (if even possible) just give me a hint 🙂
Is there a complete pack mod that has every good basic thing? Then maybe we can just add more on top of that pack.
Which lua plugin are you using?
I'm using sumneko lua
Look At "common sense" and "mx's qol pack"
Damn interesting! I'll try to look at it
me too.
@bronze yoke @ancient grail @weak sierra @gilded hawk One more update just pushed to my UI-hider: default hud visibility!. Load up with your HUD hidden from the start. (I try.)
Anybody know how to use the new good / bad color system? I haven't checked yet.
so in the terms, your not allowed to sell mods?
I think I found it
ISBlacksmithMenu.ghs = " <RGB:" .. getCore():getGoodHighlitedColor():getR() .. "," .. getCore():getGoodHighlitedColor():getG() .. "," .. getCore():getGoodHighlitedColor():getB() .. "> "
ISBlacksmithMenu.bhs = " <RGB:" .. getCore():getBadHighlitedColor():getR() .. "," .. getCore():getBadHighlitedColor():getG() .. "," .. getCore():getBadHighlitedColor():getB() .. "> "
and I have no idea how to put battery in battery charger
let's disable all mods
no still no option
Battery charger on the ground, right clic and choose the battery in your inventory no ?
Looks like the rich text system. There's a file or two called RichTextSomething.lua, RichTextPanel.lua, or similar. You can see the rich text tags by reading it
can embed images too
It has some preset colors too e.g. <RED>, if you prefer to use over RGB:1.0,0.0,0.0
Thanks, I was just looking for the new functions. Going to add that to the UI at draw and rich texts tags later.
I tried, it's been a while since last I needed that. Will check later if it needs to be indoors or what's the issue...
You could make a bridge baby
I wonder how to reduce lag in the craft list (starting from IGUI_CraftUI_OneOf) if there are 500+ clothes items.
I disabled sorting and hid unavailable items but it still lags.
Maybe try this mod https://steamcommunity.com/sharedfiles/filedetails/?id=2611723883
i use this one
yeah
the second one i was just about to link
that is deployed on multiple servers and u don't have to press 0
so
yeh
Thanks! It's interesting despite it's overriding entire files.
yeah not ideal but it fixes it
by all means write a version that is less clunk, i'll switch my server to it lol
speaking of which i still need to check into your car dismantling mod, i was firmly entrenched with the old one and its patch
im so busy 
Back when i had time was working on a crafting menu rewrite
Do want to eventually get back to it
Yeah, ok... can't put full batteries inside.
Wanted to see how much fuel it uses from generator...
https://steamcommunity.com/sharedfiles/filedetails/?id=2757712197 Using this, which as of recent has added salvaging.
Do you have an idea to integrate the java part or why did you ask?
I'm asking because there are many different lua extension for vscode
I thought you probably have an idea because you asked specificly which plugin and had the same 🙂 do you have access to the shared function from java?
but my english isn't that great. So it's possible I missinterpet things sometimes...
Oh sorry I did not notice you replied that we have the same lua extension 😅
No no it's okay, i just got confused 😅
I'm already happy that I have some sort of Intelisens right now... 🙂
I'm wondering have you tried pipewrench (https://www.npmjs.com/package/@asledgehammer/pipewrench ) ?
It's zomboid modding, but in typescript
To be honest I already saw pipewrench but I have no experience with typescript... Also LUA is new to me. I've never used it before. So I thought stay on this is better for me 🙂
Is it possible to take a section from a UI Panel and use it? I want this part
(It's the power source from a Radio - Tænd = Turn on)
theoretically yes
have to isolate it from the main panel tho
those are usually big monolithic walls of code
I have a question beside the normal modding. Is there a way to send strings over tcp to a local ip? I have a raspberry pi with a service listening on a port and I want to send strings to it to trigger some hardware. Is this possible? It don't have to be a general solution to upload on steam or anything. But I also don't want it to break on every update. I also can disable all anticheat function on my private server and read from memory but I like clean solutions 🙂
Long story short: I want to read health of a player and send some commands to my local server onChange...
Again a normal modding question. I'm still looking on my zombie update stuff.
Can I get the framerate from the options or even better the actual framerate to make a counter in the "onZombieUpdate" function? For example I want to calculate the current frames per second and make a counter which only do stuff ever X'th frame to save performance...I want to do stuff only every 100ms or so. Maybe there are better ways to do that. I'm open to suggestions...
at that point it may be more efficient to put your counter on OnTick() and use getCell():getZombieList()
to get the framerate, use OnTick and save the last time, then check the current time and find how long it's been
What are you even doing?
Depends on if it needs to be immediate
You could get a list of zombies and then process them 1 by 1.
Doing 1 every OnTick event
If the list runs empty, get a new list of zombies
This way you are not trying to do I dunno, 100 zombies at once, depending on how hard your code is
You can write into a file in the LUA folder in your zomboid user directory
You can use that and wahtever you want to write code in even powershell and use that to do fun stuff
getFileWriter
Write to a file then have an external service read and send
You sure the overhead of a scheduler is worth it for what you want to do
Thx, I already thought at this option. How often does OnTick trigger? Acording to the wiki (https://pzwiki.net/wiki/Modding:Lua_Events/OnTick) it says to avoid that. But I can imagine that onZombiUpdate is way worse. Primary goal is to let a zombie scream if its a reanimated player. This doesn't depend on ms but also shouldn't be a second. In a "far away future" it would be neat if I can slow down the reanimation of a player to make it an "Event" and also speed up this zombie etc.
60 times a second, i think
Also thanks at the other suggestions. I'm thinking about it...
i'm pretty sure OnZombieUpdate is just OnTick per zombie
ok.. then I can stay on the OnZombieUpdate... It's just a performance thing. I saw some mods that just use onZombieUpdate and do their stuff. But this feels not good. At least for me...
If it's really always 60 times a second. Then it depends on the current framerate what is more efficient. Or do I get this wrong...
well from what i can tell, where ontick always tries to be 60 times a second, onzombieupdate will be 60 times a second, per zombie, so potentially thousands of times a second
I've already experince with reading from memory. So I know that this works finde. But I always love solutions where the game sends the data I need instead of polling the memory. It's just about to finding a clean way to do it if possible...
Ok, like similar as I wrote. The ticks aim on 60 fps and if the framerate is higher then I win and if lower then I lose...So the proposed suggestion from @signal ibex can make the difference...
#mod_development message
Lua network related stuff is removed on purpose from the game
The only networking you can do is between the client and server with java methods
No custom connections are possible
That is what I suspected. But can I manually add this for my personal use (and friends) without touching the "Core"?
I think it's easier to go with the route of using the game to save data into a text file
And your program reads it
Ahm, am I able to add some stuff with which I can achieve this... I fully understand that a steam mod should not be able to stuff like this (because of security). But it's only for personal use.
just use like pytho or powershell or sth
Yes this is very possible... Or like I said... I can read it from memory which is very effictient... But it's just about if it's integradeable (is this a word) or not...
You could rewrite the java code and send the patched files to the people you want
Yeah, but if theirs an upgrade which touches the function I have to rewrite.
But thx for the ideas. If I want to track a specific user it's probably easier to write a file. I assume writing to a named pipe is also restricted?
I'm ok with this if it's not possible with direct code. I don't want to talk about possible hacks just because of my "private" problem...
Does anyone know why some clothing can have clipping?
Like, I added some body locations for my clothes but, if I'm wearing a jacket, half the model is missing
As you can see here the yellow duffle bag, is half rendered
I still thinking about this solution. I just have no clue if I should simply count the frames for example 1 to 12 (onZombieUpdate) or if it's more efficient to do some calculations to get the framerate and then decide...
@late hound Sorry for the ping, but since you made many clothing mods, maybe you have an Idea of what and why is this clipping happening
there's an issue with waterproof overalls in ClothesBox Redux (which is handled by Peach now) that does the same
it also spews errors nonstop for some players
this was an inherited problem the mod already had, though, not Peach's doing afaik
but not sure if they know how to fix it since they have not fixed it in their own mod
i hope they do, though
sick of that happening with some clothing
That's interesting, so It might be a model problem more then a code problem rigth?
@gilded hawk I tried to DM you but Discord tells me that I can.'t. So I just post the message here... Maybe other user can offer me some help.... I'm that "far" that I have a simple cylinder ready to export as fbx.
"Can I ask you in near future about some simple modeling stuff? I already asked in the modeling channel but the tutorial etc. I received to me is to "complicated" for me. I realy have no clue about 3d modeling stuff. So I just wanted to integrate a simple stick (alias stretched cylinder) as a weapon. All the stuff I saw so far is above my simple knowledge of Blender 3.x etc"
Sorry mate, but I don't touch 3d stuff, the only "3d stuff" I do is retexturing already existing zomboid models, and that's it
I'm totally ignorant about models and exports
if i check an object's flags on LoadGridsquare it seems they just default to true at that time, does anyone know a workaround?
EDIT: if anyone comes across this in a search, this is not the case, my error was elsewhere
i tried putting all loaded squares into a list and operating on them a bit later, but it didn't work for some reason; i'm sure that would've worked if i kept at it a bit but it was really gross so i'm wondering if there's a better way
Ok... If I'm ready to do some 3d-Stuff I ask again in both channels. But it's a little embarrassing that I have no experience in this stuff.
i would assume so but i am not terribly experienced modelling yet
This is so odd tho, I'm using the vanilla clothings
i recommend wings3d, it can't do every single thing blender can do but u can make models easily enough and it's intuitive by comparison
i dont think it can animate
but u can model and texture fine

making a cylinder into a model for in game
is basically just
export as .x or use a converter to
or fbx
then put it in the folder
create a model declaration in a script
then assign it to the "sprite" (game was written in all 2d originally)
of a thing
then spend 15 minutes tweaking the scale property
Ok. So I can export an fbx from Blender and then put it in to models_X(?). And then just add it as WeaponSprite in the items.txt?
one more step in there
need the model declaration
in a script
look at an existing mod with models
it's pretty self-explanatory
but yes, that's all correct besides the omission
Which is tha simpliest item (weapon) which you can think about?
in a mod? there's a mod that adds like three melee weapons
bushcraft rare weapons
smallest one i can think of of the top of my head
Have to go afk. I come back later to this. But thanks so far...
mhm
is anyone familiar with the "time decreases loot" mod? i need some help getting it working it seems.
for MP
is brittas weapons mod better than firearms B41?
i use VFE and various expanding mods, myself
I personally like brittas but I haven't tried the others
brita's is too bloaty, loot heavy, and full of redundant guns/attachments with no or little practical difference
imo
but that's a matter of taste
never used firearms
if ur a gun nut tho brita's has the most and most technically accurate content
there is a lot of redundancy, ya, but I think that gives variety without forcing you to choose the "best" gun. But I'm also unclear on how much of a difference the stats actually make. I should really try the other gun mods though
i stay away from gun mods as a whole, none of the popular ones seem to really follow the vanilla weapon balance
Okay... trying to hide the notification for Maintenance level-up... It is not called the same way as Sprinting and Sneaking levels are called. Presumably combat XP works this way, because I get the Maintenance XP from fighting.
I've tried a few things that unfortunately didn't work:
local sendAddXpOriginal = sendAddXp
function sendAddXp(player, perk, number, booleanA, booleanB)
-- Before
if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
zeroSurvivedTime()
end
sendAddXpOriginal(player, perk, number, booleanA, booleanB)
-- After
if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
restoreSurvivedTime()
end
end
local function hidePerkLevelNotifications()
patchJavaMethodB(zombie.characters["IsoGameCharacter$XP"].class, "AddXP",
function(metatableMethod)
return function(...)
-- Before
if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
zeroSurvivedTime()
end
-- Proceed
metatableMethod(...)
-- After
if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
restoreSurvivedTime()
end
end
end
)
patchJavaMethodB(zombie.characters["IsoGameCharacter$XP"].class, "AddXPNoMultiplier",
function(metatableMethod)
return function(...)
-- Before
if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
zeroSurvivedTime()
end
-- Proceed
metatableMethod(...)
-- After
if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
restoreSurvivedTime()
end
end
end
)
patchJavaMethodB(zombie.characters["IsoGameCharacter"].class, "LevelPerk",
function(metatableMethod)
return function(...)
-- Before
if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
zeroSurvivedTime()
end
-- Proceed
metatableMethod(...)
-- After
if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
restoreSurvivedTime()
end
end
end
)
end
hidePerkLevelNotifications()
This code hides some notifications and produces no errors, but I am not sure if it's 100% well-formed because I'm not 100% what the class fields should look like when they enter the patch function. Also not sure how many other points of entry XP could have.
Any ideas?
@hearty dew Your 2 cents would probably be priceless if you find the time to look this over later today. No rush. I'm about to get busy (hence giving up for now on solving it myself after a few hours).
i'm not sure i understand what you're asking, are you asking if this is good code or is it not working for maintenance xp?
the double spacing is killing me 😫
is addXPNoMultiplier the function that's called by maintenance? Its never called from the lua side so patching it won't do anything
It's not working for Maintenance XP
I think the code is good, just not achieving my specific goal.
For all I know, I blocked a different XP event of which I'm not yet aware.
I believe this does at some point level Maintenance, yes.
Let me check the decompiles
The only spot on the lua side that I can see that is increasing Maintenance XP is in ISChopTreeAction, I can't seem to find where it happens in combat
and let me guess, sendAddXP is being used for maintenance xp?
you definitely get maintenance XP from fighting, but that may be only from the java side
maintenance increases on weapon hit
Sorry, no, maintenance is a normal AddXP, I just added the NoMultiplier version to try to get lucky on the maintenance case.
there's an addXPNoMultiplier eh
Well I tried to decorate sendAddXP just in case as well
that's useful information for what i am literally about to work on
lol
how convenient
I am not sure what XP it successfully hides, if any
that's why i was telling you these java hooks wouldn't work if it wasn't called from the lua side
This XP notification crap is a mess, not usually only in Lua.
Hiding the Sprinting / Sneaking / Lightfooted XP was a headache lol
Aside from chopping trees, the only places I see maintenance XP being awarded is in SwipeStatePlayer.connectSwing and SwipeStatePlayer.animevent which aren't called from lua, which means you can't intercept the addition itself. What code actually renders the popup on screen?
addTextWithArrow
since ur hiding literally everything why not just intercept that
and forget hooking these things
I also saw connectSwing and animEvent and couldn't figure out how to use them, if it's even sneaky possible
just hook all the ui rendering
and turn it off
and forget about intercepting what calls them

addTextWithArrow is called on the Java side only afaik.
ah
I have to maneuver around the AddXP call from Lua to Java to hide it for the events I've successfully hidden so far
for my purposes i dont care about hiding such things since they are intermittent and my interest is screenshots
Not the addTextWithArrow call, that's inaccessible directly.
you may be out of luck for maintenance, it doesn't look like the callstack leaves the java side for that one
which is odd, you'd think the actual render to screen would be lua
yeah most if not all UI flows thru lua in my experience
that is odd
thats why i initially said that
How do you propose this? It's not all managed in one way afaik... toggleUI does not toggle stuff like this.
to just hook the ui
well
im sure there's some raw functions somewhere down the stack
but they may be in java
just find all the lowest level rendering calls
and tap into the relevant ones
that u can from lua
ISRadioInteractions uses addTextWithArrow, not currently clear on what its doing
Yeah if I knew any way to hide the UI entirely, including XP notices and crap, without all this detail thinking about hiding specific kinds of UI elements, I would love to do so.
Unfortunately that is not how the UI seems to be written on Zomboid's end.
if u can call it from lua u can override the exposure point if im not mistaken
but
if it calls it from java
ur still SOL
Some AddXP calls appear to be Java-to-Java. I was trying to work backwards from them to a function that triggers them and happens to be exposed, but no success yet.
ISradioInteraction.doSkill appears to be what actually handles the popup on screen. At least in 41.78
its a local function though, may be tricky to patch
Really?! What file?
ISRadioInteraction
ISRadioInteraction.lua
Okay
hmmm, it may only be related to when you get skill points from radio/tv broadcasts
Oh hell you might be on to something here in this file
doSkill is called by the Interactions, which are a radio thing, I don't even see a maintenance interaction. I think this is a dead end for your current problem, but I think if you want to block ALL popups you're going to have to deal with this too
this is just for the radio/tv -stress +cooking stuff
ya
kinda weird that they excluded maintenance and only maintenance from the radio interactions
Yo if I change a Lua and run it in SP just to see what would happen, is game gonna be mad?
nope
Right on... Gonna try something
Can't tell if 41.78 has changed how the vehicle mechanics menu is rendered or if I've broken something
Trying to get started with creating a very simple UI:
require "ISUI/ISPanel"
MyUI = ISPanel:derive("MyUI");
function MyUI:initialise()
ISPanel.initialise(self);
self:create();
end
function MyUI:prerender() -- Call before render, it's for harder stuff that need init, ect
ISPanel.prerender(self);
end
function MyUI:render() -- Use to render text and other
self:drawText("Hello world",0,0,1,1,1,1, UIFont.Small);
end
function MyUI:create() -- Use to make the elements
end
function MyUI:new() -- x, y, width, height
local o = {};
x = getMouseX() + 10;
y = getMouseY() + 10;
o = ISPanel:new(x, y, 200, 120); -- width & height here
setmetatable(o, self);
self.__index = self;
o.variableColor={r=0.9, g=0.55, b=0.1, a=1};
o.borderColor = {r=0.4, g=0.4, b=0.4, a=1};
o.backgroundColor = {r=0, g=0, b=0, a=1};
o.buttonBorderColor = {r=0.7, g=0.7, b=0.7, a=0.5};
o.zOffsetSmallFont = 25;
o.moveWithMouse = false;
return o;
end
function openUI()
print("Opens UI")
local modal = MyUI:new()
modal:initialise();
modal:addToUIManager();
end
Events.OnGameStart.Add(openUI)
It doesn't open up. I've followed this guide and even tried copying his example into instead and use OnGameStart to open it also. https://github.com/MrBounty/PZ-Mod---Doc/blob/main/Make an custom UI.md
MyUI:setVisible(true) and maybe MyUI:setEnabled(true) may also be necessary
In openUI function?
Hmm still didn't work..
function openUI()
print("Opens UI")
local modal = MyUI:new()
modal:initialise();
modal:addToUIManager();
modal:setVisible(true);
modal:setEnabled(true);
end
does that print statement show up in your logs?
can you do openUI from console?
that too
Does "ArrayList:remove" work at all in lua?
I can't remove a damn element from this damned ArrayList
it just takes an index, right? are you passing the right index?
No it doesnt :((
How would I run this?
with arraylist:size?
LOG : General , 1666388662600> self.containerList:size()4
LOG : General , 1666388662600> self.containerList[zombie.inventory.ItemContainer@1a735c4e, zombie.inventory.ItemContainer@557282d5, zombie.inventory.ItemContainer@5326c1f, zombie.inventory.ItemContainer@285fc3b]
LOG : General , 1666388662600> proxInvIDX: 2
LOG : General , 1666388662600> -----------AFTER-----------
LOG : General , 1666388662601> self.containerList:size()4
LOG : General , 1666388662601> self.containerList[zombie.inventory.ItemContainer@1a735c4e, zombie.inventory.ItemContainer@557282d5, zombie.inventory.ItemContainer@5326c1f, zombie.inventory.ItemContainer@285fc3b]
Yeah
local old_ISCraftingUI_getContainers = ISCraftingUI.getContainers
function ISCraftingUI:getContainers()
local result = old_ISCraftingUI_getContainers(self)
if not self.character or not ProxInv.isToggled then
return result
end
-- If ProxInv is enabled:
-- then remove the first container of getPlayerLoot(self.playerNum).inventoryPane.inventoryPage.backpacks
local countOfLootContainers = #getPlayerLoot(self.playerNum).inventoryPane.inventoryPage.backpacks
print('self.containerList:size()'..tostring(self.containerList:size()))
print('self.containerList'..tostring(self.containerList))
local proxInvIDX = (self.containerList:size() - 1) - (countOfLootContainers - 1)
print('proxInvIDX: '..tostring(proxInvIDX))
self.containerList:remove(proxInvIDX);
print('-----------AFTER-----------')
print('self.containerList:size()'..tostring(self.containerList:size()))
print('self.containerList'..tostring(self.containerList))
return result
end
launch the game in debug mode
just type openUI() then
ya, I don't see anything wrong with this, maybe it doesn't work
This is fucking insane why the hell :remove does not work
Hi! I already asked this question a few days ago but no luck so far in trying the suggestions here from chat. Here it is: When making a new recipe via scripts and requiring that the player needs 5 items to realize the recipe, does anyone knows whether it is possible to allow the player to use 5 items from different categories?
What I want to do is this: The player should be able to craft a new item using 5 berries as ingredient. The game comes with different types of berries: Base.BerryBlue, Base.BerryGeneric1, Base.BerryGeneric2, ... and so on. Now I want to arrange things so that players can use any combination of those berries as long they have 5 berries in their inventory. For example 5 Base.BerryBlue should work but also 2 Base.BerryBlue + 3 Base.BerryGeneric1.
I already tried to include constructions like this in the recipe.txt but nothing worked for me:
Base.BerryBlue/Base.BerryGeneric1/Base.BerryGeneric2 = 5
or
[Recipe.GetItemTypes.Berry] = 5
or
Base.BerryBlue/Base.BerryGeneric1/Base.BerryGeneric2,
Base.BerryBlue/Base.BerryGeneric1/Base.BerryGeneric2,
Base.BerryBlue/Base.BerryGeneric1/Base.BerryGeneric2,
Base.BerryBlue/Base.BerryGeneric1/Base.BerryGeneric2,
Base.BerryBlue/Base.BerryGeneric1/Base.BerryGeneric2,
The first two required the player to have 5 berries of one and the same type (i.e. only 5xBase.BerryBlue or 5xBase.BerryGeneric1 and so on but not possible to mix up different berries). The latter one allowed the player to realize the recipe with only one berry and then produced errors. Thanks for any help!
Can recipes use tags?
Sooo, :remove() on anarraylist works if you are passing the object you want to remove but not the index, this is fucking insane man
oh ok, they must only expose that overload and not the base version. I'm surprised that actually works from the lua side, pretty slick all things considered
nice find
I want to detonate my PC and and start farming irl after this
problem with tags is that there might be other things containing the string "berry" which should not be added to the recipe. for example strawberries
make your own tag and assign it to the berries you want to use
how can this be done? adding smth to the script definitions of the berries?
yes, exactly. Like itemtweaker does
and do you know how work with those "tags" in the recipe definition?
If not that, I notice the scripts for most berries include FoodType = Berry and HerbalistType = Berry, dunno if you can use those
no, which is why I asked if recipes use tags or not
ah ok! XD
so I already tried this: [Recipe.GetItemTypes.Berry] = 5 but didn't work for me.
their Type is just Food, so I wouldn't expect that to work
this Recipe.GetItemTypes is a custom function. it is also used in various vanilla recipes like Recipe.GetItemTypes.Sugar but it doesn't seem to provide the features I am looking fo
If you want a custom function you gotta write it
you can make something like
function Recipe.GetItemTypes.Berry(scriptItems)
scriptItems:addAll(getScriptManager():getItemsTag("Berry"))
end
yeah... what I meant: there are already similar vanilla functions as Recipe.GetItemTypes.Sugar and I wrote a function Recipe.GetItemTypes.Berry in the same way but it didn't work for me.
what does your function look like?
the vanilla Recipe.GetItemTypes.Sugar also doesn't allows the player to use different types of sugar like "Base.Sugar" or "Base.BrownSugar" for example (I playtested). therefore not sure if this will help
that is weird, since the function explicitely adds brown sugar
function Recipe.GetItemTypes.Sugar(scriptItems)
scriptItems:addAll(getScriptManager():getItemsTag("Sugar"))
addExistingItemType(scriptItems, "SugarBrown")
addExistingItemType(scriptItems, "SugarPacket")
end
yeah. but when you use it in the recipe via
[Recipe.GetItemTypes.Sugar];2
you can only craft the item by using either 2 units "Base.Sugar" or 2 units "Base.BrownSugar" or 2 units "Base.SugarPacket". no way to mix different sugar types up by this
ah ok, you may be out of luck then
yeah... I fear so.... only workaround I can think of so far is to implement the whole recipe via lua coding
😶
have you tried something like
[Recipe.GetItemTypes.Berry] = 1,
[Recipe.GetItemTypes.Berry] = 1,
[Recipe.GetItemTypes.Berry] = 1,
[Recipe.GetItemTypes.Berry] = 1,
[Recipe.GetItemTypes.Berry] = 1,
not yet! worth a try!
ah no. will also have the result that I can use only one berry and then produces an error 😦
Recipe Make Something
{
ExampleItem1/ExampleItem2/ExampleItem3,
ExampleItem1/ExampleItem2/ExampleItem3,
ExampleItem1/ExampleItem2/ExampleItem3,
ExampleItem1/ExampleItem2/ExampleItem3,
ExampleItem1/ExampleItem2/ExampleItem3,
ExampleItem1/ExampleItem2/ExampleItem3,
Result: ExampleResult,
}
thanks for suggestion but I already tried this version and it doesn't work for me. when I use this, I can already realize the recipe with a single ExampleItem (no matter whether it is 1 or 2 or 3) and then the game produces an error for me
this is the error which is then generated:
STACK TRACE
Callframe at: PerformMakeItem
function: perform -- file: ISCraftAction.lua line # 58 | Vanilla
ERROR: General , 1666392633221> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method).
ERROR: General , 1666392633221> DebugLogStream.printException> Stack trace:
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at se.krka.kahlua.integration.expose.caller.MethodCaller.call(MethodCaller.java:62)
at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:198)
at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:188)
at se.krka.kahlua.vm.KahluaThread.callJava(KahluaThread.java:182)
This works for me, just tested.
recipe Do Something
{
Pen/BluePen/RedPen,
Pen/BluePen/RedPen,
Pen/BluePen/RedPen,
Result:Pencil,
}
hmm... ok. I copy paste your example and see what happens. thanks!
setting all this into module Base { } probably??
doesn't work for me either. the problem is that I can already craft the recipe when I have a single pen in my inventory instead of three and this produces a bug
Huh, beats me then?
in this screenshot I just play-tested the code (no other codes or mods enabled
have you tried this with a single pen in your inventory?
I guess having multiple identical ingredient fields breaks a recipe; never was anything that was needed in vanilla so doesn't surprise me?
yeah. I also guess this is due to some strange duplication issues
There’s this mod that puts Ford trucks in the game. Especially four door ones. Does anyone know by chance which mod it is? I tried looking for it no luck.
I actually discovered the green arrow text function is exposed and tried modding it to silence it, but unfortunately it didn't work or I did it wrong. Gotta revisit later... may be a dead end. 😭
Hey guys I got my art gallery guaranteed spawn working!! Mod to be published soon. Thank you to everyone for providing resources that helped me out.
I have a question that I'm really hoping someone can help me with....
I've made a book, skinned it, everything is great, until I use the book to read it... the skin it then uses reverts back to the original book when reading. How can I change this? Where do I look up this skin/model for when reading this book?
How does one find the name of a tile to make use of it in a mod?
Have you created/defined a WorldStaticModel and a Static Model?
{
DisplayCategory = SkillBook,
Weight = 0.1,
Type = Literature,
DisplayName = Some Book,
Icon = SomeBook,
ReplaceOnUse = SomeBook,
StaticModel = SomeBookOpen, <--- Used when reading the book
WorldStaticModel = SomeBookClosed, <--- Used when placing the book on the ground
}
model SomeBookClosed
{
mesh = WorldItems/SomeBookOpen,
texture = WorldItems/SomeBook,
}
model SomeBookOpen
{
mesh = WorldItems/SomeBookOpen,
texture = WorldItems/SomeBook,
scale = 0.4,
}```
is there a quick way to append two java.util.ArrayLists without iterating through them?
someone should pin this
super lit!! wtf holy sh******
🎉
I found the issue, it was me missing linking up the static model, appreciate the help 😄
tilepicker
Hey there! Does anyone knows what those strange error messages mean?
ERROR: General , 1666406172835> RenderThread.logGLException> OpenGLException thrown: GL Error code (1286) encountered.
Error translation: Invalid framebuffer operation (1286)
While performing: TextureID.noMips.start
ERROR: General , 1666406172847> ExceptionLogger.logException> Exception thrown org.lwjglx.opengl.OpenGLException: GL Error code (1286) encountered.
Error translation: Invalid framebuffer operation (1286)
While performing: TextureID.noMips.start at PZGLUtil.checkGLErrorThrow line:23.
ERROR: General , 1666406172848> DebugLogStream.printException> Stack trace:
org.lwjglx.opengl.OpenGLException: GL Error code (1286) encountered.
Error translation: Invalid framebuffer operation (1286)
While performing: TextureID.noMips.start
at zombie.core.opengl.PZGLUtil.checkGLErrorThrow(PZGLUtil.java:23)
at zombie.core.textures.TextureID.generateHwId(TextureID.java:592)
at zombie.core.textures.TextureID.createTexture(TextureID.java:508)
at zombie.core.textures.TextureID.createTexture(TextureID.java:491)
at zombie.core.opengl.RenderContextQueueItem.invoke(RenderContextQueueItem.java:77)
one user of my mod reports them but I have no idea what this is about. is this even caused by a mod or more a system issue?
what does your mod do?
it adds some anatomically correct nude texture to male and female characters (ra's body mod). all those features are essentially clothing items which are automatically equipped to the player. but I think this error maybe a non-standard issue. never seen it before and for the vast majority of users, the mod seems to work flawless
hmmm it could be related, this is a graphics engine crash
could just be an old video card that doesn't support certain openGL operations
hmmm ,it would have to be real old
either way, unless you're writing custom shaders for your texture this one isn't really your fault and I doubt there is much you can do
unless your texture is insanely high resolution or something it's out of your hands
hey albion, you're running the unstable build right? Does your mechanics window look like this?
give me a second
nono, the new 3d model which is introduced has 200 faces or so? didn't even know anymore but it was way much under the recommended borderline. texture resolutions are all the same as in vanilla
yep, just like that
I don't remember all the parts being colored like that all the time before, also can't seem to right click on the hood anymore. Not sure if I broke something or not
ah ok
they did make some changes to the mechanics ui this update, don't remember if the colours looked this way but i can right click the hood
this is all i remember seeing in the patch notes
I notice they added % of gas and ... ya that
oh you mean right clicking the hood on the picture? i didn't even know you could click those...
yeah, i can't right click it there
ya, you can, but its always been a little hit and miss
thanks for info. in general, I always try helping people when they have problems with my mod but I think I cannot do anything... btw, the video card of the user is an Intel HD Graphics 4000
integrated graphics, rip
i think it is a quite old model (from 2011 or so???)
yeah that's pretty weak, it's unfortunate
tell them to update their opengl/graphics drivers as far as they can and hope for the best, but honestly that is meant to be showing spreadsheets
make sure they've turned on texture compression
i'd be surprised if the game was running without it on that thing but just in case
ok. I let them know
had to switch to stable to check something else so i had a look for you, the colours have changed
you couldn't right click the hood even then though
ya, that's more familiar, they only turned red when broken, and maybe green for a second after being repaired
thanks for having a look
still slogging through this UI stuff, but we're getting there
the bright colours are a little garish honestly, i hope that's easy to mod back
ya, assuming its not a bug I imagine the did it for quicker identification of issues, but the color of the %s beside the part names was good enough imo
it's part of their big push with this 'good colour/bad colour' feature i think
good colour bad colour?
it's a great idea, particularly for accessibility
yeah basically in the unstable build you can set your 'good colour' and 'bad colour' (green and red by default, as in previous builds) and these colours will show up everywhere in the ui
thats pretty nice, R/G colorblindness is super common. All the UI's I build for work I take careful note of which colors I use
Any snippet to check if a object is N, W, S, E dir?
Not sure. Maybe take a look at the item with the chunk debugger in admin mod? If anything you'll be able to tell the sprites
obj:getDir():toString()
thx man, I tried that but always get N, anyway I found another way
local getWindowSquare = function(window)
local north = window:getSprite():getProperties():Is(IsoFlagType.WindowN);
local west = window:getSprite():getProperties():Is(IsoFlagType.WindowW);
if north then
local square = window:getSquare()
if square == window:getIndoorSquare() then
local extSquare = getCell():getGridSquare(square:getX(), square:getY() - 1, square:getZ());
return { square, extSquare };
end
return { square, window:getIndoorSquare() };
end
if west then
local square = window:getSquare();
if square == window:getIndoorSquare() then
local extSquare = getCell():getGridSquare(square:getX() - 1, square:getY(), square:getZ());
return { square, extSquare };
end
return { square, window:getIndoorSquare() };
end
return nil;
end
Do you know how to get the item type of a moveable? I'm trying to get HamRadio1 or Base.HamRadio1 from a placed down radio but I can't figure it out.
if instanceof(tObj, "IsoRadio") then
I specifically need to return HamRadio1, not any other kind of radio. Otherwise I'm already using that snippet to check the frequency
Currently doing it with getSprite():getName() but I was wondering if there was a better way
(Not at home so can't show my code atm)
if you don't want to do based on texture then you probably can get the item with getType() and then getFullType().
wanted to say getItem()
Oh, I'll have to give that a try then. getType():getFullType() ?
Full type includes also the module, like base if you need it.
Yeah that'll do. I'll do a string.find(type, "HamRadio") to include all ham radios so module probably doesn't matter
Thanks for your help 👍
then maybe start with just getType
I tried that and it did not work, so maybe I was missing something
Print the item you're using it on to see what you have.
How do you do that again? I don't use the in-game console much. My function checks all objects in a radius around the player then checks if it's a radio, turned on, on the right frequency, then the sprites to make sure it's the exact radio I need
yeah sorry, doesn't work
getDeviceData():getDeviceName()
works but could be translation name
I tried that, it is, unfortunately. Better Sorting changes the radio names and messed up my mod, that's how I figured it out
when playing the game in split screen, how do I get the second player?
getSpecificPlayer is for that purpose. Use getNumLocalPlayers (or something like that) to get the number of them to iterate using getSpecificPlayer
How can I spawn a Container in the world, like a kitchen counter ? Any snippet you can point me to?
--[[
Gets all players matching a predicate. The default predicate is all players that aren't dead.
Usage example:
local all_living_players = LUtils.getPlayers()
local all_players_named_bob = LUtils.getPlayers(function(p) return p:getDisplayName() == "bob" end)
Notes:
getNumActivePlayers:
- Singleplayer: number of local players in client (including all split screen players)
- Client: number of local players in client (including all split screen players)
- Server: 1, but getSpecificPlayer() calls always return nil on server
getOnlinePlayers:
- Singleplayer: nil
- Client: lists all players (including split screen players)
- Server: lists all players (including split screen players)
getConnectedPlayers: trash. only seems useful for working with scoreboard?
- Singleplayer: 0
- Client: only updates when a player manually open scoreboard, but lists all players then
- Server: 0
]]
getNumActivePlayers
ok. thanks. I am gonna try.
a related question: for multiplayer, getSpecificPlayer is also necessary? at least I have some mods which seem to work fine in multiplayer but never used getSpecificPlayer
thank you 🙂
online multiplayer or splitscreen?
for my related question, I meant online multiplayer without split screen
getSpecificPlayer only looks up the 4 local players (getNumLocalPlayers will return 1-4 as I recall). getSpecificPlayer(0) happens to return the first player, and many mods use that to get the one local player, but that relies on the assumption that it will always return the 1st split screen player. It is better to get the player object from some other context (e.g. the player that is associated with whatever action was taken that resulted in the code to run)
If some user is playing online multiplayer while splitscreen (like him and friend on couch are joining the same dedicated server), that can be an issue
razabUtils.getPlayers = function(predicate)
local result = {}
predicate = predicate or function(player)
return not player:isDead()
-- and player:getCurrentSquare() -- Will filter out players sufficiently far from client that their square isn't loaded
end
if not isClient() and not isServer() then
-- singleplayer
for i = 0, getNumActivePlayers() - 1 do
local player = getSpecificPlayer(i)
if player and (predicate == true or predicate(player)) then
table.insert(result, player)
end
end
else -- multiplayer
local onlinePlayers = getOnlinePlayers()
for i = 0, onlinePlayers:size() - 1 do
local player = onlinePlayers:get(i)
if player and (predicate == true or predicate(player)) then
table.insert(result, player)
end
end
end
return result
end
Basically, my advice would be:
- Use an existing context to get the player object if at all possible
- When not in singleplayer, if can't do 1, use
getOnlinePlayersto get other players - When in singleplayer, if can't do 1, use
getNumActivePlayerswithgetSpecificPlayerto get other (splitscreen) players
personally I made a table that return true for the sprites that I want.
I could do that, true
Fun fact I used to place the myModule.ItemName and pickup a moveable.spritename item...
autoconversion from game
many thanks! I think I see the problem. so in most cases, I just use the "player" which is given to me by event which may work out of the box? but there are also cases where I simply use
local player = getPlayer()
and this is probably causing issues in split screen (but not in online mp without split screen) ....
getPlayer is the same as getSpecificPlayer(0). Same issues, yes
Same advice I said about getSpecificPlayer applies to getPlayer. I'd not use that api (unless I'm okay with not properly handling split screen)
so in most cases, I just use the "player" which is given to me by event which may work out of the box?
Yes, this is ideally what to do, get the player object from some existing context (e.g. the event that the player initiated)
After further testing... I AM hiding Weapon perk level-up pop-ups. Maintenance is the ONLY mf green halo text for leveling that seems to appear when I am hiding HUD... Ugh what a mystery
If you have a specific scenario when you don't have a context to get a player from (like your getPlayer() case), maybe explain it and we can figure something out
oh many thanks!. I try: whenever a new game starts or a game is loaded, I automatically equip the player certain cothing items. for loading a game, I use the event OnGameStart but this doesn't have a player variable as parameter (at least according to the wiki: https://pzwiki.net/wiki/Modding:Lua_Events/OnGameStart ). I therefore used just player=getPlayer() in this case and this is probably the problem. the people reporting the problem even said that the main problems occur when the second split-screen player leaves game and enters again...
Maybe the onCreatePlayer event would be fitting
Yea, that's worth investigating. Haven't tried out that event personally, but if it is raised for each local player created, that sounds to fit your requirements @small topaz
I need to check a item modData right when it is about to be picked up from the floor. Which function can I override to check it?
kk. many thanks! I'll try that and see what happens when I use this instead of OnGameStart
ISMoveablesAction perform is the one I use, but it has some kinks if you want to edit the data.
Yeah, I need to edit the data...
still another but related question: in a lot of cases, vanilla functions have a variable "player" as argument. in those cases, is it safe to simply use this variable for accessing the player or is it better to do something special before I access, for example smth like
local playerObj = getSpecificPlayer(player)
?
and let's say that the vanilla function also only uses the player variable for accessing the inventory or skills for example...
Sometimes player in vanilla code is a player object and sometimes an integer. When player is an integer, it'd have to be either that (local player id) to use with getSpecificPlayer (this is what I've come across before), or possibly an online player id (but I haven't seen this myself)
kk. I think I try to figure out how the vanilla code is handling the variable and then just do it same way. this should probably be safe...
Can you show me this function? What param it receive, what is the require to add to the code...
Or if there is another one to use, because you said that there is some kinks if I have to edit the modData, which is what I need to do.
BUAAA BUAAAHAHAAAA
@bronze yoke I may have a somewhat-but-not-all-that-wonky workaround
OnWeaponSwing can solve the combat Maintenance side of hiding XP notifications for me.
Buaaaaaaa buaaaahahaaaaa
IT WILL ALL BE HIDDEN
I WILL HIDE THE WORLD
Yes, that's a great approach
That's for when I pick up things
for placing it goes after the original
the findonsquare is similar to the vanilla function
ISMoveableSpriteProps:findOnSquare( _square, _spriteName )
Question about "transmitCompleteItemToServer()"
When exactly do I have to call this? For example if I set
self.character:getBodyDamage():getBodyPart(BodyPartType.Hand_R):SetScratchedWeapon(true);
do I have to call it on the character in multiplayer games?
Thanks, I will try it
Ugh, was working, now not. Ugh lol
What did I mess up sigh
what kind of item are you picking up btw
A regular item that I'm setting to function as a sensor, the mod data is to set it as active or inactive, if it is active on the floor, when the player grab it back I need to set the data to inactive again
If you're just dealing with regular inventory items (not moveables, like couches and stuff you need to go into place mode to pick up), you might need to look at ISInventoryItemTransferAction
Yeah, it's just a inventory item
Yeah it's a different action then.
There's no way for additional split screen players to send chat messages, is there?
you can modify stats of the player as well as stats of the food items in question. as pseudocode, it is smth like player:setUnhappyness(10) or foodItem:setUnhappyness(10). dont know the excat syntax by head an write on my mobile phone. but you can just search the project zomboid java doc to find the relevant commands (try searching for unhappyness or unhappiness for example)
After searching the lua code I only found this in the context of placing worlditems. So I assume it's just releated to stuff in the "world". Now I asked myself what is about ":transmitModData()" for example of a zombie. Do I have to call this after I modified some data or does it automaticly syncing with all clients and server?
For example:
local modData = zombie:getModData()
--do stuff with modData
zombie:transmitModData()
When I use this code for example on a server can I use the modData added on the client? As I understand it this is the case...
Is there a general tutorial how modData works?
it does not automatically sync, as you often don't need to sync it, and sometimes specifically don't want to
Ok... How does this work for GlobalModData?
Another behavior I noticed when I add ModData to an item and exchange this with another player the modData was on it. But I never did a sync. If my observation is correct then how do I know when a sync is needed or not?
items exist entirely(?) on the client, so there's not really any way for them to not sync moddata
this is a good guide on global moddata:
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/How to use global modData.md
Thx, I'll have a look.
So as example for zombies or player I have to manually sync?
(Because these are not only existing on the client)
yes, as far as i know literally everything but items need manual synchronisation
ok, thx...Slowly I'm beginning to understand...
hows this look? quests for superb survivors
https://youtu.be/ne67P3IesyU
This is a video demoing the soon to come Quest system for Superb Survivors Mod for Project Zomboid.
This is a VERY simple example of some of the functions of the quest system and just to display how it works.
More in depth and immersive quests still to come !
https://steamcommunity.com/sharedfiles/filedetails/?id=1905148104&tscn=1666454919
Di...
I was thinking, this code can be used to achieve debouncing, kinda like I do it in javascript using setTimeout
function debounce(func, timeout = 300){
let timer;
return function(...args) {
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(() => {
func.apply(this, args);
}, timeout);
};
}
function WetWeight()
local modif = 0
local pl = getPlayer()
local inv = getPlayer():getInventory()
local it = getPlayer():getInventory():getItems()
local isize = getPlayer():getInventory():getItems():size()
if it:isEmpty() then return end
for i = 0, isize - 1 do
if it:get(i):IsClothing() and it:get(i):getWetness() ~= nil and it:get(i):getWetness() > 0 then
modif=((it:get(i):getWeight())+(it:get(i):getWetness() * 0.01))
it:get(i):setWeight(modif)
it:get(i):setCustomWeight(true)
end
end
inv:setDrawDirty(true);
pl:getHumanVisual()
end
function CheckUnliCarry()
if not getPlayer():isUnlimitedCarry() then
Events.OnKeyPressed.Add(WetWeight);
Events.OnContainerUpdate.Add(WetWeight);
Events.OnGameStart.Add(WetWeight);
end
end
Events.OnPlayerUpdate.Add(CheckUnliCarry)
I think I'm getting a hang of OO with lua, still need to do some proper tests but i think I can succesfully store an "object" in modData and restore its full functionality when loading it again later
Ow wow
does anyone know if i can add translation strings programmatically? i have some item names that could be constructed by combining strings that already exist
nevermind, i think i can do this by messing with the item script
if not, it looks like the Translator class is exposed, so you may be able to pull it off
please elaborate :p
its much simpler than I make it seem
it doesn't have any functions that look relevant unfortunately
you may be able to intercept getText or potentially generate a file and then get to the Translator to load it. Hard to say it'll take a bunch of experimentation I imagine
Best I can tell, you can't store userdata or functions in moddata, it doesn't save. If you build your object around that, as well as give it a constructor that can take an "instance" of itself, then you can reinitialize that moddata as the object. It even remains in the same place in memory
Yea, it certainly could be used in a similar way
take for example this prototype
function EnginePart.new(obj)
local instance = type(obj) == "table" and obj or {}
setmetatable(instance, EnginePart)
instance.category = instance.category or "Other"
instance.condition = instance.condition or 100
instance.name = instance.name or error("Part must have name")
instance.type = instance.type or error("Part must have type")
return instance
end
if its passed a table, which we'll have to assume is or was an EnginePart at some point, it reinitializes it as an instance of EnginePart so you can call its instance functions again
I made the mistake of including some enumerators and such in the original object, which bloats the moddata representation of that, which is why I feel you have to be cognizant of the fact you're trying to store the instance when its not in use
well yeah, if you just don't store it as an object it works
well, unless its an object you pulled from java, there aren't really any objects, just tables
the functions that are assigned to this object disappear in the moddata, but reinitializing it like this restores them later
That's true of server/client commands as well. Only your basic lua types, string, number, bool, get serialized. The fields with anything else are lost
someone here may be able to help, not kicking you out, just saying the people who do this stuff all day are in that channel
okay thanks for the info
ya, learned that the hard way several times trying to pass players or vehicles instead of their ids
When i
item:setWeight()
It works but the players inventory capacity doesnt show that
Why? 😮💨

might need to redraw, does it update if you move an item from/to your inventory?
Nope
Yea, there's a function in the inv pane or inv page (I forget which) to redraw those capacity numbers, if I remember right. You might check what exactly they calculate when they redraw the text
The weight is changed as u can see here 😦
So i need to look for "redraw"?
So this means that the weoght is actually applied its just the string thats not showing it?
It is in function ISInventoryPage:prerender()
Just reposting this here since I don't think they believed me when I said I wasn't kicking them out 😭
#modeling message
And i cant just use to that? Imean call that function
You where right to point him to modelling his concern definitely fits better there
🙂
well hopefully someone somewhere can help
good point
that is odd
forgot I had modded my java and now 41.78 has undone it 😭
right?
yep, it's possible
instance.character:getModData().IsoDogClass = { getInstance = function (self) return instance; end};
--- usage
IsoDog = dog:getModData().IsoDogClass:getInstance();
local defaultMessageSettings = {
textColor = {r = 0.3, g = 1.0, b =0.0},
showAuthor = true,
shouldAttractZombies = true,
}
harrisonUtils.addChatTab("my fancy tab title", "my fancy chat",
"/fancy", "/f", defaultMessageSettings)
@thorn bane Today I updated the custom chat tabs with most of the vanilla java-side chat message features working, color, overhead text, server alert, zombie attraction. The interface changed a bit since the previous version. I think the interface is pretty settled though. Let me know how you like it or if anything is missing. Wondering if I should handle sending messages to other clients or if that should be left to clients.
I'm using https://projectzomboid.com/modding/ to see the classes and methods from items. Just to make sure, is this the most updated place to check?
package index
https://zomboid-javadoc.com/ has a more recent version
Thank you
any good modders looking to make a couple dollars? i may have a job for you. i host a custom server that resembles living in a player ran economy with no zombies. its only in alpha at the moment how ever its being worked on quite a bit. if you'd like to join the team let me know we are always working on something!
my main focus right now is a respawn system. obviously in regular pz you die you make a new character. i wanna keep players from making new players and limit them to one rp character. when they die id like keys to stay persistent to them and be removed from the dead character (basically make the key chain virtual) also we are in need of a license system. im hoping to create a virtual wallet that player given licenses and certs can be placed in and will be virtual same as the keychain. otherwise a simple ui that displays the licenses would work as well. maybe a "ask to inspect licenses" and when the license holder accepts it displays the license that said character has.
i'm always looking for something to do!
let me know if anyones interest we have lots of other projects as well and will grow as time goes on the server is 100+ members 🙂
i could gladdly use other types of modders as well! moddling and so on.
Is it possible to "require" and hook to a local function?
Not easily, if at all. You might be able to read a file into a function (using getModFileReader and loadstring)and run the function with an environment you control using setfenv (then do something about preventing the original from loading e.g. shadowing the original with your own file that has the same path), but I haven't tried it yet
anyone wanna look into a simple phone ui? like if i have a phone i can text other players if i have their number. also possibly voicecall? also a side implentation with admin placeable payphones would be awesome. this is for a custom rp server
i say simple but im sure its utterly complex. id slide some money for server use.
Does anyone know how I would go about modifying the vehicle door behavior? I'm not sure the specifics of what I want to do, but I'd like to modify the size of the hitbox for getting in and shorten the timer. I see the code in VehicleCommands.lua for door opening that makes sure the door isn't locked and does exists, and I'm assuming that I'd need to modify whatever args.open is to accomplish this? I'll admit I don't know much about lua, I do know some python so lua does look at least a little familiar, I assume args.open is a function located somewhere else but I have no idea where that would be.
args.open sounds like a property of a table 'args'
ok, and where would I start looking for that table?
If you post the file, someone might be able to tell you more
I'm pretty sure the area you need to stand in to open the door is part of the vehicle scripts. You could either alter the scripts in your mod or use something like vehicle tweaker to do it
Opening the door I'm not sure of, may be a TimedAction. VehicleCommands is a local table so you can't access anything going on there very easily
the bit I'm referring to is
function Commands.setDoorOpen(player, args) local vehicle = getVehicleById(args.vehicle) if vehicle then local part = vehicle:getPartById(args.part) if not part then noise('no such part '..tostring(args.part)) return end if not part:getDoor() then noise('part ' .. args.part .. ' has no door') return end part:getDoor():setOpen(args.open) vehicle:transmitPartDoor(part) else noise('no such vehicle id='..tostring(args.vehicle)) end end
located in <game root>/media/lua/server/VehicleCommands.lua
I couldn't find anything that seemed relevant to it being a TimedAction
you'd want to find where this command is sent from, the args are going to be set there
search setDoorOpen in your ide and see what comes up
Or index your Lua folders and search in Windows Explorer
setDoorOpen is called by the timed actions ISCloseVehicleDoor and ISOpenVehicleDoor, unsurprisingly
I think it actually only opens the hood
Vehicles.Use.Door in Vehicles.lua might be a better place to start looking
I don't know about the hood but I do know when you enter or exit a vehicle it outputs information about vehicle setDoorOpen and what specific door is being set to open
and I don't see anything relevant to the timer for entering the vehicle under Vehicles.Use.Door
to my understanding timedactions are only for actions that have an animation? There are references to timedactions for the hood and trunk but not for the normal doors

