#mod_development
1 messages · Page 219 of 1
It will automatically know just on the basis of whether it was passed a player object or you are on SP how to forward the command
To make the normal client response fire
do you want to dm me to explain in more depth? i generally just dont add anything i dont understand so i can read it later and know why i did it
We can keep discussing it here or DMs; I don't mind either way. The code is available for anyone to use.
ok
i just need it in simple terms because i dont know anything about coding language so some things get past me very easily
but i can try to repeat what you said, in my own words, and you can tell me what i am understanding or not understanding
Go ahead.
Context for others in the convo already:
BlackoutsServer.directClients = function(module, command, packet, player)
if not isClient() and not isServer() then
triggerEvent("OnServerCommand", module, command, packet) -- Singleplayer
else
if player then
sendServerCommand(player, module, command, packet) -- Multiplayer
else
sendServerCommand(module, command, packet) -- Multiplayer
end
end
end
so using directClients, this lets me write the same commands for both single player and multiplayer, but also add any additional actions that might be necessary for only multiplayer or single player?
Yes, basically. Let me try to say this simply...
As albion told you (and as the code in your DMs suggests), server needs to use sendServerCommand to tell players that a blackout has occurred.
But it doesn't work in SP
so will directClients also assume that if someone is logged off they will still have the server command sent to them when they log in?
So instead of calling sendServerCommand in your serverside functions, you call directClients, and it decides whether it needs to call triggerEvent or a variation of sendServerCommand to make the clients receive the command
No. For that you need to write a function that requests the current state of blackout from the server.
ok
In YOUR case, I think it would make sense to determine whether blackouts occur in your server code and then call directClients to trigger the blackout.
Because (correct me if I'm wrong) nothing about a blackout trigger is affected by the actions of individual players, right?
It's just a random event?
Based on timing and chance?
yes, and some people have asked for ways for that chance to increase under certain conditions (but they are still based on chance)
Serverwide conditions or individual client conditions?
I.e., a thunderstorm, or a player tripping on a powerline?
Right so it's still sounding like this doesn't need to be triggered from clientside at all
So if that is the case, you could likely avoid any use of sendClientCommand altogether. I might use EveryOneMinute to check and decide in your case.
yeah, i thought so too, but the command getWorld():setHydroPowerOn(false) appeared to only occur on the client side
unless it was just that i needed to have the prefix and everything else i did wasnt necessary
When something in your code will not automatically update everyone, that is when you need to call directClients to send the command to everyone.
ok. so how do i call it?
or what is calling in the context of coding
(this also reveals how illiterate i am in terms of programming)
Is blacksmithing functional?
I mean is there blacksmith mechanics in the game currently?
the feature? no there is not blacksmithing in the game
Instead of calling getWorld():setHydroPowerOn(false) on server, you call directClients("Blackouts", "triggerBlackout", {duration = 1200}, player)...
and then if player is nil it will be sent to everyone, OR if player IS a player, you can use this command as the response command for players who connect to request the current state of the blackout.
some mods enable it i think
Obviously instead of 1200 you would use your default duration
And on request you could use the remaining time.
Oh, this Blacksmith/TimedActions is a work-in-progress then?
no i think it was scrapped but they will probably rework it in build 42 since they are adding new ways of crafting
I see, I'll remove it.
These all have functions right? They're all functional? The TimedActions.
After calling directClients, the clients who receive the command can each call getWorld():setHydroPowerOn(false) to match server state. (I would imagine that calling setHydroPowerOn on server would automatically ensure that a newly connected client would see hydro power as off, but, if not, they use sendClientCommand to request the data when they join the game.)
ok this makes sense.
Alright, these should be the supported ones.
Vehicles is finished. Now I have to work on the others.
@rancid panther I would test getWorld():setHydroPowerOn on server AND forwarding it to clients first, and have someone connect
Camping is the stuff you can do with the campfire right?
You may find that hydro power is off for new clients as long as you set that variable serverside
Eh, you know what, screw camping.
But if that in fact is not how it works (I haven't read the Java closely enough to know), then you can do something like this as soon as server-client commands are available after a player connects:
-- Requests missing locations; updateSound will handle them eventually.
sendClientCommand(getPlayer(), "Blackouts", "request", {}) -- Any player on this client is fine.
This is the player-based version of sendClientCommand and if you forward player as I suggested in your server commands, then directClients will automatically use the version of sendServerCommand that just sends a message to that one player.
ok, that is currently how i have it, except not through direct clients.
will i basically just replace if isServer() then with directClients("TomaroBlackouts", "BlackoutsPowerShutoff", {duration = XXXXX}, player)
and instead of writing sendServerCommand here i create a BlackoutsServerFunctions.directClients function and send the command there?
(Unless you're in SP, which is what it checks first, and in that case it just calls triggerEvent to imitate a server-to-client message.)
since im using a test file i can basically just write what i think you're suggesting and test it
but i just need to be sure if i understand where it is supposed to go
I guess you could just track duration serverside and players don't need to know how much time is left in a blackout
On second thought maybe sending duration is not necessary
But yes
The entire if-then-else can become "directClients("TomaroBlackouts", "BlackoutsPowerShutoff", {})"
the duration is a minimum and then there is a random chance for it to come back (the same way that it triggers the blackout)
(Although I had that in a module originally, so more specifically it would've been BlackoutsServer.directClients("TomaroBlackouts", "BlackoutsPowerShutoff", {}) in the code I sent to your DMs.)
Yes but I would let code in your BlackoutsServer.lua file (or whatever you're naming it) make that decision
So only the server would need to know the remaining duration if you did it that way
(of course in SP you would still know because that file would still run in SP.)
I use if isClient() then return end at the beginning of my server file to ensure that it doesn't run in MP on clients, but if you're not in MP, isClient() will be false.
So it'll run in that case.
so if i call directClients("TomaroBlackouts", "BlackoutsPowerShutoff", {}) will i add a new function in the same BlackoutsServerFunctions.lua file? to then add the commands i want directClients to do? which is essentially either sendServerCommand or triggerEvent?
(FYI, I have to work soon... I will try to clarify what I can before I go, I just wanted both you and @bronze yoke to be aware that a problem was being addressed that was already solved by code in your DMs.)
(I only work 8-11 this morning, so I'll be back in about 4 hours after I leave. Not sure whether you'll be up.)
ok, thank you. i just didn't understand it and was going to ask you if i saw you online
thanks for your help
@rancid panther Never wait for me to be online
I am a ghost
I'm "not online" now
🤪
me too
i will play around with the stuff you sent me and then figure it out from there
Just try me and if I'm free I'll reply immediately, and if I'm not I'll reply ASAP.
But also feel free to ping me here about code I send you in DM's
I sent you that code in DM's NOT to be private but to ensure you could easily find it
ok thanks. that makes sense
Since public chats get flooded and pushed up by new conversations daily.
You are 100% welcome to repost it here and ask for help from the collective and ping me
ok! that will help a lot in the future
❤️
because i wanted to ask for clarification, but it helps knowing that i can ask for clarification from anyone about something you were advising me about
good luck at work!

how would I edit this line to do damage to glass? I want to break all glass as well as kill all zombies in a zone:
if zombie then
zombie:Kill(playerObj)
isbreak = isbreak - 1
Good luck to you while I am there
ty!
sorry this Would be the full loop
local zombie = square:getZombie()
if zombie then
zombie:Kill(playerObj)
isbreak = isbreak - 1
I just dont know what to substitute playerObj with
or if "Kill" would be correct
I tried this local glass = square:getObjects():find(IsoObjectType.glass)
if glass then
glass:applyProjectileDamage(100)
isbreak = isbreak - 1
end
with no luck
by 'break all glass' do you mean like, destroy all the windows?
yes
I want to add to this to break all windows in the area
for i = 3, 8 do
xxx = math.ceil(xxx + i * deltt[1])
yyy = math.ceil(yyy + i * deltt[2])
for xx = -1.5, 1.5 do
if isbreak <= 0 then
break
end
for yy = -1.5, 1.5 do
if isbreak <= 0 then
break
end
local square = getCell():getGridSquare(xxx + xx, yyy + yy, 0)
if ZombRand(10) <= 9 then
local zombie = square:getZombie()
if zombie then
zombie:Kill(playerObj)
isbreak = isbreak - 1
well you can probably get an IsoWindow from a square directly and use its Damage() function
rather than apply projectile damage
there's an IsoWindow class
okay so isowindow is the correct class?
then just use "damage()" as the function
also IsoCell has a getWindowList function, but i don't know if a cell is too large/small an area for your case
it might not be that simple but that's what i'd try
alright thanks I'll give that a shot after work
See I tried that with no luck though
I didn't know about this site though which is great because I was just kind of guessing on the class names lol
Oh I think I used "isoglass" as the name though okay
So;
Local window = square:getObjects():find(isotype.window)
If window:smashwindow()
Isbreak = isbreak-1
?
Also do you know of a function to call for delaying a loop? I'm currently using "zombrand" but that obviously being a random counter causes a not uniform delay. I'm looking for a function that I can call to add a set delay to a loop
Depends on context but if you want that loop to fire periodically I would use modulo arithmetic to loop a delay variable, and when the delay variable gets back to 0/1 (the beginning of the loop), you fire the rest of the function you wanted to delay
Lua Timers might be helpful here: #mod_development message @sage mantle
On a personal note, propane and dual-fuel generator functionality seems to be working in my new mod ^_^
reading this caused my blood pressure to spike
you must be the most patient person alive
So what exactly is it you want this to do? What's triggering the windows breaking and like, within what range?
As in, pretend you're commissioning the mod, describe exactly what it is you want this part of the mod to do
So I'm editing the tiger tank core code. It's for the coaxial mg portion. I'm changing it to be able to aim based on the angle of the turret. Basically it calculates a vector based on the condition in the turret spin function and then applies damage to an area in front of that vector
And I'm using the the zombrand in this case to give a 90% hit rate in that area to give it a lil unpredictability
But in the turret spin section I want to add delay to the loop so I can adjust the turret spin rate
The area right now is 3 -1.5,1.5 from center
By 50 units long
I see, so when you fire the MG the script should get a cone going out from the gun and shatter windows within that cone?
So you're able to select the cone alright then?
It's just the windows that are an issue
Yeah the cone and damage area and turret spin all works properly
I just have to add the other damage type and class below the zombie damage section
i would go through your selected grid squares and do something like
local window = square:getWindow()
if(window ~= null) then
window:smashWindow()
end
i'm sure that has issues
but that's the hacky version i'd begin with
you'll want this for sure as well: https://zomboid-javadoc.com/41.65/zombie/iso/IsoGridSquare.html
Alright cool I'll give that a shot after work
cool cool lemme know how it goes
actually extremely cool lmao
good god man you did this without any documentation
kudos
Yeah nada just referencing other lines of code I found in mods
actually the most patient person alive lmao
browse that javadoc at work i'm begging you
Oh I plan to lol
if i replace that whole section with directClients("TomaroBlackouts", "BlackoutsPowerShutoff", {}), what is the name of the function that this is now calling? is it BlackouClientFunctions.processServerCommand = function(module, command, packet)?
and under that function, would I write the actual blackout event (getWorld():setHydroPowerOn(false) etc)?
I just got the game a few weeks ago so Idk much about it tbh
you're killing me davo
I gotta find a or make a function for fuel consumption as well. In order to balance the tank I want to
1: make it non towable
2: very high fuel consumption
3: high ammo consumption
4: extremely loud (attract allot of zombies)
Towing, ammo, and noisy is done just need to make fuel consumption higher
processServerCommand receives the command. Your second parameter is the target function name serverside, which is why my original example uses theCaseFormerlyKnownAsCamelCase naming convention for that.
you can do a lot of this with the BaseVehicle class
Bruh, where did you come from?
that's what i'm saying!!
i have tears in my eyes
i'm not sure if it's pride or despair
This much experience has to come from somewhere.
Yes I've done most of it just in the base vehicle script
I just am not sure how the fuel consumption function works in PZ if there's like a multiplier or something I can use
I make some mods for a few other games
zomboid attracts some fairly unique characters i gotta say
one of the people that asked for a feature on my mod drew my eye so i checked his profile
look at this absolute chad
plays exclusively zomboid and unreal 2004
who is this guy
Can't explain now but this is key here:
Basically you need this on "Blackouts/Client.lua" or some equivalent:
local BlackoutsMainModule = require("The-Source-File-That-Returns-The-Main-Module") or {}
BlackoutsMainModule.triggerBlackout = function(packet)
-- the actual stuff that triggers the blackout
end
local BlackoutsClient = {}
BlackoutsClient.triggerBlackout = function(packet)
BlackoutsMainModule.triggerBlackout(packet)
end
BlackoutsClient.processServerCommand = function(module, command, packet)
if not (module == "Blackouts" and BlackoutsClient[command]) then return end
BlackoutsClient[command](packet)
end
Events.OnServerCommand.Add(BlackoutsClient.processServerCommand)
return BlackoutsClient
The line that says BlackoutsClient[command] literally points to a function... If command is "triggerBlackouts" it would call "BlackoutsClient.triggerBlackouts"
I used to do edits for dead island way back lol
Will explain more later
ok, thanks.
so that function just processes the command, but the actual function is done under the triggerBlackout function
Correct. Process server command's job is to ensure the command received connects to an existing function in your client module, and, if so, call it.
and it also means i can process multiple commands without manually rewriting them because [command] is like an autofill of whatever was sent from the server?
at least under the processServerCommand function
Correct. You can forward to multiple different commands using that one function if they all use the same parameter signature (packet, player)
nice! thanks
Assuming they are of the form BlackoutsClient.commandName(packet, player) as in my example
Or a corresponding refactor
so at the top you have a separate local BlackoutsMainModule = require("The-Source-File-That-Returns-The-Main-Module") or {} from local BlackoutsClient = {}
this is within the same file?
That's meant to refer to a theoretical main module you would have already
I imagine your program has a module for containing other functions it needs
i only imported it and wrote example function to show you what calling it could look like
oh okay so that would be what i originally called BlackoutEventHandler?
That part could be anything
I do not know exactly what your BlackoutEventHandler does, but a client command could call whatever function in whatever module you want
After you get to the step of calling BlackoutsClient.commandYouReceived(packet, player), then inside of commandYouReceived you could call "BlackoutEventHandler.whatever()"
Just gotta make sure you import it if it's not global
because i originally had BlackoutMainFunctions (which handled the conditions to trigger the blackout), and BlackoutEventHandler (which did the actual blackout stuff)
so BlackoutClientFunctions would be a third file that processes the commands? and then calls the blackout event(s)
Yes
I use my mod name as a folder name ever since liking how co` does that
So in TMJ we have Jukebox/Utility.lua, Jukebox/Client.lua, and Jukebox/Server.lua
Each of which has its own part of the job here.
i always kept the folder names to what they are by default because i thought they had to be an exact way
But yes you could have BlackoutMainFunctions.lua, BlackoutClientFunctions.lua, BlackoutServerFunctions.lua
You can put your lua files in their own subfolders within lua/client, or lua/shared, or whatever
They need to be in lua/client (or shared or server) to run, but not at the root level
okay, i see
Sorry, can someone publish the melee weapons categories types for Script?
I know that exists "Axe"(for axes) "Blunt" (for long blunt weapons) "Spear" ...
BUT what category i have to use for Short blunt weapon?
What is MultiStageBuild? Is that the building the structure first before actually building the wall?
What's cool too is since I already have all the vectors calculations down I think I'm gonna add a sprite and the tank muzzle and mg muzzle as well in order to get muzzle flashes
And people can use it as a template for other vehicles because I prefixed all my class names and functions
Something like that, you have to build a frame first and then from there you can upgrade to level 1-3 wooden walls, level 1-3 metal walls, door frames or window frames.
So the frame is ISBuildAction and then the others are ISMultiStageBuild, I see.
Yep.
Yesh.
I'm actually doing this now but just want to be able to find tune it further. I'm using a Zombrand call rn so it's doing the if modulo loop and zombrand then spin turret
But want to replace the zombrand with a more predictable delay
I don't understand why any modulo looping would be relevant to ZombRand being used... Can you share your code?
Yeah I'm almost back I'll send what I mean
Short break, how goes it?
okay its a long one so bare with me
im trying to get it to work still. i get a stack error on the line "directClients("TomaroBlackouts", "BlackoutsPowerStartup", {})"
---------------------------------坦克头转速 --rotations
if tankround[2] == tankround[1] and ZombRand(2)<=1 and ZombRand(2)<=1 then -- also turret speed helper
tankround[2] = tankround[1] + 1 -- this effects the turret speed 1 = faster
if vehicle:getModData().tankround == nil then
vehicle:getModData().tankround = 1
M60A1Turret.Create.M60A1Turret(vehicle, 0)
end
if isKeyDown(Keyboard.KEY_RIGHT) or isKeyDown(Keyboard.KEY_LEFT) then
if not vehicle:getEmitter():isPlaying("M60A1spin") then
vehicle:getEmitter():playSound("M60A1spin")
end
else
vehicle:getEmitter():stopSoundByName("M60A1spin")
end
if isKeyDown(Keyboard.KEY_RIGHT) then
part = vehicle:getPartById("M60A1Turret")
if vehicle:getModData().tankround == 360 then
part:setModelVisible("M60A1Turret360", false)
part:setModelVisible("M60A1Turret1", true)
vehicle:getModData().tankround = 1
else
local number = vehicle:getModData().tankround + 1
part:setModelVisible("M60A1Turret"..tostring(vehicle:getModData().tankround), false)
part:setModelVisible("M60A1Turret"..tostring(number), true)
vehicle:getModData().tankround = number
end
vehicle:update()
end
if isKeyDown(Keyboard.KEY_LEFT) then
part = vehicle:getPartById("M60A1Turret")
if vehicle:getModData().tankround == 1 then
part:setModelVisible("M60A1Turret1", false)
part:setModelVisible("M60A1Turret360", true)
vehicle:getModData().tankround = 360
else
local number = vehicle:getModData().tankround - 1
part:setModelVisible("M60A1Turret"..tostring(vehicle:getModData().tankround), false)
part:setModelVisible("M60A1Turret"..tostring(number), true)
vehicle:getModData().tankround = number
end
vehicle:update()
end
else
tankround[2] = tankround[2] - 1
if tankround[2] == 0 then
tankround[2] = tankround[1]
end
end
Is directClients still in a module?
I'm not original author FYI I'm just editing it
In my example it would've had to be BlackoutsServer.directClients
ok actually i got it working in single player now, but it was just cuz i skipped that line for now
Is this on tick or what?
yeah
I've tried adjusting the loops but can get it tweaked quite right
so I added that zombrand delay but if I change it to try to get more delay its not a uniform delay
when you said before that i could replace this whole thing with "BlackoutsServer.directClients("TomaroBlackouts", "BlackoutsPowerShutoff", {})" (for example), was there any assumption you made about what the rest of the code looked like?
so wanna replace that with a more uniform delay function, I think Ill look into that lua delay api
So this is not modulo looping... I'm saying you use a counting variable and modulo arithmetic to make it loop, and only fire when the variable hits a certain number. How often do you want the rest of your tick code to go off? Evwry 3rd tick? Every 5th tick? Every 10th tick?
for now, i just added back the if isServer() and added an else for single player to trigger, but from what you told me, i assume it is supposed to work for single player already, right?
see tankround is also used to determine the angle in follow on code
Yes I am assuming you declared directClients exactly as I did in my file
If you change its declaration you need to change how you call it
Show me your declaration of directClients @rancid panther
i dont have one, that was what i was confused about
is that its own function that is called by that line there?
@sage mantle ```lua
DavoModule = {}
DavoModule.tickCounter = 0
DavoModule.onTickFunction = function()
DavoModule.tickCounter = (DavoModule.tickCounter + 1) % 10
if DavoModule.tickCounter != 0 then return end
doEverythingElse()
end
This is modulo looping
It would let you call doEverythingElse every 10th tick
Consistently
Not randomly on 10% of ticks
Above code assumed you add the onTickFunction to the OnTick event
Ill add that in
% is modulo operator; it gives the remainder of a division problem
Division remainders loop around in circles based on size of the divisor
If you mod an endless series of consecutive integers by the same divisor, it eventually goes back to 0 when the dividend is evenly divisible by the divisor again.
I like this icon. What do you guys think?
the visual fits into that of the base game. is that an hourglass?
Yes.
directClients already works for SP. Where are you adding an else?
i just did that for now because i didnt do it properly and thus it didnt work
i just made it manually trigger the event again, but im still trying to understand everything else you gave me
what is this for? in the example you dmed me
BlackoutsServer.triggerBlackout = function(packet, player)
BlackoutsServer.directClients("Blackouts", "triggerBlackout", packet, player)
end
The idea of the triggerBlackout function is to receive command to trigger blackout clientside
And then call your clientside blackout function
@rancid panther Will you be around in 1.5 hours? Should be home, can walk you through this part on a call
Quicker than typing about it anyway
no, it's actually 7 am and i have not slept
hey hey
I gotta work another hour and will be distracted until done but will reply asap @sage mantle @rancid panther
ok thanks. i'll let you know if i have any more questions but i'll be working with what i have until then
if i can't figure it out i'll just have to pause it until next time i can get a chance to work on it
no problem man I got what youre saying with that module I'll add it in and call it in that section
@sage mantle You from Mainland China?
no no the original author is
The code is from "The Tiger Tank" mod. He lets others use and edit his code
I am just modifying it to add in some features
Also, next time use code blocks
-- This one
```lang
- your code
```
Should I allow? I feel like it's gonna be really annoying.
oh okay yeah I didnt even no that was an option my bad
It's fine. It just makes code easier to read because of the font and syntax highlighting.
fore sure
Hello, anyone knows who can make custom furry surivor model?
I'm gonna take a rest from coding now, I can finally start working on the other traits tomorrow 😄
ya making a trait mod?
Traits and Professions, yes.
oh! and how many traits are you making
I have 16 planned with 1 finished.
I see hope it goes well!
Me too. That single trait took 2 and a half days to complete 
Not really, that's just because I have work and only a few hours to work on it when I get home.
Hell nah.
You can't even read some people's code lmao
yandere sim kind of stuff?
@thick karma from this example, if my trigger blackout and end blackout function are now combined under OnServerCommand, how should the content of this function be written?
BlackoutsClient.triggerBlackout = function(packet)
BlackoutsMainModule.triggerBlackout(packet)
end
[whole example for context for readers]
local BlackoutsClient = {}
BlackoutsClient.triggerBlackout = function(packet)
BlackoutsMainModule.triggerBlackout(packet)
end
BlackoutsClient.processServerCommand = function(module, command, packet)
if not (module == "Blackouts" and BlackoutsClient[command]) then return end
BlackoutsClient[command](packet)
end
Events.OnServerCommand.Add(BlackoutsClient.processServerCommand)
return BlackoutsClient
i got it so using BlackoutServerFunctions.directClients works, but now it goes to the client file in single player. it should go straight to trigger the event right?
right now, my blackout function looks like this
local OnServerCommand = function(module, command, args)
local playersquare = getPlayer():getSquare()
if module ~= "TomaroBlackouts" then return end
if command == "BlackoutsPowerShutoff" then
if not playersquare:isOutside() then
getSoundManager():PlayWorldSound("PowerShutoff", getPlayer():getSquare(), 1, 0, 0, false)
elseif playersquare:isOutside() then
local square = getNearestBuilding()
getSoundManager():PlayWorldSound("PowerShutoff", square, 1, 0, 0, false)
end
print("blackout starting...") --!! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
timer:Simple(0.9, function()
getWorld():setHydroPowerOn(false) --?? turns off the power
end)
elseif command == "BlackoutsPowerStartup" then
if not playersquare:isOutside() then
getSoundManager():PlayWorldSound("PowerStartup", getPlayer():getSquare(), 1, 0, 0, false)
elseif playersquare:isOutside() then
local square = getNearestBuilding()
getSoundManager():PlayWorldSound("PowerStartup", square, 1, 0, 0, false)
end
print("blackout ending...") --!! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
timer:Simple(0.8, function()
getWorld():setHydroPowerOn(true) --?? turns on the power
end)
end
end
Events.OnServerCommand.Add(OnServerCommand)
im gonna call it a day here and figure it out later
goodnight
hello hello, could anyone tell me which IS action do i need to use to equip stuff to the player?
oh hey spiffo lol
Check out the list of methods you can apply to a player probably
declaration: package: zombie.characters, class: IsoPlayer
Yo @digital osprey I would recommend pulling up the vanilla code in an editor so you can easily search it
yeah i did ISequippeditem doesnt look like it does what i need
i did look but maybe not enough, a lot of functions there haha
yeah
setequippedparent is not it either right? ah no wrong page altogether
I have no idea
I'll look over what you sent and clarify later.
thanks! i dont know the next time i'll really be able to work on it, but i'll just ask questions as they come from now on
ah its in IsoGameCharacter not in isoplayer
yeah check other methods inherited
yeah was looking for something with equip but it turns out to be called gethanditem
setPrimaryHandItem or setSecondaryHandItem or wearItem for other stuff, idk, I'm new to zomboid scripting so possibly ignore me
I've never used it, my gut tells me it's timed
that would be ideal, let me test
You would be well-served to look at ISInventoryPaneContextMenu and see how many different types of equip actions there are
local option = context:addOption(getText("ContextMenu_Equip_on_your_Back"), items, ISInventoryPaneContextMenu.onWearItems, player);
-- ...
elseif twoHandsItem and not playerObj:isItemInBothHands(twoHandsItem) then
context:addOption(getText("ContextMenu_Equip_Two_Hands"), items, ISInventoryPaneContextMenu.OnTwoHandsEquip, player);
elseif force2Hands and not playerObj:isItemInBothHands(force2Hands) then
context:addOption(getText("ContextMenu_Equip_Two_Hands"), items, ISInventoryPaneContextMenu.OnTwoHandsEquip, player);
end
-- ...
context:addOption(getText("ContextMenu_Equip_Primary"), items, ISInventoryPaneContextMenu.OnPrimaryWeapon, player);
-- ...
context:addOption(getText("ContextMenu_Equip_Secondary"), items, ISInventoryPaneContextMenu.OnSecondWeapon, player);
ah so there it was tyvm, was looking through but wasnt obvious at all 😄
You're welcome!
nice one! gonna jump back in, not far from the finish line 🙂
Is it possible to make hairs that can't be used by players ?
I think only the last piece of my model is rendering what would cause this?
triggerEvent from directClients causes the game to forward the command back to your client file exactly as it would in MP. That's the point of it.
The event triggered is the OnServerCommand event.
So it calls processServerCommand exactly as though you wrote sendServerCommand in MP.
not sure if Im doing this right, so my code would go where "do everything else" is right?
M60A1Timer.tickCounter = 0
M60A1Timer.onTickFunction = function()
M60A1Timer.tickCounter = (M60A1Timer.tickCounter + 1) % 10
if M60A1Timer.tickCounter ~= 0 then return end
doEverythingElse()
end```
lol my bad
Yeah that's right. You could also consider using a local module and returning it, separately. You could put this in its own file and return M60A1Timer at end of file. Also would need to say local M60A1Timer = {} instead.
You would need to add M60A1Timer to OnTick as well
Events.OnTick.Add(etc)
Don't try to do "too much" on tick though
OnTick happens 30-120 times a second for most players afaik, which is quite often, so you don't want to do anything processor-intensive or memory-intensive routinely on tick.
it would be doing this
E.g. I wouldn't recommend a loop that checks 50-100 things on a single tick. Not ideal.
If you want to capture key events, use OnKeyPressed
okay I'll it as a local I think I was missing the events.ontick
Events.OnKeyPressed.Add(yourFunction) is usually more appropriate for key-triggered events.
should M60A1Timer.onTickFunction = function() be a local function then?
Everything in a local module is local
You don't need local throughout your code if every function / field is in a local module
If M60A1Timer is local, so is that onTickFunction
ok just making sure
Also, fwiw... I give my functions descriptive names because I was taught to do that in school and it seemed like a good idea when I heard it.
So onTickFunction is purely what I wrote as an example
If I were writing a real OnTick function, I would name it something relevant to what I'm actually doing on that tick.
The fact that I'm adding it to Events.OnTick should be sufficient for any experienced programmer to know it's an OnTick function.
yeah I'm just leaving it as is to mess with it
Fair, just throwing that out there.
I see a lot of new modders make their event function names simply "OnEventName" or something else similarly void of additional meaning
Because they're just following templates here without much reflection about the nature of a template: https://pzwiki.net/wiki/Category:Current_Lua_Events
If you're going to name a function "OnEventName" and immediately add it to said event, you might just as well have called your function "z"
Because Events.OnTick.Add(z) and Events.OnTick.Add(onTickFunction) provide you with precisely the same amount of information.
Yeah Im just seeing if it works first
(But I also wouldn't name a function z 🤪; I believe words help)
I mean the fact its completing anything is good lol
if it is not too late, you can try playing with setAlphaMax(float float1) setAlpha(float float1) setAlphaMin(float float1) ..
is a .x file?
fbx
anyway to convert from a blend file?
I think I remember using this, and it only affected the circle border alpha. There might not be a very direct way to mess with the inner color of the circle unless we mess with the java class, which is too much of a nuisance
I was today years old when I got to know that controller players have some different method of context.
Can anyone elaborate, because I need to know how what to use to fill controller world context menu.
Convert FBX files quickly and easily to X files, online and completely free. But the converter can do even more: STL files for 3D printing, OBJ files for computer animations or CAD are no problem for it.
I did end up finding it thanks also FBX works fine apparently
I need help apparently the only way to fix models doing this is to redo the models someone please tell me there is a better way?
Uhhhhh.... What even is that?
whats left of my sword model
Ahh.... Yeah probably no better way. That does not seem to have the right shape at all
the model is still fine just ingame it looks like that
I.e. I can't imagine fixing it from code or in scripts
Yes but when models are exported wrong they can be incompatible with the game
apparently this is common but I cant find anything on it
When I first exported my Meditation animation it made my character look like he turned inside out and immediately died in a gruesome fashion
its exported correctly as far as I can tell
He was healthy, of course, that's just how the animation looked
Well if you shrink the sword in game and it never looks like a sword, you are mistaken
im about to test it out with one of my other models
And figuring out how it got exported wrong is going to be the solution to the puzzle.
If something has the wrong size, change its item def in scripts to be smaller
could it be that I made the model smaller instead of coding it smaller?
But if something is entirely misshapen, it's exported wrong.
update with the new model IDK
I only know a small number of facts here from the one animation I exported...but if you don't have exactly the right values in exactly the right places and exactly the right boxes checked, your stuff will look super borked in game
yea ill try to change some settings
I would refer to a known-to-work guide. In my case I ended up pinging the poor author of the guide and showing him my settings screen only for him to immediately spot the flag I had missed
I had looked at it many times for hours but had looked at it wrong because I was too sure that I had followed every step
I would go back and apply more self-doubt and reread the steps and screenshots of a working guide much slower
I cant find any guides on this its really weird its like no one knows how to do this but I feel like its very basic
Have you tried #modeling ?
Those are the model people
Most people here are Lua people
And scripting people
Programming people
might check that out yea
a building that is in world ed
is not there when i right click and open in tileZed
am i missing something?
the mapping channel 😉 https://discord.com/channels/136501320340209664/279303619277488128
Reason: Bad word usage
Does anyone have any idea how I could add more skin-tone options? I managed to get an extra option in the UI, however, that's as far as I've managed to get with this as it won't change the skin tone, despite having made the new textures, and them being in the correct folders and all. https://i.gyazo.com/dffad45aef321f8f557ab0f7877abe4f.gif
Nothing comes up when searched online, and I've spent the past 3 hours looking through text files, but I cannot find anything that could even be related to existing skin texture files.
Anyone know if its possible to make repairs for a specific weapon not get worse everytime you do the repair?
Like being repaired for less than it was previously
hay yall im making my own custom skin for pz and i dont know how to add the skin into the game. Are there any tutorials i can follow to learn this ?
alright I got the repairs to not degrade the amount they repair but the chance still goes down is there a way to stop that or make it so hight that it doesn't matter if it goes down
I found a way all good
Hi!
Ok
so
I just fixed up Buffy's RP chat
I fixed shortCommand so it actually reads as a table now, so you can use multiple aliases
In the OG code, you'd have a line like
ISChat.allChatStreams[11] = {name = "melow", command = "/melow ", shortCommand = {"/ml ", "/emotelow "}, tabID = 1};
However, /emotelow would not work in game
Now, it does
So, I had fun with this, and added more aliases for various commands, like local out-of-character chat now has the follow aliases
ISChat.allChatStreams[14] = {name = "looc", command = "/looc ", shortCommand = {"/l ", "/ooc", "/b "}, tabID = 1};
/b is a popular OOC channel in various other RP games, and I added /ooc just to cut out the L, which many people don't know intuitively
(the original /ooc was actually listed in /all alias, but since it was listed as a 2nd it straight up did not work)
BUT!
I did more
I also made them case-insensitive
So now, you can /YELL ALL CAPS RAGE
and it wont throw a /YELL is an unknown command error
SO! Here is my question
I have uploaded the mod here
Its just an edit of Buffy's, which PZRP has done as well
Is this.... legal? Ok?
Would I get in trouble for doing this?
does the mod come with a license/does the description give any permissions?
if not, yeah, this is copyright infringement, and you could get in trouble for it, basically based on how much the original author cares
I'm an idiot
I should have checked the steam page for the OG mod!
Ok, so all I need to do is fork it on git
To be extra, I'm also going to suggest my changes, since they're basically fixes
and done
B)
-Added /my for /me actions that include 's at the end of your name. For example "/my hand hurts" = "Sura's hand hurts."
-Added aliases for /looc, including /b /ooc (move...
you just have to change the tbx file for the character as well as the png file for the texture with same name
making outfits or hairs function well with your new char model, however, a whole diff. story
I was thinking about making pool tables usable, basically two players would be able to play each other it would essentially work by timing a “shot meter” properly and the closer you are to timing it correctly improves your chances of making the shot. I’d like to commission it so if anyone thinks something like that is possible or they wanna work on something like that let me know I’ll definitely pay for it to be made either @ me or dm me either one.
I'll try and add documentation to everything by myself from now on whenever I get a chance.
If we get time, can we start a project where we try to document each function?
It'll take a ton of time for sure, but it'll help future and current modders a lot.
I mean, just a single line of comment can already explain what a function does pretty clearly.
Hi, I need to get the coordinates of a vehicle knowing its sqlid (server), the vehicle can be in an unloaded chunk, is this possible? I couldn't find any suitable methods
getVehicleById() <- return only vehicle with local id, if I get you right
Anyone know how to set a radio to spawn to a specific broadcast? I have a vehicle set to spawn the ham and would like it to also be set to use the emergency broadcast channel
oh god
that's cursed
There's actually Umbrela that did most of the work
There's no comments on what functions do
But there is every variables used and what it returns (type)
So you would probably want to add your documentation to that since it has a great base to it
Exactly, function names are just not enough.
I already have Umbrella
Add your documentation to it ?
I just added this comment to the function earlier when I was using it.
Yes, but that'll be for a later project 😄
I mean if you already end up having comments for all of these, posting it would take 2 clicks
Second trait done for today. 
I'm not an artist but I do hope they look like the vanilla ones.
They look good
Reason: Bad word usage
good afternoon! how would i get the floor container around the player? tried this but it reports 0
local square = player:getSquare();
print("square :", square);
local ground = square:getFloor();
print("ground: ", ground);
local ground_cont = ground:getContainerCount();
print("container count: ", ground_cont);
Probably get the list of items on the tile then go through them and get containers
Unless you are talking about a tile

nice one!
Hey all! I'm working on a mod for the radio, voice acting, etc. all that fun stuff to make a lil bit of a story. But I'm brand new to this stuff, at least to modding in this; would someone be so kind as to point me in the relevent direction to making a specific radio mod? Or at least one with various stations etc.?
I've seen a few things about maps, models, etc. but not much about radios
there are multiple ways. You can check Autoloot mod that is doing it from square analysis like in your exemple. https://steamcommunity.com/sharedfiles/filedetails/?id=2577903374
Autoloot.lua
thanks man! love your mod btw 🙂
ohh its called from the player object itself.. thanks was overthinking it 😄
How many tiles can you check the adjacent of on the player?
Is there a way to check if a tile is a water source?
https://projectzomboid.com/modding/zombie/iso/IsoWaterGeometry.html never tried it but try this, or maybe check the plumbing mod
declaration: package: zombie.iso, class: IsoWaterGeometry
there is an isshore method
Please take your unfunny comments back to forchan. I do not appreciate it im a new modder and didnt think this was a troll chat to bully new creators.
Thanks this worked but my friend has a server do i just send him the texture file to upload it there?
What ? There's no problem with being new and there's no bullying here buddy. Sorry if you took it that way but you do realize it's a bit cursed right ?
The fact it's detailed but blury gives it this cursed aspect like those old games. I can show you examples of faces with more details that don't look blury. If you want to improve it I would say that's the part that needs improving on the model
Take that for example
If you want to improve it at least
anyone knows who can make special furry models for people?
server doesnt need its file changed. Since char model is handled on the client side. Make a mod so all players can download it. Tell them to activate the mod then restar the game before entering the server
Don't remember the names, but if you check the creators of the Anthro Survivors submods, two of them do commissions iirc
just bumping this!
There's a few mods that already did some kind of voice acting for radios and TVs
You could check those out
Thanks very much ❤️ I'll do some digging through them!
Yeah this is one I've been looking through as well rn
(it's also moreso me just trying to learn how to as well haha)
As my eyes glaze over looking at numbers and code, tryna self teach haha
how do i make a mod that puts ambient light to zero?
u might wanna ask someone like Azakaela or Jango (the owners of the 2 major perma night mods)
there r probably a lot of others who know something about it here but those two come to mind
we're currently trying to finish a documentation editor app before we get started on this, but it's a planned feature of umbrella
They use fog for the darkness I want one that uses ambient light so it is pure darkness
Afaik ambient light is hard to control from lua. You can use a black overlay and play with alpha.
that is why i named 2 modders. the mod "The Long Night" changes world brightness ins a way that it appears to always be night instead of a thick fog around you
anyway, some people here might also have what you're looking for
You work on Umbrella too? That's neat.
yeah, my module is the least important one but it got the project started
Is there a .lua file that can move the watch widget to the middle? I tried to modify the Clock.class file, but I realized it was not possible.
UIManager.getClock():setX(double) / UIManager.getClock():setY(double)
Can you tell me which file I need to modify?
you should set this in your own file, no override
Oh, I thought you were just saying to modify the file in the path of common\ProjectZomboid\media\lua, not creating a mod.
in lua, can I return a function that returns a value?
or alternatively, should I first call that function, saved as a local, then return that local, which now has the varaible inside?
or perhaps they both work, and its just down to a style guide, readability, preference, etc. ?
they both work
returning functions can be really handy, a lot of my recent code has relied on that pattern, but for most cases it's probably overcomplicating things
Do you see anything wrong here? My table is nil, I'm copying the work I did 4 days ago, but not working
from LowQualityZombieClothing.lua
local ClothingCruncher = require ("ClothingCruncher")
print("ClothingCruncher should be a table... " .. type(ClothingCruncher)) --prints nil
From ClothingCruncher.lua
local ClothingCruncher = {}
function ClothingCruncher.MyFunction()
end
return ClothingCruncher
where is ClothingCruncher and where is the file requiring it?
LowQualityZombieClothing.lua requires it. they are in the same directory
what is that directory? requires start from the client/shared/server folder
e.g. if your file is shared/MyMod/ClothingCruncher.lua you need to require MyMod/ClothingCruncher even if you're in the same directory
Can I move files around and rename files? Or will that cause problems for subscribers?
I see a lot of empty lua files in popular mods
it causes problems yeah
ok, ill just fix my requires path
steam only updates changed files and adds new files, it doesn't remove old ones, so if you remove a file that has been on the workshop steam just leaves it and there's a checksum inconsistency between people who subscribed before/after that file was removed, and probably a bunch of old code running that you don't want
and last question, 4 days ago, you helped me as I finally swapped over to using modules.
but they were written as...
JournalReminder = {}
PlayerTimer = {}
and I think you replied, there is no point, they are still global.
So, they need to have local written, as I just posted above, correct?
yeah
if you're using vscode, if you change the setting Lua.runtime.path to```
"shared/?.lua",
"client/?.lua",
"server/?.lua"
I'm still in notepad++
...but if i ever saw a demiurgeQuantified tutorial on...
intelliJ
EmmyLua
candle
asledgehammer
Umbrella
PipeWrench
PZStudio
ZedScript
Just don't know here to start, and I'd rather not spend 2 hours asking for help step by step.
i've PRed the lua plugin for an addon that will change a bunch of settings automatically to suit pz (and it'll even install umbrella automatically) but it hasn't been picked up yet
at that point setting up vscode for pz will be very easy
maybe i'll write up a tutorial for setting up vscode soon! i just remembered i wrote 90% of a modules tutorial and forgot about it 😅
i used to be a bit of an intellij loyalist but tragically vscode just supports lua much better
Wow, I just learned that.
Good to know.
oh no...
so if i want to prevent that do i remake the old files with nothing in them?
yeah, it's generally good practice to leave a comment saying why but it doesn't really matter
so for mine i renamed them from BlackoutEventHandler to BlackoutsEventHandler and BlackoutMainFunctions to BlackoutsServerFunctions to make the naming conventions all consistent everywhere in my mod. would i just put a comment saying something like
--this file is intentionally left blank. see BlackoutsEventHandler.lua?
yeah, as long as it mentions it's on purpose i think it's fine
i have a habit of rewriting my mods as i get unhappy with my old structure as i get better, so a lot of my mods have a *lot* of empty files 😅
lol
if only i knew all this BEFORE moving to a new workshop mod
then i could have uploaded the new version with better features, more optimized, AND without empty files
but oh well. it's ok. i dont have ocd 
it bothers me quite a bit admittedly but removing them causes untold problems
panik
3 of these files are imposters
anything to prevent crashing for my people
and i also gotta make a list of known bugs now that i changed so much
@bronze yoke you were right about the method call, it amounted to me making a typo elsewhere while troubleshooting. this played my VHS. thank you so much
object:getDeviceData():StartPlayMedia()
glad i could help!
does anyone remember that guide for workshop formatting posted a while back?
i think i found it actually
https://steamcommunity.com/sharedfiles/filedetails/?id=3156268584
updated Blackouts mod!!! it is now multiplayer compatible!
congrats!!!
ty!
oh right i need to update github
i finally made a repository on the last update
now... how do i do that... 
do i just upload the same folder with all the changes and it will automatically update as if this is the newest version?
ok i uploaded it!
guys
i need help on translation
so i want to make that "contextMenu_Wuro_Bear" to translate into = Bear
self:drawText(getText("ContextMenu_Wuro_Bear"), self:getWidth()/10 ,10, 1,1,1,1, UIFont.Medium);```
i have the code like so..
but i don't understand why it doesn't do work
i am guessing it's cuz it's not contextmenu...
what can i use to get it from translated.txt file?
I used print(getText("ContextMenu_Wuro_Bear"))
and it's returning ContextMenu_Wuro_Bear
although in .txt file it says ContextMenu_Wuro_Bear = "불곰"
that sounds like your file isn't being read
can you show the file structure?
sure hold on
and yes, i changed the code
self:drawText(getText("Tooltip_WuroBear"), self:getWidth()/10 ,10, 1,1,1,1, UIFont.Medium);```
ok it now works after butting the EN translate file
but it won't translate to Korean
even though my settings are in Korean
and looking at the console.. i think the file is correctly being loaded
It is... how does the english translation look like again
Yeah, zomboid being zomboid again...
haha.. so.. nothing seems wrong?
Hello, I am creating a mod for a two handed weapon, everything is going well except when I want to place the weapon somewhere, there is nothing displayed. Once placed, the weapon is displayed well on the ground for example. However, in the inventory I do have an icon. An idea ?
can you share a screenshot of the KO folder just like the screenshot of EN one?
oh wait i missed it
u did already
did you modify this while in game or while it was closed/main menu?
getText("ContextMenu_Wuro_Bear")
you cant use tooltip translations for context menu i think. so u just have to translate ContextMenu_KO.txt
all of those translations only work on the type of menu or text they were made for
I'm not sure what's wrong. You may wanna try restarting PZ inbetween your changes. You may wanna use IG_UI_EN.txt / IG_UI_KO.txt instead of tooltip_EN.txt / tooltip_KO.txt.
hmm..
ill try the IG_UI
and yea, i always turn the whole game off and turn back on when i make a new file. unless i'm changing something on .lua
and also when changing the content of a text file (like all under translations).
yea
so now i have that
this for english
self:drawText(getText("IGUI_WuroBear"), self:getWidth()/10 ,10, 1,1,1,1, UIFont.Medium);```
this for code
this for result...
so r u saying .. image ui only gets context menu translation
??
what it says in the English one is what you have to use for Korean
try to change the English translation files without touching the code just to find out which one changes
so, change the english file into korean?
ah
yea i just did it
here ill show you
looks like it's just recieving the EN translation
dunno why
i see. im heading to bed so i think someone else will have to help you
good luck!
Perhaps it could be encoding?
what do you mean by encoding?
Notepad++ tells me Vanilla IG_UI_KO.txt is encoded UTF-16LE https://en.wikipedia.org/wiki/Character_encoding
Character encoding is the process of assigning numbers to graphical characters, especially the written characters of human language, allowing them to be stored, transmitted, and transformed using digital computers. The numerical values that make up a character encoding are known as "code points" and collectively comprise a "code space", a "code ...
hmmm how do i type korean in utf-16le
it depends on the text editor you are using
select the same encoding for your version of IG_UI_KO.txt as vanilla version of it
im using notepad++
i kinda having a hard time understanding this
what version is vanilla using?
it's not using UTF-8?
I'd try UCS-2 LE
oki ill try it
and see
ty for advice
that's interesting
mine shows 16BE for vanilla finle
i guess i can try both
It is probably related to our installation contexts. It means 16BE is probably what you need
oh dang it works
ty for your advice. it worked
so it was language Encoding problem
good intuition
who would've known
oh... thank you
hahah dind't understand what he meant first
i appreciate both of u guys ty
have fun
If all fails: its encoding
I'm making Prepared traits, should I allow the player to pick all of them or only allow them to pick one?
I'd let them maximum liberty of trait picking
What about Workaholic and Smoker?
Workaholic is like Smoker but you have to manage it by doing tasks like uninstalling/installing vehicle parts, etc.
same, mutual exclusive is used for incompatible traits by vanilla
Never mind, ToadTraits already has more prepared traits lol, I'd like my mod to be more original.
Guys this might b stupid question
but im still getting confused with oop system in Lua
Here, when ISButton is clicked with onMouseDown
it calls the function onOptionMouseDown
but why is it MyUI.onOptionMouseDown ???
not MyUI:onOptionMouseDown()
it would b alright if the function was written
MyUI.onOptionMouseDown = function(self,button,x,y)
but when i changed into that. It brought up an error
dunno if i am explaining it well..
I am not sure what is working or not but here is the '.' vs ':' difference: lua MyUI.onOptionMouseDown = function(self,button,x,y) is used the same way as ```lua
function MyUI:onOptionMouseDown(button,x,y)
both carry the instance as self. but the following does not. ```lua
MyUI.onOptionMouseDown = function(button,x,y)
yea u r correct
so i trid the lua MyUI.onOptionMouseDown = function(self,button,x,y)
so see if it would work without any problem
but it was showing error
or ..maybe i forgot to include self... let me try one more time
Nvm, it works fine
I believe i forgot to include, "Self"
haha
Limited lua experience and brand new to modding the game here. I guess I'll ask this here just to find out if it's theoretically possible: has anyone cracked how to completely disable building spawns on zombies, while still preserving the base spawns? Is there a way to stop the events that trigger it from firing in the first place, or otherwise a way to remove the zombies spawned only by it?
I'm not sure it answers your question but we can control zombies spawn depending on whether they spawn from buildings or outdoors.
Yeah, I'm aware that building spawning and outdoor spawning work quite differently, and I know that some mods like DBSF or Wake Them Up have succeeded in changing how indoor spawn functions are handled by the game. What I want to do is either stop the game from spawning zombies in buildings, or target and remove zombies spawned by that mechanic
I suppose I'll most likely have to a do a lot of my own digging and learn a lot of PZ's functions, but am curious if this has ever been done before
function yourRoomCallback(isoRoom)
local roomBuilding = isoRoom:getBuilding()
if roomBuilding then
roomBuilding:setAllExplored(true)
end
end
Events.OnSeeNewRoom.Add(yourRoomCallback)
Well I'll be damned lol. I assume since all the rooms are set to explored, that onseeroom event never fires and the zombies aren't spawned
if it does not work you'll can use the same trick as WakeThemUp with OnTick stuff
Fair enough. I'll probably upload this to the workshop and credit you for everything. This will be incredibly useful for people wanting to run with few zeds
Anyone know where the bleach model is in the game files? my friend is trying to make a mod and needs it
\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\models_X\BleachBottle.X
your install may vary... shrug
Reason: Bad word usage
umbrella has been added to vscode's lua addon manager! now to install umbrella all you need to do is open your project, press ctrl-shift-p, find/search for Lua: Open Addon Manager, search Umbrella, and click enable!
on top of installing the type definitions, this will change some of the lua plugin's settings to match pz's environment
what do i pass for an IsoDirection reference? it doesnt want a string
https://projectzomboid.com/modding/zombie/iso/IsoGridSquare.html#getAdjacentSquare(zombie.iso.IsoDirections)
declaration: package: zombie.iso, class: IsoGridSquare
it's an enum, e.g. IsoDirections.N for north
if i put it in an array i should use quotations right?
no, just as it is
glad to help!
Hi, i have no idea why in vanila tomatos have 2 "ThirstChange", is this some kind of idea with changing thirst as an ingredient or a mistake?
Welp evidently I have no idea what I am doing with the Zomboid stuff. As predicted, it seems that this alone doesn't seem to be working, and setting it up to just be called with OnTick is giving me an Object tried to call nil error on line 3. On the topic of me not knowing what I am doing, are there any good in-depth resources that I can read to help me better understand PZ lua? I know this probably has a simple solution that I'm not grasping because I don't know what anything is or does 
Did you check in-game what it is ?
Maybe it picks randomly ?
in game -8
I think it overwrites the last value, I just thought at first that the first value made some sense for the ingredient.
It is not working because the signature of OnTick is different from OnSeeNewRoom. To understand basic Lua modding, use Fenris Wolf's guide and for further questions, PZ Wiki is the place. https://github.com/FWolfe/Zomboid-Modding-Guide https://pzwiki.net/wiki/Modding
Probably not
it is a mistake, the script loader does not have any special handling for setting the same property twice
I'm trying to manipulate a local variable in a function. Right now, I'm just replacing the whole function but that feels heavy handed. Is there a better way to do this?
Heya! so.. I'm not making or using a mod that this is related too.. but i figured out of the two, this channel was best equipped for the questions... Does anyone know of a mod that may potentially add a "throw away" option or maybe even a "delete" slot in an inventory? (example, you can click and drag an item in terarria to a little box, and delete the item.)
does anyone know of a mod that may do this, OR does anyone plan to make one? I'd be very grateful for this knowledge, and if you do decide to make one compatible with multiplayer, I would LOVE to use it on my RP server!
(I am also open to comissioning someone to make this mod, but I do not know of anyone who does commissions ETC)
Are you talking about a function in the base game or from another mod ?
What are you trying to do exactly ?
I don't think I know one, why do you not use bins ?
And for commissions I can point you to the right place
it's a base file. I think I got it figured out tho. I can just run the function, hook into the return, do my math and return that
oop in Lua feels icky
We do, however when people have been going around looting dropping things on the floor, dismantling things n leaving all of it on the ground instead of going n throwing it away despite rules ETC, and its a hard thing to enforce and/or track who is doing it. we have things set to despawn ETC but it would be better to have a button for them to just delete the items. If you could point me the right way greatly appreciated!
What exactly do you need to access ?
Can you not redo the way they get it in your own function ?
Unless there's already a return of the value then ok
But if you don't have to change the lua file, probably don't do it
just trying to math on actionTime returned from ISMovableSpriteProps.getScrapActionTime
I'd rather not if I don't have to
Well I have no idea how this function works tbf
https://steamcommunity.com/sharedfiles/filedetails/?id=2709199201
this lets you empty containers, but i don't know of any mods that let you specifically delete certain items
it was made for the same reason you described in your message, so hopefully this helps enough
debug already has this option when you right click an item, it's as simple as enabling that option.
it does with a button with a server setting enabled. they appear to be looking for a solution for lazy players who don't use trash cans
Hi guys i have a thought about creating a city or map on pz. I just downloaded pz modding tools but don't know how to create a map actually. Can someone help me out about it? Am I wrong on this?
Or is there a recent tutorial about it?
map related advice can go in #mapping and i think the pins there will also be helpful
Oh how i didn't see that. Okay thanks
no prob!
Awesome.
Now go add comments to each function.
when the tool is done 😔
:0 So I might actually have enough of an attention span to install it?
Question, are there any modders that take donations to create mods?
You mean commissions ? Yes
I don't have access to that channel
Thanks m8, just posted a commission request
saw it 👌
hey, ive noticed there is a map mod template, does anyone know if their is a armor mod template? im wanting to get into modding but alot of guides seem extremely complicated.
No that's not a thing
aw man
@bronze yoke The extension doesn't take the Globals into account.
the globals?
getPlayer() and others.
have you restarted your ide since installation? someone else's ide was complaining about undefined globals until they did
I'll use my own Umbrella for now.
Is there a way to increase the loots the player can find when they have a trait?
Is it possible to getMovingObjects() in server script?
The problem is - I want to scan building for zombies.
local roomList = buildingDef:getRooms()
for room_i = 1, roomList:size() do
local room = roomList:get(room_i - 1)
local iso_room = room:getIsoRoom()
local iso_squares = iso_room:getSquares()
for square_i = 1, iso_squares:size() do
The problem is iso_squares is empty array in server script (it is populated in client script).
Sorry to ask again, does anyone know where item/weapon sprites are in the game files?
Im removing WorldItemObjects after a timed action, the models on the ground disappear normally, but they show up in the floor container until i move with the character, can i update the inventory pane somehow after the removal?
inventoryPage:setDirty(true)
Or smth like that
I don’t remember exactly the command but you can set the inventory window dirty that will redraw the inventory page
nice one thank u, work got me distracted
and is there an easy way to get the floor container? sometimes i can get it like this and then looping through:
ISInventoryPaneContextMenu.getContainers(self.player)
items themselves dont seem to have a container reference when theyre on the ground
<@&671452400221159444>
thanks
Hello! I'm wondering if an experienced modder can answer my quick question so I don't waste much effort if what I'm trying is impossible...
Do mods have access to the game's save system? Does anything prevent the creation of multiple saves?
I'm wondering if I'm better off just making a python script to back up saves for me...
I did decompile the game and found the save functions, so it seems possible with a java mod at least, would need to do more work analyzing the decompile
Does anyone know what the three values after the date in save folder naming represents?
WE NEED THE HOBO SACK!!!
STICK + SHEET
Improvised bag
THERES NO MOD FOR THIS WHY!?!?
Depends, some stuff can just not be exposed
What's the name ? 👀
There is lmao
TTRP poses!
It was demanded by my peers 
Awesome! Once you use it and get a look, feel free to post any feedback or more pose suggestions/requests.
I will tho I'm modding a lot these days and barely even play haha
What are some mods you've made?
This for now
I'm currently rewriting The Last of Us Infected and creating a framework for modders to create their own zombie types
Is called Zomboid Forge
Allows you to add simple zombies up to complexe behaviors if you want to go further (tho that will still depend on your coding skills to make custom behavior functions)
I've considered (now with my animation knowledge) looking into redoing/remaking some custom animations for certain things as my next big major project after working on the pose mod for a bit.
And addons that depend on the framework will be compatible with each others, unless the modder did some funky stuff, which my main mod will do so it wouldn't work great with other zombie addons (because custom zombie sounds, textures and shit)
Nice, I need to make animations for my Clickers once everything is setup
I already did some concept animations but wanted to rewrite the whole mod before going further with it
That honestly sounds awesome, definetly feel free to hit me up once you've finished working on that because that's something I might be interested in looking into or showing a few of my friends that are getting interested in modding.
Sure man
My goal is to make a bunch of addons that use the framework so people learn what they can do with the framework
I'm going to retake some zombie variant mods and basically link them to my mod, so you can use multiple zombie variants together
Some wouldn't work great with others because they would change things that would apply to every zombies (bcs game limitations) but some would just be like Boomer zombies, random zombies
I want to remake the Darkseeker with my framework
That sounds sick. I've always wanted to try my hand at something more coding dependent (my first attempt was at reworking the chat, to try to incorporate the ability to add tabs/etc, but I quickly realized that was in over my head), but I've mostly stuck to lighter changes/adjustments.
Hopefully, if the pose mod gets popular/successful I might be inspired for something grander.
I learned two months ago how to mod tbf
Went deep in places not a lot of people explored in the modding scene lol
Like custom animations for different zombies was something almost unheard off besides the LeaperZed from Glitcher (only example I found)
Like only having a few zombies have different animations than other zombies, today now that I know how to do it it feels so simple
But fucking hell no one knew shit about it lol
That’s the hardest barrier to entry for some things I feel, nobody wants to be the first to do it.
And that’s how it felt with me and the chat functionality, no documentation and having to be the first person to do it makes it awfully hard.
Yeah
I know there’s one server that’s made custom chat functionality but they fully rewrote the chat from the ground up rather than working off of zomboids from what I saw.
but I’m glad someone is finally working on zombies. For a zombie game it’s shocking there’s so few different ones!
If you ever get into modding in lua, I heavily suggest decompiling the java, it sounds terrifying but tbf it's very easy in fact and doesn't take much
Especially with chat stuff you'll want to check out how things are handled deeper in the code, and it's not that hard to understand tbf
Yeah lol, you have a few mods here and there but no framework to use all of them together
Wasn't my goal at first but since I wanted a clear base for my TLOU Infected mod, I thought why not make it a tool for other modders to add their own zombies
I did that actually! And it helped a lot; I got as far as recreating multiple tabs but I couldn’t figure out how to assign their specific message streams without it breaking the chat.
I might revisit it like I said since I feel like I was one breakthrough away from managing it.
Right
I suggest you come in the modding discord if you want to revisit it one day
https://discord.com/channels/136501320340209664/1125248330595848192
I hang out there mostly to discuss stuff about mods
Definitely will join. And if I ever pick the project back up I’ll certainly poke my head in.
Bless
Hi everyone, is there a mod that increasing physical strength increases the carry weight?
Vanilla already does that?
Hi all!
I do quests based on this mod https://steamcommunity.com/sharedfiles/filedetails/?id=2941736178
and there's a point there "Tag# accepts any item that has the tag. Example: "tag#Egg;12"."
I asked the author and he said that it is all in the game.
Does anyone know where to find these item tags?
upd: find it in ProjectZomboid\media\scripts
Hello guys! I have a question: How can I make an item change mesh when activating it?
I want to make a torch that turns on and off and changes mesh
i think items have a replace on use variable or something like that, my guess is u need to create two items one active and one not and give references to each other in that variable
Thats the problem, i dont know where can i program that things :S
item scripts are in media/scripts/ you can check how the items are set up, and use docs to see what vanilla functions are available to you https://projectzomboid.com/modding/zombie/inventory/InventoryItem.html
declaration: package: zombie.inventory, class: InventoryItem
also you can find a mod that already does something similar open it and see how it works
😮 wooow, what a link!
This was what I needed
Thanks for the info @digital osprey
no worries! good luck with it 🙂
Good afternoon everyone, So I'm making a mod that adds items. based on energy, I wanted them to only be usable if they were on a tile with energy.
Does anyone know how I do this?
Probably check within the methods for an IsoSquare
Could be a method to check if there's electricity or not on that tile
square:haveElectricity()
fuck
<@&671452400221159444>
lol I was like why am I getting pinged for that
ty
Sry for the ping
All good 🤣
you had one job but i was faster than you
Yeah Discord's bullshit and quick switching when you look for a ping
woOW thank you very much, but there is one detail. I have no idea how I apply this to items, do I have to make a lua file? how I do? how do I proceed lol
I have no idea how to use the lua on Zomboid, I don't know the language and the fact that I don't know and English isn't my primary language makes things very difficult
When you have an item on the floor, you can get the square it's on with other methods
Sorry for the lack of understanding, but I'll put what you sent me in the "scripts" file or I'll go and create something lua, and put this
I don't think you can put that in a script file
You can check out how True Music does it with Vinyl players
I know they check for electricity
Anyway, thanks for the help ;)
i gonna make some tests
👌
I'm trying to make it so that when a client receives mod data they only receive mod data at a specific index (just to lower the amount of data exposed to the client and so that less data is being sent back and forth):
local function OnReceiveGlobalModData(module, packet)
if module ~= "poolMiniGameData" then return end
if (packet and localPoolTableGameID) then
local poolMiniGameData = packet[localPoolTableGameID]
if poolMiniGameData then
ModData.add(module, poolMiniGameData)
end
end
end
Events.OnReceiveGlobalModData.Add(OnReceiveGlobalModData)
localPoolTableGameID is set to the host's player ID when the UI has initialized for my mini game. As seen in the code above, it should only add the data at that specific index. Mod data is updated every second on the client while the UI is open. When I added some print() functions to see what was contained in the data it seems to be sending the whole module's data instead of at that particular index. Does anyone know what I'm doing wrong?
For example if I press the button to leave the game I get an error on the client and server saying that the data is nil but the table still has data (which I'm assuming is the whole mod data set including everyone else's games):
local poolMiniGameData = ModData.get("poolMiniGameData")
local playerID = self.playerObj == getSpecificPlayer(poolMiniGameData.host) and poolMiniGameData.host or poolMiniGameData.competitor
sendClientCommand("PoolMiniGame", "leave", {poolMiniGameData.hostPlayerID, playerID})
self:close()
My guess is that maybe the mod data is wrapped in another table so I'd just have to use something like ModData.get("poolMiniGameData")[1]? Idk
I figured it out, I wasn't in a server/client environment (singleplayer) and I was using an isClient() call for when the mod data should be updated every second
does anyone know if it's possible to get the x,y,z of a bag from an item in the bag? item:getContainer():getParent() does not work on bags and the like... :/
@bronze yoke I see you guys only defined types of fields to be any, I'm gonna fork the repository and add comments and types.
Like this.
@bronze yoke Since most of the folders in Umbrella are links to other repositories, how do I contribute?
Did you check out the github perhaps ?
Yeah.
Maybe you can post there ?
I even tried forking/cloning the repository but the folders are empty.
I'm not too familiar with all this stuff so uh
you can do this, but we generate these files with scripts so we can't merge any changes
No wonder the event stubs only has any for most of the stuff's types.
the lua module is imo not that helpful because of the heavy usage of any, since lua isn't typed we can't generate these automatically
huh? i wrote the events module, it don't use any at all
Lua module
.
i'm not really sure what solution we settled on for future typing of the lua module but right now there isn't really any way to do that without changing how it works
rosetta might support it, only looked at the events portion of it
I'm not gonna do that if that creates something I can't delete for no reasons
You try it man
You're the one that wants to do that
If you've tested it and already know it doesn't work just say it lmao
I already tried stuff to show you, no point in fooling me around if you already know you can't do that
I've done pull requests before 
How do you expect me to know that ?
Why are you mad lol
I just don't understand your reaction, you're not really helping me there man, specifically this message
Anyway just do your thing, do a fork or idk, gave you my pov on that and tested things to see if it would work
Albion already said those can't be changed.
Since they use scripts, which makes sense. I can't imagine writing all of these manually.
Isn't a fork a replacement of that file ? A completely different file ?
Well you're the one wanting to make anotations on those and now you don't want to do it ? I don't get it lol
A fork is where you can make changes without affecting the main repo, if you want to change something in the main repo then you gotta make a request for it.
Yes, so what's the problem exactly there ?
The fact that each folder in Umbrella is a link to other repositories?
What ?
If you wanna contribute to Lua, you have to make a fork on Lua which is listed in Umbrella.
Hmm I see okay
Not Umbrella.
Why not make forks for those then ?
I mean yeah nvm bcs umbrella won't use those then
Tho Albion or other contributors could link to your fork instead ?
Doesn't work that way.
Can't they link to forks from those other repository ?
we merge the changes from the fork into the main repository
but the repositories containing the typings files shouldn't really be forked, we generate them with scripts so any manual changes will just get overwritten next time we generate them
Just realized that my Workaholic lacks quite a lot of actions. Would you consider this work?
These are the newly added ones.
I am still around despite the inactivity in the repo, so if you made a fork & PR I'd happily review it
I changed my mind, it makes sense that you guys use scripts for those.
I think there are plans to create a tool for adding documentation. I have an in-progress rewrite to improve the Lua stubs with guesses of types but (due to a sudden loss of momentum/interest + working on other stuff) I haven't worked on it in a while
I wish it was possible to see what elements an Arraylist has, so that get immediately knew the type.
i need to check if vscode supports this, emmylua didn't but vscode's annotations work a lot better
Oh, man. You should see Python's autocomplete and typing extensions. They're a life-saver sometimes.
yeah, unfortunately generic classes just aren't supported yet
you can create them but methods that return generics don't work at all
i think i'll look into still annotating them as generic classes, just not actually using generics in the method annotations yet, so you'd at least be able to see in-ide what type the list contains
e.g. you'd be able to see IsoCell:getZombieList() returns an ArrayList<IsoZombie>, but local zombie = zombieList:get(0) would still end up typed as any
What the heck is ComfreyCataplasm?
it's one of the poultices, it makes fractures heal faster
Oh.
Should I count these as work?