#mod_development
1 messages ยท Page 69 of 1
If that's what you're asking
i leave it empty, and it stores only one, i dont have index so cant access to next index
if you use table.insert(table,value) you don't need to count or index stuff
mm i will try, ty
your original issue is that you're starting the count on 0 and indexing 0 in Lua btw
Thanks!
but again, you dont need to do all that anyway
I ended up spending my entire day yesterday coding a CSS color library for PipeWrench. ๐
Oh nice, this is for the UI editor/API?
I used to mess around on this engine called BYOND - they have a pretty nifty UI editor - drag/drop stretch etc
Would be pretty wild to have something similar in PZ
Yes.
The prototype for the UI is working.
Also, finally managed to get the banking system to how I like it - I was overthinking it as always lol
I'm actually writing a small HTML engine that runs through the UI engine of PZ.
Right click 'assign bank' automatically assigns it to 'none' faction which lets all people with a faction use it - defaulting to their own faction. Originally I had it do a limbo state thing like the shops have - waiting to receive which faction they're linked to. Then also allow to toggle on faction-locked.

Would this be for in-game html? Like viewing stats or such?
For any UI.
๐
I'm going to upload my progress soon.
The HTML will use only elements made specifically for PZ.
Someone gave me this idea about half a year ago. Glad I remembered it.. it might end up helping out a lot of people who have trouble working with the current in-game ISUI library.
True, there is almost nothing documented on how to create uis
im trying to create a new folder in inventory, didn't found anything, only persons posting quiestions
plus is my first mod, it goes very slow
I've spent a couple hundred hours with UI over the years.
I might also provide a client-side patch that adds "experimental tools" for things like adding GLSL shader support.
I'd kill for a UI that can render as frosted-glass.
The thought of seeing that in-game drives me crazy.
it would be historic
So I think I figured out why money keeps reappearing in containers for people
If the item is removed it reverts back to the stack - itself
but those items shouldn't exist either... how/why the does the game know they exist(ed)
๐ค
I wrote a UI to rewrite the multiplayer chat a while ago, but essentially I have the same thoughts about what I could do right now.
Discord integration for deaths are pretty great to see - I've only seen it in 1 server
reminds me of an old roguelike named ELONA
it was single player but for some reason the dev added death messages over the net
so once and a while you got 'Chuck was killed by a slime.'
Yeah.. Discord integration was something useful for moderation.
Pushed all local chat to a hidden chat channel too..
All commands for another channel.
There was even a thing I built into that chat that hooked up to the Google Translate API. We literally had people who could never talk to eachother playing in groups.
I'm learning how to make mods because there are few UI mods, now I'm making one that separates equipped items into a new category, no new windows or anything. It's my first mod so I'm aiming for something reasonable, but my goal is to do something like this, maybe you'll be interested
grid inventory, i see it too hard but the rest i think is possible
I think that making a HTML element for handling radial menus will be so helpful.
Yes, i want to make something like that, but i still learning
I like the idea of a grid system but I think I'd aim for something like NEO scav
If I were to redo the inventory system I'd strip away the player inventory to be hands only - anything else would come from pockets/clothing
I like the current inventory system overall, although there'd be things to fix for sure.
The person who created the image got the idea from Neo scav
Yeah, just realized the left side isn't the player inventory lol
Combine your idea with RPG items.
I like the image more
Is there a way to find out if the clothing is worn by player currently?
Does Aiming Time really affect anything?
Make me Grim World in PZ.
I think the current system could work if they had each row show the bag as a header row and the items inside for contents
but the stacking code would cause conflicts I imagine
I like the idea of a "quick look" UI for inventory.. but a detailed look would be nice too.
i used isEquipped() and isClothing()
A capacity weight feels too arbitrary for my tastes..
I'd use that along with items taking up a grid space.
What would be cool is if backpacks and luggage had multiple grids for pockets and compartments.
trueee
It would make rushing in a situation while trying to gather stuff more immersive.
This could be done right now as a mod.
grid inventory is possible?
some factoring of item size would be nice
Ofcourse
Nice
Yeah. No UI system exists AFAIK. You'd have to make it and hide the current UI for inventory.
Item mod-data would be useful in this case.
You could approximate sizes based on their weight and category
I can see this being a fairly simple mod.
and have exceptions
No more shelves on inventory xd
Like weapons have a range stat you can use to determine width size
What a exciting and creative morning.
Would cover most other mods
Of course I'd make it in my silly HTML engine.
This is my test code right now for it:
/** @jsx PipeWrenchUI.createElement */
import * as Events from '@asledgehammer/pipewrench-events';
import { PipeWrenchUI, createUI } from '../../shared/pipewrench-ui/React';
Events.onMainMenuEnter.addListener(() => {
createUI(
<element
class="my-element"
style="top: 64px; left: 64px; width: 50%; height: 512px; background-color: #80ced6;"
></element>
);
});
Hello, I have a question regarding the distribution of items and vehicles. I found that mods use lua scripts to distribute items and vehicles, and I want to make a patch to remove spawn items and vehicles, is it possible to override the lua script with the same file name in a different mod folder?
I think something like this would be good for radial menus:
<menu type="radial">
<menuitem title="Menu Item" tooltip=".."><img />Description</menuitem>
..
</menu>
pretty neat stuff
Only just found out that underground is already being developed officially. woot.
No need to play around with making fake underground layers using the void space of a map.
that's what RV and basements do afaik
Thought I'd post this here.
Random idea for a mod: Advanced Electrician. Actually having UI where the player needs to diagnose realistic scenarios of broken electronics up to and including circuits.
Was thinking about how one could make an actual circuit with such a feature.
is there anything extra u have to do with a clothing mesh to set it up as tintable? like vertex colors or smth
or even with the png it uses, mine is a little sus and parts of it are dark though the texturechoices ones are all fine
Someone was already working on that
this was bugging me, and i finally got the chance to check it: minAngle is just your attack cone, it has nothing to do with hitting or missing, only target selection
Such a strange choice (since we can freely move our cursor while aiming, and turning isn't that slow), but thank you for checking it!
it's mostly relevant for melee weapons, since they're expected to hit within a cone, and for shotguns, since they can target multiple zombies at different angles
im p sure rifles also have a tiny minangle
for those times you can shoot a bunch of zombies that are roughly aligned in a row
unless that's a piercing property and not related to the hit cones
all weapons have a minangle
aiming would be kind of annoying if you had to be perfect with it anyway
Anyone got some ideas for some fun stuff I can do with a diary mod?
I'm recording XP similar to Skill Recovery Journal, but I am limiting you to one day's worth of XP per entry, and similarly you cannot record XP that's, say, a week old.
I'd like some other fun ideas that don't result in "powergaming the system" too hard. For example, I was considering giving a buff to the most earned XP when re-reading the section (studying your learnings), but I don't want to do something like Oblivion's levelling system where you have to very specifically level stuff.
Ye u have to define the color properties and the texture should be white
you have to use <m_BaseTextures> for a tintable item right? not <textureChoices>
Able to conduce like mentoring.
Sorta like player one becomes a radio and player around it would learn a few stuff like recipe or whatever.
texture is white but when i go ingame i think its just not loading the texture at all
it also has a 3d mesh if that matters
Could also entertain people
I do like the idea that you can use a player's diary as a way of getting XP boosts - perhaps able to go a little higher than what a skill book can do normally.
i'm havin good issue with tile and worldzed as i said last night, when i launch worldzed from tilezed it brings up prefrences and no matter what i click it closes it
Ye but thing is . I think the game should like have n infinite loop even with just character. Like u cant have it all
When u learn stuff u forget stuff
Entertain could be nice, too, yeah. Maybe if you hit certain thresholds you get a separate story in the diary, which you could copy to a notebook, or just tell orally.
U become proficient on one aspect u lost interest on the other ro atleast 1-2 levels max
Orally was the idea
Like a time based act for the teacher
And other players treat u like a radio
might use that for literacy...
i already set up xp boost media codes for that mod so it's not much work
I have tons of doable ideas just dont have means to em 
I actually keep a list
To give an example
Electric fence trap
Tripwire alams
Panic Heart attack
Panic heart attack (or at least passing out for a while) would make a ton of sense.
Ye and if assited would get back up faster
But the person assisting will also endure a certain timebased lock
So theres heroism in mp
thought that said heroin 
This is probably a silly question, but you're so knowledgeable and you seem a good place to start.
I'm trying to change the number of pages in my diary whenever I add an entry, like so:
diary:setCustomPages(diaryData.entryCount);
diary:setAlreadyReadPages(diaryData.entryCount);
But I just get a nil error.
The diaryData is taken from diary, and they are both non-nil at this point in the code.
Pft, well that explains it. I'll do setNumberOfPages instead.
I think I'm getting a nil error on line two as well, but that's probably because my diary starts off not having number of pages set at all.
yeah, that one should be fine
setCustomPages is used for the diary/notebook/etc items you can write in
alright now ive got it working however
i cannot now transfer bmp files into worldzed
trying to drag and drop as it says in the guide
but it no work
oh it seems like no, basetextures may be for meshless items from what i'm checking? works fine with tints on texturechoices with just 1 choice
thx guys for answering all my questions i think i can publish my mod soon :3
can anyone help me with worldzed for a bit?
just this one issue because there's not really any information available online for how to fix it
I would if I knew enough, MF.
I did find my nil issue, though, I was accidentally storing data on my pen instead of my diary.
it's not as active, but the people in #mapping are more likely to be able to help
thank you
Maybe only saving learned recipes that have been used in the time period of recording?
Currently I'm just focussing on XP as I have a good way of recording that for an arbitrary time period.
Recipes might be more difficult, unless there's a nice easy OnRecipeUsed event ๐
Damn.. Just realized I can't set the TPS for the UI higher without modding the client.
recipes are learned in the function ReadLiterature, which is always called from lua
you can decorate that method's metatable to grab recipes
You could pretty easily grab any used recipes by decorating ISCraftAction.Perform.
ISCraftAction.Perform = function(self)
local recipeName = self.jobType;
-- Add recipeName to whatever you are using to store --
oldCraft(self)
end```
i think recipes from tv go through IsoGameCharacter.learnRecipe actually
but those are the only two sources of recipes afaik
Fair point, both of you.
I think I'd prefer not to note down recipes learned from magazines (as others have made options to copy those magazines). It would be lovely to jot down recipes learned from other sources, however.
i don't think there's any vanilla recipes that don't come from magazines, aside from a couple survivalist things that can come from tv in addition to a magazine - if a mod were to do it they'd probably use IsoGameCharacter.learnRecipe too
I think there's a few recipes that come from your Profession / traits.
Like trap recipes?
those can be learned from magazines
They can, but I'd want to know for this player where they came from ๐
well you can check their recipes on character creation
Welp. Time to hijack the client code for limiting UI FPS...
i suppose the engineer recipes can't be learned anywhere except the profession
The Engineer has some recipe that can't be learned elsewhere afaik.
Wa-hey! I have been promoted to Builder rather than recruit. Lovely.
Maybe I'm fussing too much over the magazine thing anyway, it'd make sense that once you know (by heart) how to make something, you can.. Y'know, make it.
And thus write it down.
I also have to actually make reading the diary do things 
And figure out how to prevent (or allow?) other characters from reading it.
One of my goals, in addition to writing down details of just a single day at a time, is to ensure that you will not be able to cheese the XP recovery system by making one character, using the XP multipliers on that char, then intentionally dying, getting other XP multipliers, and immediately regaining all your XP.
Ok cool. I found out that the update function in ISUIElement is called slower than if I can push updates through OnFETick. The one through ISUIElement isn't affected by the UI FPS.
Running some tests...
Hmm yeah I think it's best to use a tick event to update my UI.
I assumed that the option in settings would affect or improve UI tick stuff but it's just slow by default and doesn't change.
Anyone knows of a mod that will respawn cars across the world?
Thank you very much
Anyone knows of a mod that lets you come back to life with (some of) your skills levels?
Not journal, that mod is bugged
@sour island
Could you clarify how the journal mod is bugged? I don't see any new comments or issues opened.
almost ready an early release

Dog
I don't think for now, I need create a lot of animations, dog hit, zombie attack, etc.
If you want to see my HTML prototype in action, here's a render of it. It's a mod you chuck in the mods folder. It simply renders an animating square on the main menu and fades with animations set by adjusting CSS style values like in JS.
my mods dont work lol
tried putting everywhere
Try #mod_support ๐
@sour island
https://steamcommunity.com/sharedfiles/filedetails/?id=2902353381 someone gave me a clown award for making my merch in zomboid ๐ฆ
I dunno, that's kind of cute.
Going for the day. Hopefully someone finds my HTML tech demo mod interesting.
xD
Oh dear
I gave you two awards just now to cheer you up ๐
I think it's best for them to be immune for now
I'll check it out once I'm home
People are weird lol
Sup, you can re-read it or something no?
Like there's an exploit
I don't quite remember the details
I would suggest using the mod, you can customize features as you see fit.
If you're worried about MP exploits there isn't a way to determine watched TV shows yet but you can set the return % to 75
Other than that there aren't any known bugs or exploits
Oh yeah that was it, the TV shows exploit, sorry
I've used the mod before, but players would unfortunately level via tv shows, journal write, etc then respawn and re read
If you set the return % to lower than what they'd get you should be fine
I worked on a fix but it didn't pan out at the time due to not being able to identify how much you get from TV
I might just overwrite the TV functions and call it a day
No worries, no negative judgement on my part, it's a great mod for 90% of situations but it's tricky to balance for big public servers.
I'm not sure what you mean by set the return % to lower than they'd get.
If someone has level 6 carpentry, journals, dies, reads journal and gets, say, level 5 back, they can watch VHS to get up to 8 or 9 no?
With book reading that is
There's sandbox options to cap the return %
If you lower it to about 70% rewatching the TV shows wouldn't net more XP than lost
Although this isn't a perfect solution as it would still reward using the TVs
Afaik the amount of XP from VHS is the same regardless of what level you're on.
Within the PZ Server browser, I've noticed the PublicDescription= doesn't allow <LINE> or <BR>, but yet I've seen descriptions with neatly formatted information. Anyone know what the bbcode or short markup is for a line break in that .ini ? (Not quite sure if this goes here) - and for further clarification, I'm referring to the info/description you get to see of a server before you join it in the game's server browser.
so back to inteliji kinks, any way to make .txt files fold {} regions?
Quick question where can I locate the icons of the inventory items in my project zomboid folder?
Reddit to the rescue." \n "
is there a mod that allows you to have guns in hotbar without a holster
A few are loose in /media/textures, but the majority of them are in one of the .pack files in /media/texturepacks. You'll need something to unpack them. I know there's a tool for it but I'm not sure where you can find it.
Hey just a quick question: playerId is unique on mp servers right? If i use getSpecifPlayer on different players it will return different value each time right?
Can someone make tutorials for stuff? I know there is a tutorial explicitly for making clothing, but its only written, and my small brain cannot follow simple steps, it would be pretty cool if it was shown to me as a video instead!
getSpecificPlayer is for local players
aka split screen characters
Anyway to get Players on mp?
can i do something like this
--lua1.lua
--stuff here
--lua2.lua
require lua1
--lua3.lua
require lua1
require lua2
if im not mistaken, its enough to simply require lua2 in lua3, right? since lua2 already requires lua1, right?
getOnlinePlayers()
names should in string
guessing you doing load order?
yes + want to use local function that is in lua2 in lua3
for that you need to export them
yes i know
and yes should be fine requiring lua2 only
cool ty
Thats a list of IsoPlayers i assume?
Also there is probably a way to know if you are on a server or in sp right?
is if recall correctly yes
isServer() returns true in a server
isClient() returns true in a client playing multiplayer
both return false if its singleplayer
Ah so it returns true for isServer if the server executes the piece of code?
can I remove events same way I add them?
Events.EveryOneMinute.Add(abc);
Events.EveryOneMinute.Remove(abc);
something like this
nevermind, found it in javadoc

wait are events supposed to have unique names?
cuz I've been linking them to local functions assuming that's enough
but I'm looking at Remove constructor and it takes event as argument
so like how does it work, can I remove events added by other mods if i accidentally have event with same name as they do?
If your function is local no, I'm not sure about global but if you have a global function with the same name as someone else's your probably having a bad time anyway.
true
ye all my shit is local so should be fine
Chuck and Albion in chat at same time
if it's global, both will still be added (assuming the function is added to the event immediately/at least before the other file reassigns it anyway)
can I do something like this ?
--lua 1
lua1 = {};
local func1() end
return lua1;
--lua 2
local lua1 = require "lua1"
Events.EveryOneMinute.Add(lua1.func1)
Yes, but I'd be curious when you'd have/want to do that
--lua 1
local lua1 = {};
function lua1.func1() end
return lua1;
--lua 2
local lua1 = require "lua1"
Events.EveryOneMinute.Add(lua1.func1)
```the syntax is a little off, but yeah
shouldn't lua1.func1() be local?
lua1 is already a local table, anything in it is local
my ide complains, not sure if it still runs okay or not

yeah i'm seeing the same thing, i don't think it likes trying to use local in combination with a table index
local n = {foo = function() end}
I hate it
local function fun() end
local n = {foo=fun}
We should have a competition to make the ugliest Lua
--TraitsLogic.lua
local TL = {}
function TL.traitABC () end
return TL;
--TraitsYouCanGetDynamicallyByCondition.lua
local TL = require "TraitsLogic.lua"
function wayToGetTraitABC ()
--code
Events.EveryOneMinute.Add(TL.traitABC);
end```
in one of my mods i had a line like local foo = require 'file'.func() for fun
if you wouldn't be insanely helpful I'd block you for this

it's an easter egg for anyone who looks at the code

LOL
lmaoo
The guy maintaining SS made the player scream about 'incompatible' mods - one was swapit, but I couldn't find any issues with it.
Nolan mentioned he meant to delete that system entirely - not sure if he has had time to do so
SS?
superb/super survivors
A while back a modder took on maintaining it - released a new mod for every patch (no idea why)
seen the page ofc so i know whtat mod does but idk
I'd say it's a solid 7/10
should try it 
Making NPCs is not an easy task by any means, and I think Nolan works on it when he can - however there's some stuff I saw that could be cleaned up
There's also alot of stuff he can't control that limit it's effectiveness
if not player:HasTrait("Outdoorsman") then
Events.EveryOneMinute.Add(outdoorsman);
end
end
can I somehow pass player into my outdoorsman func?
NPCs can't seem to operate on their own/maintain a open cell
so i dont have to call local player = getPlayer(); inside of it
I'm very curious why the devs have in mind for this - if they offload it to a simulation I feel like there'd be alot more work - but making every single player game basically a server would be taxing on PCs
Unless the event drops those arguments in you have to use getPlayer
Sandbox options are solution, got good rig - get more survivors
I see
Yeah but programming conventions would probably suggest/expect you to simulate what you can
tru
they were doing a simplified offscreen simulation from what the blogposts sounded like
the really old blogpost?
the more recent ones, from a couple months ago
I don't think I caught that one
The really old one was a good read
Oh yeah I missed this blog
Meaty blog today, and then some, but firstโฆ some housekeeping! HOUSEKEEPING First item on the agenda: TIS are hiring! HOWEVER itโs not an entry-level position, or even a mid-level one really โ the successful candidate will most likely be someone with considerable games development experience already. If you fancy joining our team and being our [...
Neat
yeah this is what i remember
Lua
Unless you want to get fancy
I'm sure others here can tell you more about whatever they've got going on in that regard.
I saw someone had a typescript setup.
Hey, love your hotbar mods
Ayy, thanks
Just recognized his name lol

i honestly really like lua, except from when indexes start at one

this and variables defaulting to global
oh gosh yeah
The length operator # is a bit surprising if you don't know how it counts "length"
I don't mind indexes starting at one but I'm also not well versed in other languages so 1 being first makes sense to me 
I do wish the arrays and lists had a mutual handler as people mentioned yesterday - like arrays working with pairs/ipairs
hey can someone help me with mods ? ๐
I still cant copy a table on a variable, getItems() is type userdata when i try to copy it dosnt work
i know how o put the mods in the game and stuff but i feel as if i need to change some settings
in police stations i barely get weapons
and ammo
getItems() returns a java ArrayList, not a table
and if i want to copy 1 item of the arrayList ? i use getItems():get(i) in a for loop, so i get a java array of one item of the inventory, i want to put the filtered item with isClothing() on another arrayList.. how ?, sry if is a dumb question
Do you need it to be in another arrayList? It can be added to a Lua table
But you can also construct an empty ArrayList and use add I think
local items = -- put however you're getting the arraylist here
local clothingItems = {}
for i=0,items:size()-1 do
local item = items:get(i)
if item:isClothing() then
table.insert(clothingItems, item)
end
end
```is this the kind of thing you're looking for?
this will loop through the arraylist items and put all the clothing items into the table clothingItems
that's a normal lua table so you can use that one normally afterwards
you need to initialise equippedClothes as a table first
on the first line, instead of local equippedClothes, use local equippedClothes = {}
Without '= {}' it's equal to nil/null/nothing
So it doesn't have an "insert" function or anything to insert it into
Yes you have to parse through the table to print entries
with a for?
for key,value in pairs(table) do
key in this case is the order since your not providing keys yourself
value would be the clothes
Also just to reiterate, {} in Lua is referred to as a table
Not to be nitpicky but since you're also dealing with an array (Java) it can get confusing
Yes, now I understand the difference between a lua table and a java arrayList, that was the problem
Anyone know a way to set an Animation Mask on an item and have it stick? During a TimedAction I can set:
player.setVariable("LeftHandMask", "holdingitemleft")
But after the TimedAction is up or sometimes when another action is performed that variable is just unset. I've currently just been brute-forcing this via a Tick function to get it to stay, but this causes the item to bounce when its unset and is just a dirty solution. Everything I can find has this be defined on the item itself in a script file with no way to set it in Lua, but hoping I missed something.
Looking at bags and stuff which apply a mask on equip these are definitions in the ".txt" files. But that's not feasible when I'm trying to hot-patch everything, including mods.
you can change scripts with lua
Anyone know where the traits are defined in the code? I want to see how they work :)
Not the trait factory to make new ones, but the already existing traits *
shared/NPCs/MainCreationMethods.lua
Thank you!
A lot of trait effects are also just reactionary if statements peppered throughout the entire code base
though if you want to see trait behaviour- yeah
Worst part, Iโve dug through that exact file so many timesโฆ ๐
you'll be going all over the place for anything beyond an xp boost
Are you referring to the DoParams() function? If so, I have tried that with no luck. The variable I need to set for it to work with that method is a JavaObject apparently so I can't add it with that. Also type "ItemReplacement" has no new function in Lua.
yeah, looks like DoParam() doesn't have checks for that specific field - you can use Load() instead
Oh dang! Is that what that does? Let's see
actually, i assumed the wrong name for that field, it does check for it
you're trying to change the animmask on an item, right?
Correct. Trying to set replaceSecondHand specifically
yeah, looks like the code for actually handling that is in Load โ a rare situation where DoParam isn't enough
it changes the value on the item, but doesn't actually do any of the stuff it needs to apply that
Yea, I could get a string to be set, but needed the object
try ```lua
local item = ScriptManager.instance:getItem('Module.Item')
if item then
item:Load('Item', '{replaceInSecondHand=YourDesiredValue},')
end
the 'Item' in Load should be the name of the item without the module
Man this hurtsโฆ trying to figure out what sort of variables I can mess with for the player, but they are all buried all over the placeโฆ ๐ฅฒ
any idea how to add button/tab/container to inventory ?
I can't find any related method
Like this:
inventory:addContainerButton(container, texture, name, tooltip)
The button gets returned to you, defined in ISInventoryPage
So I need to set the replaceSecondHand variable and not the replaceInSecondHand. I can do replaceInSecondHand via DoParams, but the ItemReplacement Java Object does not get created which is stored at replaceSecondHand; seems this is what is actually used to set the mask.
youd just have to implement the metamethod
ty
load generates this object based on the value of replaceInSecondHand
if (!StringUtils.isNullOrWhitespace(this.replaceInSecondHand)) {
var4 = this.replaceInSecondHand.trim().split("\\s+");
if (var4.length == 2) {
this.replaceSecondHand = new ItemReplacement();
this.replaceSecondHand.clothingItemName = var4[0].trim();
this.replaceSecondHand.maskVariableValue = var4[1].trim();
this.replaceSecondHand.maskVariableName = "LeftHandMask";
}
}
load concerns me a little as some of the other methods it calls don't sound like things you would want to run more than once (having not checked their code), but as far as i can see this is literally the only way to get this object created: there's no getter or setter, and even if there was the ItemReplacement object isn't exposed so you wouldn't be able to create one from lua
is there any way to not have this thing printed twice
Printing twice is a known issue - started happening around when MP was released
rip iterator metamethods were implemented in lua 5.2
I have been trying to get this to work for a bit, but have not gotten the "Load()" function to cooperate. Keep getting an error about bad args. Regardless, I don't think that setting the replaceInSecondHand option is what I need here. If I understand correctly, I don't actually want the clothingItemName to be defined, just the maskVariableValue and the maskVariableName. This is how torches and umbrellas work by setting the secondaryAnimMask value in scripts so only the mask is applied. By chance, does the secondaryAnimMask also set the replaceSecondHand value when used with Load? If so, I'll keep trying to get this set this way.
looks like it's expecting an array of strings, not one string, my bad
not really sure what format it's expecting - i copied the one vehicle scripts used
looks like it's just an array of strings in DoParam format, i've never had to construct one from lua before so i'm not exactly sure how to go about that
and yes, the secondaryAnimMask activates similar code
Anyone know if there is a way to mess with the endurance regain rate?
Currently struggling looking for that one in the code lol
Cool, I'll have to see if I can figure this out then. I don't see an example of it being used in the base code, so should be interesting. Here's hoping. Thanks
isn't there a vehicle shader that has alpha support?
no
Damn, no rust buckets?
I am 100% positive older version of More Traits had a trait that was increasing regen rate. Afaik trait was reworked since then but you can find odler version of code on github https://github.com/hypnotoadtrance/MoreTraits
i think you just manually increase their endurance constantly? i don't think you can access anything better
might be, never looked at that trait code
write code as row of elseifs
don't wanna use brain
AI, help
send 50 lines of code that's 3k chars in length
AI gives back 1.3k symbols loop
what a nice time to live in
local thresholds = {
{trait = "Cowardly", total = 0.1, melee = 0.05},
{trait = "Cowardly", total = 0.2},
{trait = "Hemophobic", total = 0.2, melee = 0.1},
{trait = "Hemophobic", total = 0.4},
{trait = "Pacifist", total = 0.3, melee = 0.15},
{trait = "Pacifist", total = 0.6},
{trait = "AdrenalineJunkie", total = 0.4, melee = 0.2, add = true},
{trait = "AdrenalineJunkie", total = 0.8, add = true},
{trait = "Brave", total = 0.6, melee = 0.3, add = true},
{trait = "Brave", total = 1.2, add = true},
{trait = "Desensitized", total = 1, melee = 0.5, add = true},
{trait = "Desensitized", total = 2, add = true},
}
for _, threshold in ipairs(thresholds) do
if (threshold.add and not player:HasTrait(threshold.trait)) or (not threshold.add and player:HasTrait(threshold.trait)) then
if (threshold.total and totalKills >= braveryKills * threshold.total) and (not threshold.melee or meleeKills >= braveryKills * threshold.melee) then
if threshold.add then
player:getTraits():add(threshold.trait)
HaloTextHelper.addTextWithArrow(player, getText("UI_trait_" .. threshold.trait), true, HaloTextHelper.getColorGreen())
else
player:getTraits():remove(threshold.trait)
HaloTextHelper.addTextWithArrow(player, getText("UI_trait_" .. threshold.trait), false, HaloTextHelper.getColorGreen())
end
end
end
end```
0 brain coding letsgo

