#mod_development

1 messages ยท Page 245 of 1

grizzled fulcrum
#

o

jaunty isle
#

and put those attachments in your character's inventory, outta bag or other containers maybe

grizzled fulcrum
#

upgrade

#

I see it

#

On my end, adding a scope doesn't change range evne though the description says so lol

grizzled fulcrum
#

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

jaunty isle
#

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

grizzled fulcrum
#

ill try one other thing

jaunty isle
#

hmm however, I have no other weapon mods activated tho

grizzled fulcrum
#

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

jaunty isle
#

ah yeah, I couldnt find something suspicious there but maybe I just didnt find it

jaunty isle
#

but yeah, I know nothing about this so can't be 100% sure hahah

grizzled fulcrum
#

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

jaunty isle
#

I see, thanks for your time and effort tho!

#

I dunno where you live so have a good day ahead/night ๐Ÿ‘

grizzled fulcrum
#

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

jaunty isle
#

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

grizzled fulcrum
#

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

jaunty isle
#

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!

grizzled fulcrum
#

cya!

tacit carbon
#

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?

dire oracle
#

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.

grizzled fulcrum
#

I can't help either of you because I've never ever done clothing related stuff

austere sequoia
austere sequoia
# dire oracle 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

dire oracle
#

I can record a vid with everything

austere sequoia
grizzled fulcrum
#

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)

dire oracle
#

I got all the textures, models, bones set to right place, but Idk if I'm messing with text files and hierarchy right

austere sequoia
# dire oracle .

Feel free to zip up your mod and dm it to me, then I can have a look ๐Ÿ™‚

young edge
#

F

grizzled fulcrum
#

don't worry, it's just UI stuff, how hard could it be??????

sour island
#

Soft Announcement of:

outer crypt
#

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.

dry pier
#

When defining a function in PZ Lua, is there any difference between "local function functionName(params)" and "local functionName = function(params)"?

grizzled fulcrum
bronze yoke
# dry pier When defining a function in PZ Lua, is there any difference between "local funct...

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

dry pier
#

Thanks for that explanation.

grizzled fulcrum
#

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++

hollow robin
#

how in the hell do i import .x files into blender

#

tried using a directx addon and i get this

sour island
past trout
#

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

shut bluff
#

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

grizzled fulcrum
#

~snip~ I figured it out lol it was easy

grizzled fulcrum
#

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?

grizzled fulcrum
#

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

crisp fossil
#

How can you get the item category. I can only see the display category

#

this one

grizzled fulcrum
#

isn't it just InventoryItem:getCategory()?

#

InventoryItem:getDisplayCategory() is separate too

crisp fossil
#

ah i see, I was using the Item class not the InventoryItem. thank you

drifting ore
#

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

drifting ore
drifting ore
dire oracle
thick karma
#

@noble summit

north drift
#

... i known right

north drift
#

Possible ItemZed 1.4 ???

dapper belfry
#

Hi everyone! I'm new in pz modding. Is it possible to decompile pz and add new classes?

bright fog
digital bolt
#

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.

compact tinsel
#

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.

compact tinsel
# digital bolt Hey gamers, Is there a good place that explains how to create a basic mod yours...

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

digital bolt
#

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
compact tinsel
digital bolt
#

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 ๐Ÿ˜„

compact tinsel
#

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

This specifically targets adding custom items to game through your own mod....

#

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.

digital bolt
#

Thank you that's extremely helpful @compact tinsel ๐Ÿ™

digital bolt
tranquil kindle
compact tinsel
#

thank you!

simple patio
#

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

dapper belfry
cursive steeple
#
GitHub

Complete tutorial to decompile and use Intellisense for Project Zomboid modder. - Konijima/PZ-Libraries

GitHub

Contribute to MrBounty/PZ-Mod---Doc development by creating an account on GitHub.

GitHub

Guide to modding various aspects of Project Zomboid - FWolfe/Zomboid-Modding-Guide

vast orchid
#

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?

grizzled fulcrum
compact tinsel
#

ohhh that's a game changer, thanks!

thick karma
# compact tinsel 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.

cursive steeple
#

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

bronze yoke
#

a main menu lua reload would be a full reload anyway

cursive steeple
#

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

bronze yoke
#

what problem are you having?

cursive steeple
#

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,

