---values and methods taken from `zombie\characters\BodyDamage\Nutrition.java`
---Values from vanilla (41.78)
local caloriesDecrease = {}
caloriesDecrease.Exercise = 0.13
caloriesDecrease.Sleeping = 0.003
caloriesDecrease.Normal = 0.016
---additional rates
caloriesDecrease.Sitting = caloriesDecrease.Normal*0.66
``` listed at the top of the mod
#mod_development
1 messages · Page 70 of 1
public final class Nutrition {
private IsoPlayer parent;
private float carbohydrates = 0.0F;
private float lipids = 0.0F;
private float proteins = 0.0F;
private float calories = 0.0F;
private float carbohydratesDecreraseFemale = 0.0032F;
private float carbohydratesDecreraseMale = 0.0035F;
private float lipidsDecreraseFemale = 7.0E-4F;
private float lipidsDecreraseMale = 0.00113F;
private float proteinsDecreraseFemale = 7.0E-4F;
private float proteinsDecreraseMale = 8.6E-4F;
private float caloriesDecreraseFemaleNormal = 0.016F;
private float caloriesDecreaseMaleNormal = 0.016F;
private float caloriesDecreraseFemaleExercise = 0.13F;
private float caloriesDecreaseMaleExercise = 0.13F;
private float caloriesDecreraseFemaleSleeping = 0.003F;
private float caloriesDecreaseMaleSleeping = 0.003F;
private int caloriesToGainWeightMale = 1100;
private int caloriesToGainWeightMaxMale = 4000;
private int caloriesToGainWeightFemale = 1000;
private int caloriesToGainWeightMaxFemale = 3000;
private int caloriesDecreaseMax = 2500;
private float weightGain = 1.3E-5F;
private float weightLoss = 8.5E-6F;
private double weight = 60.0D;
private int updatedWeight = 0;
private boolean isFemale = false;
private int syncWeightTimer = 0;
private float caloriesMax = 0.0F;
private float caloriesMin = 0.0F;
private boolean incWeight = false;
private boolean incWeightLot = false;
private boolean decWeight = false;
I have no clue what the diff is but aslong as the sledge works for me then im fine with using it
Is the cause for the colider to remain ? Cuz i doubt
Anger. Very anger..
Lua by default does not support RegEx.
Going with a lib I found.
Thanks, I did see your note there on the nutrition.java file (same as nutrition.class file right). Excuse me for being noobish, but I studied that file and didnt see those numbers 1.0, 1.3, .6 etc, listed anywhere. do you know if they are instead being deduced from some other calculation?
There is a valid reason for this given in the LuaDocs though:
Unlike several other scripting languages, Lua does not use POSIX regular expressions (regexp) for pattern matching. The main reason for this is size: A typical implementation of POSIX regexp takes more than 4,000 lines of code. This is bigger than all Lua standard libraries together
check the message underneath
private float caloriesDecreraseFemaleNormal = 0.016F;
private float caloriesDecreaseMaleNormal = 0.016F;
private float caloriesDecreraseFemaleExercise = 0.13F;
private float caloriesDecreaseMaleExercise = 0.13F;
private float caloriesDecreraseFemaleSleeping = 0.003F;
private float caloriesDecreaseMaleSleeping = 0.003F;
The rates were different at one point
I see, how do those values, sprint 1.3, run 1.0, and walk .6, derived from those?
No
This
Is odd
I still need to try your remove functions but had to go AFK for a minute and may not be able to take a look for a little while
Will update you when I do
Yeah. Wishing TIS would forward regex from Java.
That'd be helpful.
Someone made that library for Lua so I'm going to write typings for it.
They're kind of arbitrary in the java
actually yeah i see them now further down, cool thanks
Copy that
Out of curiosity what kind of pattern are you hoping to match? Might be a relatively concise solution for your unique situation that would greatly reduce mod size. Maybe not but figured it's worth considering.
I build out of libraries for PipeWrench so having it would be useful elsewhere too.
seems like im getting this issue
ERROR: General , 1672084719443> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: AuthenticAnimationsExtra of non-table: null at KahluaThread.tableget line:1689.```
```lua
local activatedMods = getActivatedMods()
if activatedMods:contains("AuthenticAnimations") then
require "ISUI/ISEmoteRadialMenu"
require "ISAuthAnimEmoteRadialMenu.lua"
ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = nil;
ISEmoteRadialMenu.icons["Sprint002"] = nil;
else
print("AuthenticAnimations mod is not activated")
end
const UPPER_REGEXP = '/^[A-Z]+$/';
What r u trying to do
I could do charCodes of 65 to 100.
Seems primitive and not something I want to do.
Ehh fine. You win.
It would seem like the menu item "AuthenticAnimationsExtra" is not added in any of the files you've put as require
Or more likely, you didn't require the AuthAnimEmoteRadialMenu file because you accidentally added .lua at the end 😛
I'm trying to create a patch for Authenthic Animation to remove naruto run
basically changing this line
ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = getText("IGUI_Emote_Naruto");
to nil
OH!
k, inteliji question, anyone knows how to disable it auto-finishing my functions? I disabled everything in code completion and it still completes it
it's annoying

U can just feed it with the same xml file
Filename and just change the animation on it
I know why cuz it can exploit endurance
I have the same issue with auth anim
encumbrance endurance and injury
Right?
No same name and same animation name
Or the string name i think i fogot aslong as its not pointing to that run animation of vanilla
If u can send the xml code here i can help u further
Someone knows what 'getCore()' does?
ah my bad
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="looped.xml">
<m_Name>Sprint002</m_Name>
<m_AnimName>Zombie_Sprint02</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_BlendTime>0.30</m_BlendTime>
<m_Conditions>
<m_StringValue>Sprint002</m_StringValue>
</m_Conditions>
<m_SubStateBoneWeights>
<boneName>Dummy01</boneName>
<weight>2.5</weight>
</m_SubStateBoneWeights>
</animNode>
@thick karma
const A_Code = `A`.charCodeAt(0);
const Z_Code = 'Z'.charCodeAt(0);
/**
* @param s The string to test.
* @returns True if the string contains any upper-case letter.
*/
const containsUppercase = (s: string): boolean => {
if(s == null || s.length === 0) return false;
for(let i = 0; i < s.length; i++) {
const a = s.charCodeAt(i);
if (A_Code <= a && a <= Z_Code) return true;
}
return false;
};
const camel = 'camelCase';
const kebab = 'kebab-case';
console.log(containsUppercase(camel));
console.log(containsUppercase(kebab));
Unhave to create another xml file with the same name located on the same folder of that file... But it should be modified..
Change the m_AnimName instead of Zombie_Sprint02 change it something else
oh I see, just replacing it and load it after
Anything u want . It doesnt have to exist but if u want u can check out the vanilla emotes to find animations u can use
That eill remove the zed run animation but it will still show naruto run
But atleast this solution solves your problem right
Let me know if it worked
Hi all, got a quick question, I'm looking at creating a profession/trait, but I wanted to create my own trait, I can find the location of professions in the game files, but not where the traits are, any ideas?
deadbody AnimSet is hard-coded? apparently his xml never is loaded
/media/lua/shared/NPCs/CreationMethods
or whatever the name
Yeah that's where I'm looking but I can't find where to see what a trait actually gives you in-game
local fisher = TraitFactory.addTrait("Fishing", getText("UI_trait_Fishing"), 4, getText("UI_trait_FishingDesc"), false);
fisher:addXPBoost(Perks.Fishing, 1)
fisher:getFreeRecipes():add("Make Fishing Rod");
fisher:getFreeRecipes():add("Fix Fishing Rod");
if you mean traits that actually do stuff (aka trait logic) it is indeed scattered around
Did it work
Would there be a way to not scatter the traits effects? Asking hypothetically. It would be nice not to scatter it but you'll have to scatter something.
it sorta works, I replaced the xml with this
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="looped.xml">
<m_Name>Sprint002</m_Name>
<m_AnimName>Bob_EmoteVomit</m_AnimName>
<m_BlendTime>0.30</m_BlendTime>
<m_Conditions>
<m_StringValue>Sprint002</m_StringValue>
</m_Conditions>
<m_SubStateBoneWeights>
<boneName>Dummy01</boneName>
<weight>1.0</weight>
</m_SubStateBoneWeights>
</animNode>
``` but then it asks for looped.xml inside the folder too so I added that.
Now when I click it, it didnt do anything
huh neat
Yes
nice
I've been using them to avoid if variable then spam
thank you so much my good man!
In how many different files are they scattered, and is there a standard place I should be placing my custom ones?
The effects are scattered all over you'll have to search for hasTrait()
usually you place 90% of your luas into lua/client
Your effects can be leveraged from one file but you may need to require() some vanilla files
Ok brilliant cheers all
Really depends on what you'd want
Well I'm planning on doing something where you take damage depending on certain circumstances like being inside for example
Or take more damage from certain things
What variable are u going to modify for that to work?
I think the dmg dependends on source of dmg not by reciever
So unwould have to revamp the system
101% in shared 😂
But im not sure

