#mod_development
1 messages · Page 106 of 1
Thanks so much A) for your answer, and B) for being so addicted to improving this game that your offtime side project is to improve the game.
Yeh wolfie for the win
Anyone know off the top of their head how to detect if the current client is still loading chunks?
lmk if u find something that works reliably ive tried almost every piece of linux software for it with no luck
ill run windows software if i must
lol
In regards to chunk loading, I have found WorldStreamer in Java, just have no idea to how to get an instance of it in Lua
Gravy what u building bud?
How do you do stuff while chunks are loading?
Afaik chunks stream in another thread. Like when your driving and you get "stopped" because the chunk has not loaded yet. I want to teleport a player, then wait until all chunks are loaded to continue the script. I just need a way to determine if there are chunks still loading
I should say this is for MP
ah, so wait for sync on client.
is there any best practices for adding body locations?
Not to judge, but you seem to be overcomplicating this. You don't need client or chunks loading for spawning items.
I think you can do it by check getSquare() from some points around player
Dear devs if you can hear this please give some pointer to any pathfinder or its options so it still will try to find a way to occupied cell pathFindBehavior2 does seem return unsuccessful results instantly trying to reach the cell cancelling actions.
square* not cell
or maybe some test or function find closest accessible square
@pulsar heath could make some kind of API utility workshop item. (Or a GitHub repo containing the code to paste into projects)
Would be helpful to the community.
luautils.walkAdj()
Is there any easy way to get a list of all the chunks in a cell?
thanks ill check out
Progress on my LuaToTypeScript transpiler. =) (Working on tuples & function returns ATM)
perfect
Hm, you can theoretically create items procedurally
InventoryItem has constructor
constructor(arg0: string, arg1: string, arg2: string, arg3: string | zombie.scripting.objects.Item);
RPG stats on items when?
Stone Axe / Paper Axe / Scissors Axe?
Someone on my workshop is suggesting to edit my mod manually to 'fix' something changed over a year ago... if people modify the lua files on their end does steam just not update those files?
weird typo
*does this game support mom editing
They state a line # and contents that doesn't correspond - but I was able to go back through github to find when it would be relevant - February of 2022
usually it does, could it be he has done something else? move it to mods folder, etc?
If you don't update the mod then no
I'm thinking, steam doesn't remove added files - or files that we as modders remove -- so it's probably working off a checksum - perhaps they skip files that don't match the last checksum too?
I've edited other's mod for debugging compat issues and steam doesn't download over it
Stream will force replace the edit files only when the mod author update it
Another surplus files will still be there if you make some changes
I'm testing it... if i change a file it doesn't get removed when I unsub
not just that file, the whole mod
wait had the game running
oops
nope removes everything
I guess this guy manually moved the mods over
true, files from intellij for example won't be removed
Steam should delete only the files with the same hash
If you made some changes, it won't get removed
The mod folder will be missing when you unsubscribe, but it will come back when you resub
That's from my observation
i had someone complaining about a mod incompatibility pointing me to a file that wasn't in either mod
Anyone knows how to influence or modify fence vaulting trip chance?
How to make that the unhappiness doesn't affect my custom action?
overwrite adjustMaxTime(maxTime) on your timed action, or overwrite create() to not call it
thanks! i'll try these out!
Good luck!
Does anyone have Save our Station working on a dedicated server?
There are a bunch of fixes and updates and it's a little confusing
Please don't give them idea to turn PZ into yet another Tolkien fantasy 
I dare you to stop me. =)
Also: That moment when you have transpiled tuple return types.
I see what Jab wants.
He wants to convert Lua to TS and force everyone to use it.
Its like TSC (TypeScriptCommunism)

It's only a suggestion
Is there a way to make weapons shoot faster? I'm planning to look at the Brita's Weapon Pack code but if anyone got a quick answer I'd be glad
local saySomething2 = function(text)
print(text);
return 'hi', null;
end
let saySomething2 = function(text: any): [string, null] {
console.log(text);
return [ 'hi', null ];
};
@nova socket Are you not entertained?
Unofortunately incoming args types would always remain any and its up to individual to fix it 
Hahaha not so much true with my solution.
You wanna reverse the type of variables?
I'm implementing a walk phase for "Type-Discovery".
oh I see
Yes and it's already partially done.
Yeah, that's dope
All statements and expressions and their expression sub-components will be ordered with unique path IDs and those references will be compiled as potential type candidates.
at least generic types would recognizible, or you wanna really dig into classes return too?
like class -> method returns?
Fields, parameter expressions, etc.
Going to do linking with requires too.
I will take = table:derive() and identify pseudo-class structures.
mm
class being internally handled as extensions of tables with constructors.
I should make the class detection and implementation component as a plugin or something.
Yeah we don't really have any direct access to Java environment If I'm not mistaken
Maybe an adapter.
(TS classes)
I already do this with my first rendition for TypeScript declarations.
What sucks is that version not having any type discovery.
Reversing the types would be a big step forward, leaves you guessing what sort of 3 string that is in there.
or 3 numbers when its not obviously a xyz function