bronze yoke
#

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

cursive steeple
bronze yoke
#

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)

cursive steeple
#

thats very odd, but I imagine it has something to do with object vs static scope

bronze yoke
#

yeah, lua doesn't natively support classes, objects are just tables that get passed around and the colon syntax is meant to hide that

cursive steeple
#

thanks for the help albion!

safe silo
#

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.

sour island
#

getRenderer()

#

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.

safe silo
#

Thank you! I'll look into it! ๐Ÿ˜„

digital bolt
#

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.

cursive steeple
#

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)

wet sandal
#

This is where I'm at mentally with repeated "bug" reports

sour island
#

That's pretty neat

#

Sorry it's come to it

cursive steeple
#

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?

outer crypt
outer crypt
drifting ore
#

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

outer crypt
grizzled fulcrum
drifting ore
grizzled fulcrum
#

Trueee

#

But I don't do ti because I'm lazy and the game some reason does it for me

bronze yoke
#

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

thick karma
#

Sorry for confusion

drifting ore
#

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.

bronze yoke
#

kahlua doesn't pass shorts to methods correctly

drifting ore
#

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.

bronze yoke
#

there is but you can't construct a short that way, it's not exposed

grizzled fulcrum
#

what the heck is a short

#

is that just calling the java class method

drifting ore
#

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

frank elbow
#

<@&671452400221159444>

cursive steeple
#

dont click this

frank elbow
#

Somehow they got around the masked link filter too

young edge
#

might be because of the top-level domain ๐Ÿค”

drifting ore
grizzled fulcrum
#

I do that a stupid amount

#

my cs classes taught me well and now im scared for life

#

I swear I'll never forget ๐Ÿ˜ญ

grizzled fulcrum
#

but yeah how would that get around filter

young edge
#

filter might only be set up to deal with .com, but who knows, really. Regex is a fickle mistress

grizzled fulcrum
#

at this point, not allowing any markdown links would be ideal

cursive steeple
#

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
cursive steeple
#

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?

frank elbow
#

<@&671452400221159444>

#

there is a sequel

#

No idea why they're targeting this channel

cursive steeple
#

always when im waiting for a response too lmao

frank elbow
#

There are some examples of transmitCompleteItemToServer too ๐Ÿค” So that's just an assumption

cursive steeple
grizzled fulcrum
#

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?

frank elbow
grizzled fulcrum
#

oh wait im dumb to forget to include zombie_list which is

#

yes it is sorry

grizzled fulcrum
#

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

grizzled fulcrum
#

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?

drifting ore
#

unless you put that into a coroutine hardware thread, it just makes the game lock up forever, unless it never actually enters the loop

grizzled fulcrum
#

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

drifting ore
#

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.

grizzled fulcrum
#

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

drifting ore
#

the object you're hooked up to is a zombie, to get the body you'd need to specifically select it

grizzled fulcrum
#

true

drifting ore
#

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

grizzled fulcrum
#

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

drifting ore
#

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

grizzled fulcrum
#

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)

drifting ore
#

According to my quick test here, callbacks run in the main thread.

grizzled fulcrum
#

ok good to know, im glad they at least let us use coroutine std module ๐Ÿ˜„

drifting ore
#

be aware that coroutines run in the same thread

grizzled fulcrum
#

oof

rare geode
#

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)

drifting ore
rare geode
#

I am stumped on how to proceed

devout marsh
#

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

devout marsh
#

I think I figered it out

drifting ore
#

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

devout marsh
#

how do I do those XD

drifting ore
#
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, ...)

devout marsh
#

is your_code a function I make, considering how you wrote it? Or am I actually writing code there? Or both

bright fog
#

Even if you pass the check, you won't get the dead body

grizzled fulcrum
#

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

safe silo
#

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?

grizzled fulcrum
#

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?

safe silo
#

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

drifting ore
#

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

safe silo
#

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

drifting ore
#

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)

fleet bridge
#

you can just use getTimestampMs() to log the passage of time

#

(irl)

safe silo
#

How would I use that?

fleet bridge
#
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)

safe silo
#

And would that be able to return seconds? Like it's in milliseconds? If I did timeElapsed * 1000 (my math is awful prob)

fleet bridge
#

yea x1000 to get it to seconds

safe silo
#