I'm also share-heavy.
I code using the "utility-first" approach.
I yeet everything in client since i mostly work with traits and they are all client-sided
Code should be where the vanilla code is if you're leveraging any of it
@agile vigil shared folder lol u might be right
Client for UI for example
It works now? 🙂
Not yet im afk . Hehe im just tagging u cuz of the convo abt the shared folder
vanilla files are always loaded first iirc
Ah 😄
Shared would be actually pretty rare tbh - but there's a few stuff stuck in there to act as a means to validate between client/server
Yes but you can't access client vanilla code if yours is in server
U shared heavy too?
In @ancient grail and I's case, we have code that changes what Parts a vehicle has. Sounds like the perfect case of Shared 😄
I threw everything in shared when MP hit and it was a mess
Im about to go back to the pc and check 🤞
dont think ive ever used it
Again, if the vanilla code you refer to is shared by all means -- also if you need the same functions in both client/server
Ow
i code in a way where client and server logic is split
This is the way
well some stuff ive had to because thats where vanilla has it
arent distros in shared?
so yeah ive had to but actual code i split
They are, I think some stuff got put in shared for anticheat
Well i guess its up to the modder then... Since we have a split
Poltergeist deltamango shared
Chuck browser vanilla
You're going to run into issues dumping everything in shared lol
Why does it have to be mutually exclusive?
ISUI has no place in shared or server.
coordinate-manipulation utilities can be in shared.
client-server-shared is basically a way to keep code clean.
Hopefully one day we'll see a java solution much like it. 🙂
Dumping into shared works if you're only in SP tho
hopefully one day clients wont load server 🙂
They don't in MP
they do
Hopefully one day SP is simulated MP on local.
They do? I know they do if you're the host
But I thought they don't if you're a connected client
clients do indeed load server
When I host from the main menu client and server are distinct entities
which is why i highly enjoy this line of code
if not isServer() then return end
I have to do that for my code to work in SP
☝️
For some reason client commands don't fire
I use it for my mod loader.
I hate that serverCommand can fire in SP but client ones dont
Or maybe it's the other way around
But yeah even as the host and client I have to communicate between the two - I assumed connected players wouldn't be also loading server stuff
Is their server entity communicating with the host's?
The server has become more of a glorified bouncer for client-auth for a lot of things.
This is why cheats popped up when B41 Multiplayer came out.
It's way more of a hollow shell than it used to be in old MP.
It did eliminate lag bites though.. Thank god.
client and server are distinct entities, it's just that both run code from the server folder
I haven't tested with a dedicated setup only from the main menu
Seems like the distinction between server shared and client shouldn't be a thing with the new MP
Default of an hour gives me like 24 in-game mins / min, or about 0.4 in-game minutes /second.
Trying to figure out the best means to set some effects, but I don’t want to ride the onTick function unless I have to. Seems like OnMinute might be a good stand in?
Since I can’t mess with the base rates of change for hunger, thirst, or otherwise- It seems like I’ll have to supplant my own changes
use on tick to a local function i guess wont hurt
not sure but thats what i observe from most ontick
Just have a means to validate if it should run
Yeah, it just only needs to trigger if the player has taken a drug, and only while they are under the effect of it
Centralize your code to call from one tick hook.
My HTML engine will do this.
Make a bunch of really long, multistage functions that run every tick buy only check if they are valid to run at the end 🥸
I learned a thing.
I also learned that the update function hook that UIElement runs is very slow regardless of FPS & UI FPS.
I use the tick hook to fix this.
That's why my animations are super smooth.
If you instantiate a UIElement object, pass a table with update(), prerender(), render(), and onResize(width, height) defined.
I was kind of surprised render is called every few ticks
Is it common practice to call rendering that fast?
Depends on what you're rendering.
TIS probably didn't plan on doing animations to their UI in the way that say I am with my tech demo so that's no surprise.
Yes because it runs on the render thread.
Should I be using label and their text instead of my UI has unchanging text?
It's a draw command. It isn't stored anywhere. All it does is send info to the SpriteRenderer used to render the UI that's then dumped when executed at the next tick.
All you need to do is ensure that method is fired every render.
My CSS implementation allows for you to do it the way you're thinking of doing it with the option to also add code for every tick.
Just concerned I'm rendering stuff needlessly
But I didn't see a way to add text as it's own thing.
Nope. As long as you call it once for every render tick, you're doing what you're supposed to do.
Hmm
update isnt commonly used
That's what I had assumed.
all the drawing and therefore animations would be done in one of the renders
i guess having a lower ticking function is also useful
It's not easily known to the end-user though.. that's the issue I have with it.
wish I had Chuck's error output mod for Minecraft right now
keep in mind time based events change their period with day length
Yeah… I’m aware :( just don’t know a good stand-in otherwise. Ideally, I would run a function ontick, but only for a set amount of time, starting it through a function. Ideally I wouldn’t set it through the onTick at all, but idk any other way
Like- if I could just have something run on tick for a predetermined timeframe, and not have it check/run that constantly that would be incredible
You can
Oh?
Any chance you have more info on that? 🙏🏻
you add event and then remove it
function everyTick()
-- code here
if xyz then
Events.OnTick.Remove(everyTick)
end
end
function func1()
if abc then
Events.OnTick.Add(everyTick)
end
end```
something like this should work
Oh… holy shit… I love you 😂
i think
Thank you
havent tried myself removing events yet
I mean, if it works- that would be a godsend. It would make so many things easier haha. I figure I could have a counter in there of sorts too, so it would know when to shut itself off
ye in moddata
Dope
mmmm
I have more CSS rules implemented now.
To do with background-image and background-repeat
Yeah I want something to only trigger on consumption, and for it to fire ontick. So I need a way to create that, without it constantly riding the OnTick event and bloating that 😂 so if I can make a way to create the event and remove it after the effect is over, that would be great
that will work, you're only using ontick while its active, so as long as "xyz" isn't an expensive operation it should be fine
i prefer sticking to everyMinute if i need something real-time-ish
you dont need to have tick accuracy on buffs/debuffs
^
Most mods do not need a fast event to hook.
My stuff is very special in this case. It has to have it.
For sure, but for some UI things I will probably need it. For the stat stuff I will probably use the same functionality but for every minute
just put everything onto OnTick, essentially all other events are just variations of OnTick anyway

All my code now triggers on tick, runs the entire code, and only checks for its exit conditions at the end of the code 
run it twice per tick just to be sure

all my code is now generated with a function running ontick
of course it is also executed on that tick
but dont worry i wont leave all those generated objects lying around
i shall trigger a gc cycle along with it too

I actually have my code outsourcing itself to an AI chat bot, which write the code for me, then inputs it back into the system, and fires it, all within every tick :)
also ofc all my stuff is global so i can access it

actually a very talked about thing
was recognized it was a mistake making things global by default
Personally, I make sure to name all of my global variables really uniquely to make sure nothing accidentally messes with them. Things like x, y, z, var1, var2, player, etc. really helps keep all of my variables super transparent :)
I was going to say make a boolean that flags off and on every number of ticks
I love this
can't believe discord didn't even try to make it visible, lmao

Thankfully I’m on my phone so I just zoomed lol
DC doesn't want any of that bullshit
🥸 I have 0 experience… Ive just been absorbing information whenever I can, and asking a lot of questions
Hell yeah 😎
That's still me
Chuck and albion are biggest gigachads in this channel
Ok Mr. 

Damn..
were just not good enough
There's always someone more knowledgeable than you about something
Delta and Browser really getting the short end of the stick here 😭 no love
And several dozen people will always beat 1 very smart person
I just molested them with like 120 questions last week so that's the origin of my statement
If not in work output, at least physically
you see the difference is to talk to us you gotta
us a question
Time doesn't count as experience however I've been around since 2014.
i will not apologize

honestly love how open the community here is to collaboration and helping out others
The veteran badge looks like a bumblebee I kind of wish I had the axe
Axe is cool ngl
never figured out how you get it is it just messages sent or a combo with how long youve been here?
I want the katana
is katana after axe?
guessing its just messages for me to still be axe
ye I think so
Both Katana and Axe cool tbh
So- if I just post all of my code snippets one line at a time… 👀
see thats where youre going wrong


On character at a time 😂
If you press beautify twice at the same time this happens
It’s like when William J. Runnings accidentally walked twice at the same time in 1845. Humans have been running ever since
Anyone knows how you can turn an IsoObject into an IsoThumpable?
indeed
local square = object:getSquare()
--triggerEvent("OnObjectAboutToBeRemoved", object)
square:transmitRemoveItemFromSquare(object)
local properties = object:getProperties()
local newObject = IsoThumpable.new(object:getCell(), square, object:getSprite():getName(), properties:Is("collideN"), nil)
newObject:setBlockAllTheSquare(properties:Is("collideN") and properties:Is("collideW"))
newObject:setIsThumpable(properties:Is("collideN") or properties:Is("collideW"))
newObject:setContainer(object:getContainer())
for i = 1, object:getContainerCount() - 1 do
newObject:addSecondaryContainer(object:getContainerByIndex(i))
end
square:AddSpecialObject(newObject)
newObject:transmitCompleteItemToServer()
couldnt i just call setThumpable if i already get an IsoObject?
dont see that function anywhere
Javadoc Project Zomboid Modding API declaration: package: zombie.iso, class: IsoObject
Ah misread setIsThumpable as IsoThumpable
Btw does the call .instanceof() get me IsoObject if i call it on my original object?
Like object.instaceof(IsoObject)?
Wheeee
Would be cool if there was a DrawTexture call that could allow for every possible transformation.
I need something like that soon, lest I generate new temp rotated textures...
Inventory Tetris is coming along nicely
Ground remains a list, because I can't really make that a grid
Very neato.
Would be cool if the 3D item could be rendered in the UI.
(I think you can?)
Not sure how the vehicle mods do it.
Maybe they render it to a frame texture and just do that.
I'll look at making <img /> elements tomorrow.
I'll probably add a custom CSS rule for rotations.
but that many 3d models for a ui?
If one could render the item and cache it to a texture then yes.
think the game already does that
if you're going for realism, you could also remove character inventory.
Lots left to do, its probably gonna be a few tiny separate grids
like the Tarkov pockets
Equipped items will not take space
Oh.. Oh no.
I just thought "I should make my own canvas engine"..
I'm thinking that I'll need to write dynamic CSS stuff to a texture image and then load it in.
nice
Thanks man but im not gonna use it it breaks my whole system that ive built
what does it break
hmm is there something to call from methods to get the this?
function patchClassMethod.create(original_function)
return function(self, perksType, XP, passHook, applyXPBoosts, transmitMP)
print("XP TRACKING: "..tostring(perksType).." +"..XP)
--.." ("..tostring(passHook or true)..", "..tostring(applyXPBoosts or true)..", "..tostring(transmitMP or false)..")")
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]
local metatable__index = metatable.__index
local originalMethod = metatable__index[methodName]
metatable__index[methodName] = patchClassMethod.create(originalMethod)
end
patchClassMethod.apply()
I guess I could use getPlayer() but I honestly hate that for the fact I don't know which player it grabs in co-op
anyone can save me few rounds of testing and tell me few details on ISInventoryTransferAction:perform()?
Does it perform action technically separately for each entitiy? I'm trying to count amount of items and weight moved by character.
for i,item in ipairs(queuedItem.items) do
self.item = item
-- Check destination container capacity and item-count limit.
if not self:isValid() then
self.queueList = {}
break
end
self:transferItem(item);
end
^ part of original code that moves items, from my understanding. I'm not sure with how it works, is it a table, is it on item per item basis? 
It does each mouse action
what if i select multiple items
you you let go of the mouse you can be dragging a group of items or a stack
or a group with multiple stacks
hm
Oh man that's so silly..
so If I want my stuff to count weight and item count properly i'll have to steal code from original file to see how it handles it?
function ISInventoryTransferAction:perform()
original_transfer_perform(self);
local player = self.character;
local item = self.item;
local itemWeight = item:getWeight();
local modData = player:getModData().DynamicTraitsWorld;
end```
guess it won't be so simple 
So TIS does have constructors to pass pixel data for Texture, however they removed the code for the constructors of those objects.
The other ones don't use the exposed objects.
I literally have to save a drawing of some sort to a file then read it.
Big bummer.
Alot of the UI code is some of the first converted to Lua
There's a few pitfalls where its not easy to mod or change stuff with out a facelift

Expose ImageData and TextureID, or a sandboxedBufferedInputStream.
You could do a listener for queued actions and pull the items info out there
depends what you're trying to do
I think I'm done for the day.
Its just a system ive built for a mod but it takes things from a sprite so when i use it on a worldobject it fails but not when i spawn the same object with the brush tool
actually
it works
local original_transfer_perform = ISInventoryTransferAction.perform;
function ISInventoryTransferAction:perform()
local player = self.character;
local item = self.item;
local itemWeight = item:getWeight();
local modData = player:getModData().DynamicTraitsWorld;
print("Moving an item with weight of "..itemWeight);
original_transfer_perform(self);
end```
prints out item by item
even when bulk moving
this is not probably not the best but you can probably compare the XP of player with the XP in that function
'edibles'
base game btw
TraitFactory.addTrait("Dextrous", getText("UI_trait_Dexterous"), 2, getText("UI_trait_DexterousDesc"), false);

its fine its not like they were coding it in IDE with spellcheck
that's very recent technology
released this year on all major IDEs

but does it work?

you know what would be cool
if besides require= in mod.info we could put incompatible= so game complains at users for using incompatible mods
you can do that in code
I guess I could do tests on getPlayer() and co-op before passing judgement
Better than getspecificplayer(0) which every old mod uses
ye but it wont show user in big red text "hey you using 2 incompatible mods"
Ah yes, I also like consistency, just like PZ devs
TraitFactory.addTrait("Organized", getText("UI_trait_Packmule"), 6, getText("UI_trait_PackmuleDesc"), false);

can do for the community api
?
can add something like that to the community api
a thing i thought about was downloading dependencies too
lets say im inserting my code into a base game perform function. Is there a way to stop doing that at some point? 
midgame or at least mid-restarts
you could reassign the function back to the original
elaborate pls?
local original_transfer_perform = ISInventoryTransferAction.perform;
function ISInventoryTransferAction:perform()
original_transfer_perform(self);
-- some stuff here
end```
how would one do that?
hm
I see
any way of preventing it firing in the future? 
like where can i put if in there so with next time player launches the game it wouldn't overwrite it? 
You can do an override at any time for the most part. For instance, I do this override on start only if a mod isn't enabled:
local function doOverride()
if getActivatedMods():contains('SwapIt') then print("Not overriding because SwapIt is enabled!") return end
local _ISHotbar_equipItem = ISHotbar.equipItem
function ISHotbar:equipItem(item) ... end```
So can just conditionally check for this when you do an override too.
Here is a simple example, which I have just tested.
What it does is the following.
Every time a zombie dies, it displays the player's counter.
And then, when it reaches 70, it gives him a crowbar.
local function ZombKilled()
getPlayer():Say("Zombies killed: " .. getPlayer():getZombieKills())
if (getPlayer():getZombieKills() == 70) then
getPlayer():getInventory():AddItem("Crowbar")
end
end
Events.OnZombieDead.Add(ZombKilled)
For some, it may be a bit silly.
But if you have never done anything, this example may be useful to you.
Actually, I realized that it's wrong.
Because it shows zombies - 1, so you have to add 1 to the counter.
The idea is to make a configuration file, where you can put, number of zombies and random prizes, and that can be configured to give prizes to the players, who reach a certain number.
Now yes, it was only necessary to increase the counter by 1.
hmm
I wonder if this can be used to do something I wanted to try
making unique instances of XP gains way higher
and taper down
What is inside the method, can be edited without problems, moreover, that method is called, every time a zombie dies, but you have many more events that you can use. It depends on what you want to do, but yes, you can increase or decrease the experience...
In fact, you can use a random number, and do something with it.
For example this.
local function ZombKilled(zombie)
if (ZombRand(3) == 0) then --selects a random number between 0-2
getPlayer():Say("0 came out.")
zombie:getInventory():AddItem("Crowbar")
else
getPlayer():Say("He left the: " .. ZombRand(3))
end
end
Events.OnZombieDead.Add(ZombKilled)
selects a random number between 0-2
This means that if the 0 comes out randomly, it adds a lever to the zombie, but... it doesn't always work, because it depends on whether the zombie has space or not in its inventory, but by giving it to the player, you guarantee that he will always receive the prize.
It may be, in fact, it never came out 3. You are right.
It is probably n - 1.
Correct, you always start from zero in programming. But I had forgotten.
Not really, I'm just learning.
But I know other languages.
It was a joke directed at lua, no worries

.> But there is a function
I have this function right here.
sayThis = ZombRand(4);
updatePosition = true;
if sayThis == 0 then
player:Say("Probably YOU hallucinating. You're a real weirdo, you know that?");
audio = player:getEmitter():playSound("AskMortWhatHeIs1");
elseif sayThis == 1 then
player:Say("Isn't it obvious? I'm a talking skull.");
audio = player:getEmitter():playSound("AskMortWhatHeIs2");
elseif sayThis == 2 then
player:Say("Bored of your inane questions.");
audio = player:getEmitter():playSound("AskMortWhatHeIs3");
elseif sayThis == 3 then
player:Say("Angry. I was chilling in the afterlife before you summoned me here.");
audio = player:getEmitter():playSound("AskMortWhatHeIs4");
end
Events.OnPlayerUpdate.Add(PI_AzaMusic_Update)
end```
check for typos, i made at least 15 typos in last week and thought something was broken
Try the following
function AskMortWhatHeIs(items, result)
local player = getPlayer()
sayThis = ZombRand(4)
updatePosition = true
if sayThis == 0 then
player:Say("Probably YOU hallucinating. You're a real weirdo, you know that?")
audio = player:getEmitter():playSound("AskMortWhatHeIs1")
elseif sayThis == 1 then
player:Say("Isn't it obvious? I'm a talking skull.")
audio = player:getEmitter():playSound("AskMortWhatHeIs2")
elseif sayThis == 2 then
player:Say("Bored of your inane questions.")
audio = player:getEmitter():playSound("AskMortWhatHeIs3")
elseif sayThis == 3 then
player:Say("Angry. I was chilling in the afterlife before you summoned me here.")
audio = player:getEmitter():playSound("AskMortWhatHeIs4")
end
end
Events.OnPlayerUpdate.Add(AskMortWhatHeIs)
I'm telling you, because I have not always received the player as a parameter. Then, perhaps, he does not know who to "aim".
It appears that not all events welcome the player.
Although I could be wrong, because I am still investigating.
Hmm okay
Anyway, I don't know if the method call is right.
Events.OnPlayerUpdate.Add(AskMortWhatHeIs)
I think it would have to be that way.
here for more context; maybe I missed something? I'm gonna try the changes you proposed -- but a similar format worked for my playable instruments mod
Now things may change.
Try it as you have it then. But with that change.
More than anything, in case you are not getting the player.
And for that reason, it generates the failure.
Hmm I wonder if this means my playable instruments mod is broken XD
what is 'PI_AzaMusic_Update' ?
function PI_AzaMusic_Update(player)
if (updatePosition) then
player:getEmitter():setPos(player:getX() + 0.5, player:getY() + 0.5, player:getZ())
player:getEmitter():tick()
end
end```
'No Such Function' appears as a lua manager thing - do you have the error and any stack trace?
Is 'AskMortWhatHeIs' only ran once? Cause otherwise you'd be adding that function everytime
function AntagonizeMort(items, result, player
sayThis = ZombRand(3);
updatePosition = true;
if sayThis == 0 then
player:Say("WHY DO YOU TORMENT ME MORTAL!?");
audio = player:getEmitter():playSound("MortAntagonize1");
elseif sayThis == 1 then
player:Say("JUST SEND ME BACK TO HELL! I HATE IT HERE!");
audio = player:getEmitter():playSound("MortAntagonize1");
elseif sayThis == 2 then
player:Say("YOU'RE A JERK!");
audio = player:getEmitter():playSound("MortAntagonize3");
end
Events.OnPlayerUpdate.Add(PI_AzaMusic_Update)
end```
I'm not seeing a typo...
it's the second line of this
OH
WAIT
there it is
Duh
it's always a missing parenthesis
thanks chuck
I don't think you should be adding the function every time tho
kek
once at the bottom after it's defined should be enough
@abstract raptor told you

Seems like LuaCallFrame LuaClosures aren't exposed?
Hello again @sour island , thanks for help before. I've figured what I want to do now with calories but at somewhat of a loss on how to get started. I've studied your calorie mod inside out and kind of understand what is going on (im very new to this).
I basically want to modify the 1.0, 1.3, and .6 values listed here in the nutrition.class file of the vanilla game:
var1 = 1.0F;
this.setCalories(this.getCalories() - (this.isFemale ? this.caloriesDecreraseFemaleExercise : this.caloriesDecreaseMaleExercise) * var1 * var3 * GameTime.getInstance().getGameWorldSecondsSinceLastUpdate());
} else if (this.parent.isSprinting() && this.parent.isPlayerMoving()) {
var1 = 1.3F;
this.setCalories(this.getCalories() - (this.isFemale ? this.caloriesDecreraseFemaleExercise : this.caloriesDecreaseMaleExercise) * var1 * var3 * GameTime.getInstance().getGameWorldSecondsSinceLastUpdate());
} else if (this.parent.isPlayerMoving()) {
var1 = 0.6F;
this.setCalories(this.getCalories() - (this.isFemale ? this.caloriesDecreraseFemaleExercise : this.caloriesDecreaseMaleExercise) * var1 * var3 * GameTime.getInstance().getGameWorldSecondsSinceLastUpdate());```
I don't want to change anything else except those three numerical values for the mod. Do I basically copy all of this above into the function of the new mod text file, then at the end of it, end it with Events.OnPlayerUpdate? Or is that overkill and I can do something even simpler if I just want to change those three numbers?
his mod is more complex and does a lot more with carry weight and temperature etc, I purely just want to change those multipliers
are you playing single player?
ya
then literally just edit those values in his mod and leave it be
unless mod gets update it will stay like that
that above text is not from his mod, its from the basegame nutrition.class file. I was just using his to learn the concept of how to go about approaching it, but I dont think he changes those three values in his from vanilla.
also I wanted to share the mod with some others who were interested in altered calorie burn rates
you said you want to use his mod but change 3 values
just change those values in his mod and that's it
no real need to create new mod/patch/tweak or anything
so again, its not from his mod. Im using his mod to just learn "conceptually". His mod appears to do much more such as affect carry weight and temp etc.
The approach I use is to recalculate the vanilla nutrition process - calculate my own with changes - then find the difference and only add that on
there's no way to inject directly into the vanilla nutrition process
I see. how does it know to replace the vanilla nutrition process with your calcs?
you can overwrite the entire calcstats using the luahook - but that includes hunger and thirst
It doesnt
the vanilla processes run as normal
oh and then yours modifies the final result up or down etc?
No
^
you can do the same
my mod has sandbox options for caloric burn rates
so two parrallel nutrition calcs run the, the vanilla game, and yours, and if yours is say 10 calories lower, yours reduces or adds that?
what exactly are you trying to change?
Yes
ya i saw that, I wanted to change running/sprinting and walking all differently from each other, your sandbox option is just global though I think?
It is, I can add more nuanced ones - I didn't see a point tho
I mean, if its really easy I would love you for that, adding 3 sandbox options, one for sprint, one for run, one for walk. But I am also fine trying to learn this. BTW my motivation for this was recent game changes that I think dont differentiate the burn rate of running and walking enough, hence why I wanted to change one more than the other.
Does anyone know if there is some sort of OnZombieCreate event similar to OnPlayerCreate? I'm not sure where to find good documentation for the APIs, I want to run some code when zombies are spawned or come into the player's simulation bubble (so not meta zombies, don't care about them). I haven't been able to find anything so far, but im new to the PZ code
OnZombieDeath would work, but I want my changes to be visible to the player before they die
So you can add the differences to the bottom half of my code before the rebalanced rate is calculated
This is where I used to have differences being applied - as old vanilla code had none
you can change the baseRate for the recalc here similar to how it's done in the vanilla side
I'd add sandbox options so people could change it to their whim
that process is more involved but - you'd just add them to the sandbox options txt and translation
If you want to give it a shot on the github I can fix any issues
Currently messing with coroutine/callframes trying to see if I can identify when addXp is run from TVs
Hmm ok let me study that part. To clarify though, do you mean I should add baseRate = [valueiwant] below each?
yes that should work
it uses the same variables across vanilla to mine
so setting them in mine at that point would change rebalancedRate
cool cool, thanks man. I will try that prob tomorrow and report back.
👍
almost done

16 + weight system
think i can finish it by the end of the year
oh wait its 27th
nevermind
I think I figured out a work around - but I hate it
I can identify the file addXp is ran from - I can check if it's the radioInteractions file
and track it to then compare it
why hate though
LOG : General , 1672109100975> [Skill Recovery Journal] func:OnDeviceText file:ISRadioInteractions line:292
LOG : General , 1672109100976> [Skill Recovery Journal] XP TRACKING: p:EllaAndrews -- Cooking +50
cause it's kind of super hacky
I can atleast account for career multipliers without doing some hacky shit
this even circumvents free levels from professions/traits
damn so much work can be thrown out the window

Hello, I'm hacing a problem with PZ mods not working at all on my MP server, any suggestions to figure out why they aren't working?
Could you tell me the problem?
Please search the #1019767076094758924 channel for the issue you're having, and raise a ticket if you can't find a solution.
Anyone got an idea how to make Fuel API mod work properly? IT keeps randomizing the fuel on barrels when picking them up and placing down again
Nope not at all
pardon me for barging in, can someone point me to the files/place that can show me all [Recipe.GetItemTypes.XXXX]
I'm trying to find one for alcohol
nevermind found it, its at \ProjectZomboid\media\lua\server\recipecode.lua
they dont typically help with mod issues
U just have to ask again till someone who knows replies
Y'all my poor character died of boredom (and maybe a wee bit of exposure) while I was just sitting here forever trying to figure out this collision nonsense. If anyone is online who happens to know exactly how to make objects (specifically trees) stop colliding with players, ♥️.
(but in a nondestructive way! I want to restore it later!)
i swear its in tile properties. maybe im crazy
Don’t think you can mess with those on the fly tho
no but you should be able to create a duplicate technically right?
Could, but that could get cumbersome when you are dealing with all the different tree variations too
LOL whoops
I am not concerned about identifying the trees... I am successfully identifying and hiding and revealing them
Problem is even hidden, they continue to collide and block light
Ah. Well, if you are already hiding them, could you just temporarily remove the whole tree?
Bc that seems like an issue with the tiles more than anything
for index = objects:size() - 1, 0, -1 do
local object = objects:get(index)
if instanceof(object, "IsoTree") then
if not Druid.hidden[object] then
Druid.hidden[object] = square
Druid.lastDeadTree = object
object:removeFromSquare()
object:removeFromWorld()
square:transmitRemoveItemFromSquare(object)
square:RemoveTileObject(object)
end
end
end
This is hiding without removing collision, for context.
Well I told the game to do that, as you can see in my code
But the game did not do that.
java time?
Idk where to look unfortunately.
not sure how Java does tree-on-player collision
or collision period
I was curious if anyone knew if it was possible to edit server settings via lua? It would be more efficient than what I am thinking I'd have to do.
I have a questline for my server - and every player that finishes the quest can make a choice to impact the server...by adjusting the zombie population modifier by + or - .1 (for example).
But really I need a Lua connection no matter what is going down in Java.
In theory, if the game removes collision when I sledgehammer these trees, I can trip it at least 1 way (destructive though this is)
But I would like a more precise way that preserves the object
what i mean is it doesn't seem like a problem you're going to solve without understanding the java
or a way to restore the object
Yeah but you've said that about problems you personally helped me solve so now I'm too stubborn to give up @bronze yoke
🤪
Bahahaha there must be a way
yeah i'm the one who read the java @_@
Somebody know things quick!
declaration: package: zombie.iso.SpriteDetails, enum: IsoFlagType
You might be able to mess with these
declaration: package: zombie.iso.sprite, class: IsoSprite
Or these
Or. Hear me out. Automatically move the tree somewhere to some other coords and then put it back 😂
Idk what the purpose of this is for, but there are a handful of things to at least dig around in
So check this out... when I run into a tree... I'm not colliding with an object at all (maaaaan)
I feel like that absurd statement deserves a maaan at the end, but it is also truish
Testing this:
Events.OnObjectCollide.Remove(Druid.defyPhysicsUponSmackingTree)
Druid.defyPhysicsUponSmackingTree = function(player, object)
print("Player")
print(player)
print("Door")
print(object)
end
Events.OnObjectCollide.Add(Druid.defyPhysicsUponSmackingTree)
It is triggered when I run into objects, such as windows, but not when I run into trees.
doesn't surprise me, they don't block your movement they just slow you
Yeah mega-oof
So it's the meta-collision non-collision type collision
or something
Where you like collide but don't
And stuff
Ironically
setNoClip works
Would think that would stop collision
But no, also covers mysterious tree non-collision slowdown business
time to check what noclip does
@bronze yoke this.noClip = false;
😔
time to scan the entire codebase for noClip checks i guess
sorry isNoClip*
I wonder if this is related
public float getGlobalMovementMod(boolean var1) {
return !this.isGhostMode() && !this.isNoClip() ? super.getGlobalMovementMod(var1) : 1.0F;
}
Oooooo
public boolean isInTrees2(boolean var1) {
return !this.isGhostMode() && !this.isNoClip() ? super.isInTrees2(var1) : false;
}
Mmmmmmm
Alright. Gonna pass out. Must continue seeking breadcrumbs tomorrow. Thanks for moral support and suggestions all
Good luck Burryaga
hello gents, I'm trying to modify existing recipe, adding new items requirements but I can't quite figure out the function to add items like addRequiredSkill
my code is like this
function modify_recipe()
local recipes = getScriptManager():getAllRecipes()
for i = 0, recipes:size() - 1 do
local recipe = recipes:get(i)
if recipe:getOriginalname() == "Make M998 Net Trunk Barrier" then
recipe:additems?
end
end
end
Events.OnGameBoot.Add(modify_recipe);
is there add items function for lua?
Does anyone know if it's possible to edit server settings with lua?
hmm is it getItems() and getUse()
Question: Is it possible to access a container through the coordinates or is it better to access it through the id? My idea, is to try to identify a container for example and remove all the loot from it. If anyone knows of an example, or somewhere to look, I would appreciate it because the truth is that I do not understand if it is possible or not, it is not entirely clear to me. Thanks.
With this, I access the player's coordinates.
In these coordinates I have a container.
I would like to "access" it.
local function playerPosition()
local player = getPlayer()
player:Say("x: " .. player:getX())
player:Say("y: " .. player:getY())
player:Say("z: " .. player:getZ())
end
Events.EveryTenMinutes.Add(playerPosition)
you can grab the square from coordinates or the player object itself, and then loop through the objects on that square looking for containers
it depends on exactly what the final application of this is though - if you want to access containers at a specific position and not just near the player, you will run into issues with the square not being loaded
My idea was to add loot in my own containers. For example, if I put a box, my idea is that loot appears in it, so to speak. The game generates loot, but in the game's own containers, not in those created by the player.
The problem is that there are certain containers that do not regenerate loot, then, until I solve that problem, my idea was to generate a mod, which through a coordinate system, access to some containers, and clean the content, to add a certain loot.
But I am totally lost. I don't fully understand the information on this site: https://projectzomboid.com/modding/, so sometimes I'm not sure how to use the different methods. Some of them I could understand, but many of them, I really don't understand.
But hey, I started yesterday, I guess it's just a matter of time.
I was able to make a reward system at least.
local itemsAwards = {}
itemsAwards[230] = "Axe"
itemsAwards[235] = "Cigarettes"
itemsAwards[240] = "Crowbar"
itemsAwards[260] = "Axe"
local function zombKilled()
local player = getPlayer()
player:Say("zombies killed: " .. player:getZombieKills() + 1)
for key, value in pairs(itemsAwards) do
if (player:getZombieKills() + 1 == key) then
player:Say("Congratulations, you just won")
player:getInventory():AddItem(value)
end
end
end
Events.OnZombieDead.Add(zombKilled)
While it works, there may be another way to do it.
it could be a little cleaner but overall that's basically how you do it
In the for, I could have been more specific with the names.
But, since it worked for me, I started to investigate something else.
And in the end, I kept it that way.
you didn't actually need to use a loop at all
something like
local reward = itemsAwards[player:getZombieKills() + 1]
if reward then
player:getInventory():AddItem(reward)
end
```would be a little cleaner
can Override:true be used to override mod recipe in the scripts?
Thank you very much for the example. @bronze yoke
nevermind found a workaround, just set ishidden and create new recipe script
is it possible to change character anim speeds? ex. I get a laceration on my hand and I use a item to counter act the swing speed debuff
It is
Sandbox atleast not sure if the server option is possible but i think it is
Sandbox settings do have the stuff for zombies and how they behave right?
Good morning.
Anyone knows how to check if an items name is edited
If setCustomName() == true then
Will this work?
I think setCustomName() is a void function as in it returns nothing
And you need to pass a boolean to it
get set logic my friend.
Always evaluate the getter.
or the is / has companion that occasionally accompanies the getter.
Does getPlayer() work regardless if i call it in mp or sp?
So long as you call it on clientside, I believe so.
Hi everybody, not a modder myself per se but is this the place to look into finding a modder to commission a small map mod? <10 buildings total
Ah so if my piece of code is in client folder it will get me the current player regardless if the mod is run in mp or sp?
Correct 🙂
Nice
I always used getSpecificPlayer for that but i dont think it works correctly for mp
.ye but couldnt find the is
Aight. Thanks
Cuz i was thinking that if it has value it will still return true right? Or no?
You're assuming too much.
Ok
that thing is a creeper lol.
my professions mod (made with profession framework) appears to crash the game when i try to use the randomize button or select a preset character
also, a sit/lay animation might be nice.
and roll over
It looks like it is very underweight.
I was working on a project like this way back. Used MisterInsayne's dog 3D model, rigged it, and animated it. Here's a test animation for the rig.
https://i.imgur.com/2Efv5VW.gifv
Yeah lol, I'm not a modeler or an animator, so I hope to improve it in the next updates
Ah. No worries. Just giving you some thoughts & notes.
Rigging that thing was fun. Hope I can find it in my files someday..
also PZ don't allow create more bones, so it is a little hard to adapt those things
I can see B42 opening up a whole new market for work on 3D animals.
Recipes lua functions have to be global right?
is it possible to force the player to wear a mask or gloves for example to craft a recipe? like they actually have to have it equipped.
If so how could I make this possible?
unfortunately
however it can access tables
Fortunately lol
so just dump them on Recipe.Something.Something
check how metalwelding is done in origial game files, it forces you to wear welder mask
I wonder if there could be a workaround for that - or if there's not much of a point
yes have it as a requirement ontest
can also wear them onperform
I actually usually avoid Recipes. cause I rather not add another point of compatibility with some other mod that wants to break everything
How would the code to that look? Would I need to make a function that requires to wear clothing onperform?
Going back through and refactoring skill recovery journal, I don't even know what this was for
---@param player IsoGameCharacter | IsoPlayer
function SkillRecoveryJournalWritingOnCanPerform(recipe, player, item)
if item and (item:getType() == "SkillRecoveryJournal") then
return true
end
return false
end
correct functions would be OnCanPerform and OnTest
look at the vanilla scripts
I’ve tried but no luck so far sadly I’ve been stuck on this for a bit now
Oh damn I finally have a sledgehammer
what about it are you stuck on
🤔
Breaking bottles on your head is a old (commented out I think) recipe - it checks for wearing a mask
-- Example OnCanPeform function.
function Recipe.OnCanPerform.HockeyMaskSmashBottle(recipe, playerObj)
local wornItem = playerObj:getWornItem("MaskEyes")
return (wornItem ~= nil) and (wornItem:getType() == "Hat_HockeyMask")
end
Actually not commented out - left in as an example
Ooo
Cramming some videos and read some books on C# and Azure stuff. I have a programming "test" in a few hours for a job. Hopefully I'll get it. 🙂
This helps
This is in recipecode.lua
I may also get involved with this mod by either extending it or submitting changes to the git.
Much love ty I’ll try this out
pop quiz: How would i select all vehicles within 10 tiles of a tile and check if they have mod data on them.
chunk:getVehicles()?
pseudo-code.
if x_min <= x and x <= x_max and y_min <= y and y <= y_max then
push to some collection
end
I'm curious at how the API implements grabbing entities.
because they are deliveing to a specific point.
You can use Mango's radius check
Is it used to modify the current ui or just to create a new one?
Minecraft had a problem where looking up certain entities in a World filtered through literally every entity when using their lookup methods.
It's a barebones, object-based solution with a add(..) and create(..) instructions API.
(AFAIK)
i really dont like that api
f
I don't prefer it but it does expose the issue with the vanilla UI API.
its very strict on what you can do
Would it also be possible to reverse this like make the person crafting remove clothing XD
and barely simplifies things
People may think that my HTML solution will be difficult.
If you know HTML and CSS logic it'll be nothing.
I suppose so - but one of the test functions occurs over and over
So you have to be careful
that api pretty much just off loads positioning ui elements and by doing that forces a certain layout
I can extract from that UI API that rules are definitely needed however not at the cost of features.
It's a decent attempt and seems to be helping a few.
@drifting stump I also want to be open about the development of this engine. Being able to make custom elements will probably be useful for adding some 'preset' UI for things like radial menus and buttons in order to help keep things simple for users while still providing the more advanced modifications that comes with the usual development of web front-end.
striving for modularity and expansions is a goal of it. Hopefully this extra work will pay off in time.
@jagged ingot you were wondering about 3d models in ui
local FONT_HGT_SMALL = getTextManager():getFontHeight(UIFont.Small)
local FONT_SCALE = FONT_HGT_SMALL / 14
local modelUI = ISUI3DScene:new(self.x + self.width, self.y, 400 * FONT_SCALE, self.height)
modelUI:initialise()
modelUI.onMouseMove = function(self, dx, dy)
if self.mouseDown then
local vector = self:getRotation()
local x = vector:x() + dy
x = x > 90 and 90 or x < - 90 and - 90 or x
self:setRotation(x, vector:y() + dx)
end
end
modelUI.setRotation = function(self, x, y)
self.javaObject:fromLua3("setViewRotation", x, y, 0)
end
modelUI.getRotation = function(self)
return self.javaObject:fromLua0("getViewRotation")
end
modelUI.javaObject:fromLua1("setDrawGrid", false)
modelUI.javaObject:fromLua1("createVehicle", "vehicle")
modelUI.javaObject:fromLua3("setViewRotation", 45 / 2, 45, 0)
modelUI.javaObject:fromLua1("setView", "UserDefined")
modelUI.javaObject:fromLua2("dragView", 0, 30)
modelUI.javaObject:fromLua1("setZoom", 6)
modelUI.javaObject:fromLua2("setVehicleScript", "vehicle", "Base.VanSpiffo")
modelUI.closeButton = ISButton:new(modelUI.width - 15 * FONT_SCALE, 5 * FONT_SCALE, 10 * FONT_SCALE, 10 * FONT_SCALE, nil, modelUI, function(self)
self:setVisible(false)
self:removeFromUIManager()
ServerPointsUI.instance.preview = nil
end)
modelUI.closeButton:setDisplayBackground(false)
modelUI.closeButton:setImage(getTexture("media/ui/Dialog_Titlebar_CloseIcon.png"))
modelUI.closeButton:forceImageSize(modelUI.closeButton.width, modelUI.closeButton.height)
modelUI.closeButton:initialise()
modelUI:addChild(modelUI.closeButton)
modelUI:addToUIManager()
here you an example of vehicle rendering
WALL OF TEXT hi
iirc items have to be with a different java thingy and i didnt get around to messing with it
Should make a Gist for something like that.
Would be good to throw links at people for this. 🙂
Anyone knows how you can add multiple instances of a InventoryTransferAction? I do it with a for loop but only adds one InventoryTransferAction or atleast my char performs it only one time
Nice. Thanks!
Will be fun making something like a HTML element for 3D objects.
ill have to look again at item rendering
how are you adding the action
This is the page where I got the Neo scav style inventory
ArtStation
First of all, I want to thank The Indie Stone team for making such a great game! They have given many players years of fun and I hope it continues for another century! I also want to thank the man under the nickname Daniel Grusuk for his divine soundtrack for the game! And I want to thank the person named Nikita Moskalev for the gorgeous art for...
do they have a crafing menu rework
I found it again
holy shit i want that.
ive definitely not been hitting my head trying to come up with a design because all i can do is code

You have my back buddy. ❤️
I can help with design ideas if you need it.
every single thing thing here is doable
IsTimedActionQueue.add(ISInventorTransferAction…..)
All the arguments are correct btw
But i think passing a list through might work
Oh wait.. yeah it is. The main menu requires texturepack modding if you want to get rid of the PZ logo.
I was actually thinking the setup pages for new games could be consolidated
My client-mod patch has a flag API to turn of rendering the Java-rendered main menu stuff.
that UI concept is pretty rad
in-game I think needs more work
I plan to write a UI redesign with my engine and my GLSL uniforms API for shading UI to have support for things like frosted glass.
No passing a list through does not work
Are you trying to transfer multiple items?
Yea
ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, item:getContainer(), container))
You have to queue it
running a new one will interrupt it as you have experienced
Is there a way to get when its finished so i can queue up a new one?
that's handled via the queue
you can just keep adding them
This is vanilla
function ISInventoryPane:transferItemsByWeight(items, container)
local playerObj = getSpecificPlayer(self.player)
if true then
self:sortItemsByTypeAndWeight(items)
else
self:sortItemsByType(items)
self:sortItemsByWeight(items)
end
for _,item in ipairs(items) do
if not container:isItemAllowed(item) then
--
elseif container:getType() == "floor" then
ISInventoryPaneContextMenu.dropItem(item, self.player)
else
ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, item:getContainer(), container))
end
end
end
just forlooped off an items list
for i = 1, count do
ISTimedActionQueue.add(
ISInventoryTransferAction:new(
getPlayer(),
getPlayer():getInventory():getItemFromType(item),
getPlayer:getInventory(),
button.data.vmInventory))
end
thats what i do but it adds only one action
and i can assure count is not 2 either
sideways profession choose menu is a disaster
imagine scrolling through 30 profession choices to see bonuses
What is item in this case? seems like you're adding the same item for each count
didnt notice the 'getItemFromType'
yeah that's not going to work lol
Why?
it will be returning the same one item
Ok so how can i pass multiple items which are the same essentially
you need to gather a list and for loop like in the vanilla example
Dug up some old pictures of my GLSL Uniforms API tests.
there's probably a vanilla function for returning all items by a specific type, let me check
So i can gather those items in a list and loop over them?
hey
Someon by any chance know where i can get a zombie grab mod?
I know thats kinda confusing
GetItemsFromType i think
uh, its a meat shield zombie mod
Something like that
You can grab a zombie and make him a meat shield
idk
public ArrayList getItemsFromType(String var1) {
return this.getAllType(var1);
}
This returns a java arraylist though
local player = getPlayer()
local playerInv = player:getInventory()
local items = playerInv:getItemsFromType(ITEM_TYPE)
for i=0, items:size()-1 do
local inventoryItem = items:get(i)
ISTimedActionQueue.add( ISInventoryTransferAction:new( player, inventoryItem, playerInv, button.data.vmInventory) )
end
you can control the number of them by changing items:size()-1 to n-1
if that's something you'd want
or I guess something like math.min(items:size(),n)-1 to prevent issues
I'm not actually sure what happens if you try to for loop with a count lower than the starting place
what's your current approach?
vehicles may not be loaded in unless a player is near by
local n = -1
for i=0, n do print(i.." / "..n) end
``` prints nothing, so the math.min should cover all bases
Okay. Going to be away for some of the day. I'll be looking into some stuff later today for PZ modding.
the idea is a trucking simulator delivery, so the player and trailer will be abound that point. I just wanna check for a vehicle that has the mod data i placed on it within range of a tile.
that was i can complete the job and pay the player.
everything is working BUT detecting if the trailer is in range and then removing it.
that's the part i am working on adding
could you grab the car the player is driving?
boot the player out and then remove the vehicle?
otherwise if getVehicles doesn't work - you'll have to parse through near by squares using the for x for y scan
brah it's learning 
"The EveryOneMinute event is a special event in the game that is called every in-game minute. When the event is triggered, any functions that have been added to it using the Add method will be executed."
question, Events.OnCreatePlayer passes 2 args: playerIndex, player
is playerIndex same thing as player:getPlayerNum() ?
also can I do something like this if i want to account for modded skills?
local totalPerkLevel = 0
for i, perk in ipairs(Perks) do
local perkLevel = player:getPerkLevel(perk)
totalPerkLevel = totalPerkLevel + perkLevel
end
Yes
I'm actually messing with perks atm
PerkFactory.Perks = Perks
I'm guessing because it's specifically exposed it can be called that way in the Lua
that made me go crazy first time writing skill recovery journal
The lua just refers to an undefined global named 'perks'
Hey, did you know if someone is deving a Meat shield Mod?
🤷♂️
local objects = square:getMovingObjects() using that how would i tell if it's a vehicle?
I don't think moving objects include vehicles
Direct Known Subclasses:
BaseVehicle, IsoDeadBody, IsoGameCharacter, IsoPhysicsObject, IsoPushableObject, IsoZombieHead
function findTrailer()
--detect the obj with sprite named wew
local player = getPlayer()
local cell = player:getCell()
local x, y, z = player:getX(), player:getY(), player:getZ()
local xx, yy, zz
for xx = -15, 15 do
for yy = -15, 15 do
local square = cell:getGridSquare(x + xx, y + yy, z)
if square then
local objects = square:getMovingObjects()
for index = 0, objects:size() - 1 do
local obj = objects:get(index)
print("object found! name: " .. obj:getObjectName())
end
end
end
end
end
instanceof(obj, "BaseVehicle")
you can also use this with otherclass names - it can identify zombies/players using IsoGameCharacter
very stronk function
okay so where would i stick that in what i have?
Where you want to parse out the vehicles
under local obj = objects:get(index) I assume
Hey is there a way to render models on client one way and on the server the other way?
Hello I was able to take your advice and successfully got your mod to change the calorie walking rate seperate from the running rate, so thanks. two questions:
-
I notice your mod only seems to affect if I start a brand new game. If I enable it on a game previously started without it, it has no effect. Do you know why that might be and if possible to alter so that I can get it to work on existing saves?
-
If I wanted to scale back your calorie mod for my purposes just to affect run/walk burn rates, but not add in the new features your mod adds. What would would I remove or zero out to achieve that? I think yours just adds a new weight factor right? I'm not sure what to remove without breaking it.
Mine adds a very slight additional burn to carrying weight
the other mention of weight is vanilla - the more personal weight you have the faster you burn
how do i scale back or remove that new additional slight burn?
you can add a new sandbox option, if you're planning to make changes to the original
--inventory impact
if SandboxVars.RebalancedCalorieBurning.CarryWeightImpact then
local carryingRatio = math.max(0,player:getInventoryWeight()/player:getMaxWeight())
local inventoryModifier = 1+(carryingRatio*0.01)
rebalancedRate = rebalancedRate / inventoryModifier
end
I'm not sure why it would only affect new saves - are you enabling the mod from the load game menu?
oh so literally only a .01 modifier you added?
well it's carrying/capacity * 0.01
it's very slight, only meaningful if you're carrying alot of stuff
I see. i just wanted to replicate that for vannilla atm. Would it break anything you think if I just removed the whole inventory impact section? or I could replicate vanilla simply by changing the .01 to zero?
you can just remove that section
Are you going to be releasing the changes as a separate mod?
not sure, just wanted to get it working for my purposes. if so then you will get 99.9 % of all credit if i do
I wouldn't mind adding you as a co-author if you wanted to work on the original
haha ok, well let me see if i can get it working the way i want exactly first then go from there
and yeah ill mess with load game mod options, maybe i messed it up there for prior saves. thanks again
no worries, unrelated but a lot of players don't know you have to enable mods from the load game menu for on-going saves -- should really be addressed in the UI somehow
that's like 20% of my bug reports

is that thermomodifier section on yours just replicating vanilla too or it does something new?
Herbalist Magazine still gives the trait, right?

anyone worked with sounds in here? any chance to catch level of sound player hears? precisely i want to catch very quiet sounds player character hears, want to count sound intensity/volume
todo for community api? 🤔
function findTrailer()
--detect the obj with sprite named wew
local player = getPlayer()
local cell = player:getCell()
local x, y, z = player:getX(), player:getY(), player:getZ()
local xx, yy, zz
for xx = -15, 15 do
for yy = -15, 15 do
local square = cell:getGridSquare(x + xx, y + yy, z)
if square then
local objects = square:getMovingObjects()
for index = 0, objects:size() - 1 do
local obj = objects:get(index)
print("object found! name: " .. obj:getObjectName())
if obj:getObjectName() == "Vehicle" then
print("Vehicle found! name: " .. obj:getObjectName())
if obj:hasModData() then
print("object ModData found!")
local tModData = obj:getModData();
if tModData.job ~= nil then
print("job ModData found! name: " .. tModData.job)
end
end
end
end
end
end
end
end
``` this never find the mod data, and i KNOW it's attached.
perhaps - I think the main menus could use some love -- that concept menu art was pretty neat
I could re write that into a main ui....
that's vanilla too
got it thanks
what print does it stop at?
print("Vehicle found! name: " .. obj:getObjectName())
LOG : General , 1672161505094> 18,684,946> object found! name: Vehicle
LOG : General , 1672161505094> 18,684,946> Vehicle found! name: Vehicle
LOG : General , 1672161505095> 18,684,947> object found! name: Vehicle
LOG : General , 1672161505095> 18,684,947> Vehicle found! name: Vehicle
LOG : General , 1672161505097> 18,684,949> object found! name: Vehicle
LOG : General , 1672161505097> 18,684,949> Vehicle found! name: Vehicle
LOG : General , 1672161505097> 18,684,949> object found! name: Player
LOG : General , 1672161505099> 18,684,950> object found! name: Vehicle
LOG : General , 1672161505099> 18,684,951> Vehicle found! name: Vehicle
that was three vehicles and me.
3 trailers, a truck and me rather lol
I didn't know hasModData was a thing
yeah i don't know if that's causing your issue or not but you don't need that
i don't think objects that have moddata can not have moddata?
public boolean hasModData() {
return this.table != null && !this.table.isEmpty();
}
Does check if it's empty - so there's that but yeah you don't need it
yeah i was just looking at that - doesn't seem like it should be causing the issue, but definitely unnecessary
I'm a Never Nester and you should too.
Access to code examples, discord, song names and more at https://www.patreon.com/codeaesthetic
Correction: At 2:20 the inversion should be "less than or equal", not "less than"
i do art.
if i knew better ways around it i would.
+1 for this channel all his videos are great
regarding that mods and saves thingy it would be fixed simply by removing the mods button from the main menu
it has no business being there besides for loading menu replacements
Implementing a mod profile similar to sandbox presets would be most ideal
but there's another issue with MP host menu - sandbox options dont appear unless mods are loaded in the main menu
maybe simply notifying that the user is not adding mods to a save
could be an alert when you try to load a game - 'there have been mods enabled on the main menu since you last played' -- it does something for when mods have been removed (shows as red)
I feel like Zomboid is unique in that saves can use specific mods
most other games just use what's currently loaded if I'm not wrong
definitely not unique in that
but yeah most dont bother with loading for a save
they do mark a save for a certain mod list tho
I really hope this weirdness with the journals was a fluke
this refactor was supposed to be a couple hours at most
local car = addVehicleDebug(args.type, args.dir, nil, sq)
local carModData = car:getModData();
carModData.job = args.job;
stage 1: 'a couple hours at most'
Whats args.job?
Any idea what is wrong here?
Commands.KYRPT.spawnTrailer = function(player, args)
is the generated code i set on the payer and the trailer, so i can track both of them
You can't store complex objects or references in modData
o
all squished ionto one string.
aud?
aiteron's user debug
needs some loving - but still works great and has a few useful tools
the journal displays the XP as 30 - but still nets back 7.5
the default multiplier for non specialized skills is only .75?
what is this conversion
oh its .25
I already had xp flatten so it's all flat across the board
I guess I just need to change the display to match?

what now?
it's jsut an id.
ah all good
local carModData = car:getModData();
carModData.job = args.job;
well fuck.
apparently... taht is not setting it for the client?
you're just assigning it to a variable, you aren't doing anything with the variable
Is args.job a non-nil value?
Oh if you're setting it on the server you need to transmitModData()
Oh oh like that, Chuckle knows their stuff.
but I think cars have an issue with transmitting modData (?)
iirc it was that transmitting didn't work from client to server
just for cars or in general?
just for cars
car:transmitModData() or carModData.transmitModData()
i didn't test it myself but somebody here mentioned it a lot
car:transmitModData()
quick unrelated question for anyone who knows their way around the java codebase:
would (GameServer.bServer || GameClient.bClient) always return true?
no
what sets those flags? or unsets them, I guess
bServer = true if its a server
it returns false in singleplayer
oh, so the client isn't a client in singleplayer? interesting
I officially helped someone with code in PZ

