#mod_development
1 messages · Page 121 of 1
I wouldn't worry about perf
you have no reason to be loading the JSON more than once per play, no?
I am trying to figure out the appropriate time to load it from mod data actually.
I am wondering if I need to use GlobalModData or something
parse the JSON eagerly, but lazy-load the current state in the case of a resumed game
vs ModData
you can afford to be lazy since PZ will have done all the work of populating the mod data anyway
as for function calls, one JSON param should represent the name of the function, and another for a context string
(if you want to be fancy, support recursion through tables)
otherwise, it's simply _G[funcName](contextStr, dialog_str)
Oh you're saying I could trigger a global function directly using their string?
That is very interesting but I probably won't require them to call a global function...
yeah, if you want to be a bit "nicer" you can allow them to specify "a.b.c..."
it's a little bit more code to then do the walk through the tables
arguably unnecessary since you can just encourage people to have a single global function that takes care of dispatch
I could definitely let them do that without recursion
or you could even build your own listener machinery that you were thinking of on top of this mechanism, too
## [Command: commandName, stringArgOne, stringArgTwo, stringArgThree] Alright, stick em up!
I was going to go with a listener mechanism that people could work to their own needs
if you use JSON, it becomes even easier
{ "funcName": "theFunc", "args": ["one", "two"]}
than :split() :trim()?
Wait is unpack an available global in Zomboid space?
yes, it's part of lua
I tried to use table.unpack and it didn't work, I thought it was part of table, I'm dumb.
oh, heh
welp, don't do that, unpack is global
Haha I'll undo that
uh, how exactly did you implement that
you know what unpack does right?
given {1,2,3}, unpack will turn it into 3 separate arguments, as if you did return 1,2,3
yes
I didn't REALLY implement unpack tbh
I didn't need unpack
I needed a subtable
actually, you could implement unpack using recursion
So I did that directly
but, unpack is implemented natively, much faster
also, unpack only works for tables with 1..N indices
all other keys in the table are ignored
If you include an n key with the desired length it will include keys in 1..n
whenever I wrap existing game code, my MO is to always do local ret = {originalFunc(...)} and return unpack(ret)
Yeah I was thinking if I use command strings they can just do stuff OnServerCommand and I could give them a list of string args to work with
i.e., local t = {1, nil, 3, n = 3} print(unpack(t)) → 1 nil 3
That's not a key with a nil value ?
Ah, I thought you meant a nil key
a key can't hold a nil value
You can try it yourself if you want 🤷🏾 works in implementations I'm aware of
Yes, but the special n key is considered
Just tried it in the debug console and it is 1 nil 3
it is indeed
there's definitely some lua esoterica going on here
this doesn't work:
local t = {1}
t[3] = 2
t[2] = nil
print(unpack(t))```
so you have to set it to nil within the table declaration
You have to assign the n key to the desired maximum for unpack, which isn't done there (unless you've excluded it?)
what do you mean by n key?
t.n = 3
there is no t.n
I think you missed that in my original message, now I see why you were confused lol
Well yeah, you have to assign it
It does
If you do the example I sent without it, it will only print 1 as you suggested
local t = {1, nil, 2}
for k,v in pairs(t) do print(k) end
print("---")
print(unpack(t))```
there is no n key present
yet, unpack correctly prints out 1, nil, 2
In which implementation?
Huh, surprising
it has to be internal, the key is marked as existing and not garbage collected
It's respected in versions I've used & in the debug console, so relevant to PZ modding at least
I've never known .n to be a thing
I swear I used 5.1 back in the day and didn't see that behavior
some non-standard extension
I'm willing to bet it works on the official Lua demo, but let me try so I can see if I'll eat my words
I ate my words
Wait what
If I define it in the table initially it works
yes, that was what I showed you earlier
I mean n, not the nil value
example?
local t = {1, nil, 3, n = 3}
print(table.unpack(t))
prints 1 nil 3, whereas
local t = {1, nil, 3}
t.n = 3
print(table.unpack(t))
prints only 1, Lua 5.4 (https://www.lua.org/cgi-bin/demo)
So yeah, some sort of magic
t[4] = 4
print(table.unpack(t))
1, 2, nil, 4
The actual value of n is ignored altogether, even. I am thoroughly confused
Unpack is auto inserting nils where they belong
but unpack can only do that for keys which exist in the table
No
I didn't make a key 3
Key 3 is not in the above code
I just ran that in the Lua demo
It autogenerates nil for key 3
Because it knows logically between 2 and 4 there is a 3
HOWEVER
This only works for 1 empty spot!
Haha
local t = {1, 2}
t[5] = 5
print(table.unpack(t))
1, 2
yeah, I'm pretty sure this is some garbage-collector related shenanigans
lol what a cluster
The only conclusion I can draw from this is that unpack defies all expectations
because by defining .n later, you're likely triggering a rehash of the table
When you iterate over the elements of the array, the first non-initialized index will result in nil; you can use this value as a sentinel to represent the end of the array.
and yet, here we are
ah, table.unpack is explicitly able to preserve nils
that's since Lua 5.2
Oof
so, whether it works or not in 5.1 is dependent on if the key is "alive"
quite perverse though, the general rule of Lua is that setting a key's value to nil is equivalent to removing it from the table
I can only assume I misremembered since I've never actually used this functionality—presumably got mixed up with table.pack—but unpack (list [, i [, j]]) (e.g., unpack(t, 1, 3)) is more reliable and works ingame too
Glad we had this talk so I didn't go on giving that poor advice
@calm depot Do you know if that JSON thing can do infinite nests? I notice it uses [ { } ] in its example... is that strict? Do I have to alternate? Can I Just use one or the other?
if it's valid JSON, it can parse it. JSON can nest infinitely, so yes
You can.
Cool just making sure that's how they wrote it.
Cool
[ {} ] is just a JSON array with a single element which happens to be a json object
Hmmmm it's tempting. Idk if it's worth it or not. Dialogues would have more delimiter management going on, but that might not be a bad thing.
generally, your root JSON node should be a JSON object a {}
{ "main": {
"text" : "Intro String",
"choices" : [
{ "text": "Choice 1", "choices": [ ... ] }
...]
}
}```
of course, at some point you terminate and there's only text, no more choices
you may or may not have a "luacall" present for any given choice
you guys know how to make the halo show a bit longer?
Yeah I gotcha, I can imagine vaguely how it would look. I mean I don't mind it but part of me is wondering what'll really be easier for most end users...
That's a whole lot of potential mistakes to make compared to "use the right number of #"
with the right indentation, it'll be perfectly readable
also, it means that they can chuck the JSON into a proper validator
Use the overload which accepts a second float parameter, which will be used as the duration
obviously I find it perfectly easy to edit and read.
I am used to brackets and colons everywhere.
I live among brackets and colons.
for writing it, if you're really a noob, do it in YAML and convert that to JSON
lmao that sounds more complicated but maybe not
YAML supports stuff like back-referencing so you can "paste" existing chunks into other places
it also just uses whitespace for indentation
so if you can handle basic python, you can handle YAML
Fair.
https://www.json2yaml.com/ does a pretty bangup job
it also demonstrates the aliasing feature
I can definitely see situations where you define an array of choices that you'd want to re-use without having to explictly copypaste it into the document, so YAML is quite a win there
heh, someone did make a YAML parser for Lua too, though I don't know how mature it is
@calm depot Just realized "^#+" won't work
Returns 1 occurrence
I need the true occurrences for the logic of my loop
Gotta split it on the space first
Could someone tell me what this error is and how I can fix it? I get it whenever I try crafting my dakimakura armor ```LOG : General , 1677194629647> -----------------------------------------
STACK TRACE
function: dakiCondition -- file: dakiActions.lua line # 109 | MOD: Big Degen's Dakimakura Emporium
Callframe at: PerformMakeItem
function: perform -- file: ISCraftAction.lua line # 58 | Vanilla
LOG : General , 1677194629648>
LOG : General , 1677194629984> creating new sourcewindow: C:/Users/thisi/Zomboid/mods/Big Degen's Dakimakura Emporium WIP/media/lua/server/dakiActions.lua
LOG : General , 1677194710612> creating new sourcewindow: H:/SteamLibrary/steamapps/common/ProjectZomboid/media/lua/client/DebugUIs/ISFastTeleportMove.lua```
make a capture group for it
^(#)+
then you can strlen it for the count
I'm still on the side of JSON/YAML docs though
Bob = "#### This is #1."
print(Bob:gsub("^(#)+", ""))
?
That's fair, I'm torn. If I could get a significant performance boost I may made the change and use the json decoder, but ultimately I'm not convinced it will be easier to edit
To me it looks like it would be harder for a lot of non programmers to understand but idk
lua 5.4
zx = {1,nil,3}
#zx
3

you say it will be harder, but unless you write a really good validator for your custom spec, any sufficiently complex dialog tree will be a nightmare to debug
that is, assuming you don't also write any bugs into your own parser 😉
the more you know...
of course, there's also nothing stopping you from adopting JSON/YAML and also supporting your own format
in fact, you could also support people writing their dialog trees purely in lua as well, if they want more flexibility around function calls
(specifically, you can detect that the type of your funccall key is already a function)
All fair enough. I WAS going to add error messages; theoretically, I could even include line numbers... And while I think you're right that it's going to be a challenging to debug a complex dialogue tree... wouldn't it be complex anyway for a nonprogrammer? I mean, dialogue trees get pretty deep.
I suppose it depends what they're building
This is an interesting idea
I like it
but you know, there comes a point where the scope of your work is large enough that you need to use a proper, structured format
This... is also a pretty damn good point.
Hmmm worthwhile considerations regardless of where I go next
this is what being a principal is like, most of your time is spent suggesting ways of solving stuff rather than actual programming issues 😄
And I do want to target the leading #s correctly so I'm glad I talked to you
Don't want to get errors because someone says, "You're #1!" in a dialogue.
that is because op actually wants to add a free trait to a profession. so I tried to explain how to do this by exchanging the "fake" trait with the actual one. the result is that the trait outdoorsman is still correctly displayed in the occupation screen during character creation. (problem is that just adding a vanilla trait to a profession as a free trait results in buggy game behavior. therefore the trick with the fake trait.)
anyone know if it works out if I have one mod required by another in the mod.info, but does that make it required to use at all? i'm trying to get it so when the two mods are installed together, it will always goto the assets in one of the two mods first always
doesn't a profession have a points cost?
why don't you subtract the trait cost from the profession cost
i dont want it to be forcefully required always, but if it is installed, it will always use the first mods assets
if i explained correctly
i tried running a dedicated server using steam's PZ dedicated server thingy. I can't seem to get a function to be executed when the server starts either, i am not sure why
-- Define a function that will be called when the server starts
function RestartAlert.OnServerStart()
while(true) do
print("test")
end
end
-- Add the RestartAlert.OnServerStart function to the server start event
Events.OnServerStarted.Add(RestartAlert.OnServerStart)```
both my mods and i dont mind doing a tiny extra
AFAIR, if a dependency is present, it gets loaded first, if it's missing it complains in the log that it's missing but I believe it still tries to load your mod anyway
but, it may also just skip loading your mod too, I haven't tested, you should 🙂
the server is working fine, I am not getting any errors, but for some reason, the "test" isn't being printed when the server starts
is your code defined in a mod?
yes the server is loading the mod no problems
where is RestartAlert defined
you are declaring a function in that table, but I don't see where you declare the table
RestartAlert = RestartAlert or {}
-- This function checks the current time and displays a message on the player's screen
-- if the server restart time is approaching.
function RestartAlert.CheckServerRestartTime()
--code removed due to discord's character limit
end
-- Define a function that will be called when the server starts
function RestartAlert.OnServerStart()
while(true) do
print("test")
end
end
-- Add the RestartAlert.OnServerStart function to the server start event
Events.OnServerStarted.Add(RestartAlert.OnServerStart)```
This is the whole file
ok
soo ye im not sure exactly what im doing wrong here
where are you looking for the string? in the logs?
no in-game console
theoretically that should work, but I'd check the debug log anyway
you should also check the log to ensure there were no errors reported loading your lua file
(and indeed, that it actually bothered to load your lua file at all)
checked that as well, doesn't seem to be there anything out of the ordinary
it did the load the mod without any errors
I'm talking specifically about the lua file
it will log when it loads the file
if you can't find the filename in the log, it didn't run
server-console.txt ye?
it shouldn't show up in the in-game console, that event is server-side
I usually use DebugLog-server
yeah, I assumed he meant the server's console window
I hope that's not what he meant
erm i actually meant the in-game console thingy for the debug mode
I don't have much experience with how mods behave for servers xd
are you hosting in-game? it should be coop-console.txt in that case
he said he downloaded the dedicated
using the dedicated server thingy
so it should be running in a command prompt
i checked the command prompt and doesn't really show the string either
lemme double check
you can use that log file you mentioned aren
ye nothing, according to the code the command prompt should just be spammed withe string
it is the console for the server
right, check the DebugLog-server.txt for the most recent run
well the log
aah that makes sense
only thing relevant is
[24-02-23 03:37:55.421] LOG : Mod , 1677202675421> 195,268,117> loading RestartAlert.
Followed by a bunch of same lines for loading translation files
yup gotcha, the file isn't actually anywhere
C:\Users\{user}\Zomboid\Workshop\Restart Alert\Contents\mods\Restart Alert\media\lua\client\RestartAlert.lua
I loaded up another mod and its functioning properly, yet it doesn't show that it loaded the actual files in the log
rename the client folder to server
ah
with the way the game currently works, technically it shouldn't matter, but this is intended for the server, so name it that way
at least we should hopefully end up seeing it appear in the logs
by the way do i need to publish changes to workshop if I am running the dedicated server locally or would it like, read changes directly locally?
if the server's been provided a Workshop ID, it'll download that and preferentially use the workshop version
I forget if a server instance can find your local workshop stuff, though
you can use nosteam so i'd think so
nosteam doesn't use the Workshop folder
that uses the regular mods folder
as in Zomboid\mods
meh shouldn't matter imma publish changes so I don't have to go through the trouble anyways. The mod is staying unlisted either ways so shouldn't be an issue
i changed the whole file to
RestartAlert = RestartAlert or {}
function onCustomUIKeyPressed(key)
if key == 21 then
local currentTime = os.date("*t")
print(currentTime.hour)
end
end
Events.OnCustomUIKeyPressed.Add(onCustomUIKeyPressed)```
i'll see if that does anything
ah bad at reading apparently lol myb.
soooo what should i do
im at a total loss
also that's weird because it actually worked
im not sure how but it did
that worked because it also loaded on your client
so what you are testing is your client, not the server
aa
on the bright side, that means the structure is correct
Alright so presumably with nothing wrong with the structure and that the file is being loaded, then it must be sth wrong with the code, right?
if you reduce the file to a simple print("hello world") and nothing else, I would expect that string to appear in your server's log
LOG : General , 1677204682862> 197,275,557> Hello World
LOG : Lua , 1677204682862> 197,275,558> Loading: C:/Users/{User}/Zomboid/Workshop/Restart Alert/Contents/mods/Restart Alert/media/lua/server/RestartAlert_ISUI.lua```
guess it did
aye
so technically speaking
-- Define a function that will be called when the server starts
function RestartAlert.OnServerStart()
print("hello world")
end
-- Add the RestartAlert.OnServerStart function to the server start event
Events.OnServerStarted.Add(RestartAlert.OnServerStart)```
should do the same thing
oki lemme start up the server and see if it does work
LOG : General , 1677205011276> 197,603,973> Server Successfully Started! YAYY!
nice
okay that's weird that the initial code is now working as intended and the command prompt is being spammed
not sure what changed
forgot to push it to the workshop perhaps?
nah it actually is working locally
i was pushing to workshop before but found out its detecting the changes locally
meh if it works it works
anyways thanks for the time so much!
LOG : General , 1677205962589> 337,147,769> Sync Lightswitch custom settings: sq is null x,y,z=10914,10093,0``` this doesn't happen on the host side but happens on the client side. i'm super unfamiliar with folder structure of where certain files should go. is there any kind of reference whatsoever? also not even sure if that's it but assuming it is since it's not happening on the hosted side, but on the player that joined host side
everything is in server atm. context menu stuff. recipe scriptmanager changes, updates to property value map, as well as my spritemanager stuff.
also does anyone know if OnLoadedTileDefinitions only happens once per load?
i'm testing stuff atm but hoping someone may have experience with something similar
yes, it only happens once
i'm super unfamiliar with folder structure of where certain files should go.
what files?
there's pretty much only one valid location for anything other than lua code
so server should be good for anything?
well all i mentioned
hmm im gonna be messing with this all night LOL i know it
I have no idea what you're doing but it's simple right
if the code should run on someone's server, put it in server
if it should run on only the clients, put it there instead
if it should run on both, put it in shared
now, there's a minor caveat in that to enforce this behaviour, the file needs to explicitly do an isClient/isServer check
RestartAlert = RestartAlert or {}
-- Get the Calendar Instance
local cal = Calendar.getInstance()
-- Get the initial time in milliseconds
local initialTime = cal:getTimeInMillis()
-- This function checks the current time and displays a message on the player's screen
-- if the server restart time is approaching.
function RestartAlert.CheckServerRestartTime()
--irrelevant lengthy code
end
function RestartAlert.RepeatCheck()
local currentTime = cal:getTimeInMillis() -- Get the current time in milliseconds
local elapsed = currentTime - initialTime -- Calculate the elapsed time
if elapsed >= 60000 then -- Check if 1 minute has elapsed
--RestartAlert.CheckServerRestartTime() -- Run the check
print("One Minute has passed")
initialTime = currentTime -- Reset the initial time
end
end
-- Add the RestartAlert.RepeatCheck function to the server start event
Events.OnServerStarted.Add(RestartAlert.RepeatCheck)```
i think im missing some logic here because according to the event im using, the RepeatCheck will only be called once when the server starts
but im not really sure what to use in its place
what is your end goal
I am trying to get the RestartAlert.CheckServerRestartTime() function to repeat every one irl minute. It uses local currentTime = os.date("*t") to get current irl hour and minute. If it matches a specific time, it'll execute an action, i.e., for example
if hour == 22 and minute == 56 then
do something
end```
It's a mod built for a specific server to display to the user an alert 10 mins prior to server restart
but doesn't in-game time pass only when someone is online?
yes, but if nobody's online, nobody's going to see the message are they now
also, you can actually set an option to make it continue simulating when nobody's on, but I wouldn't, especially for this use-case
i guess if it won't be problematic (ye you have a point if no one's online doesn't make sense for the code to run anyways), no need to toggle the option
honestly, it probably makes more sense to trigger this externally and just send a command into the server's RCON
/servermsg is the command
although I don't think you need the / if you're sending it over RCON
Theres a sandbox or server option to toggle this feature
^yes, I said this
either way, writing in-game code strikes me as the wrong approach
make your restart script - systemd or whatever, call an RCON client 10 minutes before and fire off the servermsg string
hmm understood. I'll look into the possibility of doing this. Thanks either ways!
alternatively, you could wrap the server's main function in Java and do whatever your heart desires
personally, doing it the scripty way should be good enough, but if you need something heavily custom, that's the way to go. It could even take care of shutting itself down
yeeeee i doubt im experienced enough to work with Java 😬
i think i got it working tho
if it doesn't seem to be problematic imma just leave it as is, alternatively imma just set a scheduled rcon thingy
@calm depot I really like your Lua idea. Leaning that way actually. Seems so obvious in retrospect but I feel it can just do more...
just make sure your code is wrapped in an isServer() check, otherwise it'll do its stuff on the clients too
So easily
which is going to be wrong because not everyone lives in the same timezone
Yeah, I'd opt for Lua too, unless the goal is to address some situation where consumers of your library don't want to be publishing their own mod
No I don't think that's very likely tbh.
I think Lua would be best
oo ye makes sense
but actually
currentTime = os.date("*t")
doesn't this get the os time of the hosting server
i.e. the machine running the code?
it gets the time of the machine running the code, yes
and it's going to be running on both the server and client unless you prevent that
function RestartAlert.CheckServerRestartTime()
-- Get the current real-world time according to the server's timezone
if isServer() then
local currentTime = os.date("*t")
else
return
end
--rest of code
end```
This the way its meant to be?
much easier way - stick this at the top of the file:
if not isServer() then
return
end```
ah okay that's way better
one more question
so the way i display alerts is by using UI. I haven't worked much with UI but I did with clientside and it did work correctly. for this code running server-side, im doing the following:
function RestartAlert.CheckServerRestartTime()
-- Get the current real-world time according to the server's timezone
local currentTime = os.date("*t")
-- Extract the current hour and minute
local currentHour = currentTime.hour
local currentMin = currentTime.min
-- Initialize a variable to hold the message content
local content = nil
--some stuff in between where content is defined if it meets specific conditions
if content then
local myUI = MyUI:new(content)
myUI:initialise();
myUI:addToUIManager();
end
end```
Im not sure if this makes sense or if I need to loop over all players to show them the UI
it's running on the server so you can't do that because there is no UI
so what's the way around that
how do you trigger one via code
to answer that, you need to grep through the game's code
local msg = "helloworld"
SendCommandToServer("/servermsg \"" .. msg .. "\"");
Thanks!
(or get lucky that someone in here knows the answer)
however, that function is aimed at clients for administration, so I'm not entirely convinced it'll work
exactly haha, i can't count the hours wasted on Notepad++ trying to find the answer to how sth in done in vanilla. although gotta admit sometimes its easy as well
imma test it out now
mm nope seems to throw an error
yeah, I figured
I had a poke through the exposed functions, I haven't (yet) found anything that would enable you to trigger a servermsg
i did as well, no luck. Would be cool to use it tho. way better than UI too
Yes, that's because you're running the command on a client
you don't say
sighs
there must be a way to just create such a textdraw and display over all connected players' screens server-side
what you really want is to get at the ChatServer type, but it isn't exposed to Lua
to be honest, this is feeding into the point I made about doing this externally and sending the command over RCON
what was the command to send to RCON again?
RCON listens on a port
you need an RCON client on your server in order to connect to it
the command is servermsg
I think that PZ will only bind RCON to loopback, but, if it does let you bind to any IP address, know that it has absolutely no authentication whatsoever, so if you do expose the port to the internet, you're gonna get pwned
the server is hosted on G-Portal, not on my local machine
i THINK it should have a way to schedule such stuff
I see
personally I just rent a linux box and set stuff up myself
cheaper and you have root so you can do whatever you like
what is it you trying to do again?
we did a server reminder thing using task scheduler and yeah RCON but problem is you have to have the pc on
😦
he wants to send a server broadcast message to warn people that it's going to reboot
yes, obviously it's doable
wait let me find the bat file
he doesn't have a server where you have direct OS access
at least, he hasn't indicated that
too complicated for my liking for the size of the server tbh
ye i don't have direct OS access
fingers crossed G-Portal would allow that kind of thing, otherwise, i'll just look for an alternative
the alternative way (which is quite shitty) is to implement your own client-server command so that the server can notify clients to display the message
which is frankly waaaay overengineering the problem
-c rcon.yaml -t rcon -l rcon-default.log "servermsg "Server Restart reminder""
-c rcon.yaml -t rcon -l rcon-default.log "servermsg "Server Restart in 2 mins.""
-c rcon.yaml -t rcon -l rcon-default.log "save"
sighs
i'll save that in case by any chance I find it possible to be used, although I doubt it, but thanks either ways!
we use gportal
that won't help you because it's specific to whatever rcon executable he's using
OK, so does GPortal give you RDP access?
seems to me he's renting a PZ instance specifically, not a whole server
i just placed the rcon on the systemtask32
"the rcon" - there are various ones
we rent yeah just for pz not a whole server
then it wont work? i guesss idk
So how does it exactly work, scheduling the RCON command on G-Portal?
it won't work unless the server came with an rcon app included, or you link him to the one you downloaded
by lua it should also work if you do like the horde event servermsg
your problem seems like it's better geared towards asking GPortal's support team. if you can get RDP access into your server instance, you can do what Glytch3r has done
im too beat for today to think about this anymore tbh
it has a servermsg thing so idk how it works really but if they manage to that then its doable right
the code seems workable with. Imma look at it in the morning though since my brain is refusing to function anymore
local function HTC_sendWarnToPlayer(player, data)
HTC_sendCommandToPlayer(player, data, "HTCHordeWarn")
end```
yes, it does what I said - a custom client & server command
looks like this is where its handled tho
that's some pretty gross overengineering for what can be a script that fires before the restart
ooookay imma head to bed and in the morning imma hopefully be able to figure out an easy way to do it. If not i'll just bite the dust (correct idiom?) and try to reverse-engineer what Glytch3r sent and see if I can do sth similar on a smaller scale
ah right i always get confused between those two
Well. Thanks SO much for your time gentlemen. I really appreciate it
Have a good night (or day/evening, whatever time it is in your timezone) :)
not 100% but seems like moving this to shared fixed my sync issue for hosted player
local vals = IsoWorld.PropertyValueMap:get("PickUpLevel") or ArrayList.new()
for i = 1, 10 do
local val = tostring(i)
if not vals:contains(val) then vals:add(val) end
IsoWorld.PropertyValueMap:put("PickUpLevel",vals)
end
that map is local to the host
in shared?
the map doesn't get synchronised
i was having some weird issue where if a connected player altered the modded lightswitches, the host would get that spam
oh so it needed to be in shared you are saying
but, unless you had some sort of isClient/IsServer check, it would be running on both client and server anyway
sorry my brain is ded
currently, the game doesn't properly separate loading of code
gotcha
you think this will be fine running without an event?
i couldnt find one that worked lol
if you have suggestion please feel free but wasn't sure if it was needed in this case
the last part of the light switch overhaul has been a giant pain in the ass
OnLoadedTileDefinitions sounds like the most probable
i'm using that for the function trigger for changing the value itself, wouldn't cause any issue with it?
i suppose its in server so it will run after anyways
what do you mean "changing"
im setting the Val of PickUpLevel
if you have code in that event, you can either create the key/value pair if it doesn't exist, or redefine it if it does
Events.OnLoadedTileDefinitions.Add(function(manager)
local canMove = SandboxVars.Nipswitch.Movelevel
local noMove = SandboxVars.Nipswitch.Movedisabled
local lights = {"lighting_indoor_01_0", "lighting_indoor_01_1", "lighting_indoor_01_2", "lighting_indoor_01_3", "lighting_indoor_01_4", "lighting_indoor_01_5", "lighting_indoor_01_6", "lighting_indoor_01_7"}
for _, light in pairs(lights) do
local switchSprite = manager:getSprite(light):getProperties()
if not switchSprite then return end
switchSprite:Set("PickUpLevel",tostring(canMove),false)
if noMove then
switchSprite:UnSet("IsMoveAble")
end
end
end)
``` in server
the code above this is in shared
code below is shared, above is server
i was told to trigger the propertymap update prior to loadtiledefs
as I said, in the absence of an isClient/isServer check, it doesn't matter
got it
you should still organise code properly and not rely on that fact, but just moving it to shared won't change behaviour
unless the other file had an error that prevented it loading, and your cut code doesn't 😉
got it. no loading errors everything works 100% right now
only thing just not using event for the propmap update
also, rather than using pairs, you should use ipairs
it's faster for sequential tables
pairs is just for when you have arbitrary keys
@sour island it works i just tested it
underweight players
Ow then my texute sucks if that what you see hehe
texture? that's a complete model
Well it didnt look skinny for people when it was obvious skeleton
Are you setting animation variables? I hadn't had a chance to work on much @ancient grail
didnt the devs use "animzed" or something? it got mentioned quite a few times when b41 got released
btw lights table is static so u can to move it to outside of event function
anyone knows a good decompiler for net framework? A client needs an update on a app i did 10 years ago and i dont have the code and dont remember crap of what i did there
good enough for me to have a guideline of how i made it... i dont feel like developing it from scratch...
@sour island hey, as an veteran mod developer, did you know what menu options are controllers friendly,
recently I discover that combobox are not (or i did something wrong)
what are the options for ui that support controllers?
there are a list of elements with good support?
@tame mulch it will be nice to list and mention that elements on wiki,
it will be useful for mods have great support for controllers
if we have a list of good mods for controller support I can extract a list of currently used elements
I will mention some people that deal or try deal with controller support to help in this topic: @dark wedge @thick karma
unfortunally I dont have a physical controler to do proper tests
other modders looking for that and similar discussion
#mod_development message
update: i manage to do combobox work on controller in my mod rebalance items yourself
need to use onjoypaddown, thanks burryaga
function RebalanceIt:onJoypadDown(button, joypadData)
if button == Joypad.AButton then
self.selected = self.popup.selected
RebalanceIt.onEditItemChange(self.target,self)
self.parent:close()
setJoypadFocus(joypadData.player, getPlayerInventory(joypadData.player))
elseif button == Joypad.BButton then
self.parent:close()
setJoypadFocus(joypadData.player, getPlayerInventory(joypadData.player))
end
end
--and link it when create combobox entry
comboentry.onJoypadDown = RebalanceIt.onJoypadDown
dnSpy
it'll even let you hotpatch
hey folks - anyone have any experience (or an example) with the LUA to cycle through a server on boot and remove certain tiles based on x/y/z co-ords? I've got a rough bit of code working to randomly place tiles at x/y/z on boot, but I also need to clean up those tiles from previous boot as well and am unsure how to achieve this easily.
by default the server makes a backup each time it boots
unless you've changed the default, or restarted it over 5 times, you'll have a backup save
which is orders of magnitude easier than trying to figure out which random tiles have some incorrect entity on them
@calm depot I have the tile coordinates/names that I want to check if are present and then subsequently remove on boot; I'm just not sure how to go about bouncing to each of those co-ords and performing the remove of the tile.
thx @calm depot
if only they listened to me 10 years ago and went with sql for the database and not a access database now i wouldnt have to go through this... who uses access db in a media company.... idiots...
who uses access dbs... period... makes no sense
I assume you don't still work for them. Stop complaining and bill them exorbitantly
Shit like this is where you get "special" pricing for not having listened all those years ago
You can base you panel on one of the panels in Wookiee Gamepad Support . . . Those panels have gamepad support and list boxes
cam anyone help me with understanding lua script? I know what I want to do just not sure where to start like I know I need to add a context menu and stuff
This adds a world context menu entry https://steamcommunity.com/sharedfiles/filedetails/?id=2929985581
FYI, you need to play with onJoypadDown(button, joypadData) and onJoypadDirUp/Down/Left/Right. Wookiee Joypad Support adds functions for adding button images to menus for stuff like L1 and R1 and the D-Pad.
You also need to learn to give the joypad focus to the correct object and you need to make sure that object is prepared to handle joypad focus; I personally convert ISPanels to ISPanelJoypads, deriving the fundamental structures from that in order to prepare for support to be added when I am adding support to something.
it's just not possible the way you're describing; you can only interact with tiles that are loaded, and only tiles near players are loaded, so you can't reliably do anything to the world in one go (like at boot)
the most you can do is keep a persistent table of tiles to remove and detect when they do become loaded
@bronze yoke so assuming I have a table with x/y/z/tile already built (it's how I'm loading the tiles) what would I call to delete/remove said tile?
i think IsoObject:removeFromWorld() is enough
ok - that's what I thought; just need to figure out how to iterate thru my table and have it pass the data over - thank you.
Does the game make a distinction between wetness received from rain vs sweat? I know the moodle implies it doesn’t, but is rain wetness and sweat wetness (sweatness if you will) tracked separately then added together? Or do both just pile on to the same wetness stat?
@cunning canyon Before you get wet, definitely... after, it seems no.
And the game may make you wet from Java. idk...
Oof that is totally the worst
@clever turret I have reason to believe that may be a bug in Brutal Handwork (new dual wielding mod). We are working to get to the bottom of that one, but I am not sure about it.
Good to know, thank you
It should be intermittent and nonfatal to your server afawk but feel free to play it safe on that one by awaiting the patch. @clever turret
The server can run it just only runs for about 15 minutes before that comes up and it crashes
Would there be anyone willing to help me with a container script I'm trying to complete? The model, tile properties and overlays are finished - but I'm still struggling with learning how to get it to only accept specific items. Ideally, once I get this to work it will open the door for completing a large(r) project I've been wanting to do.
But only when other players are on the server, if its just me testing on my multiplayer server it dose not happen
Omg he mentioned a bunch of people
Is it a moveable (tile) or more like a container you carry around?
It would be a moveable tile like a shelf or cabinet. I saw what you suggested on Github but admittedly, I'm still a little confused which is slightly embarrassing. I figured my knowledge of Python would help me with the logic behind it but I'm still lost lol
how far did you get?
do you have a way to grab the container for testing?
I haven't gotten it into the game yet - but I believe everything is done except finishing the item script and lua file. I can bring it into the game and test - in your comment:
myGlobalFunction = function(container,item)
--return true or false
end
Am I understanding if the container name was "toolbox1" and the item/category I wanted it to accept was "screwdriver" it would be:
myGlobalFunction = function(toolbox1,screwdriver)
--return true or false
end?
I think if you wanted to accept only tools you could use setOnlyAcceptCategory("Tools"), that needs some tweaking and I don't use that.
*probably wouldn't work, checks different category?
Oh gotcha - I've probably overlooked it completely - but is there a list of functions somewhere I can peruse?
for screwdriver it would be
myGlobalFunction = function(container,item)
return item:hasTag("Screwdriver")
end
Ok - thanks again for this.
That makes sense - and this would be in the lua file for the container I'm creating?
yeah lua
Perfect - thank you.
if you make the global function it's a good idea to put into the table for AcceptItemFunction, which means the lua file would better be in server directory and have require "Items/AcceptItemFunction" on top
so that not to pollute the global space
Got it - good to know!
I have no idea what you are talking about since this is a convo brought from a random place but I use it on a dedicated server with 350 mods and no issues at all
At least not even close to game breaking
Just came over from mod support i can link you the original thing i posted if you want, not sure how many mods i have running i am using Burryaga's server settings, yeah not game breaking just annoying for the server to shut down every 15 minutes, otherwise the mod tends to run great
I just realized he mentioned some update or something. But sorry to hear about the mods conflicting. Weird how you have that error using it when I have a crap ton of mods installed. Interested to see what is causing the bug because as much as it’s showing those things, I still don’t think its brutal handwork unless another mod is doing something to it. I have gotten 0 stack trace from it so far. I am a kb and mouse user though.
Assume you tested the mod by itself no issues?
Will be able to test it later it only happens when another person is on the server so just waiting on my mates to help me test
@drifting ore It is almost certainly Brutal Handywork independently
Dhert is aware of this bug and he acknowledged recognizing it to me in DMs
It is simply intermittent
And therefore you may not experience it at all
Ahh you know what causes it by chance?
That’s so weird that I haven’t experienced it at all
He is not 100% sure yet what triggers it, but he believes it may pertain to a failed initialization of an inventory item in the Java side of the maths.
10 hours of testing at least
Thats good then, be sure to thank them for me for looking into it
Ahhhh
I also have not yet seen it
But I was aware of it from conversations with him.
Well I’ll keep an eye out also if it’s something he hasn’t narrowed down
I know it's a bit counterintuitive, but in this one case I think it is not a conflict.
Yeah I am gonna work on reproducing it when I get done with some other stuff and see if I get lucky.
Gonna spawn all weapons and just test them all in different combo
He says he thinks it only happens during unarmed attacking
But that may or may not be accurate since it's so intermittent
@clever turret Any idea if that matches your experience?
Extra weird. I have around 600 kills with fists. Tyty I’ll specifically check that. I may have to test without the auto dial wield on. What sandbox setting do you use also Angelo?
I want to use the same
I have everything checked atm since I prefer the back and forth personally but I’m sure most may not play that way
Default settings for it so 1st one un checked, 2nd checked 3rd unchecked
PZ is using Java 17 is it not?
I mean I know LUA for the mod coding but making the build environment etc for the IDE
Hey, lads.
What are the arguments in this function?
After the string
Is it color or
The thing with Brutal Handwork is a random bug that can happen with dedicated servers only (doesn't happen with the Host option), and only with unarmed. Not sure exactly what causes it, but it is harmless from my testing; you would be the first to report it is actually killing the server @clever turret
It only happens when you're unarmed, and now that I think about it more, I think its an issue with vanilla in how its doing damage on the server. i.e. it received damage from your player but there's not actually a weapon equipped since I do it in my code locally and the game throws an error there.
I am running hosted when this happens, from my players report what seams to lead up to the server crash is them using the unarmed attacks to fight zombies
Interestingly both the players who reported that started with amputated characters using The Only Cure Mod
I don’t use toc
There a chance its them fighting unarmed without the other arm is bugging it out?
Just sharing anything to narrow down
The only cure but better
declaration: package: zombie.characters, class: IsoGameCharacter
that'll help explain what
❤️
Ah, cool. It might be something to do with that, not sure. My TOC compat has gotten better too, so maybe. I'm working on a big update for the mod, so here's hoping that issue is resolved then.
anyone know what these do in a gun script?
Hopefully, the mod is amazing otherwise the duel wielding is so cool
why they using floats for a color is beyond me though...
is it like 0,0 to 1,0 or 0,0 to 255,0
dunno it doesnt have a descriptor, given its a float I'd say 0-1.0 is likely.. Im totally new to this myself just familiar with java/IDE's etc from MC days
gonna test
usually it's 0 to 1
right now Im just pulling hair trying to get my workspace set up cuz its saying use Java 8 and Im like why?
Hello, what program does anyone recommend to work with .pack files?
you think the same way i do 😄 ... something that would take 1h tops if they had listened to me back then its gonna take at least two more days, with a premium price per day... double what i usually charge at least
In Steam if you install the Project Zomboid Modding tools you would open the pack files within the pack file area: You can open the pack files, extract, etc.
Thanks, I couldn't find it.
No problem at all. Let me know if you run into any issues.
Yeah, it is
would anyone teach me some lua? I don't need anything crazy but like how to add modifiers or like actions to items and like that stuff
but im an expert on spawn mods now lol
i'm not 100% but i think it's chat message, chat stream labels, label, label?
i think they are labeled by some id
Its r, g, b thingy
Ye
what kinda values did you use for coloring if i may ask?
quick animation question: do you need a new fbx file per animation ?
victim:addLineChatElement(getText( "UI_stagger_" .. (ZombRand(13) + 1) ), 0.8, 0.2, 0.2)
0.0 to 1.0
how did you convert them? or just kinda test until worked haha
1.0 = 100% red
got it
= 255 r
the javadocs dont got details but the values are labeled what its expecting it for
Hello, does anyone have a guide or something that explains on how to patch some mods?
Trying to fix compatibility with Spongie's Clothing and Brita's Armor Pack, but am unsure on how to do it.
ya in the same spot Im at Im trying to see if I can fix some issues with superior suvivors
you'd have to know what issues you are having first lol
patching mods is specific to the user having the conflicts TBH. mainly because everyone uses different mods and setups and settings
Ugh okay - so I did what I thought would work and rewrote the spawning functioning to be a removal function, and then swapped it out in the same place the spawn function gets called hoping it would step thru the table of map coords and use the IsoObject:removeFromWorld() function to do the removal ala my conversation with @bronze yoke earlier, but to no avail - no errors, but it's also not doing it - leaving the code dump here if anyone has a minute and could lend any insight into how I'm screwing this up it'd be greatly appreciated.
Are you able to change data in Shared from the server or does that not work?
do you mean can you change data cross-folder? the answer to that is yes, but your wording makes it sound like you expect data in shared to be networked, which it isn't
Nono I dont expect it to be networked
I mean like
There's some shared data, I change it on the server, would the server still see the changes?
If so then my lead may be dead but oh well
Oh, the issue is simple:
Brita's and Spongies have Bomber Jackets. 1:1 the same names, but different ones when worn opened. Depending which one is loaded first, it'll overwrite the other.
My newbie guess in modding is to simply change the file names and directions, but the "brute force" would be to copy the mod and have it release as a standalone lol
the fix is practically the same either way so uploading another version of the mod really makes literally no sense
my guess is you will have to update item information in scripts, but anything thats tied to it also will require some changing. i'd use the pzwiki and threads up top to get started on figuring out what will work best for your scenario. but for the most part changing some item info would net decent results. you may need someone with clothing experience since i have no idea what's affected in that dept. but doing some research yourself on how item scripts work will be a big advantage to you
tools up top in threads also if i didnt mention
Looked through them, will look through again then
But that'll be atleast something to start with
Ah, thanks
never use iso:getX() .. "," .. iso:getY() .. "," .. iso:getZ() to save XYZ coordinates in table 
it's a shit
Good afternoon.
Well - that's good to know, however it's working for the purposes of spawning right now - can you recommend a better format?
Took a break from PZ for a couple days.
tbl = {}
function set_value(x,y,z,val)
tbl[x] = tbl[x] or {}
tbl[x][y] = tbl[x][y] or {}
tbl[x][y][z] = val
end
function get_value(x,y,z)
if not tbl[x] then return end
if not tbl[x][y] then return end
return tbl[x][y][z]
end
thanks @jaunty marten - I'll refactor my code to use that tabling format at some point - likely once I figure out how to get the actual deletion working lol...
may be u don't know why ur method is bad: problem is on each string concat "1" .. "2" lua creates new string object so each ur get/set func call creates at least 2 unnecessary ones
it's bad for performance
I mean, if it wasn't clear from my code markup - I bashed this together based on code I observed in other mods; I'm completely new to LUA.
sadly most of workshop mods creators have no knowledge about good code 
lol - I will do my best to learn as I move forward; I was just happy to get this working for the spawning/placing of the tiles I need - now I want to have them "move" randomly every in game day - that's proving a lot harder than I thought it would be cause of the removal.
anyone knows how to print if the player is listening to music
listening to music in what sense? true music?
i use x
yeah i guess
visually this looks worse and it's missing the get calls
why you prefer this?
also this needs more checks
missing the get calls? huh?
visually his way is faster to use but it's actually worse
yeah
I'm too lazy so I'm using third method
auto 3d table 
what's that?
keepInBounds or keepWithinBounds which one would you prefer
metatable with __index using
so just
tbl = create3DTable()
tbl[93][57][45] = val
local val = tbl[91][567][84]
you said not to use iso:getX() .. "," .. iso:getY() .. "," .. iso:getZ() but in your example how do you get the x,y,z?
return tbl?
didn't test performance for it so I'm using it only while dev, on release will redo to 2nd method
lul
x,y,z = iso:getX(), iso:getY(), iso:getZ()
would string.format("...",x,y,z) be better ( i assumed it's worse)
huh?
in your posted code get_value ?
no need to return something
tbl[x] is nil so what u want to return
result should be nil
'how do you get xyz' with what you returned from get_value is what I was saying. might got lost in translation
tbl[x][y][z] anyway should be faster, but format is faster than just concat cos as Ik it don't creates new string objects
it's just rough example
oh I totally understand why you dont like using concat.
interesting I assumed concat was fast, I'll look into this later 👍
imho Im still stuck just setting up my enviroment to start playing with this cuz Im just
as to why I cant use JDK 17...
depends on the language
concat is a poop
would global ModData save a metatable
function objects can't be saved
anyway u don't need to save metatable, u can just easily recreate it in next time
I can't see myself using table[x][y][z] , too many useless tables also seems like str = x .. y .. z makes only one string (?)
is that an actual function or just a generic name?
i love reading these debates. i honestly write down all this stuff lol
Im only asking cuz Im new to lua totally and sadly gonna be unlearning java it seems. ^_^
I think I got it, you get minimum 100 new strings for gc every time you load a chunk
x .. y > 1st string
xy .. z > 2nd string
lua creates new string on EACH concat
stackoverflow said only one if it's one liner
too many tables, yea, but lua is good with indexing tables so it's fine
and xyz will cause overlapping values, so it actually has to be x..","..y..","..z, so actually 5 strings
ah ",", yea, forgot about it
lol... love the discussion this has sprung and appreciate all the input on formatting of my data table - still doesn't fix the original problem I'm trying to address though 
shouldn't 
tbh Im still wondering why you'd even store xyz as a string in a 3d array.
ahem, as stated before: The Trip Doctor — Today at 4:01 PM
I mean, if it wasn't clear from my code markup - I bashed this together based on code I observed in other mods; I'm completely new to LUA.
I think will be single for liner concat only if concat not variable but literally strings. like optimised it on actually loading code
not to blame chuck for example but it seemed simpler and nicer as well
not sure about that
u right but worse performance
no argue, I already agreed above 🙂
a lot of garbage
i'm still using it in a mod of mine because it'll make the code really messy if i don't, but i will take the string.format advice
agreed with tbl[x][y][z] or concat
@scenic cradle I didn't check the whole code yet but if you remove objects from server you need to use the transmit command
i was pointing you towards object:removeFromWorld(), not square:removeFromWorld(object)
i don't think the latter exists 😅
well you'll have to excuse my lack of LUA knowledge for trying to beat that into submission @bronze yoke LOL
so the square:removeFromWorld(isoObject) line in SimuVTS_SpawnVendors.Remove should be isoObject:removeFromWorld()
going to give that a shot right now and see if it actually works. thanks!
concat for LoadGridsquare makes too much garbage, better not do it
but I won't be making changes before v42 or ever
I am prepared for anything I make to break with v42 😄
I even stopped all my projects 
will wait 42 too
oh there an eta on when that is cuz Im wondering if I should just chill and try and learn lua more before even trying to get into modding cuz of possible major changes
--remove obj from server
square:transmitRemoveItemFromSquare(isoObject)
--add object from server
square:AddSpecialObject(isoObject)
--if combined with remove then use square:AddSpecialObject(isoObject,index)
if isServer() then
isoObject:transmitCompleteItemToClients()
end
Personal opinion, stuff won't change enough to be that concerned. The biggest change was the reimplementation of MP, and most mods survived that.
- you still have to get a handle on Lua either way
one Im looking into debugging has not
Which?
superior surviors
That's never been MP compatible to begin with - even before
yeah I was looking into maybe fixing some stuff and look into if its possible that right now Im just looking at why making a workspace doesnt like jdk17
@scenic cradlein code far above you make a new isoObject and then try to remove that, what's the point of that?
right now that mod slapping me with a UI update error
You're trying to set up PZ lIbraries?
yep just started down this road last night using IntelliJ
New to LUA and still figuring out how it all works 😛
Are you using Konijima guide?
It's far easier to use than the original documentation
@fast galleon I figured because I was able to place my tile via Place(square,sprite) a quick modification of that function to add in the removal code should take the input of (square, sprite) and remove them.
would you prefer to remove specific sprites or does it need to be exact location
Im just getting hung that the reverse engineering isnt using the same jdk the game actually uses.
yes that page plus pz-zmod and a few other pages
This is the only page you should need
@fast galleon each location has a specific sprite, so I COULD do removal via sprite name if that's possible? May be easier.
also if it's just for debugging you can use something even simpler
getSquare(x,y,z), then find object and remove it
local function OnLoad(isoObject)
local square = isoObject:getSquare()
if square and etc then
square:transmitRemoveItemFromSquare(isoObject)
end
end
MapObjects.OnLoadWithSprite("sprite_tileset_01_0", OnLoad, 5)
Does someone know what "GroceryBagnumber" is In-Game or how I can find out?
thanks - trying to make semblance of this now to make it work with what I have already...
spinning wheel rolling now... and that explains why I was having issues on that page and thought the instructions were too basic cuz I wasnt seeing the highlighting showing the hidden windows on each step... derp.
Ah yeah, there's drop downs for each piece. Unfortunately it's not a quick 1-click to get started.
But intelliJ, with the emmyLua plugin + those steps should set you up for some success.
do you guys know how to turn a corpse into a skeleton?
setSkeleton(true) java\characters\IsoZombie.java
that will only work on living zombies
if i access a dead corpse's zombie would it work?
like IsoDeadBody.character:setSkeleton(true)
i personally dont think so, since wasSkeleton in IsoDeadBody seems to only be assigned at the constructor
and in UpdateRotting()
yeah my layout just wasnt making it clear there was more detail to each step but looks like I might be set-up now.
Lots of new faces
for corpses, you can use IsoDeadBody:sendObjectChange("becomeSkeleton"), but only from the server (or in singleplayer)
if you need to do it on a client you might be able to just directly edit the rot stage of the corpse so that it becomes a skeleton on the next corpse update, otherwise you can send a clientcommand to the server to do it
it's just the term, you basically just send a string and a table of arguments to the server and it's up to the mod to handle it based on that
is it possible to make a mod that changes the aiming guns animation?
where could i learn to mod
zomboid
or is there like a documentation that i could read
Thanks!
is there any mod that secure spawns x item in certain locations?
like 100% chance of x item to spawn in louisville hospital
Here is an example of a simple map mod using custom room definitions, custom loot zones and custom procedural distribution lists using the new loot distribution system (41.51+). 3 gas stations have been placed in a cell intended to be added to the vanilla map via a map mod, the Northern most stat...
if you are looking for mod suggestions i'd ask in #mod_support
hwo does one get into modding this game and resources to lear
ty
oh thanks, will do
ugh - just more headaches - thanks for the help everyone today; get up and try again tomorrow.
Haven't they announced that inventory management is gonna become server side? I guess that's gonna break a lot of stuff
That'd be up-to how it's handled, but realistically not many mods create items / remove items outside of crafting or recipes.
any channel where i can discuss pixel art?
but a lot of mods track item transfers
track item transfers?
For the purpose of modding, or just in general? I'd say maybe #creativity fits best
modding purposes
hook to transfer item
Oh, then here I suppose
and adding / removing items is not that uncommon generally
Plenty of mods do it, but I'd have to say not that many tbh.
this is the icon for addict cannibal
well nice
What size are these? Aren't traits like 16x16
18x18
the first comment on my mod 🤣
they can vary in size actually
lol
I think it looks good, maybe a knife and fork if it's not too much detail to fit?
i did try the fork but it didnt look that good
i also tried to add a little bite but it just looks weird
o hey not a bad idea
might be too much detail for the size though
thanks for the feedback
i cannot believe the ham emote on the official project zomboid server is named penisham
maybe this does the trick?
lol
I can only imagine they saw the Q&A format and assumed it's a FAQ without reading anything
you can also try the trick of the utensil being off the edge a bit instead of fitting the whole thing inside
Hey y'all, new here. Is there a "Requested Mods" section somewhere?
11111111111
dont think so my man
u can try in #mod_support mb 
Darn. We should create a channel for that. Or some way of organizing requests. Id like to learn modding and fulfill requests.
some people come here or in #mod_support if they have a commission for a mod but usually ppl dont just make a mod on request
that would be great
but sometimes ppl have an idea or are asking if there is a mod for something, and if there isnt u can help them
u can try to ask devs but they probably won't create it. me tried to ask create #waywo channel 2-3 month ago but nothing 
I second this measure.
also in project zomboid discussions people sometimes post mod ideas or update ideas
Right, but having something more organized than just a chat thread. Easy for things to get duplicated or missed ya know
I'll do just that!
very tru
https://theindiestone.com/forums/index.php?/forum/55-mod-ideas-and-requests/
If only I spent a few seconds googling before asking lol. Found the mod request page. 🙂
@pulsar heath https://www.youtube.com/watch?v=084ZHk6U_2M Anyway to make zombies talk to you using twitch?
Play World of Tanks here https://tanks.ly/3I98IYY
Thank you World of Tanks for sponsoring this video.
During registration use the promo code TANKMANIA to get for free:
● 7 Days Premium Account,
● 250k credits, Premium Tank Excelsior (Tier 5)
● 3 rental tanks for 10 battles each: Tiger 131 (Tier 6), Cromwell B (Tier 6), and T34-...
function TestFunction(player, otherPlayer)
player:Say("x")
otherPlayer:Say("y")
end
Would something like this work on the client side? Or should I move it to the server side?
why r u want to kill the viewers 
you dealing with JS or some other way to do the integration?
streamer's way of dealing with rage
We're here to talk to you about your AIO extended warranty.
all good we all love mods 😄
anyone using IntelliJ care to look at zombie/commands/CommandBase.java and tell me if accessLevelToInt is showing up different then the .class file?
yep and do the diff and check out that function pls
this is the one in the .class
yeah and the decompiled one is nothing like that
yeah
public static int accessLevelToInt(String var0) {
byte var2 = -1;
switch(var0.hashCode()) {
case -2004703995:
if (var0.equals("moderator")) {
var2 = 2;
}
break;
case 3302:
if (var0.equals("gm")) {
var2 = 4;
}
break;
case 92668751:
if (var0.equals("admin")) {
var2 = 0;
}
break;
case 348607190:
if (var0.equals("observer")) {
var2 = 1;
}
break;
case 530022739:
if (var0.equals("overseer")) {
var2 = 3;
}
}
switch(var2) {
case 0:
return 32;
case 1:
return 2;
case 2:
return 16;
case 3:
return 8;
case 4:
return 4;
default:
return 1;
}
}
worst decompiler
okay... I thought I was tripp'n
well Im still wondering which one I should be using honestly I think I grasp why its using hashcodes but I dont wanna assume
The sources received from the process in the guide should provide a .java and .class file - I believe the java is used to compile the lua library.
I always refer to .class for referencing what to do/how things work
it does feel like the best one to use
I also havn't seen such a drastic difference before though
yeah thats where they from I was backtracking why there a .class file in this mod so I ended up back into the libraries when I came across this
I think its to work around issues with character sets
Could be why some people find very odd stuff in the java files now that I think about it
Hello. I was hoping to make a mod to encourage wider exploration by fuly randomizing all loot containers. Anyone have any ideas where to start? I was thinking about a master loot table injected into all of the container lists, but I'm not sure how to do it.
that's the opposite of exploring if you can find everything at one place
You'd then need to edit tables found in Distribution.lua, ProceduralDistribution, Vehicle, etc?
I think he means make it so containers dont have expected items
If you think about it like a randomizer run for other games
Imagine running into rosewood and it has mall pop 
I'm working on a mod that deals with shuffling a list
Idk if it helps, but you could technically try to shuffle the loot tables
I'm moderately sure they're consistent for the lifetime of a save
if I'm wrong, that's a terrible excuse for an ID
That's roughly the idea. The game's gotten pretty stale for me, knowing where the best stockpiles of any given item are. You can get fully equiped and set for long term survival on Apocalypse in about 45 minutes. So I figure instead of just bulleting over to the local grocery store every game, make it so the goods are thinly distributed across every place. No one place is going to have everything, and I have to do more general building exploration than simply Warehouse > Grocery > Bookstore > GG.
If you understand lua tables you can manipulate it pretty well I'd imagine
I'm not particularly fluent with lua. But I'm cobbling together a list of item IDs right now. What I don't know is if there's a more elegant solution than overwriting every individual distribution table.
You could scramble them with a single function
That'd be neat. But alas, no idea how it's done. 🤷♂️
let me see if my list shuffler can be used on keyed tables
It's probably going to require a more nuanced solution anyways. Just scrambling the tables could easily result in items that are supposed to be rare becoming far too common.
You could make it only scramble certain tables I suppose
also it wouldn't make items more rare - just change the locations
I guess it might provide more locations for it to be rare in
🤔
Take military gear for example. Guns and ammo. The boxes at the military checkpoint have a HIGH chance of them. Suddenly that table gets a chance to be put in ANY container. Guns and ammo everywhere.
Even if the chance of an individual container being a military container is low, the number of containers that end up being military gear is MUCH LARGER by comparison
So you can't simply shuffle the distro list as it's a keyed pair- but you can create a list of IDs and shuffle those
You could also make some exceptions to that rule - or modify values as needed
Right, I'm just awful at finding what commands let me actually do that. I'm pretty much only self taught via cutting up code from other sources.
Epic
All sorts of crazy are found here on this chat
local function scramble()
local origRoomLoot = {}
local foundRoomLoot = {}
for roomID,data in pairs(SuburbsDistributions) do
for containerID,contData in pairs(data) do
---if room's container's data has an items list OR if it has a junk list with items
if (contData.items and #contData.items>0) or (contData.junk and contData.junk.items and #contData.junk.items>0) then
---Add extra exceptions here if needed
table.insert(origRoomLoot, roomID)
table.insert(foundRoomLoot, roomID)
end
end
end
---shuffle found list
for origIndex = #foundRoomLoot, 2, -1 do
local shuffledIndex = ZombRand(origIndex)+1
foundRoomLoot[origIndex], foundRoomLoot[shuffledIndex] = foundRoomLoot[shuffledIndex], foundRoomLoot[origIndex]
end
---using the original order found replace the entries with the shuffled version
for n,_ in pairs(origRoomLoot) do
SuburbsDistributions[n] = foundRoomLoot[n]
---Make changes to distro here as well if needed
end
end
Events.OnPostDistributionMerge.Add(scramble)
Not tested at all
I guess I'll have to try it out to see then.
edited a typo
This was drafted using media\lua\server\Items\Distributions.lua and media\lua\server\Items\SuburbsDistributions.lua
Thank you, I'm sure I'll be able learn something about what I'm doing from this.
good luck
made this little debug menu im proud of
best part? you can easily add/remove traits
global name CONSTANTS is a bad practice 
too common name
its actually not global
but CONSTANT as a local name is probably a bad idea as well
thanks for the feedback though
for local name it's fine
but if it's local then better to name it in lower case
upper case uses for global ones
lua have no official code style
but upper case for global it's just a common thing for everywhere
i see


just gonna follow java syntax
Curious question
I may have had a breakthrough for UFP with use of metatables, I was curious if there was a way to get the current mod a segment of code is running from
Or rather, what mod is currently loading.
If so, I might have a major lead.
i don't really know, but fingerprint must do this
so i'd look there
Thank you for the lead
Oh this is interesting
Very strange, but interesting.
Makes sense though.
@sour island If you find some time soon, I may need your help understanding some of your code so I can possibly repurpose it for something else. I'd like to understand what you're doing rather than just copy pasting it, since I don't know if there's unnecessary stuff for what I'm doing or not.
I understand if you're busy too tho, so plz take your time

I might head to sleep soon tho so idk if I'll be here if and when you get here
Anyone think that we should be able to grab house alarms and then use them to attract zombies? Something for a zombie trap.
that'd be cool for like.. an advanced noisemaker
house alarms aren't presently a tangible thing afaik
just a chance event per house
Plus, you can’t remove them, or make them currently
So I’m currently trying to make a mod that makes em
Then I need to learn how to make the noise
module Base
{
recipe Make Home Alarm
{
keep [Recipe.GetItemTypes.Screwdriver],
ElectronicsScrap=5,
Amplifier,
Radio.ElectricWire,
Screws=2,
Result:HomeAlarm,
SkillRequired:Electricity=3,
NeedToBeLearn:false,
Time:100.0,
OnGiveXP:Recipe.OnGiveXP.DismantleElectronics,
Category:Electrical,
}
}
This is what I currently have to make the Home Alarm
I used the xp for dismantling cause i was looking on the xp for it too
Its just addsound
Or fo you want the trigger alarn?
Give it to you later once i get back to my pc . Im afk atm
Would like to learn how to add a way to make it start/stop the noise, like an alarm
getPlayer():getSquare():getBuilding():getDef():setAlarmed(true);
Hmm, you think that for certain servers, like rp servers, having the ability to set off Home Alarms in buildings is a good idea?
I don’t do it myself, but you could technically also use that idea to make zombies swarm to that location
Though my idea was just to make it so that a home alarm makes the alarm noise when triggered
I could theoretically add a new “Home Alarm”, by giving it a battery and making it into a throwable too, setting the noise to home alarm…
welp this code will sset the alarm yeah but if you are a player then it will also set it off
lol
you have to figure out how to get the definition from outside and stuff like that on your own
ah, interesting mechanic
I sometimes think of something similar but I reposition buildings / rooms. (bad idea currently)
ya think its possible to have a mod that you can create a container that spawns loot (not modded spawning but vanilla distrib spawning)
have you asked #modeling
you mean place tile in world and fill it with items?
oh mb wrong chat
you can add items vanilla way with ItemPicker.fillContainer(container,getPlayer()), the items will be based on container type and the room.
containerType you normally set in TileZed e.g crate
yep
then this is a solution for griefed containers?
only if container exists already, but it happens automatically if the container hasn't been filled before (explored check?)
but that can be solved with loot respawn so you probably think about placing containers back
is this code correct?

icon