Oh that's actually awesome

drifting ore
#

/1000

safe silo
#

Oh yeah LMAO

fleet bridge
#

my math is also bad ๐Ÿ˜„

#

yes /1000 lol

safe silo
#

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()

fleet bridge
#

the only issue is if there is discontinuity between sessions you might never log the correct times

drifting ore
#

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

fleet bridge
#

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

drifting ore
#

timezones something something

safe silo
#

xD

drifting ore
#

expecting it to respect OS timezone, or expecting it to be GMT0

fleet bridge
#

i have no expectations, just use getTimestampMs()

drifting ore
drifting ore
#

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.

frank elbow
#

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

drifting ore
#

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.

distant marten
#

what is getBumpFallType()?

drifting ore
cursive steeple
# distant marten what is getBumpFallType()?
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

distant marten
#

I tested with print(player:getBumpFallType()), but it was always ""

#

when falling from a tree or fence

cursive steeple
#

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

robust locust
#

hey peeps, does anyone know if there's an animation for painting that I can use?

cursive steeple
distant marten
cursive steeple
# distant marten yes print(player:getBumpFallType()) printed pushedBehind and pushedFront when I ...

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

frank elbow
drifting ore
#

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.

frank elbow
#

That's a stretch lol

#

An unnecessary wrapper is not 1000 if statements

drifting ore
#

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.

drifting ore
teal slate
#

Does the IS prefix on things like ISDisinfect stand for Indie Stone or something else?

drifting ore
teal slate
#

I'm aware of how variable naming works.

#

I asked a specific question, variable naming conventions have almost nothing to do with it.

drifting ore
#

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.

bronze yoke
#

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

drifting ore
#

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

coarse sinew
drifting ore
teal slate
#

I'm pretty sure iso does stand for isometric, yes

#

The entire iso package is related to world-objects and world simulation/display.

drifting ore
teal slate
#

Okay.

teal slate
teal slate
drifting ore
#

aren't we all? but look at the state of internal self-consistency of PZ API and consider if it's necessary at all

bronze yoke
#

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

drifting ore
#

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

bronze yoke
#

the language is fine, it's my favourite scripting language

#

the way the vanilla game's lua is written is just strange

drifting ore
#

ah, I see

#

eh, IDK. As far as using someone else's code goes, "as long as it works" is the motto.

bronze yoke
#

it's just not something to model after if you care about code quality

drifting ore
#

ideally you just don't put anything into global namespace, and this way the problem solves itself

teal slate
#

If it doesn't stand for Indie Stone, I can use itโ€”but it probably stands for Indie Stone so I won't.

drifting ore
#

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

teal slate
#

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).

drifting ore
#

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)

teal slate
#

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.

drifting ore
#

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

bronze yoke
#

yeah

drifting ore
#

