#mod_development
1 messages ยท Page 245 of 1
and put those attachments in your character's inventory, outta bag or other containers maybe
upgrade
I see it
On my end, adding a scope doesn't change range evne though the description says so lol
on a shotgun?
I see, nvm ignore me
I am inclined to believe that this mod isn't even the one that's causing it
I will keep looking tho
uhh if it's too time spending then you could just leave this be tho,
I hope you wouldnt spend too much time for this
ill try one other thing
hmm however, I have no other weapon mods activated tho
if not then I have no idea what this script is doing
you mentioned the brita's weapon mod
that could potentially conflict somehow someway I dont know why or how
ah yeah, I couldnt find something suspicious there but maybe I just didnt find it
hmm but these two are working together and meant to be work together
so I suppose any compatibility issue between two would be unlikely
but yeah, I know nothing about this so can't be 100% sure hahah
yeah I give up for now, it's probably the mod you suggest but I just cannot for the life of me figure out why it's doing that
I see, thanks for your time and effort tho!
I dunno where you live so have a good day ahead/night ๐
im in australia so it's 4 pm right now but ya
creating a mod is one thing, maintaining someone elses is a whole different game
ah, I see
here's 3pm, in South Korea now haha
yeah trying to figure out someone else's work would be something else indeed
it wouldn't be so bad if they documented it a little better because their code was basically just talking to a wall but in code form
Well It's kinda a shame that I can't reach the mod devs to ask or leave suggestions
anyways, gotta play PZ a bit more and then mind my own business hahah
see you around!
cya!
Hey! I have a clothing mod with various types of clothes that I want to add the feature to toggle on or off each type of clothing using mod options, for example, I want it to be able to turn on shirts and pants off, how can i do this?
Is there anyone who can describe me the process of uploading clothing in game? I tried to figure out myself by following the text guide, but I'm stupid or whatever and just can not figure out what am I doing wrong.
I can't help either of you because I've never ever done clothing related stuff
Where are you stuck? By the uploading itself? Or by getting the clothes into the game?
By everything
Lol ๐ If you can be a bit more specific, I could aid you. But now I could only regurgitate what all the guides already told you
I just like... Idk what exactly to show
I can record a vid with everything
have you already started with the mod and got everything you think you need? ๐
Yup
Hey quick question, I want to learn more about dead corpses, are they entities? Can I access a list of dead corpses that are in rendering range of the player (the ones being actively rendered)
I got all the textures, models, bones set to right place, but Idk if I'm messing with text files and hierarchy right
.
Feel free to zip up your mod and dm it to me, then I can have a look ๐
Okay
F
don't worry, it's just UI stuff, how hard could it be??????
Soft Announcement of:
If anyone has questions, concerns, ideas, interest: https://discord.gg/KK6sWP8aFf
Is there a way to force the container updates that happen when a grid square is loaded at another time in order to force an update for the client when the server adds or removes an item from the container? I can see the logs and know the items are moving but the client does not update unless they leave the area and return. I tried transmitting the moddata and this trick from MX ISInventoryPage.dirtyUI() but it did not update.
When defining a function in PZ Lua, is there any difference between "local function functionName(params)" and "local functionName = function(params)"?
It's decoration commonly referred to as syntactic sugar. They mean the same thing, it's just that the first one was made as an alternative as some people find it cleaner as myself. It's just personal preference.
there is a very minor difference in that local foo = function() declares the local after the function is constructed, and local function foo() declares it before the function is constructed - this should only be relevant if you're intending to use recursion```lua
-- works:
local function factorial(num)
if num == 0 then
return 1
end
return num * factorial(num - 1)
end
-- does not work because factorial is not actually declared yet:
local factorial = function(num)
if num == 0 then
return 1
end
return num * factorial(num - 1)
end
this can be extra annoying if your local shares a name with a global because that won't throw the expected 'tried to call non-function nil' error, it'll just access the global, which if it's a function will probably lead to debugging nightmares
Thanks for that explanation.
True that, I didn't actually know that until now
I just use the top one because it looks nicer imo
And I hate recursion I will never use it ever, even in C++
how in the hell do i import .x files into blender
tried using a directx addon and i get this
For anyone interested: https://www.reddit.com/r/projectzomboid/s/N16iwLHxoc
Hello everybody, please help for "lua noob" how to work with the Combo Box.
I have made my own panel on the character creation screen, and I would like to add certain information for a certain body part to the drop-down list. Maybe there is some kind of mod example? Or instructions on how to work with combobox
I was thinking of using
Combo:AddOptionWithData(?, ?)
or
Combo:AddOption(?)
I can't figure out how to transfer a body part and clothes there
trying to rebuild the projectzomboid.bank file with the fmod tool but it seems to just get stuck on the building with no progress at all
been going for over a half hour now, took less than 10 minutes to extract
~snip~ I figured it out lol it was easy
but I still want to know how to get the entity ist
list
like loaded entities by the client
im basically going to loop through all the loaded entities by the client and then check the distance of each one then do some magic if that is true
but I don't know where the loaded entities are/how to get them. Like are they a list, or do I have to loop through something ,etc?
fuck it what better way than to rummage around in the java ๐
I'd kill to have docs of these functions, like I can call inv:addItem(item) or inv:DoAddItem(item) or inv:addItems(use????) among other things and noone knows what these do or why there are multiple of the same functions that seemingly do the same exact thing
isn't it just InventoryItem:getCategory()?
InventoryItem:getDisplayCategory() is separate too
ah i see, I was using the Item class not the InventoryItem. thank you
is there a way to detect when a square becomes unloaded? the inverse of LoadGridsquare event or something
I've tried ReuseGridsquare and it just straight up never gets triggered
being able to detect if specific area coordinates-wise stops being simulated is fine too
- clothing item needs an XML file which points to models and textures
- there needs to be clothingitems.txt script file that defines some clothing items that utilize your xml-defined data
- there needs to be fileguidtable.xml with correct filenames and their guids, the same as in original xml
specifically, my code keeps track of loaded corpses so I want it to unload that data when it stops being relevant
Yeah, I know I was just missing something and not at home to continue trying to fix it
@noble summit
... i known right
Possible ItemZed 1.4 ???
Hi everyone! I'm new in pz modding. Is it possible to decompile pz and add new classes?
Yes
Hey gamers,
Is there a good place that explains how to create a basic mod yourself? I had a look at pzwiki but it's more generic advice and just points to here? Just need to figure out where to start off.
Hello! Has anyone here looked into the bundling / unbundling function of logs? I have tried to find it to get an idea of how I can create the same for planks and other items. So far everything is going according to plan, however, when bundling / unbundling logs PZ tends to remember whether it was rope or sheet rope that has been used. I am currently trying to figure out how to do that.
there is an example mod in a folder actually!
Steam\steamapps\common\ProjectZomboid\mods\examplemod this should be the path
it gives you an overview of the folder structure you need, from there on it is a bit of trial and error (at least it was for me)
in the media folder of Project Zomboid you can find scripts, textures, models, animations, etc. What helps me a lot is zipping through folders and reading up on them.
what helped me the most was looking at the items and recipes .txt
Thanks for responding so quickly!
I had a look at that one but I basically only have these files there:
$ ls -R
.:
media mod.info poster.png
./media:
lua music ui
./media/lua:
Music defines.lua
./media/lua/Music:
MusicChoices.lua
./media/music:
luatriggered preface.ogg theme2.ogg
./media/music/luatriggered:
paws1.ogg paws2.ogg paws3.ogg paws4.ogg
./media/ui:
PZ_Logo_New.png
what exactly are you trying to mod? Adding new items or something else?
I am a rookie myself still, but maybe I can help
Yeah, just maybe adding an item, adjusting some values. Maybe extending functionality for desktop PC you can find, e.g, you can kill boredom with them.
I really want to figure out the complexity behind creating one.
About your experience, how do you deal with feedback loops? Is there a quick way to verify changes, e.g,. change something in the mod and then see effects? Just concerned that it will take 5 minutes to reload ๐
for adding new items I found this guide quite useful:
https://steamcommunity.com/sharedfiles/filedetails/?id=3006109377
basically you need a folder in media/scripts
and then you throw a .txt in there, I tend to have one for recipes, items and models
MAYBE (I do remember seeing something about it in the recipes file from PZ) you can make the recipe in a way that it needs to be performed near a computer.
I'll have a quick look, maybe I stumble accross the recipe that had that right away
found it! actually didn't find it in the recipe folder itself, but online
https://pzwiki.net/wiki/Scripts_guide/Recipe_Script_Guide
NearItem:Workbench, This is the example that they give on the site, maybe it would be enough to find out how PZ calls the Computer item and add that there
and regarding your question, you can just return to main menu and drop in the file you made changes in, but if you're making multiple changes, the only way to do it is really quit to desktop drop the files into the mod folder to test and restart.
Thank you that's extremely helpful @compact tinsel ๐
Hey people, I had great help from @compact tinsel , please see if you can help them out ๐
You can find both OnCreate.CreateLogStack, and OnCreate.SplitLogStack that are used in those recipes in media>lua>server>recipecode.lua
thank you!
hi this is really bugging me does anyone know the internal name for a campfire?
im trying to add an 'Near Item' function to a recipe so you have to be close to a campfire or stove
and neither 'Campfire' or 'IsoCampfire is working
Thanks
@fast remnant
https://github.com/FWolfe/Zomboid-Modding-Guide#required-tools-software
https://github.com/Konijima/PZ-Libraries
https://github.com/MrBounty/PZ-Mod---Doc/tree/main
How would one add a custom or already existing procedural list to a container's loot list within the Distribution.lua file?
For example, how would I add CarWindows1 to metal_shelves?
BTW if you launch the game in debug mode using -debug you can reload lua in the main menu which will reload your mod sand it's files
ohhh that's a game changer, thanks!
Be aware that this can cause issues if your mod uses decorations or events or attaches functions to specific objects. Reloading Lua live will in those cases double-decorate things, or add two copies of a function to the same event. Also, things that need to happen on Events that only occur once, such as OnCreatePlayer, will not happen, so reloading Lua is also limited in troubleshooting that kind of thing.
also in debug F11 menu you can double click a snippet of code to create a break point and observe the object stack, handy little tool imo
a main menu lua reload would be a full reload anyway
I might need help with setting up a custom timed action, I'm going to keep trying to fix these errors but im almost at my breaking point
what problem are you having?
I figured out that calling the new() function with a period rather than a colon causes a casting error, so fixed that, just my lack of knowledge of lua specific quirks. My error now is that the player object is being passed in the parameters as the number 0
which I think i know why
its prob because I need to use getPlayer()
the colon calling of the function had me pulling hair out last night,
sometimes players are passed by their index instead of the object, use getSpecificPlayer(playerIndex) to get the object
the colon calling is a bit annoying here, lua uses the colon to pass self in class functions but constructors shouldn't have self anyway, just a weird way TIS likes to write constructors
That adds more context to why it was behaving the way it was
basically, when you call a function using the syntax table:function() you are actually calling table.function(table), and when you define table:function() you are actually defining table.function(self)
thats very odd, but I imagine it has something to do with object vs static scope
yeah, lua doesn't natively support classes, objects are just tables that get passed around and the colon syntax is meant to hide that
thanks for the help albion!
How could I overlay the whole screen with an image?
I'm working on a "you die, you're frozen for X minutes" and I've got the core to work but I also need to hide the screen from the player some way.
There's a render object you can call to draw things on screen.
getRenderer()
declaration: package: zombie.core, class: SpriteRenderer
render rect might be hollow, but there's also render poly
You'd have to play around with it.
If you want a texture, or image, there's that too - but you'd have to account for different resolutions.
Thank you! I'll look into it! ๐
Hey,
Could someone point into the right direction for creating a new perk/skill? So let's say I want to add a new skill called rocket launchers... I've gone through the Package zombie.characters.skills and just can't figure out how to make it work. Tried looking at source code of other mods - nothing either.
Googling for tutorials didn't result in anything comprehensive either.
then for rocket launchers you probably want to look into how aiming adds exp and do something similar with player:getXp():AddXP(Perks.MyPerk, 4)
anyone know if this is correct way to sync a ThumpableObject?
function ISUpgradeBuildingAction:perform() -- Trigger when the action is complete
print("Action perform");
if self.thumpable_obj:getNorth() then
self.thumpable_obj:setSprite(self.upgrade.northsprite)
else
self.thumpable_obj:setSprite(self.upgrade.sprite)
end
self.thumpable_obj:setIsThumpable(false)
self.thumpable_obj:syncIsoThumpable()
ISBaseTimedAction.perform(self);
end
and will this save the state of "IsThumpable" and the new sprite on the server?
I have my mods that have loaded squares in ticks and have a check to see if the square is no longer available with local square = getSquare(x, y, z) if not square then return end
That way if the square is no longer within range of the player it just stops the code from running.
yeah I figured I'd need to do something like this. It's just really not ideal, to actively check every square
particularly for a server because it could be thousands of squares to deal with. Sure I can put them in a slow rolling update so the load is low, but that's still a solid 99+% waste of CPU cycles
Oh yeah, that would be intensive... I use it on a list of items that I am actively tracking. The list has all the squares that the radios are in and runs that list.
This is true, I used to have this happen to me all the time. But it only happened to me when I reloaded Lua using the F11 file reload feature . Reloading Lua in menu for whatever reason does remove the event callbacks and readd them. Though if there it still happens I am sure you can remove the event callbacks yourself if there is a way to detect when reloading Lua is happening.
you can simply remove callbacks immediately before adding them
Trueee
But I don't do ti because I'm lazy and the game some reason does it for me
the main menu lua reload resets the entire lua environment, the debug menu file reload just runs your file again and doesn't have any system to undo things your file previously did
you can try to detect and remove events and decorations after a reload using globals but i think this is kind of a waste of time and makes your code overly complex, use it when it already works for your code and is convenient
I misread you originally in passing. Thought you were referring to reloading in game not in Main Menu
Sorry for confusion
i'm having a weird problem. When I call IsoDeadBody.getDeadBody(deadbody:getObjectID()) it throws a java error from MethodArguments.assertValid. It should return the same body I passed into the function, or the body with the same ID anyway. The real code has ID stored in a table between taking it from a body and querying it back, but this error breaks the code either way.
kahlua doesn't pass shorts to methods correctly
I seem to recall there was a way to produce kahlua-typed java values from lua numbers? It's like I caught a glimpse of it at some point but never got around to use it.
there is but you can't construct a short that way, it's not exposed
a short is a 16 bit integer type, normally unsigned
lua only has double-precision floating point numbers, with 53 bits of decimal/integer space and 11 bits of exponent space
<@&671452400221159444>
dont click this
Somehow they got around the masked link filter too
might be because of the top-level domain ๐ค
sir do you have a license for these illegal puns?
oh I didn't know you were talking about short as in integer type sorry
I do that a stupid amount
my cs classes taught me well and now im scared for life
I swear I'll never forget ๐ญ
it was a markdown link like [text](url)
but yeah how would that get around filter
filter might only be set up to deal with .com, but who knows, really. Regex is a fickle mistress
at this point, not allowing any markdown links would be ideal
anyone know if this is correct way to sync a ThumpableObject? Will this save the state of "IsThumpable" and the new sprite on the server? Or should I use ```lua
transmitCompleteItemToServer()
```lua
function ISUpgradeBuildingAction:perform() -- Trigger when the action is complete
print("Action perform");
if self.thumpable_obj:getNorth() then
self.thumpable_obj:setSprite(self.upgrade.northsprite)
else
self.thumpable_obj:setSprite(self.upgrade.sprite)
end
self.thumpable_obj:setIsThumpable(false)
self.thumpable_obj:syncIsoThumpable()
ISBaseTimedAction.perform(self);
end
looking at the source I dont think either method will sync that property
found transmitUpdatedSprite()
is there a way to do a custom packet to sync the isThumpable property of my object?
possibly what commands are for?
<@&671452400221159444>
there is a sequel
No idea why they're targeting this channel
always when im waiting for a response too lmao
Looking at the vanilla code, transmitCompleteItemToClients is used after set thumpable. You probably want a server command to handle it
There are some examples of transmitCompleteItemToServer too ๐ค So that's just an assumption
Ill have to check this out thanks
I am trying to get dead zombie corpses within a cell. I tried getting the zombie list and checking if they are dead and then appending to a list but the entities being appended to the corpses list are actually somehow IsoZombies even after passing the isDead check. How?
-- Get corpse list as zombie_list is both alive and dead zombies (maybe???)
--- @type table<number, IsoDeadBody>
local corpses = {}
for i = 0, zombie_list:size(), 1 do
--- @type IsoZombie
local target = zombie_list:get(i)
if target and target:isDead() then
corpses[#corpses + 1] = target
logger.debug("Added corpse to corpses table at index (%d).", #corpses)
else
logger.warn("Target was alive or nil.")
end
end
Unless zombie_list is only zombies but then why would corpses be populated with IsoZombie? If there were no corpses (zombies weren't dead) then surely it would be empty after running this code, right?
Is zombie_list from IsoCell:getZombieList()? If so, it looks like it's expected that that'll only be IsoZombies and not IsoDeadBody instances. I'm unsure whether there's a way to get all dead bodies in a cell, but it looks like IsoGridSquare has getDeadBodys
I will look at that
im ujst gonna rewrite teh whole thing really quick because I wrote it all at like 9pm and I have no idea what I was doing
but I will test it in a min
wait I just tested
so this code:
-- Wait for zombie to be dead and loot populated before getting zombie inventory.
while zombie:isDead() == false do end
-- Redefine var because type is no longr IsoZombie
--- @type IsoDeadBody
local parent = zombie
while parent:getContainer():isExistYet() == false do end
logger.debug("Zombie is dead and loot is populated!")
And I get an error on the second while loop (because IsoZombie:getContainer() doesn't exist). Does IsoZombie not turn into a IsoDeadBody after dying?
unless you put that into a coroutine hardware thread, it just makes the game lock up forever, unless it never actually enters the loop
I could probably do a timeout or something
but it's very rarely ever going to lock up (so the game says)
this for context is is an OnZombieDead event callback
I am only doing the while loops because sometimes my code runs before zombie actually dies/inventory exists
Does IsoZombie not turn into a IsoDeadBody after dying?
I'm not 100% positive but I don't see how that would even be possible. Objects can't change classes.
I thought what happens when a IsoZombie dies is it is removed from the world and then a IsoDeadBody is added to the world in it's place
the object you're hooked up to is a zombie, to get the body you'd need to specifically select it
true
anyway don't do while cond do _nothing_ end unless you're spinning this in a separate thread
if it runs in the same thread as the condition, then it just locks up all calculations and the condition calculation will never change
I know empty while loops are bad, but in this case I think it would be fine
unless event callbacks are not called asynchronously
then that's obviously really bad lol
getting Lua to multithread is non-trivial so if you're not manually doing anything then it's probably definitely operating in a single-threaded execution environment
but also the conditions I am checking in the while loops are always true after a very short amount of time (unless something really bad happens which then is not really my fault, like some mod destroying a zombie's inventory if thats even possible)
According to my quick test here, callbacks run in the main thread.
ok good to know, im glad they at least let us use coroutine std module ๐
be aware that coroutines run in the same thread
oof
I am trying to make an emerald coloured choker mod. Absolutely bewildered trying to figure out how to make it useable, thought I could just copy paste information from from Necklace_Choker_Sapphire.xml or whatever and have it work but I am completely clueless. Pretty much all I have to show for my efforts so far is a .blend file and this png (yes I am a complete noob and have no idea what I am doing)
you probably just need to make a different GUID
Hey, new to mod making, reading through the resources and such, how, programmed, modded for other things before, just never Lua.
How would I edit a function that already exists in the game? I've located the file and all that
I think I figered it out
you can override the function entirely (don't) or you can substitute the original function with your own version, which then (or first) calls the original
how do I do those XD
game.original = function(...)
your_code(...)
original(...)
end```
(you can actually use the ellipsis, it passes on all arguments. To extract the arguments you use select(i, ...)

is your_code a function I make, considering how you wrote it? Or am I actually writing code there? Or both
I'm pretty sure you can't access dead bodies that way
Even if you pass the check, you won't get the dead body
Yeah I went in basically 100% blind. I'm still trying to study the java to see what is actually a IsoZombie compared to IsoDeadBody
I am yet to understand fully so it's gonna take some days but I'll get there eventually
Can I use real time in the LUA? Like let's say I wish to do something every 10 minutes IRL is that possible? Or am I stuck to use the in-game hrs etc?
I know it's possible but you might have to do some work like use ontick event callback or something, measure the time elapsed and then if the time comes do your code in it and then reset the variable that holds the time measurement or something
An easier method i can think of would probably be convert PZ time to IRL time and then maybe use EveryOneMinute
Like if say EveryOneMinute event gets called every 2 sec IRL, you know that 5 calls to your callback would mean 10 seconds has passed
Idk I'm just throwing ideas out there since I can't look at the javadoc rn but you can definitely do some time measurements but I've only seen them done with measuring code performance in ms
Maybe PZCalendar class might help you?
I was looking into PZCalender and it said something about os.time but couldn't find it
It's because I'm gonna need something to count down for X minutes as a text element. Like "10:00" to "0:00"
I want to be able to display a real clock that decreases by 1 second every REAL second
Calendar.getInstance():getTimeInMillis() returns real time in high resolution
as far as I can tell there's no way to register callback to happen a specific amount of time in the future, RT or IGT
also considering the game allows different game speed & different game fast-forward rates, I would advise against using real time for anything other than something completely irrelevant gameplay-wise
I'm unsure if I'd need the callback, I was planning on storing the value Calendar.getInstance():getTimeInMillis() and then just add 10 minutes to it, would that be possible? I could just do an onTick on the client to update the value, hope this makes sense
Like display (requiredTime - getTimeInMills) for instance, requiredTime being getTimeInMills plus the 10 minutes
yeah that would work
again, be sure that this real time countdown has absolutely nothing to do with any gameplay
otherwise it's possible to gain unfair advantage by selecting specific daylength and fast-forward (conversely get severely penalized for NOT selecting it)
How would I use that?
local startTime = getTimestampMs()
local timeElapsed = getTimestampMs() - startTime```
usually i use it when i'm tracking how long it takes for stuff to execute, but it could be used to calculate difference in time (for whatever reason)
And would that be able to return seconds? Like it's in milliseconds? If I did timeElapsed * 1000 (my math is awful prob)
yea x1000 to get it to seconds
Oh that's actually awesome
/1000
Oh yeah LMAO
I think that's gonna work, super thankful for ur help lect! And yours too CS!
Would it be like this?
Calendar.getInstance():getTimestampMs()
Or just out the box: getTimestampMs()
the only issue is if there is discontinuity between sessions you might never log the correct times
this
calendar returns global real time, timestamp is not required to do so
not sure exactly what the latter does without looking at the source code, but if it's anything like OS high resolution timer, then it starts at basically random value
i've heard rumblings that global time is off... somehow? anecdotally heard it enough that i try not to rely on it, but i can't seem to find it in search bar
timezones something something
xD
expecting it to respect OS timezone, or expecting it to be GMT0
i have no expectations, just use getTimestampMs()
for the purposes of tracking time spans, that works completely fine
works well for me, pzcalendar is just a very thin wrapper over java standard calendar
well actually its entire functionality is exposing 5-ish methods of entire java calendar class functionality, IDK why would they ever do this, seems like a waste of everyone's time and innocent bystander's braincells
IDK what to tell you bruv. This looks like something that an unpaid intern would make to pad the git stats.
They probably thought it was a legit good idea to add this to the game engine and then it just kinda stuck, and if you ask around there's probably people who can justify having this kind of stuff in their codebase.
I imagine the intended purpose was sandboxing
Same reasonโI assumeโthe file reader/writer we have access to can only read/write in one encoding
Maybe even the same reason we can only make GET requests, although for that one my theory is that the devs just never had a reason to implement better http support
gee god forbid someone set custom timezone in their own isolated calendar
just to be clear: calendar objects are like literal wall calendars. You can do whatever you want with it, but it has no effect on the flow of time.
what is getBumpFallType()?
GET requests can't contain binary payload, but it can be maliciously constructed to be terabytes in size anyway, so no real reason to do this
case wasBumped:
this.type1 = var1.getBumpType();
this.type2 = var1.getBumpFallType();
this.flags = (short)(this.flags | (var1.isBumpFall() ? 4 : 0));
this.flags = (short)(this.flags | (var1.isBumpStaggered() ? 8 : 0));
if (var1.getBumpedChr() != null) {
this.type3 = String.valueOf(var1.getBumpedChr().getOnlineID());
this.type4 = var1.getBumpedChr().getBumpType();
this.flags = (short)(this.flags | (var1.isHitFromBehind() ? 128 : 0));
if (var1.getBumpedChr() instanceof IsoZombie) {
this.flags = (short)(this.flags | 256);
}
}
break;
something involving tripping possibly @distant marten
I tested with print(player:getBumpFallType()), but it was always ""
when falling from a tree or fence
if (var1.isBehind(this)) {
this.setBumpFallType("pushedBehind");
} else {
this.setBumpFallType("pushedFront");
}
thats the only 2 values I see it set to in the java source
havent checked lua files
attackFromWindowsLunge(IsoZombie var1)
comes from this method
hey peeps, does anyone know if there's an animation for painting that I can use?
I think the animation name is literally just "paint"
yes print(player:getBumpFallType()) printed pushedBehind and pushedFront when I climbed over the window and was attacked by zombies
thx!
np, it looks like this here is an example of how to stagger your character: ```lua
DebugContextMenu.onTick = function()
if DebugContextMenu.staggerBacking then
DebugContextMenu.stagTime = DebugContextMenu.stagTime - 1;
if DebugContextMenu.stagTime < 0 then
local chr = IsoPlayer:getInstance();
DebugContextMenu.stagTime = 300;
chr:setBumpType("stagger");
chr:setVariable("BumpDone", false);
chr:setVariable("BumpFall", true);
chr:setVariable("BumpFallType", "pushedFront");
end
end
end
not completely sure if im right with that assumption but it looks that way to me
I didn't mean to imply it was necessary, just my two cents on why it may have been done
Well it's like I said. At some point they probably thought it was an actually good idea.
And then you end up with code that looks like YandereDev made it.
same energy though
reminds me of the tralse thing
technically that whole piece of software engineering does something the vanilla didn't originally do. But, you know.
Something like Node's is_odd has better reason to exist, since JS type coercion is wonky and reliably testing for something as simple as if a number is an odd integer involves unreasonable amount of boilerplate code to inline it every single time.
for anyone curious
if (cond == true)
return true;
else if (cond == false)
return false;
else
return tralse;
}```
Does the IS prefix on things like ISDisinfect stand for Indie Stone or something else?
It might. Or it might not. It doesn't matter, variable naming is 100% arbitrary, and the only real rule is that it can't contain special characters and it can't start with a digit.
I'm aware of how variable naming works.
I asked a specific question, variable naming conventions have almost nothing to do with it.
Sure. It's just I like to take a step back when tackling this kind of questions, to get a better view at a bigger picture.
Anyway if you want a real answer you'd probably have to DM the devs, and probably more than 1 of them.
In the same vein Iso could be standing for something, probably of significant importance, but personally I really don't care. The naming isn't even consistent between camel case, pascal case and snake case, so at that point it's hard to care about any of it.
this is something i've wondered about too because it seems really redundant to prefix half of the file and variable names with something like that, but i'm pretty sure that is all it is
the real answer here is probably definitely that a lot of devs came and went and each of them had a vision of how things should be named, which wasn't always aligned with everyone else's vision, particularly those who worked on the game before them
Iso doesn't stand for isometric ?
It could be, but again, it's not consistent across the entire codebase. Many objects pertaining to similar functionality don't have this prefix, and some objects scantly related to isometry have it.
I'm pretty sure iso does stand for isometric, yes
The entire iso package is related to world-objects and world simulation/display.
there is a substantial number of iso-prefixed classes outside of that folder too
Okay.
Anyway, I don't care if you don't care what IS stands for, and I don't need you to X/Y problem meโI asked what it stood for because I was curious and because I care about consistency and code quality in my projects.
I am just a little bothered by my modded types not matching the ISwhatever types, but it can't be helped I suppose
aren't we all? but look at the state of internal self-consistency of PZ API and consider if it's necessary at all
if you care about code quality you really need to ignore all of the vanilla lua's standards
i can't speak for the java but the lua is very substandard and weird
wdym
lua is fine as far as i'm concerned
it allows for poor programming practices more easily than others but I wouldn't put that as a fault
the language is fine, it's my favourite scripting language
the way the vanilla game's lua is written is just strange
ah, I see
eh, IDK. As far as using someone else's code goes, "as long as it works" is the motto.
it's just not something to model after if you care about code quality
by the way, if IS stands for "Indie Stone" then you shouldn't use it anyway ๐
ideally you just don't put anything into global namespace, and this way the problem solves itself
Yes, that was my point.
If it doesn't stand for Indie Stone, I can use itโbut it probably stands for Indie Stone so I won't.
Well why'd you want to use IS prefix? Because if you don't have a reason to use it, then what's the issue?
then again it falls under the shared namespace variable collisions
It bugged me that all the other actions were prefixed with IS and mine aren't (I went with CI, because that's the initials of the mod I'm working on).
so if you have the same-ish names as something made before you, you just use a different name. Spelling it out usually avoids collisions (unless the entire name is a one big collision)
So, purely aesthetic reasons.
Yes, I'm aware that if it's the organisation, creator, or mod name then it's to avoid namespace collision. Personally though, I prefer using tables for namespacing instead, though.
speaking of. Are tables slower than locals in kahlua? I hazard a guess that yes.
i mean if it's true for LuaJIT i can hardly imagine someone else's implementation fares better
yeah
(unless it's about next, then a lot of people fare better. With an asterisk - comparatively to itself better, not compared to LuaJIT)
ime table access is not so much slower that it is worth avoiding using them when you normally would
Avoiding it when you can is just a good rule of thumb. Why waste CPU cycles resolving hashmap collisions when bytecode can point directly to the relevant data.
You could just cache the variables you're interested in if you're repeatedly accessing it in a method, or inside a loop.
yup
though caching tables to locals is probably more relevant in LuaJIT than kahlua because it builds native code that directly uses locals vs looking up table values
I figured you'd cache table members rather than the tables themselves
well yeah that's what I said (what I meant anyway)
the performance benefit really is not huge, accessing tables is pretty fast
but local + table access is always going to be slower than just local access
if kahlua runs bytecode interpreter then vast majority of computational demand of running Lua code is simply churning through a laundry list of operand type checks at every corner, compared to that looking up values in a hashtable compared to fetching it from a flat array is not a substantial penalty
kahlua does indeed runs bytecode interpreter
would be pretty sick if it could generate java bytecode and run it in JVM, which normally has a really good JIT
i imported lua code into gpt and messed around for the first time.
tried working with blindzombies mod (i think its nerfed now) told gpt how i wanted it to work and after several different attempts rewrites, it worked. pretty cool imo gpt ftw
Honestly I'd like to see Kahlua replaced by a well-kept project that runs legitimate Lua.
or just whack in luajit.dll in there
Could be done as a Java mod.
I'm attempting to decompile the game and I'm getting this error:Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: zombie.core.Core
i'm on an m1 mac
How would I draw plain text to the UI layer? Been looking into the UIElement -> DrawText but just keep getting errors.
if you just want a textbox in your ui you could add a ISTextBox or whatever its called in your ui
Yeah but I was looking to not have the textbox border thing around, like just plain text and nothing else
If you just want a text you can use this https://projectzomboid.com/modding/zombie/ui/TextManager.html#DrawString(zombie.ui.UIFont,double,double,double,java.lang.String,double,double,double,double)
Ah sweet, thank you!
It will look like this
Ah yeah sweet thanks!
or smth along those lines
declaration: package: zombie.ui, enum: UIFont
i dont remember the exact call
Also r, g, b, a are values from 0 to 1.0
how tf ๐ญ
Just divide normal values from 0-255 to 255
interesting, thanks!
Doesn't seem to be working (I'm 100% doing it wrong):
TextManager.DrawString(UIFont.Small, x, y, text, 1.0, 1.0, 1.0, 1.0)
Doesn't work. Do I need to call UIManager before or smth?
The rest of the variables are properly set so I assume I'm misusing the function
getTextManager():DrawString(UIFont.Small, x, y, text, 1.0, 1.0, 1.0, 1.0)```
I was looking at this. Would there be any way to generate bytecode from Lua? Like is it a string of bytes (literally)? Ignoring the part where Lua can't directly run the java bytecode, that is.
I mean.. that's what a compiler does
Got a bit of a weird one, creating a few new firearms and im porting the models in but theres a weird issue with the attachment screen.
The rifle appears the correct way up in hand - but when applying attachments they have to be placed completely off the rifle. The attached image shows the correct placement for the muzzle flash but its completely off of the rifle
if kahlua can generate Lua bytecode, surely you can generate Java bytecode
it helps that Lua is extremely technologically simple language
the way I see it, the main difficulty in that Java doesn't have dynamic typing (and consequently all opcodes are typed) so that involves extra work on the bytecode compiler part
but the same is true for x86 processors and JIT compilers do just fine
Hey all! Just looking to mod some custom occupations, the one thing im interested in is where the file for the park ranger and lumberjacks increased speed in the woods are, as its not in the main creation methods as far as I can tell
but yes bytecode is literally a string of bytes. The same way as machine code is also just a string of bytes. The difference between bytecode and machine code is purely semantical, in that one is meant to run in a VM (which may or may not have real hardware implementation, like LISP machines) and the other is meant to run on real hardware from the start.
some languages use IL representation for bytecode, it's their assembly language equivalent
It happens while updating the player on the Java side. updateInternal2 within IsoPlayer
In particular, the bit where it's calling isInTrees and checking for those professions
it sucks that it's not in lua
but couldn't you replicate it in lua anyway? or can you not do speed increase from lua (doubt)
Uncertain, since it'd depend on whether that update function would overwrite any changes (or whether those changes are even accessible)โso depends on the order of event calls, ultimately. That relevant bit of code looks like it's updating a "WalkSpeedTrees" animation variable
I see. I am more accustomed to C and machine code like ASM than bytecode and I've only ever briefly learnt about the Java VM, and I didn't even know Lua could be compiled since I thought it was solely interpreted (I assume LuaJIT is what I am thinking of most of the time).
like basically all modern interpreted languages, Lua compiles to bytecode and then that is interpreted by a VM. Or in case of LuaJIT, it gets further compiled to native code.
I don't see other references to WalkSpeedTrees in the Java or Lua, so presumably you could replicate it under the assumption that it'd only apply for professions other than those Scratch that, because of the event thing I said beforeโit'd be overwritten
In any case LuaJ already exists
Long story short, your gun needs:
-Barrel pointing up in blender,
-scale of gun needs to be set to 0.01 in all axis in object mode, (best is to apply scale, set it to said scale and in editmode resize it to proper size so it fits character in pz).
I don't know how to search history in discord on phone, but if you search in #modeling with my name there should be some more info about it with screenshots.
Also rotation in X axis has to be 90 while pointing up
*
Tricky stuff, ill give it another go later on!
Anyone knows why Braven made Common Sens uncompatibile with Flash together ?
i dont think modders would intentionally make mods that are incompatible
it just happened to be that way..
tho im speaking in general
idk what your situation is really
When hosting a server you can set it so safehouses are "open" when a user of the safehouse is logged in and will be safe/close when that user logs out.
Would it be possible to mod a way for the safehouse remain open X amount of in-game hours after the user logged out?
how do you get the contents of a container when its a inventoryitem?
Yeah like Glytcher said, modders don't make their mods incompatible with other mods
It just happens to be incompatible
@bright fog
That code is not making things intentionally incompatible if that's what you're thinking. It's actually probably the opposite at a glance; I suspect its purpose is compatibility with all those mods. Have you tried those mods together?
That code is just skipping a DoParam call if certain mods are loaded. If I had to guess about why, I'd guess the other mods do the same DoParam call on that item, or they do a contradictory DoParam call, or those mods won't work as expected if that call happens.
call :getContainer() on it it will give you the ItemContainer of the item
hmmm i thought i tried that, ill try again
would it be difficult to try and get pz working natively on appl silicon macbooks?
I tried changing the java JRE that pz uses to an arm64 bundle, but since the actual executable that launches java is in x64 it just crashes
mayb this should be a seperate thread
nvm i would need these libraries to be native too oof: libLighting.dylib libPZBullet.dylib libPZClipper.dylib libPZPopMan.dylib libZNetJNI.dylib libZNetNoSteam.dylib libfmodintegration.dylib
it should be, everything else is working fine. but when i try item:getContainer() and then make it print yes or no. it always comes back yes even if its not a item container. and earlier when i tried to get it to print the contents, it was printing the contents of the container the item us in and not the items container
im using the new events from new Events Plus API mod
anyways, im gonna resort to throwing everything at the wall until it sticks XD
An item is always in a container so it should return true. Floor and player inv are containers. You want to use getItems() to return an array of items in a container if you're trying to print out a list of items in a container I think.
im trying to get a list of items thats in a container like a backpack or a bag.
im actualy trying getitems now. ill see what happens
How do i detect a specific item category that player is holding?
Is it even possible?
Player:getPrimaryHandItem():getCategory()
If by holding you mean holding in the hand?
Yes.
if itemContainer then
local itemsInContainer = itemContainer:getItems()```
gives me a list of items in the source/destination container. im trying to get all the items in a backpack
In the players inventory?
wtv the inventory is that i transfer the item to
You're using events api?
yep
The event should have src and dest containers
it does
So is the destination container is a backpack ?
nope. its a shop container. from my inventory to the shop/from the shop to my inventory. if the item goes into the shop it logs the entire shops inventory, if the item goes into my inventory it logs all my inventory
Assuming the shop is noirs? Then you can check if the container sprite is player shop
If it's to your inventory then you can check item:getOutermostContainer() and see if that returns player inventory
use item:getInventory()
And also how do i avoid errors when player is not holding anything?
I think it returns nil so just check for that?
Ah, i see, thanks.
very nice comment.
shine_together does not add any attachment point to base handtorch, either there is other problem. or it was just excluded together with other mods. i will test solution to add mod that has only one function that allows flashlights to be attached
ah i had to do item:getContainer - getInventory - getItems.
I think some of your intended meaning is being lost in translation for me here.
I can't say for sure why the activation of those mods is used to determine whether that DoParam line runs. I can only tell you that the exclusion list in the code you posted is not intended to flag mods as incompatible, nor is the code trying to cause them to be incompatible.
yeah but it kinda excludes the possibility of attaching light to belt if you are using mod thats focused on making light visible to other players.
i did not read too much into shine together to analyze impact/ find any potential issues especially taking into consideration iam not fluent in lua.
i saw comments under both mods that stated that it used to work, that's why i thought that this is explicitly done.
i will test it when i will be by pc if adding this attachment type brokes something
I don't see how neglecting to run a single DoParam call would exclude the possibility of doing so in the infinite other circumstances where a mod might run that same line of code...
I can say from a modder's perspective I can think of no likely, realistic reasons that someone would intentionally stop two fun mods from integrating peacefully.
That just doesn't sound worth the time and energy it would take
I would add that if you want to understand that code fully, I would operate from the assumption that it's not doing that unless you definitively, incontrovertibly confirm through objective analysis that it is.
I think more likely than not the assumption that some part of the code is attempting to intentionally produce incompatibility will mislead you in your efforts to correctly interpret it
Looking for more participants.
https://discord.com/channels/136501320340209664/1125248330595848192
I'm outlining a mod for Project Zomboid to optimize resource usage for multiplayer to support a larger player base. anyone have some existing resource metrics for server hosting I could look at? Want to try identifying resource bottlenecks
Are there any existing profiling or benchmarking tools or should I build them myself?
it seems that his mods checks 3 different mods if they are running
if one of em is installed the change the screwdrivers attachment
im not sure why he would do this but i assume all of those mods listed either change it like that or something else and his mod is having issue about it and so he did this yo fix it im guessing
i replied first without reading whole thread. my bad.
you already knew ...
i suggest you look at those 3 mods to know what exactly they did
and if you dont mind can you d
share what youre trying to build ?
Is there anyone who let me know to make lua script for adjusting recipe ingredients?
I tried to create it by applying the "AdjustItemProperty" lua script, but it failed.
Hello, I recently started making Recipe Scripts for my mod with this guide https://pzwiki.net/wiki/Scripts_guide/Recipe_Script_Guide
is there a list with sounds and animations for these parameters
AnimNode:
Sound:
In my mod there are also new melee weapons and I need a list with the swing animations that are in the game
A guide that I use: https://github.com/FWolfe/Zomboid-Modding-Guide/blob/master/scripts/README.md
SwingAnim:
All of the AnimNode params I could find:
Disassemble
SawLog
RipSheets
All of the Sound params I could find:
OpenSeedPacket
Dismantle
BreakGlassItem
Hammering
Sawing
EmptyPan
OpenCannedFood
MakePlaster
PutItemInBag
BoxOfRoundsOpenOne
BoxOfShellsOpenOne
SliceBread
SliceMeat
PZ_FoodSwoosh
LogAddToStack
LogRemoveFromStack
ClothesRipping
All of the SwingAnim params I could find:
Stab
Bat
Heavy
Spear
Rifle
Handgun
Throw
Shove
ill try look for more but that's all of the ones the game uses in media/scripts folder
Thanks โค๏ธ , I thought there would be more SwingAnim in PZ but i think thats enough for me.
Anyone know what the difference between render and update are?
in ISPanel I mean
Nevermind I found my answer in the discord search results, wonderful!
Why is this a thing? I thought users simply subscribe to workshop and it's automatically installed?
You also have to enable the mod in game. But it's probably a dedi host saying that. They often just directly edit Mod ID and Workshop ID into their server file where it belongs.
I thought the workshop id and mod id automatically get appended to the workshop description when you upload a mod:
I never manually added these, the game did after I uploaded the mod. You have to manually remove them so that suggestion may have been to add them back?
Also I find it bizarre that there isn't a way to get a list of active moodles from vanilla. The java MoodleList var that holds them is private and the only thing you can get from lua to access it is getNumMoodles but that doesn't really help
currently I just have to loop through the num of moodles, check if the moodle level is above 0 then boom
wait im dumb getNumMoodles and ultimately MoodleList holds all the moodles even when moodle level is 0, not active moodles.
you know how the saying goes - assuming makes an ass out of u ๐
though I will acknowledge, making private anything that isn't purely technical data only meant to support inner workings of the class is CS college degree wank
ideally everything should be public, and making things private is a concession that your class cannot function without a hidden state, which in itself basically means that the correct function of that class hinges on hopes and prayers that nothing will go wrong and the hidden state will never get messed up
Can someone tell me how you can change weapon position in hand? My character should hold it like spear
wait til you see how they handle getting moodle texture based on MoodleType index.....
You'd think IS is haunted or something
Reference: MoodleUI java class ๐ญ
wait I got uno and dos mixed up its the other way around
I really REALLY really hope it's just due to the decompiler..
Sweet thanks!
Hi bro, beginner here so sorry if itโs a wrong answer but when you export that object using fbx in blender. There is a window on the right up above export. Inside that window is x up -X up and stuff. Fiddle with them might do it bro ๐
No one wants full berets made of wool?
I think PZ needs more clothing mods! ๐
yeah i did that and works
Ayyy, dreams bro. glad it worked ๐
Play around with origin point of your weapon model. Guns for example should always have origin point on handles since thats where hand is. Im not sure about spears, but if you put origin point on one side, test it and then the other side you will get general idea how to work around it
All those tips worked amazing! Just need to figure out how to change the muzzle flash texture now - how would i go about doing that?
Is there something wrong with vanila one or yours is glitchy? As far as i know all guns share a single muzzle flash and its not possible to change it for a single gun, but i could be wrong?
For some reason my flash is showing as my weapons actual texture
Could you show screenshot of it?
yeah let me see
I have mods installed on the workshop, but not enabled on the save - reckon that could be causing it?
I'm gonna be honest, i had it happend only once at the very start of my modding and back then i had no idea what caused it and i no longer have that model. Have you checked if other gun has same issue?
Just this one, though this is the only one ive added so far
Check vanila gun?
Vanilla guns all work fine
Could you send model of your gun ?
yeah can do, down to dm?
Sure, since id like to know how to solve it myself since i write guide
You're a saint 
considering that Java keeps symbol names intact and its compiler introduces a lot of optimizations, the decompiled code in all likelyhood looks prettier than the original
๐ญ
depending on decompiler, things like foreach might show up as for(i = 1, ...) but that's a minor difference and this would certainly not be true for general algorithms
basically, consider decompiled code to be "let me copy your homework" kind of deal
Thanks for explaining java compiler a little
Java is very similar to C++ compiler I guess too
well not really but the idea is the same
anyway you can look up java bytecode spec and that'll tell you most of what you need to know about the compiler
(you don't actually need to know anything about Java compiler)
Yes I know thankfully
I just like learning a little bit of stuff and I never really looked at java outside of the code
One thing I was surprised about java when I first learnt it was how much they use heap allocation because everything is new new new delete delete
In C and C++, use stack allocation always and never really use heap allocation ever unless really need to because memory leaks and bad performance can happen
hello, is there any way to tell the vscode sumneko extension where the game code is? so maybe i can get autocompletion for the game's lua variables
or is there any way at all to get autocompletion and go-to-definition to work in vscode for the above?
this stops being relevant fast when you make large programs that use a lot of memory
stack is not special. It's just pointer hopping hammers RAM latency and it becomes an issue fast
using stack is conducive to NOT doing that, so you might get the wrong impression that it's the stack itself that matters
heya, I ran into an issue with something that shouldn't be one
{
ScrapMetal = 10,
SheetPaper2/Newspaper,
keep [Recipe.GetItemTypes.Saw],
keep BallPeenHammer,
keep BlowTorch,
Result:NailsBox,
Time= 160.0,
Category:Welding,
Sound:WorkOnMetal,
AnimNode:Craft,
}```
this is the code, but it just won't show up when I rightclick the materials to craft it. All materials are in the inventory of the character
At this point I think that I've SOMEHOW put a typo in it that I just can't spot because I've been staring at it for a while.
The sound is a custom sound that I've added, though that shouldn't be the issue
But does recipe show up at all in crafting menu?
vanilla files use colon for time setting, and use equals sign to denote number of ingredients/results, so maybe changing this will fix it
Have just done the changing equals for colon, that worked, now I feel like an idiot
thank you!
were there any errors in console.txt log file?
it prints out crash stack trace when Lua goes south
only that it didn't find the sound, but that's something I think I can fix
so it didn't work due to syntax error but it never said there was a syntax error. Big oof. Should've used JSON.
Or I dunno, XML.
cough cough
why doesnt pz switch to c++ ?
because it's too late for that lol. This would entail rewriting 100% of the codebase.
at this point even switching to LuaJ to improve script performance would be a herculean task
the real suggestion would've been to switch to a real game engine like Unreal or Godot
but, again, there's no way this would happen, that's far too much work if you've gotten past barebones prototype stage
rewriting everything is par for the course when you're talking about switching frameworks
all you can take with you is experience and rough outline of the algorithms, everything else is re-done from scratch
I guess you can keep the assets too.
arent there conversion tools that would help in this matter
for something so custom and arbitrary you'd have to write those yourself too
Use umbrella on GitHub just search like umbrella emmylua
yea is guess thats true, i wouldnt be so happy tbh if the devs were using third party conversion tools to fix their game hahah
not saying its broken but switching to another language would be a big step up for this game
eh I doubt it. Java is JIT-compiled so performance gains would be marginal, and even then ONLY if you can write good C++ code which is a lot harder than writing an C++ code. Well to start with, the C++ code must be good enough to not cause crashes due to memory overruns and whatnot. And if you use libraries that do the checks for you, then performance drops to the same levels you had in Java.
A real performance gain could be had from switching from OOP to ECS, but that's even less likely than switching from Java to C++.
because instead of just writing in a different language, it requires thinking in different terms
i hate the fragility of memory in c++
Let's put it this way. Have you ever had happened to you, that you had to work a full weekend for an assignment, and then they said you had to throw it away and do it all over again but using different writing style?
Well it's like that. Except it's more than a decade worth of assignment.
yea i get it, but maybe if they increased their team they could make it happen
Choosing Java and everything else that comes with the package was a shortsighted and/or misguided decision, but at this point all you can do is suck it up and keep churning.
You know what, actually I have an example what it takes to rewrite a game in C++
Minecraft Bedrock
Or releasing what they want in b42, get it to a stable ish area and then start reworking some of the internals to clean it up a bit like a home renovation
It takes billions of dollars worth of profits and a giant international software company.
And it still turned out poorly
It runs many many times faster. To the point that you can run it on a phone. It was their goal and they accomplished it.
True but their rendering stuff still sucks
compared to java minecraft it's an outstanding rendering engine come on
I meant poorly as in the countless bugs in the game still existing after years of development with a seemingly endless money supply
even compared to Sodium it's great
On max chunks the renderer starts struggling compared to sodium I can run on 256 chunks and not much of a hitch
[x] doubt
i have a 4090 and even 30 chunks becomes problematic
and a 7950X and 64GB of RAM
you basically can't ask for a better machine
desktop gaming-wise
there is this mod that allows endless render distance by not loading every fucking block en lowering quality.
minecraft devs are so lazy
yeah distant horizons
it's pretty GOATed, and it's been getting better shader support
its so logical for minecraft to have that
do note that Distant Horizons has absolutely nothing to do with SOdium, it has an entirely separate rendering routine, in fact it renders to the skybox, the thing that goes behind actual minecraft blocks
some modders put this together but a million dollar company cant
i dont play minecraft that often and to be frank dont know what sodium is haha
It's a replacement rendering engine. It's kind of like Optifine. Except it's basically most popular Minecraft mod, whereas fewer and fewer people want to even touch Optifine. Doubling down on being closed-source was the hill they decided to die on.
modders are thousands, and they do it for free. A billion dollar company can't spend a million dollars on something that will never generate an extra million dollars in profit.
So making a C++ version was their call on how to make more money off of improving FPS. Pretty clearly they too think that Java Minecraft is too big of a steaming heap to try and fix it.
Hello, just a silly question, can global ModData store objects like a square? (I don't know much but I tried storing a tuple with a square and a number but after going to menu and entering again the tuple has nil and the number)
lua tables can store anything, but saving it to disk is a separate matter
Here's my 2nd mod I've just finished and uploaded ๐
Thanks for the help, you peeps are great ๐
https://steamcommunity.com/sharedfiles/filedetails/?id=3276683072
Hopefully, it's bug free ... ๐ซ
you can put it in the table but it will cause problems at reload time. don't do it
What T said, but you can store the x, y, z instead and grab square from that when it's loaded and available
Rerendered the back frames and symbols - p happy with the turn out
Are you able to store items in a table? Or does this run into the same issue?
you should not store java class in ModData tables. you should only store PODs in those. But you can store anything in lua tables.
In computer science and object-oriented programming, a passive data structure (PDS), also termed a plain old data structure or plain old data (POD), is a record, in contrast with objects. It is a data structure that is represented only as passive collections of field values (instance variables), without using object-oriented features.
Yes I was trying to figure out how to store items in table but also to persist over restarts. Figured mod data was not the way to go.
Mod data is the way to go for mods. you have to convert to PODs as Burryaga suggested above for squares
Yea but I wanted to store items (and their respective stats and mod data's)
items are already saved by vanilla
Yeah, i ended up using that approach, thank you everyone!! Although I'm still struggling with the client/server part.
You can refer to and refactor any of my code for help if you want. Act Undead has a little client-server talk. True Music Jukebox has more.
looking for opinions here, since spongie clothing adds leather vests i thought it would be cool to make the denim vest close/open, but I'm not sure which style to make, either the low cut(left) or the jacket cut(right) would be cool if you react to this message for clarity
Oh ya I did use nvidium sorry I didn't mention that, without it on 256 chunks I only get 30-40 fps
I don't like denim so my opinion doesn't matter but I think I would use the left one in a zombie apocalypse
Is there a way to make better mods that receive any data on server that can posted to a middleware/service to process the data e.g. consumed by web etc?
I think you can make get request from lua but not post request
you could write the request to a file and have like a python script in the background watching that file or something idk
Ideally you would have an option to open or close it.
Right cut is better
Actually looks like a denims
Imo
I'm wondering if anyone knows - for a container tile, can its capacity only be set in the .tiles file, or can it also be adjusted after the fact via script?
Yes you can do it via lua code on OnLoadedTileDefinitions event, but you have to set new property values if they don't already exist. Here's an example, this is how I set properties in Building Menu.
In a .lua file in media/lua/shared
Events.OnLoadedTileDefinitions.Add(function(manager)
local sprites = {
"location_military_generic_01_23",
}
for _, sprite in ipairs(sprites) do
local props = manager:getSprite(sprite):getProperties();
props:Set("ContainerCapacity", "100", false);
props:CreateKeySet();
end
end)
To add new values to properties if they have not been initialized in any tilepack, in the same file as the above code, or in another .lua file in shared:
-- Function to add a list of values to a specified property in the world's property value map
---@param propertyName string The name of the property to which values are added
---@param values table A table of values to ensure they are present in the property map
local function addValuesToPropertyMap(propertyName, values)
local currentValues = IsoWorld.PropertyValueMap:get(propertyName) or ArrayList.new()
for _, value in ipairs(values) do
if not currentValues:contains(value) then
currentValues:add(value)
end
end
IsoWorld.PropertyValueMap:put(propertyName, currentValues)
end
Events.OnInitWorld.Add(function()
addValuesToPropertyMap("ContainerCapacity", {
"80", "200"
})
end)
So i have been working on fixing the errors in ItemZed and trying to bring it back to life, Thinking it would be great to enable people with little knowledge about coding to be able to make simple item mods? Do we think this is worth the while or a waste of time ?
And if it is worth it, what is the MVP
what functionality do we think is the minimum required?
Awesome, exactly what I was looking for, and maybe some more code to look at for examples ๐ Thanks!
when editing loot distributions from other mods is it as simple as RemoveItemFromDistribution(ProceduralDistributions[1], "Base.M16A1", nil, true);
and making sure it is loaded in priority to the mod its removing from?
how do mod a hairstyle? is there a tutorial?
That's pretty cool. I should get back to working on ZedScript, the vscode extension that does syntax highlighting and IntelliSense for that stuff.
@north drift I'd like to make this sort of tool however with HTML5 + CSS3 instead.
Was on a TODO list. =)
I am currently doing the exact same thing but for third-party documentation for PZ's API.
hows the modding scene these days?
omg ur working on a vscode extension for pz modding? ur the goat
also bigusredus modding tools are always great things to make
https://marketplace.visualstudio.com/items?itemName=asledgehammer.zedscript-vscode
https://github.com/asledgehammer/Umbrella
nice
its been a minute since i've been on the modding scene here but the b42 hypes got me feeling it
also i've been doing rdr2 modding and that uses lua as well
so a bit of transferrable skillset as well
but thanks for the links
just posted this https://youtu.be/YXhB6PZ5VXo
The next update is almost ready for release :)
bom dia! alguรฉm pode me ajudar a iniciar no mundo da criaรงรฃo de mods? nรฃo sei por onde comeรงa, nem que programa usar ๐ซ
good morning! Can anyone help me get started in the world of creating mods? I donโt know where to start, or what program to use ๐ซ
If you want to make Lua mods, you will need a programming notepad, like VSCode. If you want to create clothing mods, you will also need Blender (or some other 3d model software). There are some very basic tutorials for making clothes and Lua mods, they're easy to find in google. The rest of it it is mainly figuring stuff out by looking at vanilla game files, documentation, other people's mods, and decompiled source code of the game. And you can just ask here if you have a specific problem.
For Lua in particular there are a whole slew of learning resources, since it's a popular scripting language in video games.
OK, Where are there tutorials for those just starting out? I'm Brazilian and I've already encountered a lot of difficulty because I don't have videos in Portuguese
Language barrier will be a huge issue. Thankfully most browsers these days can AI translate stuff on the fly.
So I suggest just looking for information in English.
ok, I want to create a mod that adds more engine power to some cars, how and where do I start?
I wouldn't know exactly, so here's a general methodology to approaching this kind of problem. Look for original game files that pertain to cars, and figure out which one of the settings controls engine power. Then create a new workshop mod package (in the c:/user/zomboid folder) and put identical file in there (with identical folder path to it) and then modify it. When you enable the mod in the game, your file will override the original.
thank you very much for the support
you can look in C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\scripts\vehicles for the bulk of the files
estรก bem
how can I dig up a texture used by a game? namely I want media/ui/BodyInsulation/heatbar_horz to see how textures are stored and stuff so I can add my own texture for a bar
goes without saying that if go to that location there's no folder called BodyInsulation
I need to add textures for gradient bars that are not in the game
for example, game has red-green gradient bar but I for example want green-red gradient bar (flipped)
or other way around
you get the idea
jacket cut, I feel like the low cut could be misunderstood as a different material
I'm making both, I really like the low cut for any cowboy outfits out there
Is there a website or online course that teaches you how to create mods?
there is github resources and also the source code for the game / other mods. Other than that its pretty bare online
this is the best starting point imo:
https://github.com/FWolfe/Zomboid-Modding-Guide
Really, there's nothing on YouTube
ok
Will I learn the Lua language, even though I don't know anything about programming?
you should learn how to program before considering making a mod in my opinion. Or you can just get a mod similar to what you want to do and edit it
Got it, good idea.
man, it's so hard to take the first step due to lack of totorials in your native language
becomes a thousand times more difficult
tranks bro
heya, I have ran into two issues, but I'll start with one
Recipes that I have given a skill and a skill level won't show up in the crafting menu and aren't right-click craftable (despite the character having the right levels)
Did anyone else have similar issues?
My mod worked 3 days ago and I haven't changed anything. I now get this error
Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@c4773121```
It says function: onPlayerDeath -- file: NecroDeath.lua line # 140 MOD: NecroCore
Here's that line:
-- Function to handle player death
function NecroDeath.onPlayerDeath()
print("NecroDeath: Sent we died.")
line 140 -> sendClientCommand("NecroDeath", "onDeath", player, nil)
end
I have tested this with all my mods and without. Still breaks here.
Anyone knows? 
#mod_development message
my girlfriend doesnt like the stomp sound effect as its too yucky for her if she deletes or replaces the sound file for it can we still play vanilla mp together?
also which sound is the sound which plays when the zombie dies of stomp.
im sure it can be replaced
for how it can probably be done
you should be able to whip out mod for that with no issues
considering you can literally take other mod and change like 3 things
look in the texture packs, there's a tool to extract them in the modding tools
where would I find the modding tools mentioned? Also will i have to pack my textures in the packs aswell or simple png suffice? Like for traits and stuff i just use png
on steam, pz modding tools, it should be in your library if you own pz
ah
you don't have to pack anything, the game treats packed and non-packed files mostly the same
cheers
Client cannot send anything on death
From what I recall
Figured out it was the order of the sendClientCommand() that was wrong. But thank you!
how are the clothing masks numbered?
<m_Masks>12</m_Masks>
<m_Masks>13</m_Masks>
That's what I copy to do a vest, which I guess is something related to the torso
what part of the body represent each number?
here's what I found
#modeling message I guess you're looking for this?
Hello, I have mod with new recepies and items. Does anybody know how to make a translation for my mod?
you just make new folder with language code and put translations there
do you have example script how it should look?
also when my mod is in EN lang do i need to add EN translation or i can leave it?
EN folder is where your translation files are located.
UI_trait_AVClub = "AV Club Member",
UI_trait_AVClubDesc = "You are a part of the AV Club",
UI_trait_AxeThrower = "Axe Thrower",
...
}```
```UI_CN = {
UI_trait_AVClub = "AVไฟฑไน้จไผๅ",
UI_trait_AVClubDesc = "ไฝ ๆฏAVไฟฑไน้จ็ไธๅ",
UI_trait_AxeThrower = "ๆทๆง่
",
...
}```
for exmaple, UI_EN and UI_CN
game loads translation based on game language
or english if translation is missing
I mean my mod have items and recipies in EN already so do i need translation files for EN lang
you already have them
because you made them
???
unless you hardcoded your values which is bad pratice
i dont have folder for EN names ect. i mean in my code when i create weapon i already make EN name
then idk
oke
idk how items load and how game defaults them and stuff, guess take a look at one of 50000 item mods on workshop to see how they do translations
that's my best bet
ok, thanks for info ill check that
do i need to add smth like that
``` to mod.info?
dont think so
No
i give up i tried everything and it is still not working
Translations? What are you trying to translate (recipes/items/etc)?
For items, create a media\lua\shared\Trasnalte\EN\ItemName_EN.txt then do something like
ItemName_EN = {
ItemName_Base.Crowbar = "Crowbar",
}```
Replace EN with the actual language you want to localize to
and Base.Crowbar with the item you want to translate its name
For recipes, you follow same logic, but use media\lua\shared\Translate\EN\Recipes_EN.txt, and then, for example:
ItemName_EN = {
Recipe_Make_Aerosol_bomb = "Make Aerosol Bomb",
with replacing Make_Aerosol_bomb with your actual recipe name
The game should automatically pick up these kinds of translations when they're available. So you don't really have to do anything rather than creating the localization files and making sure naming and stuff is right
anyone know how to convert ui.pack to png?
pz mod tool. tilezed
a website?
i see thanks
I'm creating recipes to make jams or food in general.
I need these items to be returned to me once consumed, an empty jar and the lid
How can I do? Do I need a function lua?
what.
nevermind im unphased at this point
ignore what I said
ItemZed 1.4
Changes fix the two errors i saw in forums and was able to replicate
-Updated .Pack reader to handle .pack files with PZPK versions
-Updated Script read to ignore commented lines
ItemZed Scripts & Distribution editor. Welcome to ItemZed! ItemZed is a development and modding tool that is used to edit the contents of script modules (foodstuff items, weapons, recipes etc) and the distribution table that dictates where different in-game items can be found and looted on th...
Working on a new version of the machines mod
I tried that several times with different combinations, i checked how other mods have translation and i also tried those and nothing is working idk why both for items and recipes
ok, i fixed translation and its working ty
Hello everyone, the modding discord is hosting a ModJam this upcoming week, check it out if you're interested:
I will say the Game Night API is easy to use -there's a guide linked on the page. I'll also be around for support.
So im running into a problem with attachments for guns, every time i reload a save it deletes the new gun from the list of weapons an attachment can go on - any ideas?
I had a similar kind of problem when loading a save would delete sandbox settings and revert to defaults. The issue was that sandbox data isn't actually loaded right at the moment when the script activates, it happens a bit later. Somehow when you start a new game it's the other way around. The solution was to put code that modifies data in an event callback, not execute it immediately. Maybe you have a similar problem.
Default sandbox settings are used until global mod data is initialized
Anyone good with UIs in here?
Got following problem:
I have an ISPanelJoypad that I create. in init I create children
function ISETWUI:initialise()
ISPanelJoypad.initialise(self)
self:createChildren()
end```
```lua
function ISETWUI:createChildren()
self.mainGroup = {};
self.nodeGroup = {};
... other code here
y = y + FONT_HGT_SMALL
if ETWCommonLogicChecks.EagleEyedShouldExecute() then
x = lineStartPosition;
nonBarsEntryNumber = nonBarsEntryNumber + 1;
if (nonBarsEntryNumber >= nonBarsEntriesPerRow) then
y = y + FONT_HGT_SMALL;
nonBarsEntryNumber = 1;
end
if nonBarsEntryNumber ~= 1 then
x = lineStartPosition + columnGap * (nonBarsEntryNumber - 1);
end
self.labelEagleEyedProgress = ISLabel:new(x, y, FONT_HGT_SMALL, getText("Sandbox_EvolvingTraitsWorld_EagleEyedKills"), self.btnTextColor.r, self.btnTextColor.g, self.btnTextColor.b, self.btnTextColor.a, UIFont.Small, true)
self:addMainGroup(self.labelEagleEyedProgress)
end
end```
and later on I change values in prerender
```lua
function ISETWUI:prerender()
self:setWidthAndParentWidth(WINDOW_WIDTH);
self:setHeightAndParentHeight(WINDOW_HEIGHT);
...
if self.labelEagleEyedProgress ~= nil then
self.labelEagleEyedProgress:setName(getText("Sandbox_EvolvingTraitsWorld_EagleEyedKills") .. ": " .. modData.EagleEyedKills .. "/" .. SBvars.EagleEyedKills)
end
ISPanelJoypad.prerender(self);
end```
and It creates the label again instead of modifying existing one
oh and addMainGroup is simply adding child
function ISETWUI:addMainGroup(_widget, _ignoreAddChild, _view)
self:addChild(_widget)
end```
And label does exist in the table
But instead of editing existing one it for some reason does whatever it does
actually if i break it after i update the label it shows that it updated correctly, but the question still stands, why does it make it in new place instead of editing existing one
I'm stupid
prerender should end with
ISPanelJoypad.prerender(self);
self:clearStencilRect();
end```
I forgot to clearStensil
whatever that does
honestly i dunno, all I know is that it fixes it
guess I could look up in decompiled lua files what it does but why
if it works it works
The stencil is used to define an area that is valid to draw inside of.
It normally matches the size of your UI element so that if you draw something too big, instead that overflowing and rendering outside of the UI element, it gets cutoff.
why does clearing it fixes stuff? 
The UI element you're drawing inside of is likely too small
wait so when I create label with some text it sets the label (UI element) boundaries and later on when I try to edit it it refuses (cuz new text is bigger than old one) and just drawn a new one next to it?
Ah, yea.
If you create a label and edit the text later you'll want to make sure to update the width based on the new text.
Yea it's perfectly fine for labels, just letting you know what it does
thanks 
Since I got you here and you're knowledgeable in UI, what's the dif between prerender and render? I assume render runs on every tick, but what about prerender?
If you got a min and know the answer
Prerender runs before the UI elements children are rendered
I think
Doesnt seem to be the case, If i have my page open and change some value in my moddata and i have the updates in prerender it still updates realtime

When adding items to a players inventory using
playerObj:getInventory():AddItem("Base.WaterBottleFull");
local bag = player:getInventory():AddItem("Base.WaterBottleFull");
(as examples)
How would I add multiple to an inventory without just writing copypasting that command multiple times? If any way
ooooohh, that looks like a very cool panel
Oh wow the use of those color gradiants is nice
if there's no innate way you can loop, but there should be a way. Dunno cuz havent looked at inventroy
That looks amazing
Aight so just spam it? Understandable
XD
Yea, it's still every frame, but if you moved your labels around in the render function they would have 1 frame latency, vs using prerender where it would be immediate.
for loop
wait so is prerender better performance wise?
That too :3
from the source code, UIElement renders in this order: execute prerender, then execute every child's render function (i.e. this very routine), then execute it's own render
so it literally doesnt matter, it still renders with same refreshrate so performanse-wise it's all the same
cheers
No, they both run every frame.
Order is:
Prerender
Render
For each child UI
Prerender
Render
For each child UI , etc
when that would be useful tho
oh for example if i wanna prerender bigger picture and then render other things on top
gotcha
it's one of those scenarios where it might be useful for reasons that are not apparent to you
ye ofc
nice
you're mistaken, the order is:
prerender
child prerender
child child (...)
child render
render
prerender and render aren't redundant, they're used to render things before or after children
neither will introduce any latency, both happen on the same ui frame
Hi, Can anyone help me create a mod for the game Project Zomboid that allows me to change the color and background of the messages displayed on the game's TV.
I studied a little about the ISRecordedMedia and RecMedia functions, but I didn't understand how I can create the mod.
Hi, Does anyone have experience creating mods that give players XP or is it even possible? I'm working on creating a apprenticeship mod that while a player is grinding skills another player could be sitting next to them gaining a small amount of xp. So far I have most of the mod working expect actually giving another player XP. Should this code belong on the server-side. I'm willing to provide my code I've written so far. Thank you!
ETW
k how can I clean a window or something, when I create children it draws them and when I update values instead of editing what's on the screen it just draws over
idk anymore

That stuff is draw on render usually
shouldn't overlap like that ๐ค
Also I meant the menu with the glowing markers
Or is that now part of ETW?
you can just use player:setXP
gradient bars? I just cannibalized how base game uses gradient bars in temperature and made few textures for my own gradient bars
no, label
yep more specificy it should be player:getXp():AddXP(perk, 50)
if ETWCommonLogicChecks.EagleEyedShouldExecute() then
/some code/
self.labelEagleEyedProgress = ISLabel:new(x, y, FONT_HGT_SMALL, getText("Sandbox_EvolvingTraitsWorld_EagleEyedKills"), self.btnTextColor.r, self.btnTextColor.g, self.btnTextColor.b, self.btnTextColor.a, UIFont.Small, true)
self.labelEagleEyedProgress:setTooltip(getText("Sandbox_EvolvingTraitsWorld_EagleEyedKills"))
self:addMainGroup(self.labelEagleEyedProgress)
end```
here i create the child
and in render i try to update it
```lua
if self.labelEagleEyedProgress ~= nil then
if not ETWCommonLogicChecks.EagleEyedShouldExecute() then
self:clearChildren();
self:createChildren();
else
self.labelEagleEyedProgress:setName(getText("UI_trait_eagleeyed") .. " (" .. getText("UI_EvolvingTraitsWorld_Kills") .. "): " .. modData.EagleEyedKills .. "/" .. SBvars.EagleEyedKills)
end
end```
ignore childern shenanigans its ro dynamically remove stuff thats no longer needed
but the issue is that I'm not setting it for the client player, I'm setting it for another player on the server
Labels should be using drawttext and only doing so on render
so just use according player object
and if i go into tables in-game and check, it updates correctly BUT it still draws original under
if not ETWCommonLogicChecks.EagleEyedShouldExecute() then this returns false all the time?
I have been, but its not working. It just doesn't set and no error is being throw so its difficult of find out why.
Cause there's no returned value
its outside function, it returns false in this case
function ETWCommonLogicChecks.EagleEyedShouldExecute()
local player = getPlayer();
if SBvars.EagleEyed == true and not player:HasTrait("EagleEyed") and SBvars.TraitsLockSystemCanGainPositive then
return true
else
return false
end
end
Sorry brainfart, thought the first snippet was the function
well the server has no concept of "current player" so you might be fecthing irrelvant data
and same thing happens with gradient bars, they still have INITIAL gradient bars under the render. I know because when i create them I set their values to 1, and tou can see highlight shadow on the sides
so idk what to do here
Question - what's addMainGroup?
Looking it up only shows uses in ISClothingInsPanel and it seems to be doing something related for the character window having multiple views
jsut create children, it's redundant, I yoinked it from temperature base game code, its how it create ui's there and i started there
self:addChild(_widget)
end```
Ah
Yeah this is all weird
setting the label's name should change it's text I believe
it does, but for some reason it displays old info under it
Could you be calling create twice?
Making an old version of the element left behind?
self.labelEagleEyedProgress = self.labelEagleEyedProgress or UI STUFF HERE
Just to test the theory
wdym
self.labelEagleEyedProgress = self.labelEagleEyedProgress or ISLabel:new(x, y, FONT_HGT_SMALL, getText("Sandbox_EvolvingTraitsWorld_EagleEyedKills"), self.btnTextColor.r, self.btnTextColor.g, self.btnTextColor.b, self.btnTextColor.a, UIFont.Small, true)
oh I see
This would prevent an additional label being created
My guess is you may be accidentally running it twice
so the old label is losing it's reference point - and thus not updating
that's smart
Yeah but it's not a fix if that's the case - cause that may mean you're writing text twice all over lol
Nah, I've just tortured myself with UI for longer
but i think it still writes it over twice
cuz you see how it's a bit jagged
but at least i know what to try to figure out now
thanks
UI can do that
I've elevated myself from UI, and now I'm torturing myself with network desync and fighting the item code to update worldObjects
function ISETWUI:initialise()
ISPanelJoypad.initialise(self)
self:createChildren()
end
function ISETWUI:createChildren()
--random children here, no calls to other functions
end
function ISETWUI:prerender()
-- code here
ISPanelJoypad.prerender(self);
self:clearStencilRect();
end
function ISETWUI:render()
ISPanelJoypad.render(self)
self:clearStencilRect();
end
function ISETWUI:update()
ISPanelJoypad.update(self)
end```
anything stands out why it'd render twice?
if not ETWCommonLogicChecks.EagleEyedShouldExecute() then self:clearChildren(); self:createChildren(); else ?
that one scraps the thing and re-makes it if child is no longer needed
tested and works
and it hasnt ran in screenshots
where it overlaps
It's just clearChildren just empties the list - I don't think it removes them
if self.javaObject == nil then
return;
end
self.children = {}
self.javaObject:ClearChildren();
end```
wouldn't it yeet the children? 
As far as I can tell no
it just empties the parent's children list
well ISUIElement/self = parent of the child
hmm
It's only used twice, and I can't really tell what it's doing

container info panel (?)
and tab panel
both cases it's also removing the parent from the UI
wait
function addCharacterPageTab(tabName,pageType)
local viewName = tabName.."View"
local upperLayer_ISCharacterInfoWindow_createChildren = ISCharacterInfoWindow.createChildren
function ISCharacterInfoWindow:createChildren()
upperLayer_ISCharacterInfoWindow_createChildren(self)
self[viewName] = pageType:new(0, 8, self.width, self.height-8, self.playerNum)
self[viewName]:initialise()
self[viewName].infoText = getText("UI_"..tabName.."Panel");--UI_<tabName>Panel is full text of tooltip
self.panel:addView(getText("UI_"..tabName), self[viewName])--UI_<tabName> is short text of tab
end
local upperLayer_ISCharacterInfoWindow_onTabTornOff = ISCharacterInfoWindow.onTabTornOff
function ISCharacterInfoWindow:onTabTornOff(view, window)
if self.playerNum == 0 and view == self[viewName] then
ISLayoutManager.RegisterWindow('charinfowindow.'..tabName, ISCollapsableWindow, window)
end
upperLayer_ISCharacterInfoWindow_onTabTornOff(self, view, window)
end
local upperLayer_ISCharacterInfoWindow_SaveLayout = ISCharacterInfoWindow.SaveLayout
function ISCharacterInfoWindow:SaveLayout(name, layout)
upperLayer_ISCharacterInfoWindow_SaveLayout(self,name,layout)
local addTabName = false
local subSelf = self[viewName]
if subSelf and subSelf.parent == self.panel then
addTabName = true
if subSelf == self.panel:getActiveView() then
layout.current = tabName
end
end
if addTabName then
if not layout.tabs then
layout.tabs = tabName
else
layout.tabs = layout.tabs .. ',' .. tabName
end
end
end
end```
i use this to add page
i think i initialize it twice
once in my init
and once here
it's from TchernoLib
That'd do it
yep
I jsut have to yeet my own init 
--ISPanelJoypad.initialise(self)
--self:createChildren()
end```
I'm i nnocent
while you here, anyone would know how to limit rendering to my own tab?
I can add 15 pixels on the side so it's never out but it's meh
stencil should work if the bar is a child
any pointer where to look
you already use stencils in your code lmao
yes but idk what they do 
I'm a bit rusty, but there's 2 parts
It would be a matter of making your visuals happen inbetween
so you'd most likely need to draw the stencil before render then clear it after
soemthing like this?
self.barAsthmatic = ISGradientBar:new(barStartPosition, y, barLength, FONT_HGT_SMALL)
self.barAsthmatic:setGradientTexture(redYellowGreenGradient)
self.barAsthmatic:setValue(1)
self.barAsthmatic:setHighlightRadius(highlightRadius)
self.barAsthmatic:setDoKnob(false)
self.barAsthmatic:clearStencilRect();
self:addMainGroup(self.barAsthmatic)```

k nvm not as easy
you're clearing it, but you need to draw it first
also this is done on render
per frame
hm
What does ISGradientBar:render look like?
it's big
function ISGradientBar:render()
ISPanel.render(self);
local w,h = self:getWidth(), self:getHeight();
local radius = self.settings.radius;
local valOffset;
if self.settings.doKnob then
--valOffset = PZMath.clamp(self.value * w, self.settings.radius, w-radius);
valOffset = PZMath.clampFloat(self.value * w, 0, w);
else
--valOffset = PZMath.clamp(self.value * w, self.settings.radius+3, w-radius-3);
valOffset = PZMath.clampFloat(self.value * w, 3, w-3);
end
self:drawTextureScaled(self.gradientTex, 0,0,w,h, 1.0, 1.0, 1.0, 1.0 );
if self.settings.darkAlpha > 0 then
if valOffset > radius then
self:drawTextureScaled(nil, 0,0,valOffset-radius,h, self.settings.darkAlpha, 0.0, 0.0, 0.0 );
end
if valOffset < w-radius then
self:drawTextureScaled(nil, valOffset+radius,0,w-(valOffset+radius),h, self.settings.darkAlpha, 0.0, 0.0, 0.0 );
end
self:drawTextureScaled(self.highlightTex, valOffset-radius,0,radius*2,h, self.settings.darkAlpha, 0.0, 0.0, 0.0 );
end
local c = self.settings.colBorder;
self:drawRectBorder(0, 0, w, h, c.a, c.r, c.g, c.b);
c = self.settings.colBorderInner;
self:drawRectBorder(1, 1, w-2, h-2, c.a, c.r, c.g, c.b);
if self.settings.doKnob then
c = self.settings.colBorderInner;
self:drawRectBorder(valOffset-radius-3, 0, (radius*2)+6, h, c.a, c.r, c.g, c.b);
self:drawRectBorder(valOffset-radius-1, 2, (radius*2)+2, h-4, c.a, c.r, c.g, c.b);
c = self.settings.colBorder;
self:drawRectBorder(valOffset-radius-2, 1, (radius*2)+4, h-2, c.a, c.r, c.g, c.b);
end
end```
Ok add this a the top
self:setStencilRect(0, 0, self.width, self.height)
and add clear at the bottom
self:clearStencilRect()
This should make it cut off at the bounds
Or make itself invisible
shoudln't it be self.barAsthmatic:clearStencilRect();?
this is the gradient bar's render
oh wait you know what
It would be alot more efficient to do this to the tab window itself
rather than each bar
But the gradient bar doesn't stop at the edge
๐ค I guess you do need to run it for each bar
Error Mag does this several times too, and I havn't seen issues - so you should be fine
wait but you said I should do this on render and NOT when creating children?
Each one of these is the entire error - I cut it off at a line height, but I also stencil it
Yeah the render for the gradient bar
not the render of the main window
but render of gradient bar is base game and not me
Does it drag over the edge in vanilla?
Or is this cause you're putting it so close to the edge?
prob cuz close to the edge, lemme quickly test
Just override it ๐คท
local gradientRender = ISGradientBar.render
function ISGradientBar:render()
self:setStencilRect(0, 0, self.width, self.height)
gradientRender(self)
self:clearStencilRect()
end

so how does it feel to be smart?
thanks 
this means i dont have to leave artificial gap at left too

also this gets ugly in other languages so fast
even though i used relative positioning for everything so it looks great
local lineStartPosition = 5;
local barStartPosition = 150;
local barEndPosition = WINDOW_WIDTH - lineStartPosition;
local barMidPosition = lineStartPosition + barStartPosition + (barEndPosition - barStartPosition - lineStartPosition) / 2;
local barLength = barEndPosition - barStartPosition;
local barOneFourthPosition = barMidPosition - barLength / 4;
local barThreeFourthPosition = barMidPosition + barLength / 4;
local barOneThirdPosition = barStartPosition + barLength / 3;
local barTwoThirdPosition = barOneThirdPosition + barLength / 3;
local highlightRadius = 20;```
all the bar marks are relative
but i looked at it in other languages
and oh boi it's ugly
also idk why my barmid is so convoluted when it's just min+(max-min)/2

If you want to nitpick optimize it you can only run the stencil stuff if the values are on either end of the spectrum
Not sure if it would be worth it though
I imagine a comparison would be less overhead than a stencil rendering thing
Are you making it a framework for anyone to use ?
And add to the menu maybe ?
I need some help with coding, and radios if someone has that experience.
Essentially, I've made a mod that adds voice over to radios, and wanted to make a looped version (mainly for servers)
https://steamcommunity.com/sharedfiles/filedetails/?id=3068924704&devcomment=1&tscn=1719465910
The problem is, it doesnt seem to be looping. The Idea is as follows:
VRTVs modifies the RadioData.xml file (for taggin and time purposes)
Looped Version just holds a modified RadioData.xml with a maxloop of 50 instead of 1
If I modify VRTVs directly, It does loop. But If I used the Looped Version, it doesn't. It seems that Looped Version is not overwriting VRTVs version (even though it requires VRTVs, so it should load after it). does anybody have an Idea on how to fix this?
i would not be surprised if radio files don't follow proper load order, load order does differ between different content types and i don't think anyone would have tested that specifically
yes. onCreate
AddItems(item, quantity)
Anyone can help with my code?:
Events.OnFillInventoryObjectContextMenu.Add(function(player, context, items, item)
if items:GetFullType() == "Crisps" then
context:addOption("Open", items, function()
player:getInventory():AddItem(Crisps)
end)
end
end)
line 2 is making errors, i can't understand why
with the comma?
nvm found an example with it
appreciate it :D
It would be interesting to have an admin tool that allows you to check the health of the player PCs
- Wounds
- Infections
- Zombie infection
- Zombification level
- Poisoning
etc. etc
This type of tool would be very useful for server managers
Do you think it is possible to create it??? as long as it doesn't already exist...
where can i find the lua files that control the text and content of TV and radio broadcasts?
im trying to modify the dialogue of those broadcasts but i cant find the files that i need to base mine off of
Troubleshooted my mod just not working for a few hours
have 0 clue what I changed to fix it, and now it works
Hm. I made myself spawn with cigarettes, and I somehow gave myself 220...
if char:HasTrait("Smoker") then
local cigarettecount = ZombRand(18) + 3;
bag:getInventory():AddItems("Base.Cigarettes", cigarettecount)
end```
x)
In your case each unit will be x20 due to Count on item being 20
There is, i have code for it somewhere, but in my case its bullets
But they do have count = 5 too and it worked for me
Maybe try using CreateItem isntead of add item?
Oh my... it looks horrible in discord...
mood
after the three backticks you can inclue lua to tell it the colors to use, ex.:
```lua
if true then
print("Woow!");
end
```
if true then
print("Woow!");
end
Woow!
Get full type will return Module.Item. getType is what you want to use.
Player is the index number, you want to use something like playerObj = getSpecificPlayer(player) then replace player: with playerObj:
Surely not a scam link
<@&671452400221159444>
500010806009947 % 7 = 499995773624418 WTH?..
did you mean i should use smth like this?: Base.Item.Crisps
i can't understand that correct
Modulo at high values doesn't really work
Make your own
yeah OK kahlua is officially dogwater and needs to be replaced
having bugs in basic math routines is not allowed


at this point