desperately looking for a flaw in this code so that i'll still have a job in a year
๐
oh actually i didnt need to do elseif inside again could have jsut combined into single if
lemme see if i do that and give it to ai if it will generate different code

6 am coding == quality coding
guy in charge of my project really does believe ai will eventually replace programmers

i'm not @_@
more jobs for me XD fix performance and better integrate ai generated systems
ok if I shorten my initial code it gives prettier code back
local thresholds = {
{trait = "Cowardly", total = {0.1, 0.2}, melee = 0.05},
{trait = "Hemophobic", total = {0.2, 0.4}, melee = 0.1},
{trait = "Pacifist", total = {0.3, 0.6}, melee = 0.15},
{trait = "AdrenalineJunkie", total = {0.4, 0.8}, melee = 0.2, add = true},
{trait = "Brave", total = {0.6, 1.2}, melee = 0.3, add = true},
{trait = "Desensitized", total = {1, 2}, melee = 0.5, add = true},
}
for _, threshold in ipairs(thresholds) do
if (threshold.add and not player:HasTrait(threshold.trait)) or (not threshold.add and player:HasTrait(threshold.trait)) then
for _, t in ipairs(threshold.total) do
if totalKills >= braveryKills * t and (not threshold.melee or meleeKills >= braveryKills * threshold.melee) then
if threshold.add then
player:getTraits():add(threshold.trait)
HaloTextHelper.addTextWithArrow(player, getText("UI_trait_" .. threshold.trait), true, HaloTextHelper.getColorGreen())
else
player:getTraits():remove(threshold.trait)
HaloTextHelper.addTextWithArrow(player, getText("UI_trait_" .. threshold.trait), false, HaloTextHelper.getColorGreen())
end
break
end
end
end
end```
although
for small stuff like this ai is definitely going to take over but ai can't write a game yet
I use GitHub copilot for anything UI related because I can never remember all the fields for the constructors of the ISUI stuff
i get around this issue by never writing ui ever
if it involves ui someone else can do it LOL
I just comment in detail what I need then ask the AI to fill
It makes small mistakes, but they're easy to fix
am i really the only person writing uis
ive talked about it before how i like the way it is right now because it gives maximum freedom
i'm sure if i did it a bit more and became more familiar with it it'd be okay, but none of my mods have really needed any and the system is scary from the outside
Although my current WIP mod is a massive inventory overhaul
Doing most of that myself
but im also that one dude who enjoyed writing asm so probably not a good example
if only i could design uis
been hitting my head against the table trying to get a design for the crafting menu
I don't know what's good, but I know if it's bad
not sure about the site you're using, but those sites love pulling a 'we own everything the ai generates *and* everything you put into the ai'
im sure rj will bring down the wrath of his chickens upon you

they are menacing
I pay for GitHub copilot, so I'm good to use the outputs by their license.
recent ruling by somebody important says that copyright requires human authorship so you can't copyright anything made by an AI anyway
I don't know how I'd feel about asking an AI to give me a full implementation though.
Copilot just acts as really smart autocomplete. Usually just the current line. Occasionally a few if it's brain-dead obvious where I'm going.
can you prove it was generated by an ai?
Or you can comment in detail what you need then ask it for output. Usually gets it 80% of the way.
(For like 5-15 line functions)
Noticing if I call all of these on a tree object and its square...
object:removeFromSquare()
object:removeFromWorld()
square:transmitRemoveItemFromSquare(object)
square:RemoveTileObject(object)
...it removes the tree, and the shadow cast by the tree, and the tree's presence in the square's objects, but crucially does not remove the tree's presence as a potential object of collision. Anyone know what I need for that last step?
I know nothing about this area, nor the networking side of this.
But have you tried killing the tree?
tree:Damage(9999)
I do not want to kill the tree because I want to be able to restore the tree.
Ah
For removal that was my thought. But it would likely leave the stump too.
I can sledgehammer it and I think that works (using a function, not by playing)
can you save its information, sledgehammer it, and then recreate it?
Possibly, but I do not know how to save a copy of a tree object and add it back to the game world as I found it.
I figured simply removing it and adding it would be easier if I had the right functions, but I'm all about whatever works.
How would I copy an IsoObject's data completely into a new IsoObject from Lua and then add it back to its square (code may assume I can get the square just fine)?
I assume if I store the IsoObject in another variable I just pass the reference to that Java object as I would in Java.
And thus it would be destroyed?
So not that way... (?)
well when it comes to a tree, you just needs it sprite, location, and maybe its health, right?
Idk I just want to add the exact tree I delete back where it came from... I do not know what all fundamental values are tracked by the IsoObject trees in Java
I just want to put the thing back the way I found it.
I don't know what all the game uses to create these trees.
I know one-or-more of these lines are part of it because I use it to redraw the hidden trees:
tree:setSquare(square)
tree:addToWorld()
square:AddTileObject(tree)
But how to initialize the tree object correctly is something I couldn't find in Lua ๐ฆ
Also I'm wrong the shadow cast by tree is not hidden
when collision is active so is the shadow
IsoTree.new(IsoGridSquare, IsoSprite)
looks like IsoTree.new(IsoGridSquare, string spritename) is acceptable too
Looks like I can easily get either from the object, cool
Hold on I think I was must have added an old copy of the function through debug somehow... I think RemoveTileObject is actually right @bronze yoke
I think that's how sledgehammer does it
Gah maybe not oof
I will need to test something. If I have a character, they die, and I make a new one, is my stored ModData on that player still the same?
no
You're always around ๐
Thank you, that's basically exactly what I hoped for.
What u trying to do? We only needed the trigger function right? Also pls do a sandbox of the power if its admin only or trait based
Thats all i ask thank you
Now, is the getID method on items a GUID I can rely on? I'll need some kind of GUID for either players (not characters) or items ๐
i just generate my own for players
If the Player I have is new each time a character dies, how could we generate our own GUIDs for the actual player/account?
oh just use steam id or username
i think there was a sql id if you want it to be splitscreen safe
I'll have a look around, this is plenty to go on. Thank you for making things easier ๐
i was generating a guid specifically to make it not persist after death, i think the sql id was the solution we found for it to persist
I think I'll use the Username for now, and then investigate options for creating a weak-match system on traits / occupations in order to limit how much you can 'change' from the original person who wrote the diary.
Goal is to minimise cheesing in trait-choices when dying and respawning, but also to allow some changes (such as underweight/overweight, and the various fit/strong traits).
I might also use this weak-match in order to determine "similarity" between two different people reading the same journal, in order to let you gain some benefit of reading someone else's thoughts who are much like your own.
Like, if Alice and Bob share almost all traits with each other, I might give Alice a learning speed multiplier from reading Bob's diary, until she's earned as much XP as Bob has.
Anyone know if there is a mod that lets you chose the pose for mannequins along with maybe adding new poses? Asking for a friend.
is there an event to determine when you have a loot panel selected. like if its not selected it will do something
If there is, remember that some mods (like Proximity Inventory) might still display items from your loot panel, despite it not being currently selected.
the thing i wanted to do isnt worth the trouble of looking at other mods cuz all i wanted to do was to blink that container of the atm
and off when its not activated
or i coul dprobably just keep it blinking
The way I tamper down on cheesing is that the journal doesn't apply XP multipliers. It's all flat XP - I still need to work on the earning aspect and deal with TV information.
I've played with your mod extensively (though this is like 6 months ago), and in my experience, it seems like you can play a character, with, say a 4x multiplier, get to level 10, write it down, then die and swap character, get almost to level 10 (minus the beginning levels) and just grind the last tiny bit.
Am I going crazy here? ๐
Earning XP is still an issue
But you can't earn lvl 8 -- switch to someone with a higher multiplier and read it to get lvl 10
Yeah, that wasn't a concern I had ๐
I'm lucky enough that you already solved that problem ๐
I was going to sit down with the TV stuff again, may offer a way to stop XP multipliers abuse
But that's going to create so many bug reports lol
Ow about this
Back when i was still an admin for a server. I noticed that if the level is manually added but not the exp it doesnt add to the journal ehich was a good thing cuz we can then reward level ups using other mods we did
But it wont be added to the journal its a way for us to prevent players from maxing their journals
Oh I'm just remaking the whole thing from scratch, so I'm not too worried about any of all this stuff. More thinking about extra new features I can do to make the book more of a balanced feature that seems more "Vanilla"
I have the project on GitHub and don't mind collaborative work
I know, it's more of a way to keep my mind open to new solutions. It can be hard to break the mould when it's all around you.
Fair enough, feel free to check the GitHub out for tricks
One issue I do have is co-op has no meaningful way to prevent cross use
And the TV issue
That's exactly what I'm doing when I get stuck / need inspiration.
๐
I can make a fix for the co-op thing using the SQL id of the player, but I'm not concerned about it, honestly.
The TV issue is definitely one I want to consider myself as it was very problematic on our server, since we had a baseline x3 XP rate, and people didn't remember what they had/hadn't seen before.
I'm thinking I can tap into the function for watching TV and store the XP from there
Unfortunately last I recall it will require a hard overwrite
It was standard faire to die, respawn, go to the VHS-central hub in the bigger base and re-watch every skill VHS while reading skill books.
There must be a way to simply mark the character as having already watched the show, somehow, no?
I hate that you can get multipliers with TV watching too
The journals mark that you've watched the show
The issue is you can watch it before you read
Riight, yeah that's possibly what happened.
And there isn't a way to separate the XP
So if I have to track the XP anyway might as well track it itself
Definitely one of the players had her journal at one base, and we had skill books / vhs at another base.
I might even remove the media tracking all together
I feel bad cause I hounded Nasko about making it exposed ๐
What I'm doing for my diary right now is I'm tracking all XP gains, rather than calculating how much XP you're supposed to have.
This is XP prior to multipliers (even from sandbox settings I think).

Are you overwriting the addXP?
No, addXP is in Java, but it calls the AddXP event, so I can hook right in.
Ahyes
As best I can tell, I get the exact float that AddXP was called with, prior to any modifiers.
Except when that perk is already at max level, or when AddXP is given a negative number.
There's an argument for add XP that turns off multipliers
You can also call add XP directly
Well that sounds pretty ideal.
I'll be messing with it to solve the TV issues - and perhaps implement a way to prevent career abuse
If you find a way to solve those things I know past me would definitely have been happy ๐
Unfortunately I haven't had time ๐
But I was hoping the return % sandbox option would help mitigate issues
Still making my own diary thingie, but more for the spice of doing it, and for making it separate.
Really want to do per-day stuff and see where that takes me. Make players interact with the diary some more, make them write down their recent memories, and make it harder to just write down a whole life's worth of experience.
I'm sure it would, we had reasons for keeping it at 100% that were unrelated to the cheesing ๐
I can't help but feel like the TVs XP rate was an accident and just left
I'm not entirely sure. I would definitely prefer TV XP being a separate setting in the SandboxVars.
And if skill books didn't impact TV XP.
Yeah that second one is wild lol
Nah, fuck it, make TV XP work the same as a skill book? Just another multiplier.
Could be a flat multiplier too
In general, I'm more a fan of getting a multiplier for the next X (pre-multiplied) points, rather than until you reach some threshold total points as it is now ๐
So no needed skill range
Yeah that'd work well, I think.
Definitely out-of-scope for the journal mod ๐
I feel like you've got some pretty nifty tooltip code in here for the journal. Gotta just check it out in-game, because I might want to redo my bait and evolved recipe tooltips to use more of your strategy.
And I forgot to enable your mod, do'h.
<m_Pants>false</m_Pants>
<m_AllowPantsHue>false</m_AllowPantsHue>
<m_AllowTopTint>false</m_AllowTopTint>
<m_AllowTShirtDecal>false</m_AllowTShirtDecal>
Is there a code like this that makes bags not possible to be equiped on the back?

will this work?
like if the sandbox is disabled
it will return
but i hope it wont need a server restart
or should i add this to each functions?\
Good morning.
can we talk in dm
@sour island Have you had time to check out that tech demo?
anyone want hear my mod idea? i got an unique idea that is easy to make
and is unique
anyone knows what handles the container if its seen or not
i was looking an modder that doo stuff for 2 dollars
checking it out now
Hey. Hope you had a good Christmas. (If you're about that ofc)
Yeah, long drive tho lol
why no one tries my mod ideas :/
I'm going to be working on image support this morning because a friend requested it be done soon. ๐
I place it in /mods/ right?
Yeah
Clean stuff
I found something useful when testing yesterday, which is that for some reason the update hook in ISUIElement from ISElement in Java is fired very slowly.. and using tick event hooks is way better for my needs.
Oh crap! Thanks for the gif! That's hella useful.
I recommend shareX to anyone
Thanks for checking out the tech demo. ๐
I'd be curious how easier it would be to make more complicated UI
If you've used aiteron's AUD before - I've been using that to reload files on the fly for testing/tweaking
doesnt work in MP though as the reload calls happen on clientside
I'm using the main menu ATM since my current tech is too weak to really handle loading a full game. I am in debug mode so the button 'Reset Lua' is my friend.
With my mod loader solution I mentioned previously, you can actually write reset code for both client and server-side.
My old chat engine actually had this feature so I can reload new code for players without booting them to restart the server.
issue with reloading files is hooks and events
Yeah this is true. It depends on how the code handles unloading / processing the pre-reset and then loading back in.
When I write blocks like this, I tend to do:
export interface Module {
onLoad?(): void;
onStart?(): void;
onUpdate?(): void;
onStop?(): void;
onUnload?(): void;
}
(Or something similar)
Module-like implementations solves a lot of the problem of organizing that logic.
The main thing for me is that this solves the workshop-item-update situation for my work if I'm working on a server-specific mod.
cmon :(
no one makes my requests
mod requests
Why donโt you make your own mod?
Ye exactly
Instead sending dms to people
Asking for a mod with 2$ steam cred worth as payment ๐
hello, anyone know which .class file contains the modifiers for how many calories sitting, walking and running take? I've seen people quote the numbers but I cant seem to find it. I looked in zombies/characters/bodydamage/nutrition.class but it seems to not be there.
Unless you're willing to shell out cash your other options is to hope someone really likes your idea or you make it yourself. ๐คทโโ๏ธ
I have caught that cheese too, watch tv, die, and then just watch tv episodes again.
Iโm pretty sure that the progress in recorded media and books should be save-able though
Consider the following. These people spend dozens of hours, even days to create a mod. Do they want to make your idea? Just because you think it is cool doesn't mean they agree. If you want things made, either go through the trouble of learning how to mod and then make then yourself, or get some money and commission someone to make them. Otherwise, you're SOOL. Modding games isn't easy, it takes time, and can be extremely frustrating.
I do save it - but there's no way around people watching it first then reading
without tracking the XP itself
speaking of which, the class for XP is typed out like this right? zombie.characters.IsoGameCharacter.XP.class
Ohhhhhh, word. I figured there was some block- but that makes sense
Yeah, if they read it first it's fine
Yeah, that seems right
Hmm I can't seem to access it with the same trick as print()
local patchClassMethod = {}
function patchClassMethod.apply()
local class, methodName = zombie.characters.IsoGameCharacter.XP.class, "AddXP"
local createPatch =
function(original_fn)
return function(self, perksType, XP, passHook, applyXPBoosts, transmitMP)
print("XP TRACKING: "..tostring(perksType).." +"..XP.." ("..tostring(passHook)..", "..tostring(applyXPBoosts)..", "..tostring(transmitMP)..")")
return original_fn(self, perksType, XP, passHook or true, applyXPBoosts or true, transmitMP or false)
end
end
local metatable = __classmetatables[class]
local metatable__index = metatable.__index
local originalMethod = metatable__index[methodName]
metatable__index[methodName] = createPatch(originalMethod)
end
patchClassMethod.apply()
I can probably get away with just smashing up the TV function
hmm I feel like they changed the radiointeractions code
seems different
local function doSkill(_player, _amount, _name, _perk)
if _amount == nil or _amount <= 0 then return; end
--local curXp = _player:getXp():getXP(_perk);
local amount = 50*_amount;
--if curXp>0 then
--amount = (2 / curXp)*50;
--end
local oldXp = _player:getXp():getXP(_perk);
_player:getXp():AddXP(_perk , amount);
amount = _player:getXp():getXP(_perk) - oldXp;
--_player:setHaloNote(_name.." +"..round(amount,2));
--ISRadioInteractions:getInstance().addHalo(_name.." +"..round(amount,2));
if oldXp~=_player:getXp():getXP(_perk) then
ISRadioInteractions:getInstance().addHalo(_name, amount, true);
end
end
@ me getting in trouble w/ my gf on Christmas for accidentally coding for 6 hours ๐
I did 8. ๐
the whole thing is localized ๐ฆ
-- Be evil
(function()
doCode()
end)()
It does that too
local Interactions = {};
--Stats
Interactions.ANG = function(_player, _amount, _opIsSet) doStat("Anger",_player,_amount, _opIsSet); end -- Anger
Interactions.BOR = function(_player, _amount, _opIsSet) doStat("Boredom",_player,_amount, _opIsSet); end -- boredom
Interactions.END = function(_player, _amount, _opIsSet) doStat("Endurance",_player,_amount, _opIsSet); end -- endurance
Interactions.FAT = function(_player, _amount, _opIsSet) doStat("Fatigue",_player,_amount, _opIsSet); end -- fatigue
Interactions.FIT = function(_player, _amount, _opIsSet) doStat("Fitness",_player,_amount, _opIsSet); end -- fitness
๐ค
I was going to try and inject into interactions - but that's local too
-- Be more evil
(function()
loadstring('from_some_file_that_does_the_same_thing')()
end)()
Would you happen to know why it can't grab the class in this
local patchClassMethod = {}
function patchClassMethod.apply()
local class, methodName = zombie.characters.IsoGameCharacter.XP.class, "AddXP"
local createPatch =
function(original_fn)
return function(self, perksType, XP, passHook, applyXPBoosts, transmitMP)
print("XP TRACKING: "..tostring(perksType).." +"..XP.." ("..tostring(passHook)..", "..tostring(applyXPBoosts)..", "..tostring(transmitMP)..")")
return original_fn(self, perksType, XP, passHook or true, applyXPBoosts or true, transmitMP or false)
end
end
local metatable = __classmetatables[class]
local metatable__index = metatable.__index
local originalMethod = metatable__index[methodName]
metatable__index[methodName] = createPatch(originalMethod)
end
patchClassMethod.apply()
local class, methodName = zombie.characters.IsoGameCharacter.class, "Say"
``` Works
I would have done more too ๐ญ I was so hyped. I got my testing code fully functional, so I now have a constructor module to instance my tables, and rigged an OnEat function to reference those tables based on mod data attached to the item. Got it fully operational yesterday, so now my drug mod is going to be flying through on progress haha
Nice. I'm glad to see that level of enthusiasm and determination.
๐๐ป๐ธ
It's hard to keep that though.
Haven't seen many modders like that over the past 20 years of my modding.
For sure- it really helps having others to work with. I have hit so many walls, especially on small dumb things that I wouldnโt have caught for hours- but between this community here and my teams help, itโs been so much fun
I accidentally typed item.getModData() instead of item:getModData(), and that alone put me on my ass for like 3 hours ๐ IDE didnโt catch it
Yup. I use Typescript to avoid that silly problem. ๐
Tbh I didnโt understand much about coding, or anything about lua before jumping in. So I have mostly just self taught by digging through the main code base, and referencing others projects, (And plenty of help from others). So idrk the advantages / disadvantages of different systems. I started my coding in Notepad++ ๐
I prefer VSCode, but now I mostly use IntelliJ for the decomp
I wonder if I should attempt Base64 decoding textures like is supported on real CSS for images..
function ISRadioInteractions:getInstance()
if instance ~= nil then
return instance;
end
local channelLog = {};
local interactLog = {};
local interactions = {};
local cooldowns = {};
local self = {};
local noHalo = {};
local currentPlayer;
``` There's no way to get 'interactions' from here right?
Be careful with self.
Bug report time. ๐
it's all locked up behind local or function() dropped in define
You can get it if you assign it by overwriting the method.
Yeah this file needs a bit of a rewrite
they should be in the stack in the order they were declared
im probably doing it with the crafting menu
Good candidate for that community patch
we really gotta get on that
and the fast ui libs i need for the menu rewrite are a prime candidate too
If I overwrite the file do I need to worry about the functions it drops into Events?
what do you mean
Events.OnGameBoot.Add(function() ISRadioInteractions:getInstance(); end);
also the instance itself
local function Init()
Events.OnDeviceText.Add( self.OnDeviceText );
Events.OnTick.Add( self.OnTick );
when you override the file the original one doesnt get executed at all if thats your concern
yeah that's what I was worried about
the game first puts all files into a list
if a file has the same path/name it replaces it in the list
All the potential xp gains are openly accessible in lua, if you can access the lines theyโve listened too you should be able to reference it yourself
I doubt many other mods mess with this file - I feel a little less apprehensive
XP gains are a bit randomized
Can't reverse calculate it
if other mods do mess with it its probably hooks or overwrites
and since you replaced the original they would do that on top of yours
so no issues
Does the community thing have a tip-jar?
I'd put in some work if that were the case. xD
ill have to take a look at what was made back then
Any of yall know if there is a way to mess with the rates of player variables? Like, instead of directly increasing thirst, emulating something like the high-thirst trait? Endurance recharge/decrease rate, hunger rate, etc?
@sour island wasnt it you who did a rework of hunger and stuff
he did the calorie rework
Ye
I translated the java to lua for calories and calculated the difference
I think calcStats has a hook as well as the event
so you can overwrite the calculation entirely
but you then have to replace everything
that's why I went with the calculate approach
and why I don't want to calculate XP rates from TVs when you have multiple multipliers lol
Although if I can hijack the addXP like I did with say
I wouldn't have to overwrite an entire file lol
Hoping I can find a way to do border-radius stuff with CSS using PZ drawing API.
I need to draw circles or partial.
I can access the character class but not the XP
Anyone familiar with the __classmetatables stuff?
it works ๐คทโโ๏ธ
$ seems to be the symbol for subclasses or whatever java calls them
intelliJ absolutely hates it lmao
Kahlua stuff.
Oh yeah if you want to dive into Java internal stuff..
$ <- Anonymous stuff for classes. # for method.
Check out JavaDocs.
You use # to point to methods in docs stuff.
se.krka.kahlua.vm.KahluaException: Skill Recovery Journal XP.lua:6: unexpected symbol near "$"
nvm, doesnt work - just manages to load
How do I access that then :\
that's what it refers to the class as
making it a string doesn't work
is there a way to grab light level around player? either in tiles next to player or general light level? idk how lightning works in the game, any pointers on what to look for in javadoc?
ok closest thing related to measurable light i found is this
print("Night Strength: "..getClimateManager():getNightStrength());
doesnt account of light like lamps and shit
but at least tells me how dark it is outside
I think squares have a light level
how do I get darkMulti from square though?
https://zomboid-javadoc.com/41.78/zombie/iso/IsoGridSquare.Lighting.html
Javadoc Project Zomboid Modding API declaration: package: zombie.iso, class: IsoGridSquare, class: Lighting
oh was looking at wrong place
it's getDarkMulti
it takes int as argument though

Is int perhaps the.. Height layer to grab the dark multiplier from?
Uncertain how the z-levels are implemented, honestly.
Could also be vertex ID, in case the game has vertex-based light/darkness.
print(XP.class)
If it is the vertex-based light level, you can average darkMulti from 0-3
How do I select a square I want based on it's coordinates?
looking thought https://zomboid-javadoc.com/41.78/zombie/iso/IsoGridSquare.html and my smoll brain can't figure it out
there are methods like getS() and getE() that return squares
but like there are 4 of those and they take no arguments?
each square has x y z fields
and you can get those with methods
but i want to get square based on coordinates, not get coordinates based on square
ah think i found something https://zomboid-javadoc.com/41.78/zombie/iso/IsoGridSquare.GetSquare.html
getSquare(x,y,z) is global function
@dull moss
it returns nil if square is not loaded
cheers, was about to go dig why inteliji doesnt suggest it
I assume isCanSee(int int1) returns true if player can see it right now? what's the argument?
ID maybe?
correct. and it takes the player id. I found the following example in the foraging on getting a square relative to the player too:
if square and square:isCanSee(self.player) then ....```
oh that's gonna be helpful, thx
is there efficient way on checking cells that player can see?
how does that work getGridSquare(plX + x, plY + y, plZ)
i mean i get it takes position relative to player
but is this whole block ran in a loop that grabs squares around player ? that'd be inefficient
Yup, its searching in a radius around the player. Found in: lua/client/Foraging/ISSearchManager.lua
the x and y are the offset up to the radius
I see, thanks
hm
I think I have an idea how to write custom function that catches cone of player vision so you dont have to check whole area in radius 
today on "Optimizations that nobody cares about"