(unless it's about next, then a lot of people fare better. With an asterisk - comparatively to itself better, not compared to LuaJIT)

bronze yoke
#

ime table access is not so much slower that it is worth avoiding using them when you normally would

drifting ore
#

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.

teal slate
#

You could just cache the variables you're interested in if you're repeatedly accessing it in a method, or inside a loop.

drifting ore
#

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

teal slate
#

I figured you'd cache table members rather than the tables themselves

drifting ore
#

well yeah that's what I said (what I meant anyway)

bronze yoke
#

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

drifting ore
#

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

hollow talon
#

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

red tiger
drifting ore
red tiger
raven marsh
#

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

safe silo
#

How would I draw plain text to the UI layer? Been looking into the UIElement -> DrawText but just keep getting errors.

neon bronze
#

if you just want a textbox in your ui you could add a ISTextBox or whatever its called in your ui

safe silo
#

Yeah but I was looking to not have the textbox border thing around, like just plain text and nothing else

safe silo
#

Ah sweet, thank you!

coarse sinew
#

It will look like this

safe silo
#

Yeah exactly

#

Would it just be TextManager.DrawString(?, x, y, str, r, g, b, a)?

neon bronze
#

you'd need the UIFont

#

but that is globally accessed through UIFont.Small i believe

safe silo
#

Ah yeah sweet thanks!

neon bronze
#

or smth along those lines

safe silo
neon bronze
#

i dont remember the exact call

coarse sinew
#

Also r, g, b, a are values from 0 to 1.0

safe silo
#

how tf ๐Ÿ˜ญ

coarse sinew
#

Just divide normal values from 0-255 to 255

safe silo
#

interesting, thanks!

safe silo
#

The rest of the variables are properly set so I assume I'm misusing the function

coarse sinew
#
getTextManager():DrawString(UIFont.Small, x, y, text, 1.0, 1.0, 1.0, 1.0)```
grizzled fulcrum
young edge
#

I mean.. that's what a compiler does

safe nebula
#

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

drifting ore
#

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

golden palm
#

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

drifting ore
#

some languages use IL representation for bytecode, it's their assembly language equivalent

frank elbow
#

In particular, the bit where it's calling isInTrees and checking for those professions

grizzled fulcrum
#

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)

frank elbow
#

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

grizzled fulcrum
drifting ore
#

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.

frank elbow
#

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

drifting ore
#

In any case LuaJ already exists

tranquil kindle
#

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
*

safe nebula
#

Tricky stuff, ill give it another go later on!

twin relic
#

Anyone knows why Braven made Common Sens uncompatibile with Flash together ?

ancient grail
safe silo
#

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?

echo lark
#

how do you get the contents of a container when its a inventoryitem?

bright fog
#

It just happens to be incompatible

thick karma
# twin relic

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.

neon bronze
echo lark
neon bronze
#

unless your item is not an InventoryItem?

#

how do you get your original item?

raven marsh
#

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

echo lark
# neon bronze unless your item is not an InventoryItem?

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

fleet bridge
echo lark
#

im actualy trying getitems now. ill see what happens

zinc epoch
#

How do i detect a specific item category that player is holding?

#

Is it even possible?

fleet bridge
#

If by holding you mean holding in the hand?

zinc epoch
#

Yes.

fleet bridge
#

Yea primary or secondary

#

Would work

echo lark
#
    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
fleet bridge
#

In the players inventory?

echo lark
#

wtv the inventory is that i transfer the item to

fleet bridge
#

You're using events api?

echo lark
#

yep

fleet bridge
#

The event should have src and dest containers

echo lark
#

it does

fleet bridge
#

So is the destination container is a backpack ?

echo lark
#

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

fleet bridge
#

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

bronze yoke
#

use item:getInventory()

zinc epoch
fleet bridge
#

I think it returns nil so just check for that?

zinc epoch
#

Ah, i see, thanks.

twin relic
echo lark
thick karma
twin relic
# thick karma I think some of your intended meaning is being lost in translation for me here. ...

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

thick karma
#

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

sour island
sonic shuttle
#

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?

ancient grail
# twin relic

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

ancient grail
tough peak
#

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.

cunning isle
grizzled fulcrum
#

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

cunning isle
#

Thanks โค๏ธ , I thought there would be more SwingAnim in PZ but i think thats enough for me.

grizzled fulcrum
#

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!

glossy estuary
#

Why is this a thing? I thought users simply subscribe to workshop and it's automatically installed?

thick karma
grizzled fulcrum
#

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?

grizzled fulcrum
#

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.

drifting ore
#

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

cunning isle
#

Can someone tell me how you can change weapon position in hand? My character should hold it like spear

grizzled fulcrum
#

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..

brisk remnant
honest shard
#

No one wants full berets made of wool?
I think PZ needs more clothing mods! ๐Ÿ˜„

brisk remnant
tranquil kindle
safe nebula
tranquil kindle
safe nebula
tranquil kindle
safe nebula
#

yeah let me see

safe nebula
#

I have mods installed on the workshop, but not enabled on the save - reckon that could be causing it?

tranquil kindle
# safe nebula

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?

safe nebula
#

Just this one, though this is the only one ive added so far

tranquil kindle
#

Check vanila gun?

safe nebula
#

Vanilla guns all work fine

tranquil kindle
#

Could you send model of your gun ?

safe nebula
#

yeah can do, down to dm?

tranquil kindle
#

Sure, since id like to know how to solve it myself since i write guide

safe nebula
#

You're a saint Salute

drifting ore
drifting ore
#

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

grizzled fulcrum
#

Thanks for explaining java compiler a little

#

Java is very similar to C++ compiler I guess too

drifting ore
#

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)

grizzled fulcrum
#

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

tranquil bone
#

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?

drifting ore
#

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

compact tinsel
#

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
tranquil kindle
drifting ore
#

vanilla files use colon for time setting, and use equals sign to denote number of ingredients/results, so maybe changing this will fix it

compact tinsel
#

Have just done the changing equals for colon, that worked, now I feel like an idiot
thank you!

drifting ore
#

were there any errors in console.txt log file?

#

it prints out crash stack trace when Lua goes south

compact tinsel
#

only that it didn't find the sound, but that's something I think I can fix

drifting ore
#

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

deep cipher
#

why doesnt pz switch to c++ ?

drifting ore
#

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

deep cipher
#

yea but how does one import the game to unreal

#

or do you mean rewriting everything

drifting ore
#

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.

deep cipher
#

arent there conversion tools that would help in this matter

drifting ore
#

for something so custom and arbitrary you'd have to write those yourself too

grizzled fulcrum
deep cipher
#

not saying its broken but switching to another language would be a big step up for this game

drifting ore
# deep cipher yea is guess thats true, i wouldnt be so happy tbh if the devs were using third ...

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

deep cipher
#

they would just be better off using unreal engine

#

i hope they do that

deep cipher
drifting ore
#

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.

deep cipher
#

yea i get it, but maybe if they increased their team they could make it happen

drifting ore
#

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.

deep cipher
#

but they would be better off creating a second game

#

actually

drifting ore
#

You know what, actually I have an example what it takes to rewrite a game in C++

#

Minecraft Bedrock

grizzled fulcrum
#

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

drifting ore
#

It takes billions of dollars worth of profits and a giant international software company.

grizzled fulcrum
#

And it still turned out poorly

drifting ore
#

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.

grizzled fulcrum
#

True but their rendering stuff still sucks

drifting ore
#

compared to java minecraft it's an outstanding rendering engine come on

grizzled fulcrum
#

I meant poorly as in the countless bugs in the game still existing after years of development with a seemingly endless money supply

drifting ore
#

even compared to Sodium it's great

grizzled fulcrum
#

On max chunks the renderer starts struggling compared to sodium I can run on 256 chunks and not much of a hitch

drifting ore
#

[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

deep cipher
#

there is this mod that allows endless render distance by not loading every fucking block en lowering quality.

#

minecraft devs are so lazy

drifting ore
#

yeah distant horizons

#

it's pretty GOATed, and it's been getting better shader support

deep cipher
#

its so logical for minecraft to have that

drifting ore
#

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

deep cipher
#

some modders put this together but a million dollar company cant

deep cipher
drifting ore
#

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.

drifting ore
#

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.

hidden rock
#

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)

drifting ore
#

lua tables can store anything, but saving it to disk is a separate matter

robust locust
mellow frigate
thick karma
sour island
#

Rerendered the back frames and symbols - p happy with the turn out

fleet bridge
mellow frigate
#

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.

fleet bridge
mellow frigate
fleet bridge
#

Yea but I wanted to store items (and their respective stats and mod data's)

mellow frigate
hidden rock
thick karma
hollow lodge
#

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

grizzled fulcrum
grizzled fulcrum
drifting ore
#

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?

grizzled fulcrum
#

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

drifting ore
vestal gyro
#

Actually looks like a denims

#

Imo

shrewd cedar
#

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?

coarse sinew
# shrewd cedar I'm wondering if anyone knows - for a container tile, can its capacity only be s...

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)
north drift
#

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?

shrewd cedar
wise igloo
#

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?

junior blaze
#

how do mod a hairstyle? is there a tutorial?

red tiger
#

@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.

reef portal
#

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

red tiger
# reef portal omg ur working on a vscode extension for pz modding? ur the goat
GitHub

A collection of EmmyLua typings for Project Zomboid's API - asledgehammer/Umbrella

reef portal
#

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

weary knoll
true pollen
#

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 ๐Ÿ˜ซ

drifting ore
# true pollen good morning! Can anyone help me get started in the world of creating mods? I do...

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.

true pollen
#

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

drifting ore
#

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.

true pollen
drifting ore
#

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.

true pollen
drifting ore
#

you can look in C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\scripts\vehicles for the bulk of the files

dull moss
#

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

cursive steeple
hollow lodge
true pollen
#

Is there a website or online course that teaches you how to create mods?

cursive steeple
true pollen
true pollen
#

Will I learn the Lua language, even though I don't know anything about programming?

cursive steeple
#

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

true pollen
#

Got it, good idea.

#

man, it's so hard to take the first step due to lack of totorials in your native language

true pollen
#

becomes a thousand times more difficult

compact tinsel
#

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?

safe silo
#

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.
drifting ore
#

you posted the wrong part of the stack trace

#

none of this says what's the issue

dull moss
crystal pendant
#

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.

dull moss
#

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

bronze yoke
dull moss
bronze yoke
#

on steam, pz modding tools, it should be in your library if you own pz

dull moss
#

ah

bronze yoke
#

you don't have to pack anything, the game treats packed and non-packed files mostly the same

dull moss
#

cheers

fleet bridge
#

From what I recall

safe silo
dull moss
#

works

hollow lodge
#

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?

drifting ore
#

here's what I found

hollow current
cunning isle
#

Hello, I have mod with new recepies and items. Does anybody know how to make a translation for my mod?

dull moss
cunning isle
#

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?

dull moss
#

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

cunning isle
dull moss
#

you already have them

#

because you made them

#

???

#

unless you hardcoded your values which is bad pratice

cunning isle
#

i dont have folder for EN names ect. i mean in my code when i create weapon i already make EN name

dull moss
#

then idk

cunning isle
#

oke

dull moss
#

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

cunning isle
#

ok, thanks for info ill check that

#

do i need to add smth like that

``` to mod.info?
dull moss
#

dont think so

cunning isle
#

i give up i tried everything and it is still not working

hollow current
#

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

fringe tulip
#

anyone know how to convert ui.pack to png?

ancient grail
fringe tulip
ancient grail
#

you might need to check filters

fringe tulip
#

i see thanks

silk pike
#

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?

grizzled fulcrum
#

nevermind im unphased at this point

#

ignore what I said

north drift
#

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

mystic vessel
cunning isle
#

ok, i fixed translation and its working ty

sour island
#

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.

safe nebula
#

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?

drifting ore
#

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.

fleet bridge
#

Default sandbox settings are used until global mod data is initialized

dull moss
#

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

dull moss
#

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 KekW if it works it works

wet sandal
# dull moss whatever that does

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.

dull moss
#

why does clearing it fixes stuff? KekW

wet sandal
#

The UI element you're drawing inside of is likely too small

dull moss
#

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?

wet sandal
#

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.

dull moss
#

clear stencil works too so I'll leave it at that

wet sandal
#

Yea it's perfectly fine for labels, just letting you know what it does

dull moss
#

thanks pat

dull moss
#

If you got a min and know the answer

wet sandal
#

I think

dull moss
#

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

devout marsh
#

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

bright fog
#

Oh wow the use of those color gradiants is nice

dull moss
bright fog
#

That looks amazing

devout marsh
#

XD

wet sandal
dull moss
devout marsh
drifting ore
dull moss
#

so it literally doesnt matter, it still renders with same refreshrate so performanse-wise it's all the same

#

cheers

wet sandal
#

No, they both run every frame.

Order is:
Prerender
Render
For each child UI
Prerender
Render
For each child UI , etc

dull moss
#

when that would be useful tho

#

oh for example if i wanna prerender bigger picture and then render other things on top

#

gotcha

drifting ore
#

it's one of those scenarios where it might be useful for reasons that are not apparent to you

dull moss
#

ye ofc

bright fog
#

nice

bronze yoke
#

neither will introduce any latency, both happen on the same ui frame

distant vortex
#

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.

winged ocean
#

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!

sour island
dull moss
#

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

sour island
#

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?

drifting ore
dull moss
sour island
#

Ah

#

As for the text thing - are you using UI:drawText ?

#

Where UI is the window?

dull moss
#

no, label

winged ocean
dull moss
#
    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

winged ocean
sour island
#

Labels should be using drawttext and only doing so on render

drifting ore
dull moss
sour island
#

if not ETWCommonLogicChecks.EagleEyedShouldExecute() then this returns false all the time?

winged ocean
sour island
#

Cause there's no returned value

dull moss
#

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
sour island
#

Sorry brainfart, thought the first snippet was the function

drifting ore
dull moss
#

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

sour island
#

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

dull moss
#

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```
sour island
#

Ah

#

Yeah this is all weird

#

setting the label's name should change it's text I believe

dull moss
#

it does, but for some reason it displays old info under it

sour island
#

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

dull moss
#

wdym

sour island
#

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)

dull moss
#

oh I see

sour island
#

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

dull moss
#

that's smart

sour island
#

Yeah but it's not a fix if that's the case - cause that may mean you're writing text twice all over lol

dull moss
#

good thing you're smarter than me

#

you are correct

sour island
#

Nah, I've just tortured myself with UI for longer

dull moss
#

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

sour island
#

๐Ÿ‘

#

Looks fine to me tbh

#

Which part is jagged?

dull moss
#

Maybe I'm just SCHIZO at this point

sour island
#

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

dull moss
#
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?

sour island
#

if not ETWCommonLogicChecks.EagleEyedShouldExecute() then self:clearChildren(); self:createChildren(); else ?

dull moss
#

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

sour island
#

It's just clearChildren just empties the list - I don't think it removes them

dull moss
#
    if self.javaObject == nil then
        return;
    end
    self.children = {}
    self.javaObject:ClearChildren();
end```
#

wouldn't it yeet the children? PepeThink

sour island
#

As far as I can tell no

#

it just empties the parent's children list

#

well ISUIElement/self = parent of the child

dull moss
#

hmm

sour island
#

It's only used twice, and I can't really tell what it's doing

dull moss
sour island
#

container info panel (?)

#

and tab panel

#

both cases it's also removing the parent from the UI

dull moss
#

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

sour island
#

That'd do it

dull moss
#

yep

#

I jsut have to yeet my own init KekW

    --ISPanelJoypad.initialise(self)
    --self:createChildren()
end```
mellow frigate
#

I'm i nnocent

dull moss
#

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

sour island
#

stencil should work if the bar is a child

dull moss
#

flushge any pointer where to look

sour island
#

you already use stencils in your code lmao

dull moss
#

yes but idk what they do PepeLaugh

sour island
#

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

dull moss
#

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

sour island
#

you're clearing it, but you need to draw it first

#

also this is done on render

#

per frame

dull moss
#

hm

sour island
#

What does ISGradientBar:render look like?

dull moss
#

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```
sour island
#

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

dull moss
#

shoudln't it be self.barAsthmatic:clearStencilRect();?

sour island
#

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

dull moss
#

wait but you said I should do this on render and NOT when creating children?

sour island
#

Each one of these is the entire error - I cut it off at a line height, but I also stencil it

sour island
#

not the render of the main window

dull moss
#

but render of gradient bar is base game and not me

sour island
#

Does it drag over the edge in vanilla?

#

Or is this cause you're putting it so close to the edge?

dull moss
#

prob cuz close to the edge, lemme quickly test

sour island
#

Just override it ๐Ÿคท

local gradientRender = ISGradientBar.render
function ISGradientBar:render()
    self:setStencilRect(0, 0, self.width, self.height)
    gradientRender(self)
    self:clearStencilRect()
end
dull moss
#

so how does it feel to be smart?

#

thanks KekW

#

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

sour island
#

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

bright fog
# dull moss

Are you making it a framework for anyone to use ?

#

And add to the menu maybe ?

keen silo
#

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?

bronze yoke
#

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

autumn pumice
#

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

devout marsh
#

nvm found an example with it

#

appreciate it :D

silk pike
#

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...
unreal pewter
#

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

devout marsh
#

drunk 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)

tranquil kindle
devout marsh
#

ah I did not know that :O

#

thankies

#

is there a way to spawn in less than that? XD

tranquil kindle
#

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...

devout marsh
#

mood

tranquil kindle
dry chasm
# tranquil kindle

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
tranquil kindle
#

Woow!

fleet bridge
dull moss
#

Surely not a scam link Clueless <@&671452400221159444>

drifting ore
#

500010806009947 % 7 = 499995773624418 WTH?..

autumn pumice
fleet bridge
#

Make your own

drifting ore
#

yeah OK kahlua is officially dogwater and needs to be replaced

#

having bugs in basic math routines is not allowed

dull moss
drifting ore
#

especially when neither language it runs has this problem natively

#

java resolves this correctly and so does C lua