#mod_development
1 messages · Page 159 of 1
You can and I've done it in the open for a decade. TIS knows full well I do.
It's what you mod and how you distribute it.
Play nice and they will too.
they're pretty open about not wanting us to as a general rule, so we tend to shy away as a community from doing as much
however YMMV depending on what you're up to
“We can’t javamod”
Simply another phrase for “I haven’t tried hard enough”
This is a bad way to look at it. I've seen people go to jail in my 20+ years of modding games. It's not a bad take.
People do stupid stuff. Learn to play by the rules. If you don't know the rules, ask.

Just because the gaming community has more-so accepted modding doesn't mean the companies' views on the legality of modifying their IP has changed.
best for TIS legally to ask we don't run java based bitcoin mining operations on our user's cpus
even this sentence is too complicated
i got the 'making the square' part, let me find a video it's actually kinda neat
I strongly advocate for what you have rights to do, however I also am more-so an advocate for learning what rights you have.
If you couldn't publish core-mods, then the anti-cheat patch I released in early January of 2022 would've been DMCA'd.
Most core-mods for PZ that come about deal with piracy and cheating so it makes sense to be warry about it.
I’ve tried core modding twice but both times was attempting to find code for vanilla traits
To make different versions of them
It's sprinkled all over the codebase.
They add in trait checks when calculating or executing events.
I was looking specifically for inconspicuous and cat eyes, but couldn’t find anything in the lua
Possibly in the lighting thread.
Passed probably to the JNI.
Either that or the shaders.
I hope that frosted glass will eventually find its way into PZ vanilla one day. For now I have to mod it in. =(
Would implement it myself in their code if ever permitted. All they'd need to do is toggle shaders in the UI render context and pass the current FBO as a Texture2D to the shader.
The shader would do the rest.
result was pretty tho
trouble was, i couldnt think of a way to achieve that bukkit-style of area copy/paste without a lot of nested, ugly code and so it became too cumbersome to continue
found some uses for it, though
I considered modding a Towny plugin for PZ.
It was for town establishment and protections.
Also building houses, much like the ones already in the game.. not the constructed ones by players.
Would be funny to turn PZ into SimCity.
Have the zombies be citizens and have a full-blown RCI model.
i try to avoid entire gameplay loops unless i'm being paid to make it
i only have so many braincells to rent out
I mod as deeply as I want really. Depends on the project.
My still-unreleased core-mod for the client has modified code in the deep render code for PZ.
Curiosity will eventually kill me.
xD
If ya ain't havin fun, why ya doin it?
Hmm. More issues happening with this file thing
If anyone has any immediate ideas of what I'm doing wrong, let me know? Otherwise I'm just gonna trudge through this. My first thought is to see if the lines variable is actually getting filled
yeah good idea
I'm not sure what lines is but if it isn't being filled or is nil or isn't a table
lines() should be a stream, not a table
i'm not sure if you can use streams or not, i usually just do while reader:ready() do local line = reader:readLine() end
hmm. So no lines variable outside the loop, just do reader:readline. Gotcha
local function addItemTagsFromFile(path, tag)
if not fileExists(path)
then
print("Cannot find file");
return {};
end
local reader = getModFileReader(AnthroTraitsGlobals.ModID, path, false);
--local lines = reader:lines();
local line;
local foundItem;
local itemTags;
while reader:ready()
do
line = reader:readLine();
foundItem = getScriptManager().instance:getItem(line);
if foundItem ~= nil
then
itemTags = foundItem:getTags()
if not itemTags:contains(tag)
then
itemTags:add(tag);
if getDebug()
then
print("tag "..tag.." added to "..line);
end
end
else
print("Cannot find item "..line.." to add tag "..tag)
end
reader:close();
end
end
you should move reader:close() after the while loop
oop reader:close is a bit too high
lmao
sorry
Thank you for that. I promise I'm a mostly competent programmer, I just have ADHD
XD
I'm kind of confused with timed actions, if I create one will the game automatically add it to context menus assuming IsValid is true? If not, how should I trigger them?
you need to add them to the context menus yourself
Does anyone remember which is the event that get's fired once the player spawns?
Events.OnGameStart?
depends exactly what you're going for, OnCreatePlayer might be what you want
Is OnCreatePlayer only fired the first time the player spawns? Or every time the players loads the game after clicking on "this is how you died"?
every time an IsoPlayer object is created
any IsoPlayer? or just yours?
any local one
Good enough
i don't think it fires for multiplayer characters but it does fire for splitscreen characters
Is there a way to make testing easier? Every time I test I do the process of
-closing the game
-deleting the mod folder
-copying the mod folder manually to the mods folder
-re opening the game
-deleting the old save
-adding the mods to a new save and waiting
-looking at the error log
-repeat
i just work in the mods directory, and i have my mod disabled on the main menu so that lua reloads whenever i reload the save
nice!
idk if I'm late or not but in my experience (modding insurgent mod) that event pops for every character spawn, not sure the first one
is there an easier way to figure out what sound effects are triggered by what action? for example, there are 4 "ui_menu_start" .wav files, and instead of _01 being menu start, it turned out to be when you respawn a new character. I know theres a "ui_menu_start for menu start, "click to start" and respawning a character but idk what the 4th one is for
find the piece of code that triggers them i guess?
Can I make a wearable item drainable?
weird.. it seems like it just uses one of the four at random and since its in the .bank file i don't think you can specify it in a script right?
If I do item:getModData() will the moddata be saved in the player savefile once I edit it?
Cause it looks like it's not saving them on my side
it should be saved
Is there any case where it would not be saved, or takes longer to load? Like, i'm truyi
I'm accessing the mod data of an item via the event OnCreatePlayer but it's not working
No, but you can save data in that item that you could use to achieve a similar result
thank you, I'll look into that
I was also wondering what makes an item able to equip
can I add custom slots and can any types be equip them in?
Clothing items use slots, you can create your own slots
thanks, didn't see the sub thread*
Is there any event that gets fired right after OnCreatePlayer ?
Cause it looks like I can't use item:getVisual() at that time
Nevermind, I dumb
What set of characters does the zomboid font support?
the english font should support utf-8
what does AttachmentsProvided do?
allows your item to provide hotbar slots like a belt does
i'm working on sandbox settings for my mod, how do you set the variable type in the sandbox-settings.txt file?
like boolean, interger, string. google search is flooded with peoples preferences to actual sandbox mode, not the file for modding.
if someone could list out the valid types it would be appreciated.
local function ATPlayerUpdate(player)
if player:HasTrait("AT_NaturalTumbler")
then
--Fall damage reduced
player:setFallTime(player:getFallTime() * .5);
elseif player:HasTrait("AT_ClippedWings")
then
--immune to fall damage
player:setFallTime(0);
end
end
Events.OnPlayerUpdate.Add(ATPlayerUpdate);
Hoping to pick people's brains here. My Natural Tumbler trait is meant to make things like jumping out of a second story safe, but in testing it prevents all damage, even jumping from 7 floors up.
How should I fix it? Is there an oncollide event for hitting the ground that exists?
As of right now I fear that Natural Tumbler doesn't even allow fall time to get beyond 1
you're halving their fall time every frame, so it's decreasing much much faster than it increases, so it's probably near zero by the time they reach the ground
what you could do is track the current fall value and compare to the previous value every frame, then subtract the difference you want
OldValue = getValue()
function ValueTracking()
NewValue = getValue()
Diff = OldValue - NewValue
NewValue = OldValue + Diff*0.5
SetValue(NewValue)
OldValue = NewValue
end
thats how i've been doing it for other stats and its worked fine
There should be an example mod pinned somewhere. If not take a look at a mod that adds these and you will see how it is done
double, string, enum, boolean, integer
is there a way to make it a list of premade options? like how zombie infection has 3 options and not a text box
i'm trying to simplify a large amount of changable settings by having a preset of behaviors instead of 6 seperate interger variables
that would be enum
how do you set it up though? none of the sandbox settings files i've seen use enum so i dont know how to set up the values
i think i have one in one of my mods, one sec
option Literacy.IlliteratePenalty
{
type = enum,
numValues = 3,
default = 2,
page = Literacy,
translation = Literacy_IlliteratePenalty,
valueTranslation = Literacy_IlliteratePenalties,
}
```the value of the enum in lua will be an integer starting from 1
for the value translations, they're Sandbox_valueTranslation_option1 / option2 / etc
thank you, is there a source for this kind of predefined functionality of modding besides projectzomboid.com/modding
not that i've seen
damn, thanks again anyway.
Thank you!
@red tiger I was wondering since you said you specialize in making mod developing tools. Do you have any experience with Audio Editing software?
Because after releasing my Broadcast voicer mod ( https://steamcommunity.com/sharedfiles/filedetails/?id=2973493897&tscn=1683754850 ) I thought it would be nice to add a custom/modified audio editor that:
. Allows Audio Editing
. Can read a Broadcast Script (what the .xml says, the lines spoken)
. Can assign the times to the script based on how you split the audio
And finally configures everything for you.
I'm not sure that's possible within the current versions of PZ.
I was thinking more of an external tool
not inside PZ
(also a programm to make custom radios would be nice too, I guess that there must be one out there)
Hello! I was wondering about getting into modeling, mainly to make a mod like the one posted below, I got no clue how to do or what to do, can I get some pointers?
Hello, i don't know if i'm in the good channel. I'm trying de create my first java mod for project zomboid. My domain is C/C++ but i wan to learn and perfect my java language.
I'm using IntelliJ IDEA. and i try to follow this tutorial : https://github.com/Konijima/PZ-Libraries
But i get this error.
'org.gradle.api.tasks.JavaExec io.pzstorm.capsid.zomboid.task.ZomboidVersionTask.setMain(java.lang.String)'```
Thx in advance for your help.
Thx for you quick response, i'm going to try it.
how do you make zombies spawn with object impaled in them?
is it as simple as adding a weapon to their outfit?
look into media\lua\shared\Definitions\AttachedWeaponDefinitions.lua
In your mod media directory:
myMod/media\lua\shared\Definitions\MyModId_AttachedWeaponDefinitions.lua
AttachedWeaponDefinitions = AttachedWeaponDefinitions or {};
-- katana in stomach
AttachedWeaponDefinitions.myModId_katanaStomach = {
chance = 1,
weaponLocation = {"Stomach"},
bloodLocations = {"Torso_Lower","Back"},
addHoles = true,
daySurvived = 60,
weapons = {
"Base.Katana",
},
}
local function ATPlayerUpdate(player)
local beforeFallTime = player:getModData().ATPlayerData.oldFallTime
if player:HasTrait("AT_NaturalTumbler")
then
--Fall damage reduced
if(beforeFallTime < player:getFallTime())
then
player:setFallTime(beforeFallTime + ((player:getFallTime() - beforeFallTime) * .5));
end
if getDebug() and player:getFallTime() > 0
then
print("FallTime (natural tumbler): "..player:getFallTime())
end
player:getModData().ATPlayerData.oldFallTime = player:getFallTime();
elseif player:HasTrait("AT_VestigialWings")
then
--immune to fall damage
player:setFallTime(0);
else
if getDebug() and player:getFallTime() > 0
then
print("FallTime: "..player:getFallTime())
end
end
end
About to test this out and see if it works
Well. Uh, Definitely works lmao
Did you know that jumping from four stories high kills you without the trait on? I didn't. I guess this test is a success hahaha
@main lion The chainsaws you added ironically dont seem very good at cutting down trees, ha ha
And also has an absurd attraction range.
edited this a bit to add some debug prints and to only change falltime if the old falltime is lower. According the the prints earlier, it goes down rapidly once you reach the ground, but not all at once, and I'm assuming a negative value was messing with the decrease
Working on another trait. Anyone know how to get whether or not you're behind a zombie?
local function ATOnCharacterCollide(collider, collidee)
local knockdownEndCost = SandboxVars.AnthroTraits.BullRushKnockdownEndCost
local colliderBehindCollidee = ;
if instanceof(collider, "IsoPlayer" )
then
if collider:hasTrait("AT_BullRush") and collider.isSprinting()
then
if instanceof(collidee, "IsoZombie")
then
collidee:knockDown(colliderBehindCollidee);
collider:setEndurance(collider:getEndurance() - knockdownEndCost)
elseif instanceof(collidee, "IsoPlayer") and ((collider.Pvp == true and collidee.Pvp == true) or collidee.isZombie())
then
collidee:setKnockedDown(true);
end
end
end
end
also if anyone sees anything wrong with this before I test this, pointing it out would be appreciated haha
instanceof's syntax is instanceof(object, "ClassName")
not instanceof(ClassName, object)
You could probably make an audacity plug-in. Haven't done so myself, I've just used audacity for splitting and labeling generated audio—in my case it was predictable intervals so it just involved a few clicks but presumably labels could help you out here (for use in the plug-in, I mean, but maybe just in general since it could be a tool outside of audacity)
Thank you! Edited the code above to reflect that
@frank elbow Is there a tutorial on how to do this? Because I would also like it to show like which line gets asociated with which segment of audio
I would assume so. There's an audacity wiki which probably has info on how to create one
you might be able to work out if the player is behind a zombie through however the game determines if short blade weapons should do a backstab
I'll look into that
there's an IsoGameCharacter isFacingObject, but i'm not really sure what it's expecting for its parameters
isFacingObject(IsoObject object, float dot)
it seems to be a tolerance of some kind? it's probably some maths thing i'm unfamiliar with, vanilla always uses 0.8 so i'd start with that
i think lower is more tolerant, so you might actually want a very low one to determine if the player is behind
Hello, java mod can be posted on steam workshop or not? I want to write a simple mod doing the same thing as "Zombie Reanimator" but in java for reduced ressource consumption.
as far as I know, steam workshop is lua only
ok thx.
the game doesn't have any way of loading java mods so while you might put them on the workshop to get it out there, it will require manual installation
ok
any place to commission a mod?
Ye
please direct me, is it a channel or discord?
Links on my profile
thanks
@tame mulch Is there any way that Kahlua can expose implemented classes for handling primitive data types? E.G: int[], short[], byte[], or List<Byte>, etc? Thanks.
This would substantially decrease the memory footprint that Kahlua has when handling large amounts of primitive data.
it's not really supposed to represent weight
Still, a weight system would be far simpler.
I imagine for Encumbrance the player would always hold the drumsticks like they're ready to drum 24/7.
Hey all, I'm going mad trying to remove a recipe from a mod within my own mod. I've tried all sorts of combos of module, imports, Override, Obsolete, etc... The best thing I can do is just remove all the recipes (by using the same file/module name and having a blank recipe list). Is there a way to selectively remove ONE recipe? I've got my load order set up correctly to load mine last, so it's not that.
Edit: I see above that someone has posted a way to do this with lua, I will give this a go.
Edit: Yup, that works, you the best @weak sierra
Thinking about logo design again..
I never asked anyone about what they thought of my organization's logo design.
WDYT of it?
This was the original back in 2015/2016 when I worked on ModelLoader:
Don't know if anyone here is into logo / media design for their workshop mods etc.
I know @ancient grail does his stuff with his team and that's what made me think about it.
Heh:
Found this one too. xD
How can a stick be bigger than a trumpet?
that probably didn't work, your not saving the old fall time between checks. move "beforeFallTime" to a global variable and make sure you set it to the new change at the end of the check
Okay. Back into the void.
isn't that what the moddata is doing?
Thats what I was jokingly complaining about. The sticks weigh 3 and the trumpet weighs 1. So the auto item-sizer did that.
I just overwrote the sizes manually to fix it
I had a take on how to implement grid inventory systems in PZ.
It works for sure!
it seems to work just fine in mod data
i'd be loath to put that in a global var since I want this to be compatible with MP anyway
i'd recommend keeping it in a local variable or a table if you want splitscreen support
moddata doesn't really make sense here
are you sure its working? because with what i read it should be comparing the current fall time to the current fall time, which will always result in 0 as the difference.
local function ATInitPlayerData(player)
local modData = player:getModData();
if modData.ATPlayerData == nil then
modData.ATPlayerData = {};
local atData = modData.ATPlayerData;
atData.trulyInfected = false;
atData.oldFallTime = 0.0;
end
end
Events.OnNewGame.Add(ATInitPlayerData);
I thought this was attached to each player. For split screen or other player, is it different?
It'd be cool too if wearable containers could take damage and depending on the amount they'd randomly drop stuff when walking or running.
Evil
yeah 😅 I printed the fall times, they increase. Fatal fall without the trait is three floors, with the trait it's six.
I mean.. yeah.. but hey that'd be fun.
OH it does work, i didnt see you had an OldFallTime value being saved in playerdata
nevermind then i'm the stpuid
if not, maybe doing it via this event might work? https://pzwiki.net/wiki/Modding:Lua_Events/OnCreatePlayer
I'd also make it so that containers which need to be opened would take time. A grid system could make it so you'd need to remove top items to get to a bottom item.
it is attached to each player, but moddata is mostly for persistence
Would be insanely more immersive.
Both planned, search function and layering big items under small items if the container spawns with more stuff than it normally can fit
If I understand correctly, the grid system scales in size with the weight, so something that weighs a lot will fit in the inventory, such as refrigerators, boxes, etc.
My UI would also be isometric and slide in with alpha transparency say on the right side of the screen.
Like an isometric render of the backpack with each pocket as slightly opaque grids of items.
Maybe you could have backpacks with locks on them too.
TimeAction heaven.
Looking forward to see what you come up with @wet sandal
I may draft my UI visual. I think it's a cool design.
what albion is saying is you can have a table for global data that needs to be saved without being fully SAVED as a character variable.
one gets dumped when the game ends, the other is saved to the player file.
for online multiplayer you don't need to worry about it at all since the scripts dont interact with eachother.
in split screen you can use a table like
local PlayerOldFallTimes = {}
function SetPlayerFallTime(Player)
PlayerOldFallTimes[getPlayerNum(Player)] = 234
end
It sounds cool from how you describe it
Like the mouse wheel would give so much convenience to scroll through each pocket then middle-mouse click could be to select it. Maybe all of this while holding TAB.
And something that weighs a lot, such as a big refrigerator? such as
yeah, moddata is usually used for things you need to be persistent, and sometimes things that don't need to be persistent but are instance specific (though in the case of players this usually isn't needed since a table keyed by player index is probably better)
does anyone know where the movable data for beds are?
I've searched the files and got them in bed but I can't find anything
Does anyone mind giving me a little direct guidance with how PZ functions work with what I want to do. I have 2ish yrs of coding experience (c++ and assembly lang) so I don't need anything crazy. Just some pointers based on your experience. Also, yes, I have been looking at resources. It just helps a lot to be able to ask someone specific questions.
I am new to modding
same boat
it's tough working through someone else's code and trying to put together the pieces 
what is helping me rn is making a "tier chart" of the function layers
what is it you're having trouble with?
just coordinating what i need to do i guess
this is going to sound dumb, but im trying to make an item that's basically a sourdough starter
i think itd be a great learning process to do more with PZ
that sounds rad, it's maybe a bit more involved than what i'd recommend for a first mod but since you have experience already
should be manageable
Anybody know if it's possible to check if a TV is playing something through code?
so the steps here are:
-make an item
-make a recipe
-have it generate more "dough" after a set amount of time. after the set amount of time is reached, require a "refill" with flour and water
im referencing how crops function in the game because, that just makes the most sense once the item is crafted?
is that logical for PZ? @shy hearth
sorry for the ping
no worries, feel free to ping
i don't have any experience with running lua from objects but it seems doable
the first two steps are trivially easy and the last one much harder lmao
YEP
its like, okay, i have the item... now how the fuck do i proceed
i found a mod with code for a potted berry bush. great aspects of this are:
object is craftable
object is movable
object regenerates berries via water input and time
take a mod that implements recipes and see how it is doing it
local deviceData = television:getDeviceData()
if deviceData:isPlayingMedia() or deviceData:isReceivingSignal() then
i wasn't sure if you only wanted it to be if it was specifically playing a tape, if so then you can just drop the isReceivingSignal
sounds good, usually I find a similar mod like that and can't figure out their lua connects to the scripts lol
this is a big issue of mine, too
hence trying to piece it all together lmao
reading code only really helps if you know how it works overall
deviceData:getMediaData() returns a MediaData object which has a bunch of getters for stuff like that
we love an awesome mod
Thanks a lot @bronze yoke 
is this the place to share updates with my mod
I'd talk more about the idea but it'd be a bit sad if I mentioned it here and somebody did it before me 😛
totally understand
i hate talking about any project before it's finished lmao
If this works, it's gonna change things.
Now do I include it in common sense or make it standalone
🤔
people regularly do, but mostly for like 'here's the release of that mod i was asking you guys about'
ahhh i see
Anyone know how to move/teleport players from a serverside lua? setX etc of the player object in question doesn't seem to work
is it ok to occasionally come for advice
i get worried cause some coding communities can be really toxic 😨
nah this place is real sweet
mostly i come back to search in:mod_development with whatever it is i'm looking to do
and someone has asked it already and usually been given a solution
Overall it's amazing
i wouldn't be surprised if you can't
As an Android developer I am used to people complaining about the smallest and silliest things and being super toxic overall. Here people are absolutely fantastic. Lots of people willing to help with the craziest ideas and you get a lot of support from the community with any mod as simple as it may be
on the client, you have to use this monster afaik```lua
player:setX(x)
player:setY(y)
player:setZ(z)
player:setLx(x)
player:setLy(y)
player:setLz(z)
does that still trigger anti-cheat 12 dya know?
try it from the serverside but most likely you'll need to send a server command with the desired coordinates
no idea
more reason to love the PZ community 😄
aye it's what i'm doing from the server rn, no errors but no results
i'll see if it bothers the anti-cheat then
thanks albion
when i tested my mod locally i didn't run into any anti-cheat issues
okay excellent, i'll report back for future reference
i first should make the item and have it placeable and then move on to the complicated stuff
I'm finally ready to sync my moddata for multiplayer.
It can only be stored in 2 types, either an InventoryContainerItem or an IsoObject.
Anyone know the api calls or a mod that syncs data properly I can quickly check out?
sync moddata? you just call object:transmitModData()
first place i would start is figuring out how to trigger lua functions from objects
a hacky way to go about it is to have a recipe to 'reload' flour and water into the starter
when the recipe is created change a boolean to start a timer
note that items and players don't need to transmit mod data at all, it's synced by default
after the timer replace the crafted recipe with two units of the initial starter, or something
idk how bread works
outside my wheelhouse
yeahh i considered this as an alternative
and you should *always* transmit mod data, even if you don't need to, because moddata transmission overwrites the existing moddata so if you don't transmit yours another mod transmitting from another client could erase the local data
honestly i'd go with the hacky solution for now since crafting is changing next update
but yea if it's a learning exercise
better to do it right
the sourdough starter is prob the most complicated part of my overall plan
my main goal is a bakery mod pretty much
idk how many people would be interested in it, but my friend and i would have fun with it lmao
have you checked to see if anyone has made anything similar? i think there's a bakery-like mod out there
it might not still be supported
it could be a good point of reference
i would 100% play with the bakery mod so if you can make it then do
please add potato flour
i have an artist background before becoming a programmer, so ill be able to edit models n shit
i want to forage for my bread lmao
ooo i didnt even know about potato flour
thank you for informing me
ill definitely add that
you can make a form of flour from basically anything starchy i believe
okay maybe i do know a lil about bread
you know more than me 😭 and im supposed to be making the mod
im researching recipes n stuff
nah i learned it all from cataclysmDDA
im hoping itll be a nice, lightweight, QOL addition to the game
can take no credit
yea zomboid is sort of a spiritual sequel to CDDA, although that's not official i believe
anyway best of luck with your cookin jesse
lua goblins aren't real they can't hurt you
Correction: They hurt with you.
you only need to comment the name of your function above the function
They are emotional creatures.
that's all
lmao
i shouldn't even joke about it, since modder comments are basically 95% of the entire documentation for zomboid
bless
"My code is self-documenting."
(Calls 911)
shouldn't have messed with the lua goblins, now i'm in rosewood pen
only professional programmers know this 1 trick
I literally wrote a tool and a JSON library for applying documentation to PipeWrench's generated typings.
xD
Funny how you say that.
i saw you talking about UML somewhere
man, i really need to start figuring out what lua is exactly
sighed to myself and went back to comment my code
it's tables
that's all it is
#1 PZ Lua isn't real Lua.
of data?
tables all the way down
Keep that in mind.
the strings? tables. integers? tables. the tables?
you better believe they're tables
i'm not even joking
sry if i sound dumb, im not experienced at all with game coding
is it where the game saves data?
like objects
nah it's like a data structure
Letting you know that you're preaching to the guy who solely focuses on literally that.
no tutorials out there
i was thinking of a system like this to really lay out the connections between functions
and the tutorials that do exist arent for beginner modders 
yea the learning curve really starts at doing an autopsy of someone else's mod
which you need prior experience and much patience to do
i've learned to fear anyone who writes extensions for ides
i only feel capable bc ive felt like "idek know where to start or how to get to B from A" many times in the past with coding
and eventually i work my way to B
yea it's what makes it fun tbh
one step at a time rule
I mean.. We could make tutorials.
i would go off and learn the basic concept of what lua is if i were you
i have a problem where i think too far ahead and get thrown off on the early steps
it'll save you unlearning a lot of stuff
I need a good microphone to do it.
that's exactly where i am
I'd be down with it.
needing a mic
considering just buying the tokens to get an AI to voice it
yeah that seems critical rn honestly. just with understanding the communication
I am no longer asking.
USB microphones are terrible.
They pick up all the high frequency noise in the background.
great, gonna have to learn audio mixing now too
i am happy about where im at rn with coding. the learning curve for c++ was INTENSE
I used to be a proud owner of a Shure SM7B.
it's my first prog lang
c++ is a rough starter tbf
I started with ASM technically which failed and then JavaScript.. Then Java.
i s2g the people that say it's easy, have never done anything actually complicated with it
pretty cursed path tbh
but it worked out for ya
misspells 1 int:
IDE: 03188x800 dhajabxbaksieyq8worjhaka 000234
i just went to university like a loser
but 20 more lines of this
I modded minecraft back in 2010 without any mod tools.
I fixed broken decompiled code.
I do it on PZ.
at least you can do the 'can you give me a few pointers' joke
im in college:D
I'm a mod goblin.
comp sci student
LMAO
you know what's helped me tremendously with pointers
learning assembly
Pointer to left-stage exit.
do you know MIPS?
i swear just the basics are great
helps my understanding of programming a lot
im going to be building my own IDE next semester (same prof, he has told us this)
I don't know MIPS.
Been poking at x86 lately.
Was thinking about building a PZ mod where you can access computers and write code in ASM.
🫡
now that is beyond me rn my friend
Just in case PZ wasn’t masochistic enough you want players to write assembly? Haha
You could create books to help them learn programming skills
I mean.. it's 1993.
Fucking fantastic idea.
O’Reilly’s GOTO Instruction Manual “some bird on front page”
Dummy’s Guide to How to Access MainFrame 101
You're late-game in 1994.. Why not write AOL?
Not sure who can live like its 1993, when Radio Shack was king and internet was capped at like 14 kb/s.
My life be like
You know I did think it’d be cool if i could make mods that’d allow players to play some silly games
Idk like Number Muncher
Oregon Trail
But I never thought about learning assembly lol
absolutely omg. you have to be so dedicated for this shit 😭
If TIS can spend a few minutes and expose implemented array-like classes for packaging primitive numeric values I'd make an ASM emulator.

In the history of video games, the third generation of video game consoles, commonly referred to as the 8-bit era, began on July 15, 1983, with the Japanese release of two systems: Nintendo's Family Computer (commonly abbreviated to Famicom) and Sega's SG-1000. When the Famicom was not released outside of Japan it was remodelled and marketed as ...
My proof of insanity was writing two transpilers so you can write PZ mods in TypeScript.
=)
I still need to try that out, but I'm not writing mods from scratch yet.
TypeScript -> Lua?
just occurred to me, you could probably do something with the ReplaceOnRotten item parameter and modify the rot time
Make a RPG sword that evolves over time.
oh dear god
this ASM class has been my easiest comp sci class by far tbh. the key for me is to just not think too hard. just let my fingers type 🫡
This is literally everyone in Fundamentals.
best part about ASM is that nothing is hidden
The more zombie blood it drinks, more powerful the sword gets?
surely someone has made that already
somebody's gotta work out a way to grab the parameter names from the reference site
to link automatically?
yeah, there's only so much use you can get out of arg0, arg1, arg2
Did you just volunteer? Lol
yeah i bet. i dont even want to begin to think making something super conplicated with asm
oops meant to reply
I can write a scraper for the docs.
i get so angry looking at the decompiled code
by the time i reach n18
maybe... i haven't really any experience with that sort of thing
I actually scraped the whole javadocs for offline use. Want it?
in a sea of unnamed variables
crawled it using grep
i think i already got it off of you actually
👀
give give
I’d be .. interested…
Oh it’s online somewhere?
@upper wave save this https://pzwiki.net/wiki/Scripts_guide/Item_Script_Parameters
NICE
aiteron finished it fairly recently
thank youuu
actually what i have was the list of lua events decompiled, not what jab is talkin about
I can't find it.
so yes jab give us the goods
Looking for it.
wow
I haven’t really started looking into modding yet but that sounds helpful
Thank you Sir
my pleasure, just passing on someone else's work
some real auteurs in here
i haven't checked actually
i just bookmark as i go
you'll find a lot of hidden gems using the discord search filters in this chat
I lose track of links all t he time.. ugh need to do something’s bout it
sitting down with a glass of cool lemonade
@shy hearth @spice saddle
reading cover to cover
yea handy to have
I can take this website and scrape it with code to extract param names.
does anyone have a zip of all the zomboid classes decompiled?
that's the true holy grail for me rn
Not wise to ask. (Illegal)
Also
You can use IntelliJ IDEA and double click or open a .class file.
sry i just saw this. this is a great idea
does intelliJ still have a community version?
Of course.
I use IDEA.
VSC for life
I use VSC for all scripting langs.
i last tried a year ago wheni was even more of a baby programmer
i was getting a weird error
i tried googling and could find 0 solutions
it's so simple that if you don't know what you want from it it won't give you anything at all
I love the terminal but I wish I could undock it.
it was something to do with a java function
i forgot what specifically
i tried 3 solutions via my professor and kept getting the same issue
Well if you get accustomed to vscode there's an extension I work on for you to use for script files.
TY!
i'll work on it again after finals week
that's great to know
it'll prob be fine this time
Got to get a working linter one of these days..
Then the fun can begin on formatting.
Which bip bone do hats attach do? Head or head nub?
Currently my model looks like this in game which i'm pretty sure is due to the bone thing
what it's supposed to look like
normals are all good as well, no issue there
Is there anyway to see what mod added a recipe object from getScriptManager():getAllRecipes()? I poked around in the debugger and couldn't see any fields/functions that did this.
i don't think it tracks this, this was only added to items very recently
well... very recently in relative terms
darn, was worried of that. Hmm.
if the mod is written properly the module name might help
but if they're dumping everything in base that's no good
Huh, it is in its own module. Will that be in the recipe somewhere?
yeah, recipe:getModule():getName()
Hmm, that doesn't seem to work for me.
Oh, I did . instead of :, still getting used to lua
Absolutely perfect. You just saved me a ton of horrible code and effort.
Is there a limit to how many files I can put inside fileGuidTable.xml ?
no
Odd, my clothings are not loading 🤔
And the tooltip is empty and it's firing errors when visible
head. The reason I think that there are nub bones is that they signify the different ends of the skeleton. I also think its an export preference for 3DS Max, which is what TIS used to make the models. Its similar to how leaf bones work in Blender.
I see, thank you
I think it's actually an issue with vertex weights, because changing that in weight paint modifies how it looks
idk, i'll have to look into how other mods did it more
on an unrelated note, look how cool my character looks now lol with all my mods
Is there any specific name convention to follow for the Script item name?
not really, just be consistent
Damn
Does anything come to mind that can cause this issue?
looks like a GUID mismatch or clothing item xml name mismatch
The script item name, can be the same name as the ClothingItem ?
yes
Made a short video detailing an issue I'm having that i need some insight on! Here's a side of relevant code!
local function ATOnCharacterCollide(collider, collidee)
local knockdownEndCost = SandboxVars.AnthroTraits.BullRushKnockdownEndCost
local colliderBehindCollidee = collidee:isFacingObject(collider, 0.5);
if instanceof(collider, "IsoPlayer" )
then
collider:setIgnoreStaggerBack(false);
if getDebug()
then
print("colliderBehindCollidee: "..tostring(colliderBehindCollidee));
print("Is Sprinting: "..tostring(collider:isSprinting()));
print("Tripping: "..tostring(collider:getStats():isTripping()))
end
if collider:HasTrait("AT_BullRush") and collider:isSprinting()
then
if instanceof(collidee, "IsoZombie")
then
collidee:setStaggerBack(true);
collidee:knockDown(colliderBehindCollidee);
collider:getStats():setEndurance(collider:getStats():getEndurance() - knockdownEndCost);
--collider:getStats():setTripping(false);
collider:setBumpDone(false);
collider:setBumpStaggered(false);
collider:setBumpFall(false);
--collider:setIgnoreStaggerBack(true);
elseif instanceof(collidee, "IsoPlayer") and ((collider:getCoopPVP() == true and collidee:getCoopPVP() == true) or collidee.isZombie())
then
collidee:setBumpStaggered(true)
collidee:setKnockedDown(true);
collider:getStats():setEndurance(collider:getStats():getEndurance() - knockdownEndCost)
--collider:getStats():setTripping(false);
collider:setBumpDone(false);
collider:setBumpStaggered(false);
collider:setBumpFall(false);
--collider:setIgnoreStaggerBack(true);
end
end
end
end
Events.OnCharacterCollide.Add(ATOnCharacterCollide)
Sorry to interrupt! I'll brb, eating some dinner and I'll take a look at the chat after
This makes no sense, the GUIDs are correct, the names are correct wtf is wrong
Like, does anyone see anything wrong here?
Even the names are matching wtffffffffffff
I didnt know theres a setIgnoreStaggerBack()
Thats pretty useful
Does it work
I think youre missing a name and a path on the xml file thats inside the clothing folder
What do you mean?
The image in the middle
Is that how its written? Im on mobile
But iirc its missing some stuff
if you are referring m_MaleModel and m_FemaleModel I did not fill them in intentionally, it's an empty model, like the Belt
could anyone explain to me how to associate a lua table with a certain item? I'm trying to store the number of times and object has been used. Thank you
Maybe one of the known clothing modders can take a look at this, because this problem has put a massive roadblock in my testing
Try modelling?
yeah
Im pretty sure he ment you @ 
What was it
I was also looking at that
Thinking i think theres something missing but not quite sure
I knew it should be a path to xml
But i thought maybe it was the model
Was looking st the 2nd img
All this time it was the guid xml lol
Ajhh i see
Lol so it wasnt shown after all
Yeah this wasted me so much time 😦
How would I override a vanilla items script parameter? Like if I wanted to add an evolved recipe to a food item that doesn't have one
I tried just having it as the same name and parameters + my custom parameter ; however, that did not work
Can I add recipes via lua?
I'm trying to dynamically create a fairly simple recipe, just a straight one item for another.
I could write it as definitions but I'm doing weird stuff with detecting mods so can't rely on the .txt files, as I'd need loads of sub mods and one would have to manually enable them
do you have a 4:3 monitor lol
no i just have pz in windowed mode
looks like a runescape paper crown you shud make that
quick question is there a way to get a unique id for every inventory item?
I want to display a string of text to the console to help with my lua debugging. How do reference the console? I am assuming it is basically "something.print(STRING)" at the most basic just going by some lua references.
print()
it does SOMETHING, but I can't really tell what
I have! but uh, they do it completely differently
interesting
So I didn't know if it was like. A legacy thing or...
The programmer did some hacky stuff like using ghost mode here and there
and they do the whole thing in the OnPlayerMove event
Yeah I assumed ghost mode would be involved
Thank you very much.
hi guys i'm trying to do a mod that adds passenger seats for the truck bed and that lets you shoot, i discovered how to add the passenger seats and make the model appear in the back but i dont know how to add the turning animation to the model, does anyone know?
True music: Check
Colorful life: Check
Remote Light controller: Check
a fog machine mod: ???
How can I provide myself entertainment without a fog machine to make my own basement rave?
Wht r u trying to do
You should look for the server command to cast the smoke
Long story short, knock over zombies when sprinting, stop the bumping action on the player, and figure out why the player gets trapped in an animation when hitting 3+ zombies clustered together
Maybe cuz of dragged down
It triggers players to get eaten
While you are forcing it to not react maybe
Took off god mode. The animation freezing thing that happened above happened when I hit 2 zombies at the same time
InventoryItem:getID()
thank you
ids are the same across server/client and i think persistent too
and I also have kind of a general question about mod data
If you do item:getModdata() is that exlusive to the item? Can I use that to store data about the specific item?
yeah
great
thank you
I thought it was global or something and I was going to put the id as an index
steam://https://steamcommunity.com/sharedfiles/filedetails/?id=2853615523
Update to my shops and traders mod, now featuring player ran shops. 👍 Shout-out to BowlOfOodaLoops for sponsoring the endeavor.
bonus art
I'd appreciate any feedback that can be given
I want this tank to be used from two squares and now it works by having two pumps. If I leave only one pump so it's the same level of fuel which actions would I need to patch? I know worldobject context and radial for vehicle, any other menus?
hm, maybe I can do patch for the function that finds the fuel pumps and sync the levels there.
Question: does anyone know if it’s possible to mod the game so that the player can carry more than 50 pounds of stuff at a time in the main inventory (the one displayed by that cardboard box)
This might be a really easy question as it's basic .lua which I'm still new to but: Can I define functions in one file and call them in another? So I can have like helper functions I reuse. Not sure how lua works/executes, or if I have to write a line to import it.
You can use any global function directly.
You can also make modules by making a file return a table, and using
local module = require "file"
you should search for how require works in pz if you use this
So does that file basically return a {} with the functions you want as properties?
Cool, so basically how js modules work under the hood 😅
Thanks all, as always. I popped my head in last night and have already posted like three questions but everyone's been helpful and massively improved my understanding of lua/pz modding.
I'd been Googling/reading the forums all week with no progress - turns out the discord is where it's at.
shared/fileA.lua
local x = 0 -- Private variable as its never exported
function funcA()
x = x + 1
end
return {
funcA = funcA
}
client/fileB.lua
local utils = require('fileA')
utils.funcA()
a lua file can return something and be imported later.
also if you come from a js background you may wanna look at pipewrench and pzpw
https://github.com/Konijima/pzpw/wiki/Tutorial:-Creating-Project-Zomboid-mods-using-PZPW
Oh nice. I've literally been using TypeScript to process data and write recipe blocks for me and just copy pasting them 😅
Thank you very much
if you want to see example of pzpw mods, here my latest using the latest version of pzpw
https://github.com/PZPW-Mods/Death-Log
Does that have types for the pz built ins? Because that would be amazing
yes, pzpw uses pipewrench, so basically you have intelisense for all of pz java side and lua side
😱
You have probably just increased my efficiency by several orders of magnitude.
I will check that out for sure - thank you!
if you have question don't hesitate to ask! 😄
also check out some example (maybe outdated) in the wiki
https://github.com/asledgehammer/PipeWrench/wiki
I'm sure you'll hear from me, haha. I have an extensive programming background - but never lua (apart from some light stuff in gmod) or PZ. Been really struggling to even discover what types/functions/etc I have available to me. So using TS (my current language of choice) with intellisense will be huge.
Also, I was ranting to my friends yesterday how backwards lua is - so many things about it make me 😬
Don't worry. You're not the only one that does that with Lua.
PipeWrench started as a joke and critique of Lua.
Well I'm glad it exists, my thanks to all involved who made it real haha
Am I able to go TS mad in this? Like is there anything it doesn't support?
Can I just be creating my own types, lambda expressions, etc, all over the shop?
For some missing or any types for the Lua codebase of PZ you can write Lua interfaces and mix TS code with Lua
There's some caveats. Look up TypescriptToLua.
Hmm is there any reason ArrayList<E> get method returns any and not E?
I was the only developer for PipeWrench. I had a lot of help getting it to auto run for updates on PZ versions.
I only exposed what PZ exposes.
Hmm, okay, fair.
I wrote the code that inspects and traces what is exposed and the generics as well.
nice
That's a good idea
Basically just pull out everything and make ts typedefs for it, so we can have intellisense
Not only that but type safety
Yeah, that's what I was hoping but the first thing I went to use returned any despite it being generic haha
PipeWrench is powerful.
var recipe = recipes.get(i) as zombie.scripting.objects.Recipe; is what I ended up doing for now, as I know that's the underlying type
Or use import deconstruct
I should get back to my rewrite of the Lua to Typescript transpiler.
I shelved that to work on a vscode extension for ZedScript for a few months.
I shelved that right when I had a breakthrough on emulating PZ pseudo classes in their Lua codebase.
I am getting a little confused with the type hinting
I see types in the typedef file, but just any in my actual scripts?
Probably something that I had to do to get it to play nice before I finished generics support
I was thinking about rewriting the transpiler in Typescript and to have it use source files instead of reflection in runtime.
Reflection is a terrible way to extract generics since that's all but erased at runtime.
Yeah, in Java, they'll all exist and you'll be able to probe to no end the generic types of any params and returns.
TS on the other hand, types aren't real once it's transpiled to JS, so I assume the same is true for transpiling to lua.
However, these are just typedefs in the TS world so should be fine/doable.
It'll depend on the java code and what's visible (which I haven't seen so can't really comment). This stuff is still massively helpful, I just have to be a bit creative/cast things.
Yeah. I code JS at work entirely with typedefs.. something I chose to do.
I go hard on it.
My work refuses to adapt to TypeScript.
oh no :x I work in an entire TS stack for both backend and frontend.
Yeah, I used to work on a 15 year old PHP application - old stuff gets stuck haha
I've worked in Java for over 15 years. JS for around 10 on and off.
TS for about 5
Try ASP.NET framework 4.8.
I can't use modern C# syntax sugar. 99% of the code is in VB.
I'm changing that.
lol
D: C# is actually one of my personal faves
Couple jobs ago I was the sole maintainer of a c# solution that we had to remote desktop in to some laptop that had a vs2008 (or something) license as it was the only way to build it (and they only wanted to buy one license).
I ported it to .net core 2.0 when that was new, built it a new pipeline and auto deploy jobs.
Nope.
I code in VSCode.
I use Rider for C#, but VSCode for everything else.
Visual Studio is too freaking big and also it's cumbersome to code in.
Aye, it's a mess.
Well, sat down and actually wrote a replacement TS version of what I'd done so far in lua and it's all working 👍
Good stuff, thanks for that
Good stuff.
I'm still a little confused on arrays, as I've seen people say Lua is 1 based. But under the hood, Zomboid is Java...
I've seen some mods start at 1, and do < size + 1
To loop all recipes, I've done for (let i = 0; i < recipes.size(); i++) and it didn't blow up
In TS, you should be fine staying with 0 throughout.
Unless whatever you're invoking is Lua-specific with a index param.
Also PZ Lua is not real Lua. It's Kahlua2 which emulates incomplete Lua 5.1.
Oooh, okay, noted.
It was developed over 10 years ago with Java 1.6 technology.
it depends on what you're interacting with
It's utter trash.
lua tables are 1 based (unless the developer is weird, which happens more than you'd expect), java objects are still 0 based
This, but changes when working inside the TS environment.
TS is transpiled to 1 instead of 0.
(IIRC)
I could be absolutely lying since it's been a year since I made this.
TSTL aims to support almost all modern, idiomatic TypeScript without any modifications. In other words, you probably will not have to worry about the idiomatic quirks of Lua or other internal decisions that TSTL makes when converting code.
This is all I could find ATM.
Either way you could write a quick test-case to test this out @novel swallow
Refer to the documentation on this website when you need to clarify any differences from a conventional JavaScript environment.
Yeah, I have a feeling this is going to be "do it 0 based till it errors" lol
IMO The less time spent rewriting code for assumptions the better.
if I find something odd, I'll just end up wrapping it and using my wrapper anyway
I can't imagine having to go through pure Lua and figure out what API change(s) broke my mods.
TS compile will tell you right away.
debugging lua and just... knowing what props/funcs are available was killing me after just an hour
no IDE/intellisense help either
it was like going back in time
More people script than code in PZ so I shifted focus to writing the first full scripting support environment inside of VSCode for people to use.
I'm not really seeing much traction with that even though I have mentioned it a lot so I might shift back to PipeWrench. Who knows..
Is there a way to add recipes via code using PipeWrench?
I'm not a huge fan of them being .txt files 😅
Would be cool to write an API for that.
Since it's a node environment that can be possible.
basically turn code in to the .txt files you mean?
(Some flaws in this commit version but) https://github.com/asledgehammer/ZedScriptParser
I'm also a freak, btw.
lol
I mean it looks like you've written what I was planning to write, haha
Does JSON.stringify work in TypeScriptToLua? That'll help me with dumping out stuff for analysis
No. That's why I wrote a Lua interface for a Lua library I modified to work in pz Lua.
.
@novel swallow
oh wow, you really have done everything I need 😂 thanks
No problem.
It's really funny how I'm just one dude with an itch to code properly and made all the stuff I linked. xP
You can make things so much easier and yet no one takes the bait to do good or even better with it.
I was thinking about the zed corpse
In some ways they are similar to manequins ..could the be a chance to add to their poses like what i did for the tha manequins
I wonder...?
i don't think so, i think their pose is decided by a boolean
Hmm, is there a way to get fire rate of a gun? I don't see it on the base Item class
and now I'm doubting if the min/max damage of a gun is the melee damage or the projectile damage 🤔
it should be on handweapon
How do I get that from Item?
Are you aware of the differences between Item and InventoryItem classes ? Are you sure you are manipulating an Item instance ?
oh, sorry, actually if you're on Item it should be there
i was thinking of InventoryItem
I'm filtering the result of getAllitems and I'm brand new to this so no idea 😅
if there isn't a getter for it then you might actually need to make an instance to get it
i think it'd be called swingtime or something
Hmm I checked that but it doesn't seem to be representative
it isn't, attack speed is heavily tied to animations
i don't know of any way to compensate for that
You could create another xml and the animation itself speed it up and do a boolean check for when the speed should be faster
Hello,
I need a little help if you can.
Events.OnZombieDead.Add(FunctionName)
This event work or not? I don't see anything.
it works
If you are interested in combat speed, as it is complex and messes with animation speed, I suggest you start by having a look at my mod on the topic. https://steamcommunity.com/sharedfiles/filedetails/?id=2864671032
ok thx. I will continue trying to see.
Does that stuff also apply to firing guns?
Hmm I guess the real question with guns I want is how long it takes to get an accurate shot, not fire rate 🤔
i think that's referred to as aimingtime
yes it applies to guns.
I still need to know if I can get TIS to quickly add primitive numeric wrappers for Lua API.
I really shouldn't store bits / bytes as floats / doubles because Lua doesn't support primitives.
=/
We'd use so much less ram in PZ if mods could access these sorts of tools.
Also I would literally throw my example code on how to pass arbitrary uniforms to shaders in PZ if they'd implement either it or their take on it.

Controlling shader values from Java or Lua code is something that I'm sure a lot of people asked about over the years.
hey. Does anybody know where the streetlight properties are hidden in the scripts? Where is it triggered on/off? thanks 🙂 Couldn't find anything related yet
if i write a print, where the print will come? in game on command console output log? Do you have other tips for see if my code is executed or not?
debug mode has a console in-game. You can expose the game's command prompt by running it through CLI.
Yes i have this console, but i don't see my print on it. I'm spammed with many log.
ok thx
Uhhh
It's neat that there's a debug mode for Lua in PZ.. however why is there a SQLite editor in PZ? Mega security-flaw.
@indigo grove
thx Poltergeist.
Actually i only have this.
print("WakeUp is hook!")
if zombie == nil then
return
end
end)```
yes?
#FreeGeneralChat
Please don't bring up BS in here.
is mod enabled? Where is your file? Is this MP / SP?
This is for mod development.
Events.OnZombieDead.Add not addListener
also addListener?
addListener is from PipeWrench-Events API, not vanilla.
My mod is enabled and i'm in singleplayer debug mode, the file is in media/lua/shared/zombieWakeUp_shered.lua
Ok, thx. I will try just add.
Add
no zombies harmed during testing?
PipeWrench implements more natural naming conventions for API.
I hook to this event to set them on fire so it should work.
ok, i'm doing a mistake i think. Don't work for me actually.
print("WakeUp is hook!")
if zombie == nil then
return
end
end
Events.OnZombieDead.Add(ZombieWakeUp)```
local function ZombieWakeUp(zombie)
print("WakeUp is hook!")
if zombie == nil then return end
end
Events.OnZombieDead.Add(ZombieWakeUp)
Looks fine?
is this the entire file? maybe a syntax error earlier on is stopping this part from even being reached?
otherwise i think the file just isn't being loaded at all
it works ! , thx you. What is my error? indentation error?
Python pains, not Lua.
Hmm. I'm still struggling over here to turn an Item from getAllItems() in to a HandWeapon
Hand weapon has a constructor and I passed stuff in to it but... Then it doesn't seem to work properly.
InventoryItemFactory.CreateItem(String itemType)
is itemType there getTypeString on the item?
getName()
that's a little inconsistency, name usually refers to the translated name but on Item it's what's referred to as type everywhere else
ah I see
getFullName() might be better
ooooh, you seem to be on to something 👀
Thanks
I've got more correct looking data coming out now (trying to glean stats from items)
When things say Time like AimingTime and ReloadTime, what unit is that?
Some kind of game tick? If I had to guess, it'd be like 60 ticks a second so a Time of 30 would be 0.5s
Well this say reload time is 30 and it certainly doesn't feel that slow 😛
ohh this works weird
the player's 'BeenMovingFor' increases 60 per second while moving and decreases 30 per second while not moving (clamping between 70 and 0)
if the player's BeenMovingFor is greater than aimingTime + their aiming level, it subtracts the difference from their hit chance
i think that's how it works anyway - if you sprint around for a really long time and it doesn't seem to take much longer then there might be more factors i'm not seeing
oh!!
i'm talking about aiming time and you're talking about reloadtime
i think reload time probably uses the same ticks as recipes/timed actions, which nobody seems to really know...?
Yeah, we're talking about different times BUT thank you for what you just mentioned as that is useful info to me as well 🙂
Oh wait, I was taking about both times! I assumed they were the same unit - but appears not.
yeah, reload time should be timed action ticks (on top of a reloading speed modifier based on skill and probably panic and stuff?) but i've never heard how long they are
my reading of the code says they should be 1.25 seconds, which is blatantly wrong, but i can't find anything else relevant
Polling for opinions:
I have an trait that subtracts endurance from the player every time they collide with an enemy. Problem is, the collide event triggers each tick until the enemy can no longer be collided with, subtracting ungodly amounts of endurance. I've already tried to mitigate this by storing the last collided with entity, and it works--for one player or zombie. A crowd is a problem, especially if you collide with two at once. So what should I do?
- Store an array of entities the player has collided with and track the time since collided, removing them after ~1 second. Use this to compare instead of last entity collided with.
- Create / find a different event that triggers only once in the process.
- something else?
by the way, I figured out how to stop the player from being bumped. You just need to set the bump type to "", a la
collider:setBumpType("");
collider:setBumpStaggered(false);
collider:setBumpFall(false);```
I know @ancient grail was interested in this
sorry I wasn't trying to @ you for your opinion, just to let you know that I figured out the bumping issue I was having yesterday. I remember you saying that figuring that out could be useful for you
but obv your ideas are appreciated
if not zed:getModData().bumped then return end```
you'd still need to remove it after a second
so it seems like keeping a lookup table would be better than going through moddata
I use vishnyas lua timer
Oooo enlighten us pls
i'd like to look for a different solution though, could you just check if the zombie is currently falling/on the ground?
I for some reason didn't think of this. There's something similar, one sec
You should follow albions advice instead
And use mine as a last resort
in isoGameCharacter there's an isBumped. I'm not actually sure if the zombies get bumped or not, but I could set that too
That i believe is just for a short while? Does you collider have infinite energy
Can collide 100% all the time
How will it die

no lmao. Once they can't sprint they're unable to do the event
which is bowling over a zomboid lmao
I see
I'll post the code once I can get it to work flawlessly
Then check for endurance level instead
or mostly flawlessly, at least
here's what I'm checking for
U already made it so that it reduce enduranxe right?
check if the collider is a player, if so, is it colliding with the previous entity it collided with? if not, then check if it has the right trait, if it's sprinting, and has been sprinting more than 10 (i'm unsure as to what unit of measurement this is, but it seems fine)
Sounds good
I can add
and not collidee:isBumped()```
at the end of that second-to-last if and see if it works
Try it
again, i wouldn't really use moddata for temporary data like this
local lastCollidedChr
local function ATOnCharacterColide(collider, collidee)
...
if colidee ~= lastCollidedChr then
...
lastCollidedChr = collidee
end
if you need splitscreen support you can make it a table indexed by player number instead
if you look at the event in the documentation it's really hard to tell who's the collider and not, so I made it easy for myself by fudging english a bit lol
If both are sprinting then yes
Ah that can be fixed easily
Just need to add
if instanceof(zombie , "isoPlayer") then return end
btw, just a style thing, but it can be a lot prettier to do if not condition then return end instead of if condition then if you're wrapping the entire rest of the function in that block
I want to do this. Unfortunately I think I'm gonna need more explanation to do it? Other than being able to support splitscreen, what benefits are there to not using modData? At what point does this temporary data get cleared? Where exactly do I put the table, in the main lua script outside every function?
I'm one of those people who love the
}
}
}
at the end of each function. I find it helps me keep my syntax straight if each if block is indented more
but I'll take a look at returning
getModData() is a java function, so it's slower to call that than to just use a variable (though you could cache it to get around that), and a regular variable will be cleared whenever the game closes or lua is reloaded, instead of being saved as part of the save file
moddata would support splitscreen by default though
if it's the style you're comfortable with you should keep it the way it is
if you wanted my way to support splitscreen you'd instead do```lua
local lastCollidedChars = {}
local function ATOnCharacterColide(collider, collidee)
...
local playerIndex = collider:getPlayerNum()
if colidee ~= lastCollidedChars[playerIndex] then
...
lastCollidedChars[playerIndex] = collidee
end
Gotcha! I can understand that a lot better
Is there a way to make that table two-dimensional in lua? That's what I'd need to solve the current problem
...speaking of which, give me a moment to test the isBumped() idea
I've been looking at this chat nonstop lol
yeah, you just put tables in the table
can I make an item than when you use it, grants a recipe and then is consumed?
Oh, that looks quite easy actually, nvm.
Gonna release mods under the banner "Team sledgehammer"
Just gave two old laptops a new life, one by replacing a bad HDD and both by doubling LRAM. One now has Ubuntu.
does anyone know how many vehicle scenes there are in PZ? just wanna make sure I didn't miss any
okay I have it working. Needs more testing from players over the long term, but it seems to work well for me!
Here's what I got: This will knock down zombies if you're sprinting at them with the appropriate trait, and only trigger the endurance reduction once!
local function ATOnCharacterCollide(collider, collidee)
if instanceof(collider, "IsoPlayer")
then
-- take the sandbox cost, modify it by the difference between the player's current strength/fitness and the average strength/fitness of 5. Then turn that into a decimal since endurance is a decimal. Pick .01 if the cost is lower.
-- if you ever figure out math, make it do a percentage taken away instead of a flat number
local knockdownEndCost = Math.Max(SandboxVars.AnthroTraits.BullRushKnockdownEndCost - (((collider:getPerkLevel(Perks.Fitness) + collider:getPerkLevel(Perks.Strength)) - 10) / 100), .01)
local colliderBehindCollidee = collidee:isFacingObject(collider, 0.5);
if getDebug()
then
print("ATOnCharacterCollide Triggered");
end
if not collidee:isKnockedDown() and collider:HasTrait("AT_BullRush") and collider:isSprinting() and collider:getBeenSprintingFor() >= 10
then
if getDebug()
then
print("collidee: "..tostring(collidee));
print("colliderBehindCollidee: "..tostring(colliderBehindCollidee));
print("Is Sprinting: "..tostring(collider:isSprinting()));
print("getBeenSprintingFor(): "..tostring(collider:getBeenSprintingFor()));
print("Tripping: "..tostring(collider:getStats():isTripping()))
end
if instanceof(collidee, "IsoZombie")
then
collidee:setStaggerBack(true);
collidee:knockDown(colliderBehindCollidee);
collider:getStats():setEndurance(collider:getStats():getEndurance() - knockdownEndCost);
collider:setBumpType("");
collider:setBumpStaggered(false);
collider:setBumpFall(false);
elseif instanceof(collidee, "IsoPlayer") and ((collider:getCoopPVP() == true and collidee:getCoopPVP() == true) or collidee.isZombie())
then
collidee:setBumpStaggered(true)
collidee:setKnockedDown(true);
collider:getStats():setEndurance(collider:getStats():getEndurance() - knockdownEndCost)
collider:setBumpType("");
collider:setBumpStaggered(false);
collider:setBumpFall(false);
end
elseif collidee:isKnockedDown() and collider:HasTrait("AT_BullRush") and collider:isSprinting() and collider:getBeenSprintingFor() >= 10
then
if instanceof(collidee, "IsoZombie")
then
collidee:setStaggerBack(true);
collidee:knockDown(colliderBehindCollidee);
collider:setBumpType("");
collider:setBumpStaggered(false);
collider:setBumpFall(false);
elseif instanceof(collidee, "IsoPlayer") and ((collider:getCoopPVP() == true and collidee:getCoopPVP() == true) or collidee.isZombie())
then
collidee:setBumpStaggered(true)
collidee:setKnockedDown(true);
collider:setBumpType("");
collider:setBumpStaggered(false);
collider:setBumpFall(false);
end
end
end
end
Events.OnCharacterCollide.Add(ATOnCharacterCollide)
If you don't separate the player and zombie classes, you can crash the game