pardon me for butting in
D:
anyway
there is this mod, that allows player to do naruto run without consuming stamina
the code is something like this
require "ISUI/ISEmoteRadialMenu"
local ISEmoteRadialMenuinit_old = ISEmoteRadialMenu.init
function ISEmoteRadialMenu:init()
ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"] = {};
ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].name = getText("IGUI_Emote_AuthenticAnimationsExtra");
ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = getText("IGUI_Emote_Naruto");
ISEmoteRadialMenu.icons["Sprint002"] = getTexture("media/ui/emotes/Naruto.png");
end
is it possible to create a patch to disable this naruto emotes? if so, how do I start?
just disabling it the GUI should be pretty good patch
do I need to use ```lua
local activeMods = {}
local activeModIDs = getActivatedMods()
for i=1,activeModIDs:size() do
local modID = activeModIDs:get(i-1)
activeMods[modID] = true
end
can't you just catch it with if getActivatedMods():contains('NarutoRun') then end or whatever ID is
oh its from authentic animation and in the mods it has tons other animation packs
ye but you still can catch it with my option, no?
oh?
Doing it that way would fully disable the AuthenticAnimation mod afaik. You'll have to edit the ISEmoteRadialMenu available options to remove this entry I would think.
no it wouldnt?
he's supposed to put his code between then and end
that patches whatever he wants to patch
and then make sure his patch loads after whatever he's patching
I somehow combined his snippet and yours in my brain into some mess. You are correct in that you are just checking for the mod's existence.

I've had way too much caffeine.
hmm I apologize, I kinda need some help on this
I just learned that the CSS casing used for property names is called kebab-case.
That's flipping cool.
so if I make something like this
local activeMods = {}
local activeModIDs = getActivatedMods()
for i=1,activeModIDs:size() do
local AuthenticAnimations = activeModIDs:get(i-1)
activeMods[AuthenticAnimations] = true
then stuff here
end
All good. If you need help with modding, this channel is here although people may not reply quickly.
thanks!
local activeMods = {}
local activeModIDs = getActivatedMods()
for i=0,activeModIDs:size() do
local AuthenticAnimations = activeModIDs:get(i)
activeMods[AuthenticAnimations] = true
then stuff here
end
You can set i to 0.
I need to figure out what to put at "stuff here"
Yeah. What stuff do you want to do?
basically removing the submenu for naruto running
ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = getText("IGUI_Emote_Naruto");```
which function should I use to remove the sub menu?
as in patching the previous mod
you could try simply overwriting it with empty string, see how it goes
a moment, im looking for overwriting function
You should be able to just do = nil in order to remove a table entry.
oh?
ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = nil; ought to just remove that entry, assuming the EmoteRadialMenu doesn't expect a certain number of entries or anything.
In Lua, this is equivalent to something like Map::remove(key) in Java.
oh interesting
or delete table.entry in JS.
^Or that, yep ๐
๐ฎ
As best I can tell, Lua doesn't ever store a nil for you. Nil isn't a storeable value. Instead nil is the absence of a value, thus setting something to nil means you are unsetting it.
I meant to ask - does this mean the class should just be XP.class?
require "ISUI/ISRadialMenu"
require "ISUI/ISEmoteRadialMenu"
local activeMods = {}
local activeModIDs = getActivatedMods()
for i=0,activeModIDs:size() do
local AuthenticAnimations = activeModIDs:get(i)
activeMods[AuthenticAnimations] = true
then ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = nil;
end
should this work?
I think the then in there might cause an issue, but not sure.
hmm
I think you meant something else, but not sure, your activeMods here is just a lot confusing to me.
local checkedSquares = 0;
local squaresVisible = 0;
local square;
local plX, plY, plZ = player:getX(), player:getY(), player:getZ();
local radius = 20;
for x = -radius, radius do
for y = -radius, radius do
square = getCell():getGridSquare(plX + x, plY + y, plZ);
checkedSquares = checkedSquares + 1;
if square and square:isCanSee(???) then
squaresVisible = squaresVisible + 1;
end
end
end
print("Checked squares: "..checkedSquares..", visible squares: "..squaresVisible);
``` yea fuck knows what argument you need to pass to isCanSee, tried player, didn't work
Normally you'd check and require a mod by using something like this:
if getActivatedMods():contains("ItemTweakerAPI") then
require("ItemTweaker_Core");
end
@young grotto
Did you check the Java source, yet?
I see
you mean foraging or something else?
In IsoPlayer.java you can see that the expected integer is the PlayerIndex. You can get this value by using getPlayerNum on IsoPlayer.
basically what I want to do is to patch that single line above from Authentic Animation mod, making players unable to pick naruto running
however, I am not too sure which function should I use
how'd you find that one?
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
Just made this code.
kebab-case to camelCase conversion. ๐
Try using getActivatedMods():contains("AuthenticAnimations") in an if (or whatever the mod id is of Authentic Animations) first.
Then when that mod is available, you can use a line with
require "ISUI/ISEmoteRadialMenu" (and whatever file then adds "AuthenticAnimationsExtra" as a key to that)
And finally you can do the = nil part.
I just decompiled the source code as per the instructions by Konijima on the PZ-Libraries GitHub. https://github.com/Konijima/PZ-Libraries
my mod ideas will never happen
I see, lemme try
Then I searched in zomboid.jar for "isCanSee" looking for the definition, and looked at usages of the method.
First check the Lua, then when it becomes clear it is a Java method, check the Java ๐
Are you looking for something very specific in the method or the method parameters?
params
๐
ok I maybe not using this correctly but
where exactly you found its params?
am I looking in wrong place?
No you're in the right place.
/**
* Method Parameters:
* - (int arg0): boolean
*/
isCanSee(arg0: number): boolean;
Ctrl+Click isCanSee in the code and you can see users. I thought the updateLOS method in IsoPlayer.java sounded very promising, so I looked there.
The ISSearchManager I gave earlier uses self.player, which it creates from _character:getPlayerNum()
I've also done:
return pSquare
end```
Which does work
OH THE INTEGER IS FOR SPLITSCREEN 
so from there you just try to find what it takes as argument?
I just realised. It's to determine which of the local players can see the square.
I really need to get that 3rd-party documentation thing completed.
Yeah, looking at the usages of isCanSee, you're looking for an argument that's really good at just simplifying things. In IsoPlayer, it was directly a call to getPlayerNum() so that was easy.
had to reinstall my inteliji cuz mine was 2021