It can get nasty though if you have sub-class methods that restructures itself as either different returns, parameters, visibility scope etc.
Oh wait.. Lua doesn't know what a private is.
nope, no static, no private. Scope is determined solely by locality of your table(interface)
Yup. Was a joke lol
Apparently JS has private using #
Lua and ES5 JS are very similar.
Besides JS is OOP
How do you post code here in those expandable boxes?
ES5 wasn't OOP?
```JS
code
```
For my situation, I'll have to construct classes through ES5 logic.
```lua
in most cases
Makes sense due to similarity you mentioned.
It doesn't mean I won't use the class syntax in TS. It means I have to interpret the Lua code differently.
It's why I commonly refer to Lua classes as "pseudo-classes".. because it is literally just that.
Lua can support OOP.. It doesn't mean it is packaged with OOP.
Same with ES5 JS.
I mean it would break the concept of Lua of being simple. If you want full-scale OOP why not go (like in this case) for Java.
Or even JavaScript / TypeScript if you want to remain in a scripting context? Monospace C# script?
Kotlin-script too.
TypeScript if for anything that looks like application.
I wouldn't say that JavaScript is suitable for L7 solutions, not like it cant but still.
It's not at any complaint or diss towards Lua OOP projects going on in here.. I feel like I'm being honest about my desire to have OOP support and guard-rail / type-safety checks by simply going to TS rather than implementing it inside of Lua, which it isn't designed to do.
Lets remember that JS doesn't have types either.
I don't use a language for a solution that it isn't designed to handle.
Hence TS.
I sometimes have feeling like TS first concept was somebody "fuck that, I want to know types"

Hahaha
TS is beyond simply compiling to JS though.
A lot of people get trapped in that mindset that it's only designed for JS.. even though TS is a superset of JS.
It's so goddamn flexible and intermediary that it is a pseudo-language in a technical sense of the definition.. A Haxe but actually useful.
I mean bruv, I completely undestand what you saying. I managed to fully describe my needs to operate with RAGE Engine on pure TS.
Apparently a lot of Warcraft modders use TSTL.
So yeah.. I love the phrase "TypeScript Communism"
hahah
Its simply enough flexible to just study it for being hand.y
"From each according to his interface, to each according to his implementations".
It's like frontenders with their React and Angular. Like you can do your own, but why if its either first or second.
Well you could write any kind of transpiler extending from TS and have any TS code transpiled to it.
What's to stop me from converting Lua to TS, to Java?
None, but your will to do it pretty much.
Exactly.
My drunken ass started this 2nd transpiler yesterday lol.
Either I have a lot of willpower or I'm silly enough to waste my time on these projects. <3
I'm trying to overwrite variables of items and I cant just seem to get it to work. As an example I'm just trying to change the name only in dried chick peas the game seems to recognize the Item Dried Chick Peas is overwritten because when I mouse over the item it'll tell me mod: ChickenPeas but the item name still remains Dried Chick Peas. I'm aware there is an Item editor but I don't want to use it in this case.
module Base
{
item DriedChickpeas
{
DisplayName = Chicken Peas,
DisplayCategory = Food,
Type = Food,
Weight = 2,
Icon = DriedChickpeas,
EvolvedRecipe = Soup:10;Stew:10;RicePot:10;PastaPot:10,
FoodType = Bean,
Packaged = TRUE,
HungerChange = -60,
ThirstChange = 60,
UnhappyChange = 40,
Calories = 2851,
Carbohydrates = 544,
Lipids = 0,
Proteins = 181,
WorldStaticModel = DriedChickpeas_Ground,
Tags = DriedFood,
EvolvedRecipeName = Chick Pea,
Override:true,
}
}
Not everything can be overridden it seems, I also tried to change category of item just to find it being the same. I might guess it has something to do with load order.
However I'm too new to know if you can set a load order for scripts in any way.
Its odd that the game says Dried Chick Peas now comes from my mod but the values dont change. Maybe someone else will know the answer. This is my first time dabbling in modding scripts and the only work around I can think of is using the obsolete function and just creating a whole new item but I doubt it will let me use that as well.
😭 oh nooo that's so dirty, and potentially unreliable. What if the player is near edge of map and there are squares that does exist.
Oh wow never mind. The work around I thought of actually worked. The obsolete function removed the vanilla item and I then I duplicated the script without the function and changed all the values I wanted. It seems I just got to modify the recipe now and im all set
Which method you used to wipe item from Base?
OBSOLETE = true,
You guys know that display name and category get translated right?
Any reason why I shouldnt use this or just curious?
...god dammit I knew that.
Big ass brain fart right there
Adding a script occupying the same ID will overwrite the old one
Recipes are a different matter
Well thanks for helping me learn the easy way. Now we know the convoluted way as well.
Happens alot unfortunately
Alright so, need some assistance; where would I find where I can change the requirements for the basic wooden wall and door frames?
Ideally I would like to add an alternate recipe for each rather than overwrite, but either will do for now.
development can be a cruel but I got to walk away with learning an easy way to do it and a more complicated way to do it that I figured out all on my own. Thats a win in my books.
True mark of someone learning to program; finding new ways to do the same thing :3
Good luck with what you're making! lolz
Thanks man I really appreciate it! Im pretty familiar with C# and have been learning Lua specifically for this game just haven't done much outside the lua scripts yet so Im not familiar with landscape.
Anyone know a a reliable way to detect in mp if the client is still loading chunks?
Similar to me then haha.. I've made and released several apps in C# for other games, and started learning Lua specifically for this game.
multistagebuild.txt
Wouldn't there be a way to check what chunks are loaded locally, and then compare that to what is needed?
That has all except the base structures, unfortunately.
the base structures are defined in lua
Okay, so I'm thinking the multistagebuild that's in the scripts folder. Should I be checking elsewhere?
you should be checking the lua folder
all the build menu stuff is just hardcoded
or as 'hard' coded as lua gets anyway
Do you happen to know how to know what is needed? I have been through every bit of the Lua in base PZ and can't seem to find anything
I found a class in Java called WorldStreamer but it doesn't seem to be accessible from Lua
it's not designed in the least for extensibility and the code is even ugly as hell to boot
You can say that again
Unfortunately I don't know, no. I generally have never needed to do anything even close to that. What are you trying to accomplish.
are you trying to use a fake player to force chunks to load?
No, I'm making a loot respawner that's far more configurable with fine grained control.
so why do you need to teleport a player and test if chunks are loaded?
Would it not be possible to detect when a chunk is loaded somehow, and use that to daisy-chain you functions?
No need to force-check it's loaded, if an event/function was fired by the client because it loaded.
I hijack the right click respawn mechanism to refill the containers. Only way I know to do that is to have it done on client. Everything is working perfectly except once in a while some containers are missed because the chunk isn't loaded yet when I trigger the search for containers
I don't know if the base game includes something like an onChunkLoad(), but that would be where I would start looking, if it does.
I've been looking for hours on this
All the simple ideas I have burned though
i have a mod that needs to run on chunk load and it just uses LoadGridsquare and modulos the coordinates
LoadGridSquare... Searching now. If this works I'll save a special place in my heart for you forever
keep in mind loadgridsquare is pretty notorious for its performance hit - i use every performance trick i know when i have to work with it
Alright, I'm finding the parts that create the build menu itself, but I'm not seeing where the requirements for each piece are. Like for example, wood wall frame requires 2 planks and 4 nails.
I am either blind, or not sure what I'm looking at here.
Ty, this will only be used once in a while and only by admins on a server to repopulate small portions of the world with loot. It's horribly inefficient and slow, but it doesn't matter.
im starting to wonder if it is even possible to make a character start bitten with profession framework
ProfessionFramework.addTrait("Bitten", {
name = "UI_trait_Bitten",
description = "UI_trait_Bittendesc",
cost = -10,
OnGameStart = function(trait)
Events.OnCharacterCreateStats.Add(function()
local player = getSpecificPlayer(0)
if player:HasTrait("Bitten") then
player:getBodyDamage():getBodyPart(BodyPartType.ForeArm_L):SetBitten(true, true)
end
end)
end
})
i think i have tried every combination of suggestions and ideas from reading other posts in this chat
Take a look at the extended traits mod, it has a trait for injured
Id use that as a base
i have looked at that mod and it has like 500 ZombRand rolls for random injuries and the types of injuries, but none of them are bitten
what is OnCharacterCreateStats? i don't think that event exists anymore
and all i wanna do is make it a guaranteed bite
iirc the OnGameStart function will be called automatically when a character is created with that trait, you don't need to add it to an event
i tried it because i read a post that said OnCreatePlayer would make the trait happen whenever the player loads in
i have also tried it without adding it to an event and all that jazz too but i dont really understand
if you want to capture player creation only once, use OnCreatePlayer and set a mod data on the player
replace OnCharacterCreateStats?
then if you function checks for that moddata before running it won't run more than once
oh wow. i have no idea what any of this means
i dont know how to code and this is my first mod, but i wanted to add this feature
but i think profession framework probably already does htat
let me check what OnGameStart actually does
how do i check that? or the list of all this game's vocab and what they do
There isnt a dictionary.
You learn through skimimng code
i figured
i found a thing about zombie damage from a dif post on here that i was trying to understand
Javadoc Project Zomboid Modding API declaration: package: zombie.characters.BodyDamage, class: BodyPart
no, it doesn't u_u
I dont want to sound like a dick but maybe take a deep breath or a break. I can tell through discord how frustrated you are right now.
other mods i have looked at that use profession framework use repeating events (like neurodiverse traits)
im fine rn, just trying to gauge how difficult this would be or if it is worth trying at my skill level (0)
the basic idea is like
Events.OnCreatePlayer.Add(function(_index, player)
local modData = player:getModData()
if modData.yourModData then return end
-- the actual code for adding the bite goes here
modData.yourModData = true
end)
Do you understand what all of that means? We can break it down for you if you dont
everything i have done so far involves just adding stats and items, so this is completely different from what i've done before
i'm not sure if going through profession framework will actually help in this case, you might just want to add this to that event directly
that's what i figured, but i had issues when i tried doing some things with profession framework and some things without
unless i just make a completely new mod that only adds a bite trait so i dont have to worry about the rest
in that case the only change you really need to make is like
Events.OnCreatePlayer.Add(function(_index, player)
if not player:HasTrait("TraitName") then return end
local modData = player:getModData()
if modData.yourModData then return end
-- the actual code for adding the bite goes here
modData.yourModData = true
end)
(actually this would be needed even if you went through profession framework... disregard the first one)
and then the moddata stuff is that code about the get body part and add damage etc?
what happens in the first instance of modData.yourModData vs the second time? i assume i dont write the same thing there twice
at the first point, we check if it's already been set, and if it has we just cancel the function
at the second point we actually set it
oh i see
that way the function only runs if it has never run before
so do i change yourModData to what im actually doing?
yeah, you can call it whatever you want
so like giveBite? or something
did i do this right?
if it doesnt work cuz im using prof framework then i'm ok with not having this on my mod. just wanted to see if i could do it. it's just for personal use
No. local modData is just a place holder name.
i see
Its asking you to name a local variable
so I would name it something like local playerIsBitten
'local' means that variable can only be used inside the script or function depending how you use it. It stops it from being a public variable which can be called from other places that you dont want.
playerIsBitten is a bit unique but when you name a variable 'speed' for example. You could have a ton of other functions or scripts that have theyre own speed variable and can accidently call it when you dont want to.
Someone correct me if im wrong anywhere. Ive been coding for many years but this is my first time trying to explain
i understand
but what do i do about the yourModData part? i see we set a variable for local modData, but i dont understand what to do with getModData or yourModData
that part to im a little confused about too. Lua is still new to me.
The idea is though is the if statement is checking to see if what its suppose to do has already been done to you.
so is it something i can/should change as well? i was thinking i would change it to CheckForBite or something?
In the method there is modData.yourModData = true at the bottom, that means all the code thats suppose to be above it gets called, thats where youll add the logic for being bitten.
Yes that would be a good one
so is my code for the bite in the wrong spot atm? should it go below the true statement?
The code runs from top to bottom so when the if statement is false it will start with your logic to make yourself bitten then make a boolean true.
oh okay
so it is in the right spot? or it doesnt really matter since the check already happened by then?
After that the if statement 'if modData.yourModData' is now true so its stop it from running the if statement again
What do you mean?
Which part of it?
the player:getBodyDamage goes above the true or below? or doesnt matter
above
ok
modData.yourModData = true stays at the very bottom
If you have it on top the code will turn the boolean true before any of the other code gets to fire off
and once all that is settled i just need to make sure i'm actually properly assigning a bite to the forearm?
Something like that
Its looking much better
But you need to work on your code format. Its incredibly hard to read.
Can you send it over in that grey box thing
ill clean it up and show you what I mean about code format
ProfessionFramework.addTrait("Bitten", {
name = "UI_trait_Bitten",
description = "UI_trait_Bittendesc",
cost = -10,
OnGameStart = function(trait)
Events.OnCreatePlayer.Add(function(_index, player)
local player = getSpecificPlayer(0)
if not player:HasTrait("Bitten") then
return end
local PlayerIsBitten = player:AssignBite()
if PlayerIsBitten.CheckForBite then
return end
-- the actual code for adding the bite goes here
if player:HasTrait("Bitten") then
player:getBodyDamage():getBodyPart(BodyPartType.ForeArm_L):SetBitten(true, true)
PlayerIsBitten.CheckForBite = true
end
end)
end
})
I would write a conditional as short as
if not player:HasTrait("Bitten") then
return end```
as
```if not player:HasTrait("Bitten") then return end```
personally...
Thats what I was talking about
i see
But if not that, then
if not player:HasTrait("Bitten") then
return
end
is also standard.
i see
But never return end because you make it look like end is the thing that you are returning
i see
You are not returning end, you are returning nothing at all (a.k.a. nil in Lua, null in Java)
You delimit the end of the if block using end.
u helped me earlier with the SetBitten(true, true) thing earlier right? thank u for that
Did that work?
i still havent figured out what im doing wrong tho
no, but im sure i can figure something out
-debug mode?
Yes
i havent
Would be a good place to start, just to make sure you even have the right command for making yourself bitten
as in run it without the mod activated? or with the mod
You don't need a mod to call getPlayer():getBodyDamage():getBodyParts():get(3):SetBitten(true, true)
Or alternatively the form of the command you were using above
getPlayer():getBodyDamage():getBodyPart(BodyPartType.ForeArm_L):SetBitten(true, true)
That's a vanilla command
Should work from debug to make you bitten
At least... that's the dream
and i have seen ppl use getPlayer and getSpecificPlayer and player
im assuming player is just the local term, but what about the other two
ProfessionFramework.addTrait("Bitten")
name = "UI_trait_Bitten",
description = "UI_trait_Bittendesc",
cost = -10,
OnGameStart = function(trait)
local player = getSpecificPlayer(0)
if not player:HasTrait("Bitten") then return end
local PlayerIsBitten = player:AssignBite()
if PlayerIsBitten.CheckForBite then return end
if player:HasTrait("Bitten") then
player:getBodyDamage():getBodyPart(BodyPartType.ForeArm_L):SetBitten(true, true)
PlayerIsBitten.CheckForBite = true
end
end
end
Events.OnCreatePlayer.Add(function(_index, player)
This is what I mean by code structure, what I wrote here is not correct at all in syntax since I dont have time to correct everything but you need to make it easier to read
is getspecificplayer for splitscreen?
getPlayer() gets player 0, getSpecificPlayer(X) gets player X
ic
You should look at the PZ lua files and observe how they place everyhing like indent functions and follow that.
in debug mode can i just keep testing the mod without exiting the game and reloading then by resetting lua?
Its the standard for code structure
yes
as long as your only editing the logic in the lua script. You gotta reload the lua script first though
its in the f11 menu
what are the shortcuts for reopening the console and stuff after closing them?
then you find your script in the list click it then click reload. If its not there its because theres a major error in your script and the game removed it
If your talking about the console in the bottom left hand corner of the screen, I have no idea
Nice
Awesome, now you just gotta figure out how to make the code work.
yes. ah the bane of my existence
i cannot just copy a framework and type silly numbers anymore
the ones on the outside r from profession framework
There are limitations to this, but often the answer is yes. If you are decorating any functions with code that you do not want to run twice, or code that cannot run twice, you will redecorate them by reloading your mod, and that could cause incorrect behavior or even exceptions in some conditions.
here is an example of a trait that works properly, because im not using Events
and because it is just in the format of profession framework
I have no idea how events work in that addTrait function but have you considered simply adding the bite OnCreatePlayer like I originally recommended?
and here is a profession framework example of a special trait
I don't know if it would work
yeah i tried it but i was probably doing everything else wrong
so none of my attempts have given the player a bite so far
Joy.biteMe = function(playerIndex, player)
if player:HasTrait("Bitten") then
player:getBodyDamage():getBodyPart(BodyPartType.ForeArm_L):SetBitten(true, true)
end
end
Events.OnCreatePlayer.Add(Joy.biteMe)
Keep at it man, trust me the high and sense of accomplishment youll get when it finally works is worth all the trouble
lolz... Joy -> Bite Me
lol thanks
thank u. i have been trying and failing for hours
Might I request a look at the question I asked earlier @thick karma? Not sure you'll be able to help, but I think I've caused myself temporary blindness staring at files the past hour or so jaja
The end of it is here; #mod_development message
I mean I dunno if I'll know but I'll definitely take a look! lol
Dude we all started like this
I've found just about everything related to building things, minus the one part I meed; actual definitions that get passed to the functions, indicating the required material(s).
Perseverance is the key ingredient.
@rancid panther Fwiw, I think something like this would bite a random part:
Joy.biteMe = function(playerIndex, player)
if player:HasTrait("Bitten") then
local part = ZombRand(player:getBodyDamage():getBodyParts():size())
player:getBodyDamage():getBodyParts():get(part):SetBitten(true, true)
end
end
Events.OnCreatePlayer.Add(Joy.biteMe)
Haven't tested it but it looks right
i see
(getBodyParts() just returns a Java ArrayList of BodyPart objects, so things like add, get, remove, contains, and size are available on the object)
@rancid panther And if you want to make sure player is only bitten once, you do this:
Joy.biteMe = function(playerIndex, player)
if player:HasTrait("Bitten") and not player:getModData().bitten then
local part = ZombRand(player:getBodyDamage():getBodyParts():size())
player:getBodyDamage():getBodyParts():get(part):SetBitten(true, true)
player:getModData().bitten = true
end
end
Events.OnCreatePlayer.Add(Joy.biteMe)
@true vault You try modding this?
ISBuildMenu.onWoodenWallFrame = function(worldobjects, sprite, player)
-- sprite, northSprite, corner
local wall = ISWoodenWall:new(sprite.sprite, sprite.northSprite, sprite.corner);
wall.canBarricade = false
wall.name = "WoodenWallFrame";
-- set up the required material
wall.modData["xp:Woodwork"] = 5;
wall.modData["need:Base.Plank"] = "2";
wall.modData["need:Base.Nails"] = "2";
wall.health = 50;
wall.player = player;
wall.completionSound = "BuildWoodenStructureLarge";
getCell():setDrag(wall, player);
end
(in ISBuildMenu.lua)
I didn't even see that, no.
Sadly, I was even in that file already too, further up lolz
I'll try that now, thanks!
I searched all the lua/script files for WoodenWallFrame to see what the Lua did with them
Fwiw
I tried using the Windows equivelant of GREP and it didn't turn up anything for "woodenwall" string ;-;
You should index your ProjectZomboid folder.
And your Steam/steamapps/workshop/content/ folder
Then you can just search in Windows.
huh... didn't realize indexing worked on file contents
sorry, wrong channel
when i try to give the player a bite with the mod enabled, i get this error
my mod removes the vanilla professions
same way i used console to add a bite without the mod
@true vault This seems like the best way tbh . . .
Lets you just right click folders and index them, and tell yourself why.
shrug
Can you click Errors and expand the window?
Or just post your console.txt from %userprofile%/Zomboid/
Sadly, this didn't quite work either;
ISBuildMenu.onWoodenWall = function(worldobjects, sprite, player)
-- sprite, northSprite, corner
local wall = ISWoodenWall:new(sprite.sprite, sprite.northSprite, sprite.corner);
if getSpecificPlayer(player):getPerkLevel(Perks.Woodwork) >= 8 then
wall.canBePlastered = true;
end
wall.canBarricade = false
-- set up the required material
wall.modData["wallType"] = "wall";
wall.modData["xp:Woodwork"] = 0;
wall.modData["need:Base.Plank"] = "3";
wall.modData["need:Base.WoodenNails"] = "3";
wall.player = player;
getCell():setDrag(wall, player);
end
ISBuildMenu.onWoodenWallFrame = function(worldobjects, sprite, player)
-- sprite, northSprite, corner
local wall = ISWoodenWall:new(sprite.sprite, sprite.northSprite, sprite.corner);
wall.canBarricade = false
wall.name = "WoodenWallFrame";
-- set up the required material
wall.modData["xp:Woodwork"] = 0;
wall.modData["need:Base.Plank"] = "2";
wall.modData["need:Base.WoodenNails"] = "2";
wall.health = 50;
wall.player = player;
wall.completionSound = "BuildWoodenStructureLarge";
getCell():setDrag(wall, player);
end
doesn't throw any errors, but doesn't change the build menu options either 
Error suggests you wrote getPlayer somewhere you meant to write getPlayer()
ah
It thinks you want to access a table but it's a function
It assumes table because no parentheses
i just did that with getSpecificPlayer(0) and it worked fine so i missed that with getPlayer
but the character is not losing health or taking damage
lemme check if they will get sick if i fastforward
yeah they are anxious now
yea they seem properly infected
I would just accelerate the rate of turning to test it
just without the bleeding, which im fine with. i think this might actually be better
Make players turn super fast
You may be able to deliver an artificial injury with it, I'm not 100% sure how to fake a bite wound.
Interesting...
and now i am losing health, just not from the wound
Could be hunger though
drank water and ate
also i am bleeding on the floor. the rate is just not changing and im not taking damage from it
make a player who starts out bitten, for ppl who want a rush to find a cure or force themselves to play a short game
to work with a mod that adds a cure or delays infection speed
lol
What is your goal exactly?
Essentially, I'm attempting to allow players to use wooden nails in place of nails, top build things.
Ohhhhhh I did not see what you changed, got it.
Are WoodenNails vanilla items?
Is Base the proper module?
Idk tbh
Never seen them
I placed them in Base, yes. Crafting the nails themselves works.
I might have figured something out.
Testing it out now
@rancid panther Try adding damage
Joy.biteMe = function(playerIndex, player)
if player:HasTrait("Bitten") and not player:getModData().bitten then
local part = ZombRand(player:getBodyDamage():getBodyParts():size())
player:getBodyDamage():AddDamage(part, 0.5)
player:getBodyDamage():getBodyParts():get(part):SetBitten(true, true)
player:getModData().bitten = true
end
end
Events.OnCreatePlayer.Add(Joy.biteMe)
I just died of bite that way
No I dont think so
i see. i'll try to get the other stuff to work first, but i actually think i like that it is a non-damaging bite
Its come to a point I dont know whats vanilla or not anymore
is it an open wound or is it bandaged on start?
it is open, but i'll probably give them a bandage on spawn
as it is, the wound is open
Actually, it works @rancid panther
This will work fine:
Joy.biteMe = function(playerIndex, player)
if player:HasTrait("Bitten") and not player:getModData().bitten then
local part = ZombRand(player:getBodyDamage():getBodyParts():size())
player:getBodyDamage():getBodyParts():get(part):SetBitten(true, true)
player:getModData().bitten = true
end
end
Events.OnCreatePlayer.Add(Joy.biteMe)```
I just tested it
And died purely of infection
You need to turn down the time it takes to die of infection
Aww shizz, it works.... now to figure out how to allow players to use both nails and wooden nails, instead of wooden nails only... lmfao
I turned mine down to 0-30 seconds and died quite quickly
ok. this is tested purely as just that command tho?
i mean like with a trait without using profession framework
Unfortunately, I think you'll have to check inventory to see if they have one or the other, and base the modData set on that.
Unless there's a cool tag someone knows about for either:or
That would be great TBH; if there was a way to get the funciton to look for any item tagged as "nail". Would make further mods so much easier.
@rancid panther I sent these three lines via debug console:
local part = ZombRand(player:getBodyDamage():getBodyParts():size())
player:getBodyDamage():getBodyParts():get(part):SetBitten(true, true)
player:getModData().bitten = true
And died quickly thereafter and became a zombie.
ah
it may just be an issue with using profession framework
(obv the .bitten thing isn't even necessary in retrospect for the test, I just grabbed the inside of the if statement real quick)
i could probably make a standalone mod just for the bite
this is a trait
the framework allows for both, but it might not work for making a bite, or i need to do work outside of the framework to enable it
Why not
-- Or use your local module.
local Joy = Joy or {}
Joy.bittenTrait = function()
local name = getText("UI_trait_Bitten")
TraitFactory.addTrait(name, name, -10, "You're screwed.", false)
end
Events.OnGameBoot.Add(Joy.bittenTrait)
?
when i try to add a trait without using the framework, it doesnt work, so i think if i were to do it that way i'd need to make a separate mod to enable this trait
but im trying to see if i can do it within the same mod for mod list simplicity
That doesn't seem like it should be the case
If ProfessionFramework makes vanilla TraitFactory stop working, I'd call that a bug...
i am pretty sure it is only me
but i dont know how to fix it so i've been keeping everything in the framework format
Well maybe try the code above?
It's like 6 lines... just try em
Throw them at the bottom of your mod and boot up
it makes the game stuck on the menu background
so GameTime.getRealworldSecondsSinceLastUpdate() does not return the real world seconds since the last update u_u
Did you use Joy without actually making a Joy table?
What would make you think it does? 
i left it unchanged aside from the name
I wasn't clear at all at first, sorry, but when you use a prefix like Joy., you are indicating that the function is in a module, i.e., a Lua table that neatly contains all your crap for whatever mod you're doing
ah
if it's a local module, Joy = {} at the top is sufficient
If it's a global module, Joy = Joy or {} may be better
Because then you can not worry so much about whether Joy is declared in this or that file first (unless the functions in different files depend on one another of course)
when you write Joy, is it looking for something actually named joy?
like my username? or is it just something arbitrarily named for the example
@rancid panther
local Joy = Joy or {}
Joy.bittenTrait = function()
local name = getText("UI_trait_Bitten")
TraitFactory.addTrait(name, name, -10, "You're screwed.", false)
end
Events.OnGameBoot.Add(Joy.bittenTrait)
Joy.biteMe = function(playerIndex, player)
if player:HasTrait(getText("UI_trait_Bitten")) and not player:getModData().bitten then
local part = ZombRand(player:getBodyDamage():getBodyParts():size())
player:getBodyDamage():getBodyParts():get(part):SetBitten(true, true)
player:getModData().bitten = true
end
end
Events.OnCreatePlayer.Add(Joy.biteMe)```
Arbitrary
See example above. Arbitrary name.
(I don't have your translation file)
(So my pic just shows the stuff I fed getText as a fallback)
Did your trait show up as "Bitten" or "UI_trait_Bitten" when you did this?
oh it showed up as what i named the actual trait
What is the name of the actual trait?
[Misc] Bitten
Then you need player:HasTrait("[Misc] Bitten")
My code assumes you named it Bitten
If it showed up as [Misc] Bitten in your trait selection, I would try tagging it that way in the conditional
idk
that's only in translation files
If the name is Bitten, you also need to create it as such:
TraitFactory.addTrait("Bitten", name, -10, "You're screwed.", false)
This will let you reference it as:
player:HasTrait("Bitten")
The first name in the example given is the internal name, the second is the translation
Otherwise, you have to reference it always as:
player:HasTrait(getText("UI_trait_Bitten"))
I fixed my example to use the translation everywhere.
@rancid panther See the edit please for easier code to copypaste.
afaik, the internal name is never displayed. so you don't need to use the translation for that part.
[edited]
Fair enough.
I did the code jam I said I'd do this weekend. 14 hours today, 6 hours yesterday. :D
I now have a somewhat fleshed out Lua to TypeScript transpiler, pre type-reverse lookup.
So then this:
local Joy = Joy or {}
Joy.bittenTrait = function()
TraitFactory.addTrait("Bitten", getText("UI_trait_Bitten"), -10, "You're screwed.", false)
end
Events.OnGameBoot.Add(Joy.bittenTrait)
Joy.biteMe = function(playerIndex, player)
if player:HasTrait("Bitten") and not player:getModData().bitten then
local part = ZombRand(player:getBodyDamage():getBodyParts():size())
player:getBodyDamage():getBodyParts():get(part):SetBitten(true, true)
player:getModData().bitten = true
end
end
Events.OnCreatePlayer.Add(Joy.biteMe)
Alternatively.
Once type-discovery is coded into my transpiler then I can move onto more complex Lua coding patterns. :D
Once I have redone the animation for lefthanded swinging and stabbing I might not hate fragmotion so much anymore 😭
dhert knows . . . dhert knows . . .
it worked! thanks!
Fragmotion is such a pain in the ass to work in
But sometimes it works and does what I want it to!
Honestly, though, it's not Fragmotion entirely
Those damn prop bindings are infuriating.
I would have the animation done by now if not for them
this is with a random bite location tho, can i change the getBodyParts() back to getBodyPart(BodyPartType.ForeArm_L) and it should work? or is this example purely for if i want a random bite location
Glad you got it sorted.
Of course.
also, the arbitrary parts are all the things that say "Joy" so i can change that too right?
You could find and replace Joy (match case and whole word for best results when doing this kind of thing) with anything you want to use for the name of the module
But the name of your module must be PascalCase or you're a traitor to humanity.
And there will be consequences.
Not programmatic consequences or anything.
Just spiritual ones.
and i can change "You're Screwed" back to pull from translation files with gettext("UI_trait_bittendesc")
whatAreYouTalkingAbout?
No you have to keep it You're Screwed.
Nah just kidding just kidding.
You almost got me.
If you insist on changing that, I GUESS
We all know camelCase is better
mine in translation files is already "Your days are numbered"
but... "You're screwed" was already a contender LOL
Not containers
I mean stylistically, a static class or the class used to insantiate objects IS more often than not PascalCase
In most languages
And in Zomboid that is the pattern followed.
Probably because they inherit a lot of habits from Java
Then ill stick to it then
Where that is the official pattern
Gotta keep it uniform
However, I am not really a nazi about style things, I don't think Joy will ruin the world by choosing to use camelCase module names
I am exaggerating my concern for comedic effect
But it will help some programmers immediately understand your intentions better.
I didnt know they were used for different things. I always just thought it was outta personal preference.
Honesly I was repping camelCase but I always use PascalCase anyways
In Lua things are painfully inconsistent, but in most languages, different cases preferentially indicate different things
It feels more natural when my fingers are flying
i figured there was a pattern but i have not really learned it. i just kept the casing from other things i looked at
objectVariable
e.g.
but NEVER local_variable. That's just wrong. 😉
(*local_variable is objectively right in some languages, I just hate underscores.)
I mean, everything is wrong with me (I primarily code C#, PHP, and JS, sooo.... everything... everything is wrong), but that's besides the point...
Different languages vary somewhat but there are a lot of commonly accepted norms that you will notice when you explore more languages.
ah, yes, when i explore more languages 😅
Lua is my second one after C#
Man I didnt realize until today how bumping this side of the PZ discord is.
i wonder if i should even make it always on the left forearm, or keep it a random bite location
Lua is my first and C# is gonna be my second proper.
Assuming I keep up with programming that is.
"Hmm, why isn't it adding rocks?" "oh, maybe if I actually put in Stone instead of Rock, since that's the correct name...""

Lua is my last. 
cuz i feel like the left forearem is a good tropey location for a bite that doesnt hinder your combat too much
ok it works! nice!
C# is a lotta fun
Me when everyone hates on Lua, I know it's for good reason but at the same time Lua my beloved
It was my first programming love
so i really was held back trying to keep it within the framework

lmao nah I don't mind Lua, although I do find its system of indexing to be a bit unnecessarily tedious, given that it seems purposed for working with languages where that is not the norm or even reasonably appropriate for the structures used.
Lua does have some stupid crap in it but I still love it anyways
Anyone know any good economy mods? Where I could sell jewellery for cash and then use that cash to buy things (Preferably configurable)
(Why are global variables a thing? Why not all local? There's a noticable performance increase from local and you should be using local anyways.)
The table system is very useful and cool for its concise flexibility.
Tables my beloved
Globals are a thing in C# as well.
but you gotta put public instead of local to make it a global
Depends on your use case; the apps I make require a global every once in a while. Locals do not transfer between forms, for example.
When I was making my own game Globals were important for certain aspects.
Ah fair.
biteMe was a better name, but I guess I forgive you.
It's stupid, but I ended up learning programming from Roblox of all places, and because of how they set up Luau over there globals are frowned upon.
😉
It was, lest we forget
We all gotta learn from somewhere though.
I learned in school
Anyone know how to target a broken version of an item, as a valid/required recipe "ingredient"? lolz
I self-taught myself nearly everything I knew before I finally took programming classes in school.
Then my last teacher said I'd never be fit for programming.

I still haven't taken any programming courses, and have like 5 published apps, soo...
Kinda only limited by what you put your mind to.
I went to school for Game Design and Development and Programming was my weakest area the enitre time
It was only when I left school and started working on a solo project it became my strongest
okay now to give them a bandage on spawn
I learned more in 3 months in programming working on my shit then I did in the 2 years of school
School was just a good launch point
thankfully, i have the old code from when i made the traits without profession framework
School kinda taught me what I already knew but introduced proper OOP which I couldn't wrap my head around at the time.
For me School taught me the tools to teach myself.
why wrong lul
for me school mostly taught me about algorithms and stuff
I haven't gone to college or anything and tbh I don't really want to, if I do I think I'm gonna do PC and Networking maintenance stuff.
lua even don't have official code style
I have a working knowledge in all aspects of Game Development so I can pick up anything and just start fucking around and ill make progress
Coding I think fits me best as a hobby.
I cant reasonably do it for 8 hours a day, 5 days a week without going insane.
Me too. After school I decided that Game Development was not a career I wanted but a hobby
Which is why im here xD
Because mods are more fun to make then your own game
Yess
I do wanna get into Unity someday and start making my own little game, but it's admittedly a bit intimidating.
Unity is pretty easy to learn
Before I went to school I had a good understanding of how the engine worked.
People can talk shit all they want but Unity has a place in my heart forever
Also Unity has amazing tutorials and resources out there.
Like a substantial amount compared to any other engine
Holy fuck! If Im correct I just completed my first mod 🏆
wudjudoo
Its going to blow your mind
The greatest QOL mod ever to come to PZ
I changed the spelling of the Baloney food item
to Bologna
What baloney. Downvote.
congrats!
do you think i can create the bitten trait using profession framework and complete all the functions outside of it?
Nah, I did notice that and always thought I was just wrong. lol
like the name and cost and all the easy stuff?
or better to just keep it all together
Well it's sort of wrong and sort of not, in my pedantic opinion.
Arguably "baloney" is not "balogna" because most Americans couldn't guess how to pronounce that second word if their lives depended on it
We all say "baloney" when we see "balogna"
blasphemy
Buh-log-nah
player:getInventory():AddItem("Base.Bandage");
how do i squeeze this in here?
wdym?
before, when i was making the traits without profession framework, it looked like this
which worked, but i had issues doing this at the same time as using profession framework, which is why everything is in that now
but when i want to add a bandage to the inventory as is, how you made it for me, it doesnt show the trait
do i need to put it in a certain spot or create a new event and function like i did with these
According to the Java doc OnGameBoot does not send you any parameters to work with.
@rancid panther Therefore I would work with OnCreatePlayer for player stuff
OnCreatePlayer gives you a player index and object:
ok
GameTime.instance and GameTime.getInstance() return different objects
That's because great programmers work in more than one plane of existence simultaneously.
my issues have been coming from some cursed gametime instance
It brings balance to the other instance
But you must seek understanding to tap into its power
Use the Force, albion.
and getInstance doesn't do anything weird - it literally just returns instance
i didn't factor in the force 
yeah i need help with time too.
i gave up on the gametime 2 weeks ago
giving them items on spawn seems to make the trait disappear from the select screen completely
which tends to be the issue when i do something wrong
If the trait is disappearing from select, it's likely because your mod is catastrophically failing. If the mod can't even begin to load because of a major error, the file will simply be left out under some circumstances I haven't quite clarified myself.
But it suffices to say I have seen my mods with errors fail to load the file at all
i think i had an extra end in there actually
i reverted it back to how it was without the bandage
local function BittenTrait.assignBittenStuff (player, square)
if player:HasTrait("Bitten") then
player:getInventory():AddItem("Base.Bandage");
end
end
Events.OnNewGame.Add(BittenTrait.assignBittenStuff);
and here is the info im trying to add that is messing things up
oh it still says onnewgame in this one
i'll try on character creation again
OnCreatePlayer
playerIndex, player
Not player, square
When you change it
However, player, square is correct for OnNewGame. I'm not sure how that one works though... may only happen on a brand new server, idk.
that's still there for the other stuff, i was just adding from the old version of my mod for the items
okay i'll do playerIndex
If the function is a listener for the OnCreatePlayer event, it receives playerIndex, player in that order, and you can use player the way you already are.
so local function BittenTrait.assignBittenStuff(playerIndex, player)
it doesnt show up in character creation
But actually
should it be withint or outside of all the other stuff i did?
That's a little bit of an odd way to write the function header
If you have local BittenTrait = {} above your function somewhere, you can just go BittenTrait.assignBittenStuff = function(playerIndex, player)
Does anyone know what file the code specific to the "Composter" is located?
@rancid panther I don't know what you mean
i'll just do something and then send it
after testing first if it even works
here is how it looks rn. the trait isnt on character select screen atm
This is the entire code?
of the trait yes
the entire mod has like 6 professions and 15 traits
You say
local BittenTrait = {}
BittenTrait.name = "Bitten"
BittenTrait.anotherExampleField = 4121505219
BittenTrait.yetAnotherExampleField = {
i = "am",
a = "table",
inside = "another",
one = "!",
thisCouldEvenBeAnotherFunction = function(someInput)
print(someInput)
end
}
BittenTrait.doBittenTraitStuff = function()
end
BittenTrait.doBittenTraitStuff()
Events.WhenYoMamaGetsBack.Add(BittenTrait.doBittenTraitStuff)
return BittenTrait
The last two are just examples of using the function in the module two different ways
As a listener or just called directly
IsoCompost
(Returning BittenTrait at the end may be useful to other modders interacting with yours down the road.)
it worked!
Added some examples above... showing how to use fields and tables within your module (which is also technically a table).
Glorious
so this is how it looks now. it works, but is there anything i can do to clean it up or remove any arbitrary stuff i added in my inexperience
local BittenTrait = {}
BittenTrait.bittenTrait = function()
TraitFactory.addTrait("Bitten", getText("UI_trait_Bitten"), -10, getText("UI_trait_Bittendesc"), false)
end
BittenTrait.assignBittenStuff = function(playerIndex, player)
if player:HasTrait("Bitten") then
player:getInventory():AddItem("Base.Bandage");
end
end
Events.OnGameBoot.Add(BittenTrait.bittenTrait)
BittenTrait.assignBite = function(playerIndex, player)
if player:HasTrait("Bitten") and not player:getModData().bitten then
player:getBodyDamage():getBodyPart(BodyPartType.ForeArm_L):SetBitten(true, true)
player:getModData().bitten = true
end
end
Events.OnCreatePlayer.Add(BittenTrait.assignBite)
Events.OnCreatePlayer.Add(BittenTrait.assignBittenStuff);
Thank you Riko
or if i applied your advice incorrectly and still somehow got lucky,
Tabbing is still wrong... end statements should either come at the end of the line of the keyword that needs them, or tabbed in identically to that keyword on a line below that keyword.
Your functions should not be tabbed in more than local BittenTrait = {}
Your last end statement and your last if block are correct, but BittenTrait.assignBite needs to be in line with local BittenTrait
i see... i did it because the lines pointing down from the other lines helps me visualize
And you should not add a new tab level to your code unless you are entering a deeper scope.
i dont understand what you said about tabbing. which keywords do you mean, and what do you mean by a line below that keyword
first scope
{
second scope
local bob = 5
{
third scope
{
deepest scope
more stuff happening
}
back in the third scope
}
back in the second scope
bob still equals 5
}
back in the original scope
bob is dead
end of file
Scope is used to indicate where local variables exist
Local variables exist from the point at which they are declared until the point at which their scope ends.
So if I add a local variable named bob above...
so they should all be on the first scope?
When you enter a function, that's a new scope. when you enter a conditional, that is a new scope in many languages but honestly in Lua I'm not sure, however, we tend to punctuate it that way.
it is in lua
Okay I wasn't sure; I think I've seen some people declaring local things inside conditionals in Lua mods, and that looks weird a.f. to me
didn't know what to make of it.
you can even use```lua
do
end
Yes I am aware of do end
so is pretty much everything tabbed too far in by 1?
yeah pretty much
So basically, when you open up a table definition or a function definition or a conditional or a loop, you will begin writing lines 1 tab further from the left side of the screen than before
BittenTrait.assignBite's code can be indented
Your if block in the function albion's talking about is inside the scope of its function
Therefore the whole thing would get 1 more tab
?
how about that events thing
should it stay where it is and not indented or indent it or move it to the bottom with the other things
i didnt wanna move it cause where it is rn is when the trait started to work
Events lines are correct but you didn't indent the whole if block.
You only indented its header and its end statement
Since the conditions also open new scopes, you should also indent their contents.
After each if then line, the stuff below it should be tabbed more than the if until you get to the end.
ngl this feels like what i had before minus a line or two
Why did you change the function tabbing above the first Events line?
should the function lines stay on the first indentation?
Highlight 131 - 134 and hit Shift + Tab
Highlight 128 and hit Shift + Tab
And then you have it
Though 139 could go
Little oddly inconsistent spacing
ok that makes a lot more sense now. thanks!
i was confused which things warranted an end statement and pretty much indented what i thought was supposed to be before it
Also
Small point of style
You have unnecessary semi-colons
Lua does not require semi-colons at the end of lines
Only if you want multiple discrete commands on one line do you need to delimit commands with ;
ah, that was left over from when i was copying something else
O frabjous day! Callooh! Callay! Finally got my first mod of many to come on the workshop
https://steamcommunity.com/sharedfiles/filedetails/?id=2929244705&searchtext=no+phony+bologna
Hope posting the link is cool here I just had to share it.
Nobody seems to mind
local BittenTrait = {}
BittenTrait.bittenTrait = function()
TraitFactory.addTrait("Bitten", getText("UI_trait_Bitten"), -10, getText("UI_trait_Bittendesc"), false)
end
BittenTrait.assignBittenStuff = function(playerIndex, player)
if player:HasTrait("Bitten") then
player:getInventory():AddItem("Base.Bandage")
end
end
Events.OnGameBoot.Add(BittenTrait.bittenTrait)
BittenTrait.assignBite = function(playerIndex, player)
if player:HasTrait("Bitten") and not player:getModData().bitten then
player:getBodyDamage():getBodyPart(BodyPartType.ForeArm_L):SetBitten(true, true)
player:getModData().bitten = true
end
end
Events.OnCreatePlayer.Add(BittenTrait.assignBite)
Events.OnCreatePlayer.Add(BittenTrait.assignBittenStuff)
here is how it looks now
I think the people here generally have favorable attitudes regarding the existence of new mods 😉
Yess
oh i think one end is still indented too much
I figured here of all places it was going to be cool since were all in this together.
We're all one big, catastrophically sleep deprived family.
is that right?
Was just about to tell you
Preach it
You have it now
Im exhausted as fuck
Again, a final return BittenTrait at the end is good practice @rancid panther
Though in your case I highly doubt anyone will want to intervene or hook this particular code
at the very very end? or after the last end?
i see
More code after an inevitable return statement is a strict coding no-no.
so if i make any other traits without profession framework, it should look something like that
this is assuming all the traits are in their own files?
all my traits share a space based on their category
though i might need to move my skill traits to a dif file from the misc traits
Right. However, fwiw, you could make your code a bit more concise perhaps:
local Bitten = {}
Bitten.trait = function()
TraitFactory.addTrait("Bitten", getText("UI_trait_Bitten"), -10, getText("UI_trait_Bittendesc"), false)
end
Events.OnGameBoot.Add(Bitten.trait)
Bitten.apply = function(playerIndex, player)
if player:HasTrait("Bitten") and not player:getModData().bitten then
player:getBodyDamage():getBodyPart(BodyPartType.ForeArm_L):SetBitten(true, true)
player:getModData().bitten = true
player:getInventory():AddItem("Base.Bandage")
end
end
Events.OnCreatePlayer.Add(Bitten.apply)
ok i thought i could concise it up a bit
Each file can only have one root-level inevitable return statement
thanks
Also, each function can only have one inevitable return statement.
And inevitable return statements must not be followed by more code within their own scopes.
so if i wanted to add a bunch of traits on one file and end with a return statement, would i make it more general like
local AddTrait = {}
?
and at the end
return AddTrait
How about "Joyful Traits":
local JT = {}
maybe
Then you can have stuff like this:
i should make a special file then for all the traits that might need that
since i dont think i need it in the ones i make using profession framework
JT.Bitten = {}
-- Bitten stuff.
JT.Blitzed = {}
-- Blitzed stuff.
JT.Godlike = {}
-- Godlike stuff.
(IF you wanted it all in one file in a legible way, in one local module that you could return at the end of the file)
ok i'll have a separate file in case i need to add things in the future
I mean you can also do that
Have a Bitten.lua with local Bitten = {}, etc.
That's a style choice that depends a lot on how many custom traits you have planned and how complicated they are.
rn i made a MiscBitten.lua and put it all there
Sure whatever works
thanks!
Yeah big takeaway here is if you try something, and it works, and you try something seemingly unrelated, and the first thing no longer works, make super duper certain you haven't simply borked your file outright in an unusual way.
need global, however if he will do all in single file it's fine, but single file is bad so better global one
can i make the bite not bleed?
For his use case he doesn't "need" global because he doesn't really need a parent table called JT at all.
rn it is SetBitten(true, true) so is there another boolean for [isBleeding]?
The JT parent table would be the single-file option
He could also just do a set of local table files
JT is a module?
that was one of their suggestions. for bitten trait (as i have it rn) it is BittenTrait
It could be. We are discussing possible layouts. Nothing is really set in stone.
but if i wanna make a bunch of traits then i'd probably use something more general
these are just a bunch of things for my personal server with friends or solo play
so im not really doing too much crazy stuff with it.
although, now we can make bitten characters! i wonder who would actually use it... maybe it just becomes a free trait down the line when we find a cure
problem is bite = 100% lethal so it will useful only if in sandbox settings legality of bite is disabled
the bite isnt 100% lethal. it is 100% infected
I think they want to find a cure mod
if you use a mod with a cure, you will survive
and if you want to just have a challenge mode where you wanna kill as many zombies as you can before you die, there is that too

Do you have a good cure mod Joy? I'm curious if any active ones still work properly.
theyknow (no space) is a modification of they knew that lets you use a medication that resets your infection timer instead of fully cure you
and they knew also works, but it does not yet have an option where you delay the cure
ideally, i'd like to have a mod where you can never be cured, but you are constantly searching for medicine that will extend your life
but i feel like without hope of a cure, most ppl will kill themselves when they are bitten even when they can extend their life, so i would add a low chance of finding the cure, while making most instances of finding only a sample
So does They Knew no longer work?
hi guys, is there a way to disable stunlock in pvp?
it works. it does not have a "Not a cure" option yet
but the mod description says they plan on it
Soon™️
Soon™
Nice, They Knew does seem to work.
I am currently not dying from the bite that killed the last three versions of me
nice
the secondary option, Zomboxycycline, adds a pill that prevents infection for 24 hours (cannot cure or slow down set infections)
Nice
i almost have a perfect professions/traits mod
perfect as in a little bit on the easy side, and catered to playstyles rather than lore based occupations
Anyone knows? want to make vaulting zombies having a high chance to trip, but i have no idea about zombie animations/chances
There is a mod called Tripping Zombies I believe, use that as a launch point
welp. I couldn't resist once i found the vanilla punch animation. Got that mirrored to the left, and now I have a special state that you activate when aiming and holding control (or left bumper) and your player is unarmed, which allows you to punch. 😄 No balance yet, but it works!
Is there a left handed weapon mod out there yet? Or is this the first?
That is really cool
oh wow, I like that.
Could make an occupation like Boxer to go with it.
And if your feeling really ambitious hand to hand combat skill
there are 2, currently. one has not been maintained, and the other is a bit exploitable/janky (no disrespect, i used it for a bit).
oh man
and thanks! yea, i do plan to expand this a bit more. this is more just me messing around and trying to make this the best i can for right now. haha
The last time I played I got injured on the right forearm and it fucked me
I was honestly useless in my crew
I wished then for a left handed mod
dude i will never use a weapon again
Well, this will work for you then. it already supports swinging with JUST an offhand equipped if you want
me literally this second lol
Yo I would love that
I challenge you to reach that same number unarmed after I'm done. hahaha
I'll have sandbox options, so you can make the punch op if you want. xD
I play the least amount of clothes possible meta but my right forearm I realized is carrying me all the way
i love it dude. i will 100% start a new char just for it lol
Yea please send it, im eager to try that.
some of the best stuff in mods is the stuff after the mods done lolol
at least the core
dhert your mods are dope though man, all of them
Gonna check out your collection
QOLNation
Therese punch lrft and right already actualy
Now create a skill called "unarmed" and tie the damage to it and bam! xD
it's what he's doing... lol
There are, but there were no action files or method to activate them. I have added this. And womp, I didn't realize that Bob_AttackPunch02_Hit was actually the left arm. could have saved myself like an hour. haha
Thanks! def will take a look
I know
Yup! Eventually, will balance it around that.
I mean, learnable skill, like carpentry and etc; most mods i've seen tie this kind of unarmed combat to short blunt
That is what were talking about
If you want some kind of inspiration, cataclysm dda adds several types of combat stances for martial arts and etc; you can add a trait that increases melee damage or knockback/critics, even a boxer/martial artist profession, etc, now its a world of possibilities
Thats a really good mod to skim to use as a reference
Is there a way to set a recipe to not give anything, except EXP? I already have a script for OnGiveEXP, but im forced to specify the Result field in the recipe, setting quantity to 0 doesn't work 😦
there's a RemoveResult or something
hmmm thanks for the pointer, ill go investigate the functions
i think some vanilla recipes have it so if you search for similar terms i'm sure you'll find it
it's in the actual script i think
i'd check it for you but i'm not at my computer right now
is there any mod that allows you to learn traits by reading book?
I havnt seen one
Unless one got released over the past month when I last went through most if not the entire workshop then im gonna say no
I remember one that gave the nutritionist trait by reading a magazine, but can't remember which one
from what i found it only allows input ingredient to be destroyed but not the result
many thanks
@rancid panther So if I made a patch that allowed players to turn They Knew into a resistance-extending drug that provided +X minutes of immunity per dose, that would be basically worthless and not at all interesting to you, right?
If possible punching should level strength and the higher that level the more power behind the punch
If I knew the name of this mod I could use it as a basis to create my own
I think that mod already has something that does just that. It just doesn't spawn by default
I think the mod has vaccine pills, but they don't work after you're infected.
After infection, it's cure or no cure. @hot patrol
Simple overhaul traits and occupations did, but just checked and its no longer the case (this is done with an event that is checked each X tick and recognises the recipes learned, what you can simply do is a "on item used" action for that book, similarly as recipes do, and it would work - will try to give an example later)
I could add an option to make it level strength, but afaik other weapons do not increase strength directly so wouldn't want to make this an exception. Could be wrong on that, haven't extensively tested it. But anyways, damage would be based on strength and a new "Unarmed" skill. Attack speed is already influenced by these + Fitness
i suppose it's put in the Lua script and not the vanilla recipe itself, as the latter breaks the recipe completely
it should be put in the recipe script
i'd be interested if it turned the second option (Zomboxycycline) into a resistance extending drug, so i could keep the cure as an rare possibility
zombie virus vaccine for multiplayer is one of the better atm if you like to work for your cure
the way the mod im using does it, is that it resets infection stage to 0 basically
i think it is basically a copy of the cure except instead of disabling infection, it resets infection
so it keeps the cure, and the resistance, and also adds a life extender
if it's the one im thinking of, i'd prefer one that doesnt add a bunch of crafting processes
i dont like the idea of developing a cure urself in this game
thank, found the issue it was RemoveResultItem:true,
i think i might have come across an issue with my mod
i think i outlasted the bite and the infection doesnt seem to be in effect anymore
i might need to cause the player to be infected rather than the bite itself
Actually that sounds better.
idk if this info is outdated but the wiki says combat does level strength
and in my experience, strength has a lot faster passive gain than fitness (even in running (for some reason))
Hey, thanks! I hadn't really looked into that. Hopefully me calling some of these base game functions already does this, but I guess I'll add this to my ever-growing list of things I still have to do. 
Who needs sleep anyways?
how can i check if im still infected in debug mode?
i was able to make my character infected initially with my trait, but after a while the symptoms disappeared and the bite healed
if you can just outlive the bite i might need to rethink how i made this trait
i think im good actually
infection level refers to knox virus right? just making sure
You can check this with: player:getBodyDamage():getBodyPart(BodyPartType.ForeArm_L):IsInfected()
anyone knows how to force drink using lua
Okay after some testing it defintley is not
there is no wounds on my body anymore. the bite healed
I got it 100 and let my self get to terminal and I still dont have the zomified moodle
i see
so should i add something to my mod to set the player to infected instead of just the wound
Im not 100% sure what infection level is referring too but its definitely not the Knox virus. When you have it your last few moments youll get a moodle or maybe just a some words in the health screen saying zombified
I dont rememver I havent died like that in a while
is there a different place i can check if they are infected?
Look at what dhert said above
By "force", I assume this is something that will just happen after X amount of time? If so, when your event occurs, check if the player has the item you are looking for in their inventory, and then: ISInventoryPaneContextMenu.eatItem(item, amount, player:getPlayerNum())
You can use a consol command
thnx ill try this
im actually lost in confusion
im trying to add drink with ice cube on every context that has drink
Are you trying to have this be "crafted" first, and then drank? that might be easiest as you just trigger that above command in the crafting function
if its a recipe, the game will just add it to the context menu for you as it does. otherwise, you have to add the option to the context menu and consume your item that has the added benefits (or something) from the ice cube.
Ive had not much success with custom context menu actions
surely this must mean im infected
Yes, you are
function drinkWithIce(player, context, items)
items = ISInventoryPane.getActualItems(items)
local playerObj = getSpecificPlayer(player:getPlayerNum())
local inv = getPlayer():getInventory()
local drinkOption = context:getOptionFromName(getText("ContextMenu_Drink"))
local subMenuDrink = context:getNew(context)
context:addSubMenu(drinkOption, subMenuDrink)
for _, item in ipairs(items) do
if drinkOption and inv and inv:FindAndReturn("Sapph.IceCube") then
subMenuDrink:addOption("Drink with Ice Cubes", item, function()
item:getContainer():DoRemoveItem(inv:FindAndReturn("Sapph.IceCube"))
ISInventoryPaneContextMenu.eatItem(item, 1, playerObj)
end)
end
end
end
im dumb. it was like 2 lines below the infected level
however, it does bother me that the bite healed
Okay so you need to have that checked and then the infection slider goes up
my world is on 1-2 weeks infection time because i thought it would be harder to find a cure -.-
if there's a function that generates that context, it's best place to hook.
i found 3 cure zombies already and 1 had a cure
this makes a new submenu?