and tutorial was for 2022 and i had slightly different menues
so i just reinstalled to have smae menues as in tutorial
did all from 1st try, 
Oh. I mean't a program I made for Typescript docs.
Basically my way of saying "Why not just document it myself...".
Is this for use with that TypeScript to Lua transpiler?
Yeah.
The program also contains the Lua-2-Typings transpiler / generator thingy. xD
I do like the idea of stronger typing.
Gotcha, that's neat. The transpiler isn't for me but further documentation will be helpful to a lot of people, I'm sure
my man just turned to dust
Yeah. It's there to help beginners and people like me. ๐ People who are seasoned here don't need it.
it works 
LOG : General , 1672082682440> Checked squares: 1681, visible squares: 7
LOG : General , 1672082683074> Checked squares: 1681, visible squares: 7
LOG : General , 1672082683690> Checked squares: 1681, visible squares: 7
LOG : General , 1672082684323> Checked squares: 1681, visible squares: 7
LOG : General , 1672082684940> Checked squares: 1681, visible squares: 9```
Nice.
Perhaps a bit more than we needed to see, but 
@fast galleon ty homie
Ding ding ding.
local patchClassMethod = {}
function patchClassMethod.create(original_function)
return function(self, perksType, XP, passHook, applyXPBoosts, transmitMP)
print("XP TRACKING: "..tostring(perksType).." +"..XP.." ("..tostring(passHook)..", "..tostring(applyXPBoosts)..", "..tostring(transmitMP)..")")
return original_function(self, perksType, XP, passHook or true, applyXPBoosts or true, transmitMP or false)
end
end
function patchClassMethod.apply()
print("SkillRecoveryJournal: accessing class:`zombie.characters.IsoGameCharacter$XP.class` method:`AddXP`")
local class, methodName = XP.class, "AddXP"
local metatable = __classmetatables[class]
--print("__classmetatables : "..type(__classmetatables)) for k,v in pairs(class) do print(tostring(k).." - "..tostring(v)) end
local metatable__index = metatable.__index
--print("metatable__index : "..type(metatable__index)) for k,v in pairs(metatable__index) do print(tostring(k).." - "..tostring(v)) end
local originalMethod = metatable__index[methodName]
metatable__index[methodName] = patchClassMethod.create(originalMethod)
end
patchClassMethod.apply()
You can do this to overload exposed functions
Overlap?
overload - same as with Lua when you store the original function and apply changes before returning the original
credit to @hearty dew ๐ showed me how to do it for Say()
Overloaded functions let you call one function and have it dispatch to different implementations based on the argument types. C++ and Java have support for this at the language level; in Lua you can roll your own at runtime:
Ooh, you're overloading a Java method?
Yeah, well - decorating it
you can grab it - change arguments as needed - and pass it on
What's the purpose for doing that? (Debug mode only)
Wait it only works in debug?
Reflection methods are only exposed if the game is in debug mode.
Otherwise it'd be a huuuuge security risk.
Truth :c
Trust me. (The anti-cheat guy)

aw man
I'm sorry to bring you down @sour island. This is why I core-mod.
I have a core client mod that is a bundle of all my goodies and tools to improve on the game & API.
It's like the same idea you guys had for a community library.
If you want to contribute to that I wouldn't mind putting that in. I plan to release it sometime soonish so I can get back to modding shaders via Lua.
local activatedMods = getActivatedMods()
if activatedMods:contains("AuthenticAnimations") then
require "ISUI/ISEmoteRadialMenu"
require "ISEmoteRadialMenu.lua"
ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = nil
else
print("AuthenticAnimations mod is not activated")
end
not sure if this is correct
[Skill Recovery Journal] XP TRACKING: Doctor +5 (nil, nil, nil)
still works outside of debug mode
๐คทโโ๏ธ
@jagged ingot
he's only changing calls from lua
Don't do the = true thing, you're overwriting what's in there that way 
Ah okay. I thought he was deeply editing it.
This is actually good news. I'm tempted to try that same strategy for my XP tracking - that way I can track XP earned above level 10 and store more in the diary.
That's good to hear.
I apologize, I'm still learning in lua. Do I remove = true thing completely?
Makes me happier to do it this way than overwriting the radio interactions
I'll have to rewrite most of the mod now tho
(Was referring to this)
if (Core.bDebug) {
try {
this.exposeMethod(Class.class, Class.class.getMethod("getName"), LuaManager.env);
this.exposeMethod(Class.class, Class.class.getMethod("getSimpleName"), LuaManager.env);
} catch (NoSuchMethodException var3) {
var3.printStackTrace();
}
}
Yeah the whole line.
you can read fields out of debug - I think writing is what doesnt work
if (Core.bDebug) {
this.setExposed(Field.class);
this.setExposed(Method.class);
this.setExposed(Coroutine.class);
}
ye
Yeah because Class<? extends Class> isn't exposed.
Tyrir is god level wizzard
@bronze yoke I figured out why I was so confused about whether or not that function was working to remove collision of the trees. @ancient grail
so my final code would look like this
local activatedMods = getActivatedMods()
if activatedMods:contains("AuthenticAnimations") then
require "ISUI/ISEmoteRadialMenu"
require "ISEmoteRadialMenu.lua"
ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = nil
else
print("AuthenticAnimations mod is not activated")
end
It takes several seconds for the tree to disappear as a collider / shadow-caster, and I may have to step a square or two away from the tree as well.
Eventually the collision detection goes away, but for at least 5 seconds of walking around I can continue colliding with it. But it DOES go away; after extensive testing, I can confirm that after a certain amount of time and/or movement, the position of the tree no longer collides with me
Correct ๐
So some kind of refresh event must be periodically occurring that calculates nearby collision possibilities periodically on the basis of what objects exist in what squares...
ah thanks, aight gonna try the code at lua/client
That should be the right place.
@ancient grail You'll also want to read my last few messages. Maybe you can think of why this happens or find someone who knows.
@sour island Hello I was studying your mod on calories and had a question. First off thanks for making it, I was wondering do you know where the calorie multipliers are at in the base game? I'm new to modding and wanted to modify them but can't seem to find them in the PZ files and I dont see them in the nutrition.class file. I thought you might know from your experience with the calorie mod. The ones that list out as:
Spritning: 1.3x
Running: 1.0x
Walking/Sneaking: 0.6x
Any help would be appreciated.
U mean this one?
I notice you do not use square:RemoveTileObject(obj); like I do... you found obj:getSquare():transmitRemoveItemFromSquare(obj). I wonder how much of a difference in behavior there is here.





