#mod_development
1 messages Β· Page 124 of 1
My workaround has lots of things involved and would like to make it simplier
I had to use commands to make Meditation MP compat doing this.
There may be a smarter way to fire the animations that automatically sends the animation update data to everyone but idk what it is
Both method works
Yes by doing timeaction
Or emote
But thats not applicable to stance
I wouldn't say that's smarter necessarily, whether that works for you is context dependent.
Or moving
He can't make a timed action for idling π
I can't make a timed action for sitting
I mean I guess I could but it's be more of a hassle.
wtf, why is it doing this now :c
Ehat sitting is a time action isnt it
No
Blend
ah right
Adjust xml blend
No he doesn't want it to go back to the upright position at all.
You can add blend out
yeah it should be like this
Emote works
We got away with not using time action . By using emote..
If you scroll up there are more vids i posted
I'm not sure if you can play an emote while entering the sitting position.
maybe, but idk
I doubt it.
Does it have to be on the sit position really tho
You can just set the state maybe if it has too
In your animation's action XML file, make sure to replace these too:
<m_Target>aim_rifle</m_Target>
<m_AnimName>Bob_IdleToAim_Rifle</m_AnimName>
</m_Transitions>
<m_Transitions>
<m_Target>walkRifle</m_Target>
</m_Transitions>
<m_Transitions>
<m_Target>runRifle</m_Target>
<m_AnimName>Bob_IdleToRun_Rifle</m_AnimName>
</m_Transitions>```
The animname should be replaced with your animation, as does different animations based on some conditions too
Ahhhhh good catch @dark wedge
i was planning to do that, but wanted to get the idle animation working first
Thats what i did and the m target is the filename of the xml
I am unaware of any ways to tell Java the player is sitting without activating the javaside sitting mechanisms.
I see
Maybe it could be done
Then your method is safe i bet
I could possibly just emote into an animation loop
not sure what i did to make this happen tho, its broken now
Also, y'all should know that OnEquipPrimary and OnEquipSecondary events are synced in MP for all players. So, if all you need is to update a weapon on equip, can use these events. no need for a custom command. π
Oh
Nice
you think its the animation fbx itself?
Have y tried blend
Is there an updated Events page somewhere?
My bookmark is missing those π¦
its not suposed to switch to the vanilla idle
its suposed to stay at the modded idle. the one before it snaps back
Oh nice @dark wedge
Actually those are listed... did you originally type OnPrimaryEquip?
I gave the wrong snippet.
Thought I read it that way and searched for that
<m_AnimName>Bob_Idle_HeavyBreathing_Rifle</m_AnimName>
</m_2DBlends>```
its likely that one
also, is there a way to reload the scripts and xmls without restarting the geam each time
if you're running around and stuff
XMLs auto reload
When you save them
action files and animations should be refreshed automatically on external change
omg good catch
i should have godmoded myself ughh
ingame?
what about animation fbx
Yea, I typed it wrong. its OnEquip{Primary,Secondary}
Not those
Maybe those? Idk
I thought I had to reboot if I updated my FBXs, I could be wrong
FBXs don't seem to reload automatically. .X do, but those kinda suck. xD
I seeeeee
oh yeah, i asked about animzed a bunch of times but it seems forgotten
should name and animname be the same?
or should it be vanilla "IdleRifle"
Should be diffrent but idk which method youre doing my method or burry agas or dherts
dhert
You cant combine em all ow ok
and without burrys template i cant even start the animation
I mean I am by no means well-informed about weapon animations
It would surely involve lua
Burry aga had his own method it also involves lua
Dhert uses timed action
My template is for overriding nil focus general animations, one of which happens during a timed action, one of which does not.
A timed action is not a solution to this problem unfortunately.
That would be unwieldy a.f.
Feeling lazy.. but need to work... Almost finish with the entire queue list. Need to start looking for clients pretty soon
You would have to design it to constantly be interrupted and then re-engage
doesn't have to be, no
Just to stand correctly
You'd need to be in a timed action at all times
So idling via timed action imo is out @ancient grail
Sure
Since you're making your own animation that is not replacing anything, it should have a unique m_Name
the m_AnimName is the actual animation track's name.
I also use a unique m_Name... though I was under the impression that it's just a label and not used to actually trigger anything? @dark wedge
i can just put ScrapGatling_Idle?
The mod should be adopted to vanilla
i think its how the game stores things. i.e. 2 animations with the same m_Name would overwrite.
Yup! Both can be that
Sure @hollow shadow That should be fine
I seeeeeeeeee
maybe that explains the behavior here
I thought just filename and animname and conditions needed to be unique
(I made my m_Name unique purely because it felt right)
I could be wrong. I've never made an animation replacer, just added my own animations/conditions so the name was unique for sure. ha
Nope i use same xml name and mname only the animname is diff and we all know thats the animation file name too
Looks good to me.
Wait
No
You Still have two vanilla Bobs
Idle to run?
Maybe that's an issue
ok i managed to get it working again
Idle to aim maybe nothing to be done about
it resets to the modded idle after walking
Vanilla weapons? @hollow shadow
@dark wedge @thick karma thank you guys so much. i will be off to making an aiming animation and improving this one
OH wtf
he do the idle when i dont even have anything in hands aswell
Lmfao
Sounds like perhaps my removal of the state is not registering on unequip somehow
@dark wedge Do you know if OnEquipPrimary fires when you remove weapons?
You're in -debug mode right
yep
getPlayer():clearVariable("YourVariable")
?
See if that makes you idle normally
should i copy paste that into the command console
right
i did that and now i hold it like vanilla
Right
Unequip
that should confirm the issue is when we are adding / removing the condition
So once that's confirmed, gotta remove the condition at a better time
Also perhaps just add the condition OnEquipPrimary as dhert suggested
My biggest recommendation would be to NOT do an override of the equip/unequip action. that is nuclear overkill for this.
local onPrimary = function(character, weapon)
if not character then return end
if instanceof(weapon, "HandWeapon") and weapon:getFullType() == "Module.ItemName" and character:isItemInBothHands(weapon) then
character:setVariable("ScrapGatlingEquipped", true)
else
character:clearVariable("ScrapGatlingEquipped")
end
end
Events.OnEquipPrimary.Add(onPrimary)```
For sure, no need to do that if there is an event. Didn't realize
if i unequip manualy it goes back to normal as intended
If i equip a different weapon tho, without unequiping the gatling, then it doesnt
wuts this o.o
I see. In that case, consider what @dark wedge just offered.
technically weapon in the params is only known to be an item at first, just for your own awareness. @hollow shadow
instanceof is used to confirm that the item is actually a weapon.
This should work, and should work for MP too as this is called for other players in MP too.
Really? When another player on my server equips a primary, my client fires this event on their character object???
But yes, it checks if the item is a weapon, if it matches your type (so replace "Module.ItemName" with your item's full name) and also checks if its in both hands. If so, it applies your anim; otherwise clears
yurp
Dayum nice
was a thing i found when working on this Brutal Handwork update. will be refactoring both it and Fancy Handwork to use that instead of doing it myself.
And does this fire on unequip too? (Sorry if I missed your reply)
any change, so yup.
just be careful, it is called on someone in MP like...first. lol
not sure why it does that, i used this
You don't still have my code running do you?
basicaly same issue as with your template. but it happens when i move a bit
is if not character then return end really necessary @dark wedge? Can that function be fired with a nonexistent character object? And if so... why?
also dropping it does the same thing :c
I could see it doing something wonky on death, or on character stuff. so idk. best safe, its nothing.
Fair
what do you mean "does the same thing". your character still assumes the idle pose like they are still holding it?
yep
In the second video it looks like he assumes his custom idle pose with a different item @dark wedge
only if i "unequip" it by either pressing the button in the context menu, or by putting it onto my back. it fixes itself
Did you make any changes to the base SGunsIdle.xml file?
Do other items get this animation if you equip them first?
i didnt make any changes
just replaced the name
from when i first copy pasted it
wut
@dark wedge @thick karma just restarted my game and it doesnt work anymore
was i sitll using burrys template??
would mean that dherts thing didnt work at all tho
I guess the character:isItemInBothHands(weapon) isn't actually viable during the event. Welp, TIL.
just remove that part of the condition, so it would be:
if instanceof(weapon, "HandWeapon") and weapon:getFullType() == "SGuns.ScrapGatling" then
...
Did you restart the server after loading dhert's code?
The first time?
Or did you just edit, save, and reload file?
Because reloading file with my code deleted would not undo the things my code did
Im trying to make a mod which lets you build oven but im not even sure is this possible
i exit to main menu, saved the lua and then reloaded it
anyone got a template on how to add object to build menu?
it's 100% possible
okay so quick question for anyone who's familiar.. i have only tested on host with player connected. and in the hosts console. it's not an error or warning at all. but it starts spamming this like every in game min or so when a person that isn't the host starts doing anything with a lightswitch.
anyone familiar with this whatsoever? i'm chatting with glytch3r and some others but i'm stumped atm
it's not an error whatsoever either
how do i do this then? seams so simple but so hard ive tried ISUI method but cant seam to crack that
is 10907,9993,0 the correct location? the error implies that square isn't loaded on the server, but if it's where the player is it really should be
yea and i tested it works perfectly also
like synced
i was flicking the switch and changing bulbs
i would check the java for what actually prints this message
ah good call
receiveSyncCustomLightSettings lol
this has got to be some mp sync thing
can't be a cooincedence that it only happens when a user touches something that isn't the host
If the object at that index is an instance of IsoLightSwitch, the method calls the receiveSyncCustomizedSettings() method on that object, passing in the ByteBuffer var0 and the UdpConnection object var1 as parameters.
If the object at that index is not an instance of IsoLightSwitch, the method logs an error message to the DebugLog.```
this is where i think i'm stuck atm. i'm going to spend tomorrow figuring out how to do mp sync stuff. also gonna test in dedicated and see if it's a host thing or server or what
Try create IsoLightSwitch on serverside
looking it up. i'm not super familiar with it
---@public
---@param arg0 UdpConnection
---@return void
function IsoLightSwitch:syncCustomizedSettings(arg0) end
``` ?
is this what you mean? sorry if i'm not quite there. the sync stuff is a little beyond me
oh maybe this...
---@public
---@return void
function IsoLightSwitch:addToWorld() end
well i guess it's going to be a fun homestretch for this one π nice part is this is my final step
anyone knows why theres a letter s on the vanilla file
i have verified files and ask dhert if we have the same file and he said its the same so why is there an s ? does this do something
altter s?
oh
Just mistake I think
ok then
Sorry, crashed, but if that's how you restarted, you couldn't have been running my code. Restarting server would have cleared it.
Did removing the 2 hand check work?
Dhert's last idea?
Does anyone know why the SkillRequirement for this item doesnt work? Ist the skill name wrong?
Yep. The skill name should be "Doctor"
Thank you! Do you know where i can check what the skills are called? Because if you check the Skill books its say "FirstAid"
Here
Thank you so much β€οΈ
Good morning. Still somewhat sad from yesterday having issues with vehicle template scripts. =/
good morning
Maybe skizot knows?
It's nothing to do with implementations. It's to do with syntax troubles in my code.
Dont be sad youl figure it out
Noticed you got this working; nice work, congratulations. You might want to consider posting your controller-emulator solution for gamepad testing on the Wiki in the Pins.
I'll need to separate my lexer code for vehicles. It shot up my lines of code from a couple hundred lines to a thousand.
Ouch
The issue is that I fall out of sync with tokens when building them after a part in a template vehicle.
Me trying to reuse code caused it.
I'm going to statically build vehicle and template vehicle when I touch them again.
Redundant code, but can't be asked to build effective code for what I'd consider to be troublesome implementation for the game. =/
Besides syntax adjustments, everything in ZedScript is okay except the vehicles.
I'd literally need an application that gives me the ability to edit without being in script to work with vehicle scripts. Crazy stuff.
Not sure how @faint jewel does it.
Hoping that template is eventually used for other script content. This is a good idea that would help a lot of modders.
@faint jewel tends to pick projects that at the first glance look easy
but when you try to implement them... god damn it...
π
lol half-kidding amirite
hey i want to push the engine.
Lmao
deliveing mail should NOT be that hard.
it shouldnt but it is
PZ tells you it so freaking is.
Hey, sorry for the beginner questions but i'm kinda stuck. I want to remove the recipes for Disinfect Bandages and do my own. I tried the Overwrite tag but it will only overwrite one of the 4 recipes. Now i tried the "obsolete" tag but it does nothing. Any ideas?
you shouldn't have to do either.
as long as it is named the exact same, it should auto overwrite the default.
you will have to rewrite all 4 of the recipes if that is the issue.
I did that and changed the time to 10-13, but instead of overwriting it will add them as new recipes
So now there are 8 recipes
so it's not overwriting them.
i will admit that i have not overwritten recipes.
i have overwritten items.
so i'm going off what i know.
is there a mod out there that modified them already?
you could see what they are doing that you might be missing?
you could iterate the existing recipes in Lua and use setIsHidden on them
It works for recipes with only one version, but "Disinfect Bandage" has 4. so its only overwritng the last one. I think its a bug
Thats a great idea
can you send me the link for it?
Pins are up here @wheat kraken
It's the 3rd symbol.
Which is called a thumbtack sometimes, or a "pin"
Can I look in the source files of other mods to learn how they do certain things? ||im new||
yes
In order for that what should I do does the source file add itself to my computer when i subscribe to a mod or i can only look at the ones that are open for editing
when you subscribe to the mod, it's downloaded to the Steam workshop folder, just like for any other game that uses Workshop
the ID of Project Zomboid is 108600
Oh so i can look into every mod i subscribe on steam?
yep
Thanks, I diddnt know it I appreciate it
Try adding "Override:true," to each one you want to overwrite and see if that works.
Yes, i tried that. It will only overwrite the last recipe. The first 3 are not affected
Its probably because they all share the same name
recipes have some issues with that as they allow for the same name to occur
What you can do is parse through the vanilla recipes using lua instead
When should i execute that script? I guess in a lua event but which one? OnGameStart?
Should be on shared if I'm not mistaken as you need both host/connections server/client to match
I use OnGameBoot - but I think that may trigger anti-cheat if you let it run more than once
Recently started doing this for SP/MP
Events.OnLoad.Add(function)
if isServer() then Events.OnGameBoot.Add(function) end
Servers don't run OnLoad, and I check isServer to keep onBoot on MP
Trying to find my snippet for hiding recipes
But basically you use ScriptManager
Man - where's @calm acorn so I can thank them again for CarWanna - so easy to add additional vehicles to the pinkslip system π
Lol
Np mate happy it helped out, btw there is a power shell script on my github to mass produce them
@sour island Thank you so much, i will try that!
I know! We talked about it ages ago, you might not remember though
s'been some time.
Actually i think ive updated to the latest
Should have all of the flags for pinkslips that sort of went undocumented
oh neat, might have to grab that then - I was just adding the Rhino Tow Truck in by hand as a request to one of the players on my server π
pinkslips from the Marquee Printing Company? π
I am going to need to produce a new list for nshops at some point - at which point I'll either be writing a new spreadsheet generator using your PS script - not sure which way I'll be going yet.
@calm depot not sure ... btw I love your icon/mask π
heh, it's from the original Crimefest announcement
oh I know π
local obj = square2:getObjects():get(i);
print(obj:getObjectName())
``` how the crap do i get hat print to show me the sprite name? that just shows "IsoObject"
getTextureName I believe is what you want...
I haven't successfully used it yet in my own code, but @fast galleon slide that one my way the other day
Right from one of the game source files: local o = sq:getObjects():get(i):getTextureName();
actually it's literally getSpriteName
texturename worked sprite name gave me nil
then what you really wanted was the texture name π
is the object you're dealing with a proper 3D model?
nope. mailboxes
hmm, odd, maybe it doesn't use a tilesheet or something like that
@sour island Do you mean like this? Or did i missunderstood the start of the function?
Lol I just realized that I have been so busy with ZedScript that I haven't been a broken record for mentioning PipeWrench in here for weeks. XD
:addRequiredSkill - use : for method calls
also - you'll need to fix those arguments/params
also, when you have code to share, paste it as text inside 3 backticks, don't take screenshots
But that should work -- I'd only be concerned with how recipes handle translations
The naming conventions for scripts (being they're so old) can be a bit convoluted - so you should try to confirm getName gets the untranslated one
add a language after the first set
yeah, you might want to use getOriginalname instead
@sour island Thats it right?
local function changeRecipes()
local recipes = getScriptManager():getAllRecipes()
for i = 0, recipes:size() -1 do
local recipe = recipes:get(i)
if recipe:getOriginalname() == "Disinfect Bandage" then
local perk = Perk("Doctor")
recipe:addRequiredSkill(perk, 2)
end
end
end
Events.OnLoad.Add(changeRecipes())
if isServer() then Events.OnGameBoot.Add(changeRecipes()) end
Ahh you have to write lua at the beginning?
If you want syntax highlighting support for Lua code, then yes.
You're calling changeRecipes in the expressions at the bottom. This means the function will be executed when the script runs. It returns nil, so that's what will be used as the argument to .Add
The way you had it in the initial screenshot was fine, no call is necessary there. Just changeRecipes
....so here's one folks - anyone have any experience with using LUA to mark a "safe area" the way an admin can on a server?
Is there any way to intentionally make a function stop the game and jump into debug, ie funct/method like raise/break/stop?
Ah yes thank you, i already removed them because it threw an error. I couldnt get addRequiredSkill to work, i don't receive the perk. Any idea whats the right syntax? It script works with with setHidden instead of addRequiredSkill
At work atm but off the top of my head it should be Perks.Doctor
is it possible to remove a moddata. no empty it but remove it alltogether
local function onDoMail(player, obj)
player:Say("Mail Time!")
local mBox = obj:getModData();
mBox.dDate = 1;
mBox:transmitModData()
end
local function onNoMail(player, obj)
player:Say("No Mail For You!!")
local mBox2 = obj:getModData();
mBox2.dDate = nil;
mBox2:transmitModData()
end
onDoMail works.
onNoMail fails.
i need to clear out the mod data for it to work.
you talking memory data or a physical one?
Worked 
far as I understand it moment you said mBox2.dDate = nil its gone
no I mean that statement just wiped out that value. it shouldnt even exist ie. unreachable.
then lua GC manual lying
maybe doesnt die cuz its part of a mbox2 only thing that would explain it.
The list (enum) for perkfactory.Perks is exposed as simply _G.Perks btw
So you should be able to use that for type checks and such as needed
I meant to ask but what's the purpose of the mod? Make bandaging wounds less easy?
okay what the hell man.
and judging by the silence there is no actual method/function that lets me intentionally open debug.
it's erroring. but it's working.
Set launch options "-debug"
no not be able to open it I want to code open it so I have a manual mouse driven breakpoint
So you want the F11 error window?
I think there's a function to call it
Otherwise you can just do "if 1 ==false"
ie make an actual error
I know you can also use intelliJ to run the deconpiled java to make breakpoints in the IDE from selecting lines as such
mBox:transmitModData() and mBox2:transmitModData() are calling nil?
But that was a pain in the ass to get working
ERROR: General , 1677600876997> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: Object tried to call nil in onNoMail at KahluaUtil.fail line:82.
i am so confused
yeah I wasnt even trying to get IntelliJ to interact with teh game, Im making a mod that will open debug and tell me exactly what code is runing for the UI based on what I clicked on
Wouldn't a simple print do the trick?
What does this mean
If the isoObject doesn't have a getSquare() result it doesn't do anything
I ran into this issue when using commands to transmit inventory items around
It loses the square but nothing else
I didn't check other uses
I see
Can you do damage to the overall health of a player or just the bodyparts?
Both
It's a bit weird from my experience
Damage to bodyparts sends changes to overall
But you can also directly set damage overall
Its not weird i think
part dmg jut goes to infection stuff ie local health of that part then overall just controls if ya die?
does adding moddata remove the square?
How much overall health does a player have? 100?
because other than the transnit it's working but i want it to work in MP.
Moddata of square?
@quasi geode Have any chance to attempt implementing support for vehicles?
I'll be trying to wrap up my implementation today.
its half done. low priority atm
Oh so you're on the police file? That broke me last night haha.
no i am setting it for a mailbox
I tried to dynamically unpackage the vehicle code and that was my first mistake. x)
Going to write a separate lexer TS file to contain lexer code for static objects.
it all parses fine, but i havent done any advanced transformation on them, or the child blocks
Try do by square under mailbox and use transmitmoddata()
Ah yeah. Good to hear.
@quasi geode I had a question since I started making vehicle mods does "offRoadEfficiency" not work at all? In my tests I didn't see any difference to offroad efficiency for car, If you had a look over it before
When I'm done, I'll present my deconstructed design.
Here's my current render for burntvehicle:
I actually have no idea. havent really poked around the vehicle stuff
From my experience items with a getSquare transmitted stopped having that square - I'm not sure why but it probably has to do with references
It's a lot more work to deconstruct the way I'm doing it however I think it's going to help when implementing it for my future editor.
I know you can safely transmit isoPlayers and inventoryItems -- I could have sworn it was safe to transmit squares -- but maybe the reference of a square gets weird?
Would make sense that the references don't line up in MP tho
You might not ever see another player's loaded squares
server tracks that doesnt it?
local function onDoMail(player, obj)
player:Say("Mail Time!")
local square = obj:getSquare();
local mBox = square:getModData();
mBox.dDate = 1;
mBox:transmitModData()
end
local function onNoMail(player, obj)
player:Say("No Mail For You!!")
local square = obj:getSquare();
local mBox2 = square:getModData();
mBox2.dDate = nil;
mBox2:transmitModData()
end
``` same thing.
local function onDoMail(player, obj)
player:Say("Mail Time!")
local square = obj:getSquare();
local mBox = square:getModData();
mBox.dDate = 1;
square:transmitModData()
end
local function onNoMail(player, obj)
player:Say("No Mail For You!!")
local square = obj:getSquare();
local mBox2 = square:getModData();
mBox2.dDate = nil;
square:transmitModData()
end
Does anyone know what setDamage expects as a argument?
function OnEat_Bloodbag(food, player, percent)
player:Say("Ouch")
player:setDamage(50.0)
end
sadly, same issue. transmitmoddata.
transmitModdata()
d is lowercase need
send error from console.txt
hmmmmm
opkay, with small d.
it does nothing lol.
wait it might be.
YAY!
so it now does it right
Why does pz source code loop in pairs, rather then just looping through bodypart damaged rather then just looping normally?
local bodyPartDamaged = ISInventoryPaneContextMenu.haveDamagePart(player);
for i,v in ipairs(bodyPartDamaged) do
subMenuBandage:addOption(BodyPartType.getDisplayName(v:getType()), items, ISInventoryPaneContextMenu.onApplyBandage, v, player);
end
now to get the mailboxes container and add stuffs to it.
Are you asking why it's ipairs instead of pairs?
Also that, but why is in pairs rather then a normal for loop
for i in bodypartDamaged(count) do
...
Are you asking why using ipairs is necessary, or why it declares both i and v when it only uses v?
I suppose both would be nice!
Presumably bodyPartDamaged is a table, so without a __call metamethod your code example would not work. I think you're asking a deeper question about Lua, to which I'd recommend reading up on how for loops work in Lua
The short answer is that you can't use a table directly in a for loop
As for why it declares both, π€·πΎ. The code could very well use _, v to show that it's unused, but if you need to use the value you have to declare it like that when using ipairs or pairs, because it gives you both the index and value
Yes I'm used to code in c++ and c# so I'm a bit surprised I needed to loop through a table with one value with a pair
ipairs/pairs are the standard way to iterate over a table, which one you use depends on whether it's sequential keys or not
Gotcha, yeah I'd recommend reading up on Lua a bit to understand how some stuff works. Definitely not 1:1 with c++ or c#
so in that case, "i" is the index of the table and "v" the result I see
Then in C++/C# you'd be familiar with a range-based for loop
E.g. for auto&& i : vec
Or in C#, foreach
Yes exatly, so is a table treated more like a std::map, or a Dictionary in c#?
In lua, a table can be a mixture of both
It can function as either an array or dict
One, or both at the same time
But thanks to the both of you that really helps understanding how it works. Because I was thinking tables would just be a normal array so when it was looping in pairs I was a bit confused!
pairs is for arbitrary keys, ipairs is for keys in the range 1 to N
Yeah that makes a lot of sense!
Pairs has no stable sequence either
If you add or remove a key, pairs might iterate in a completely different order
Only if the keys are non-numeric right?
is it possible to just CREATE some items in a container?
I think it's unspecified
I.e. even if it's only sequential numeric keys, I think an implementation is allowed to have pairs do non-sequential order
I certainly wouldn't want to rely on it
(and indeed, why would you when ipairs exists)
ipairs removes keys in place of numbers doesnt it?
I don't think it retains any kind of order either way but I could be wrong
checks if the debug option loadall is on?
yes it printed true when i check
but it sounds like it has potential to do stuff
and your debug setting for that is off?
return DEBUG_LOAD_ALL_CHUNKS;
} ``` so there a flag if or what actually uses it no clue.
likely debug scenarios ie 'tiny maps?' only Im not sure loading all chunks on the whole world would be wise.
It doesn't remove anything, it's for iteration
Given a table of 1 to N and other arbitrary keys, the others will be ignored
hmmmmm
now all i need is how to add an item to a player and i believe i might have the initial version of my mod ready to beta.
you can with
if #table > 0 then
for i = 1, #table do
local v = table[i]
end
end
but who tf would do that instead of just
for i,v in ipairs lmao
i've heard that ipairs runs worse
you don't need the if #table > 0 then check, it's redundant, so at that point```lua
for i=1, #t do
local v = t[i]
end
TAKE THIS MONEY YOU BASTARD. sfdpoghadfpoihadfp[o\
apparently ipairs takes roughly twice as much processing time so it easily seems worthwhile to me
so how do i give a player "Base.Money"
he wont take this crap when i try to put it in his inventory like i do that mailboxes.
This is not using it directly either (in the sense that I mean it, anyway), since you're getting the length of the table (or more accurately of its sequential integer keys starting at 1)
Nonetheless good detail to include
you do need it bc when i didnt have it my function kept erroring
hey guys
does anybody know if a java method can be patched?
trying to patch IsoGameCharacter:getHungerMultiplier
That means something in your function was causing the error
yea but when i added the check it stopped erroring so
actually wait if #t is 0 then i=1 > 0 by default
yeah exactly, the check is already part of the loop
then idfk why it errored lmfao
I don't know about that one specifically, but in general you can patch Java methods by modifying __classmetatables[ClassYouWantToModify.class].__index. The key you set in that table should be the name of the function you want to patch, and the value should be the function. I believe this will only affect Lua calls to it, though, so the full answer is yes and no
And the even more full answer is yes with Java modding, but I know little about that
i did try to patch it "statically" (patching the class method without an instance), but i think i should do it every time a player is created, to patch the instance instead
ah nvm this might not work
lmaooooo
also shouldnt it be getHungerMultiplier()
and not getHungerMultiplier alone
im trying to get a method reference
not a call actually
maybe i can patch the metatable
ic...
man thanks a lot
ill try that
oh...
so i accidentally used : instead of .
yea now that makes sense
gonna try now
@thick karma Seems to still do nothing as if it didnt work
Oof, sorry. I will try to help more later. Busy atm
all good lol you dont owe me anything
when you said this, were you referring to creating another instance on top of the current instances on the tile on just the server side? i was really tired when i read this, but these are coming from switches that are currently in world on map creation. only change i made really besides making a wall attached moveable, was giving it Light properties in tiledef
i really would like to figure out the sync thing if i can, but i did notice that when player and host are near each other, there is no desync at all
hi guys, is there a way to create a zombie tree > which this tree spawn zombie and attack the player base, player can destroy this tressssss
by chopping it
good for events
and the log (no error, just a general log) shows on the host side only, which i assume is why you said create on server, but any insight at all would be massive appreciation if you have an idea
if anyone else has a suggestion also, i'm open to trying just about anything. i can use the constructor to create a new isolightswitch but just not seeing how it would benefit me, or how i would implement it when they already exist as a static spawn in world as normal
i don't think creating an object would help, your error specifically means the square isn't found
yea i didn't think so... i'm dying inside over this lol... it's got to be me sending some sync message or something to server from client when interacting with em right? at least best guess?
i had a look and it seems like basically every method to do with messing with lights sends the sync
What's the best way to log something? Just a simple print? Is there a way to log to a new log file that we define ourselves?
guys
i'am trying to make a trait from a Insurgent mod to be Mutual Exclusive to another trait from more traits mod
EmotionlessTrait.name = "Emotionless"
EmotionlessTrait.insurgentExclusive = true
EmotionlessTrait.mutualExclusions = {"NervesOfSteel", "CombatAnxiety", "Cowardly", "Brave","NervousWreck","Melancholic"}
the NervousWreck and Melancholic are from more traits mod (i think), the problem is the Emotionless trait now is mutual Exclusions to vanila traits and Insurgent traits but not to NervousWreck or Melancholic
from what i can see, this error doesn't get printed when debug is disabled, so i'm not sure if it's really important?
if it were a critical error it would always print, surely
i wondered. i did see that it was from debug.log
god i am going to hate myself if it's literally only a debug thing
i didn't realise this was a client log
hosted
i will try dedicated
it only happens when hosted and another player uses em
is the host the only player in debug?
yes
lol so im literally worrying about nothing
but it doesn't matter because it'll load that stuff from the server when the player gets there, so it's only printed in debug
ahh explains why it s a general log and not error
THANK YOU
releasing today in this case lol

time to create a govt contract for your mail company π
lol
finally releasing the mod also! your beautiful lightswitch model will finally see the light of day
π‘
i think i need a method to call all traits from the trait pool
can someone help?
local md = square:getModData()
if not md.dDate then
local dateCheck = true;
else
local dateCheck = os.difftime(md.dDate , os.time()) < 0;
end
print(dateCheck)
why would it be printing nil
not in scope
?
local md = square:getModData()
local dateCheck
if not md.dDate then
dateCheck = true;
else
dateCheck = os.difftime(md.dDate , os.time()) < 0;
end
print(dateCheck)
your dateChecks are in the scope of the if/else statement, the print is outside of that scope
so if i can get the "give dude a money" thing working i am set!
henlo guys anyone know how to fix this?
did you make the model for the flash or is it a default zomboid one?
default zomboid one
hmmm maybe it's scaled via the script.
it worked fine for my scrap guns. but for this weapon itdoesnt work atall
is there any kind of scaling being done in the script at all?
I don't know if scale should work in there, never tried that
Also check how game create isolightswitch by tilepickertool
it seems my error is only a debug log
it doesn't show when not in ddebug
and it's not an error so i shouldnt even use that term
it's just a general debug log
i will do thorough testing via players and see if i need to end up fixing it. i just realized it's only a log for debug mode though
doesn't print if not debug
Can you send me script file with your item model?
yea one sec
ty also for always responding to almost everything. you are truly a good one
Hey guys how can I modify a container's properties? Like the capacity and such? Trying to modify a bag but it seems changing it in the items script breaks the game.
can you show me the script?
so you are trying to change the capacity of vanilla backpacks
the numbers that got changed were capacity and run speed
i see, it shouldnt break the game. unless you typed some insanely large number or missed a comma
I will dm a snip of the modified part
oke
you just need to make a much louder firing sound to go with it
Gentlemen, I am extremely new to the modding scene. Listen all I wanted to do was change the vans texture into the Amazon delivery truck. How would one even go and about and access the vehicle texture files? TYSM in advanced
You need find van vehicle script. In this script you will find texture name. Then in textures folder you will can take texture image, change it and then need upload mod with new texture
Thank you so much, I really appreciate it
ERROR: General , 1677624050418> DebugLogStream.printException> Stack trace:
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "zombie.inventory.InventoryItem.getDisplayName()" is null
at zombie.inventory.InventoryItem.getActualWeight(InventoryItem.java:1927)
at zombie.inventory.InventoryItem.getUnequippedWeight(InventoryItem.java:2633)
at zombie.inventory.ItemContainer.getContentsWeight(ItemContainer.java:2681)
at zombie.inventory.ItemContainer.getCapacityWeight(ItemContainer.java:2711)
at zombie.inventory.ItemContainer.hasRoomFor(ItemContainer.java:198)
at zombie.inventory.ItemPickerJava.tryAddItemToContainer(ItemPickerJava.java:522)
at zombie.inventory.ItemPickerJava.doRollItem(ItemPickerJava.java:759)
at zombie.inventory.ItemPickerJava.rollProceduralItem(ItemPickerJava.java:649)
at zombie.inventory.ItemPickerJava.rollItem(ItemPickerJava.java:715)
at zombie.inventory.ItemPickerJava.fillContainerType(ItemPickerJava.java:508)
at zombie.inventory.ItemPickerJava.fillContainer(ItemPickerJava.java:459)
at zombie.LoadGridsquarePerformanceWorkaround$ItemPicker.checkObject(LoadGridsquarePerformanceWorkaround.java:83)
Modified the values on a bag and now this happens
Hey I just wanted to show you guys my progress, I need to re-center the actual logo and also make it look like it wasn't drawn by a 5-year old. I like how the text turned out and then I'm going to attempt to add little details like detailing doors. The reason I am doing this is because I just finished working at Amazon and I figured there would still be a couple of Amazon delivery vans roaming around Kentucky when the apocalypse hit. This is literally my first attempt at any retexture/modding ever.
Cannot invoke "String.equals(Object)" because the return value of "zombie.inventory.InventoryItem.getDisplayName()" is null
item doesn't exist?
I dont understand why it would do this
all i did was change a numerical value
this is a script right
and the game is like super mad about it
yep it cant update the value of something that doesn't exist
thats prolly why its mad
i will send you the side by side from original to modified
just use diffchecker or something
i dont have time to go thru your 700 line script
feel free to post it still. someone may notice something
This kind of works, one test done. Using global object system instead of LoadGridsquare
https://steamcommunity.com/sharedfiles/filedetails/?id=2940213969
@dark wedge have you seen this
looks like people are going to want to use your mod as requirement.. did made it so that its to use as a framework?
I'm looking for documentation for Foraging System. Is there any place that has information on how the "spawnFuncs = { doGenericItemSpawn, doWildFoodSpawn, doRandomAgeSpawn .... }" section works?
They seem to have simply replaced the punching animations I used.
it doesn't seem to work properly either
unless it's made for only females or i was missing something
--custom spawn function when item is picked up
@function ISBaseIcon:getItemList()
self.itemList = spawnFunc(self.character, self.character:getInventory(), self.itemDef, self.itemList) or self.itemList;
Thanks, I'm new to modding. I found it after searching the game files π
not sure but you can get it from the timed action of the player
eeeh, idk if it matters that much lol
we're just trying to log who and what people are buying from our server's admin shop.
print("APA ATM Transaction -- Player: " .. player:getUsername() .. " -- Recieved: " .. result:getType())
wish we could put it in it's own log, but I couldn't find any code referencing a way to do that
unless we wrote to Lua, but that seems unnecessary too
that's pretty cool
It's making me realize just how much I want proper animations for the katana
Any idea where to find the lua (if such exists) that is behind heating elements such as the wooden stove and the fireplace?
Tried looking from \ProjectZomboid\media\lua and the subfolders, didn't find :c
Thanks in advance! <3
is there anyone who is able to do tile editing?
i have one question about tile and it's urgent
hello, I watched a modding tutorial and viewed some of the files in vs code and found that the problem I'm originally trying to fix is probably in the code of the game, found a forum where explains how to decompile the java code but I'm wondering if you can make a mod that touches that code or something like that legally for a server. My problem (the reason I'm entering modding) is because there is actually a bug where VOIP is for default muted for each player unless you approach them in voice range, then it activates (for example, if you never saw a player, the players tab will only show "Unmute VOIP" but can't press it. When meeting the player, they are unmuted and can mute or unmmute them until the session ends). This is problematic for me because unless I meet each player when I log in a server, I can't talk to them with radio/hams and I REALLY want to roleplay a radio station. Does anything of what I'm saying makes sense?
I know codding, never modded and can understand global coding things
Item script for moveable is mostly for debug item list. Otherwise there are other options to use.
I thought throttle kitty was her on mod chat wheb i saw TK lol mybad
this is a bug in the base game and is possible to fix but have had some people try to find a fix with no luck, you are welcome to try, you will not have many resources to direct you on this specific subject. feel free to ask questions as much as you want though! also devs do not encourage java modding.
I never saw this mute thing. Maybe its on the audio setting
you know what exactly would be the bug in that case?
I have clues that point towards the voip mute system, muting by default (or a variable not set, being a fake 'false') until someone gets close and then unmuting them or creating the variable. Then the UI button actually works for the player that was close to you, instead of the other players never met, where the button doesn't work
But I need to look into the java code for this
yeah but any idea where Im thinking the same thing already got java set up more then lua when it comes to docs _
the VoiceManager class I think
the UI button calls VoiceManager:playerGetMute and is getting a "is muted" equivalent, and when pressing the button and calling VoiceManager:playerSetMute it does nothing
yeah found it zombie.core.raknet
Exploring an idea for a mod -- yet another toxic fog one -- that will be a bit more intense with it's simulation of contamination spreading indoors... https://youtu.be/VMrx55kZpU0
Exploring an idea for a mod that requires some basic atmospheric simulation.
dang that raknet code so clean I feel dirty just looking at it
did u found something?
I need to research how to set up the java code to search for myself but I'm a little busy rn
ok tomorrow I will try to learn how to setup the java code so if my theory is true, make a mod that idk makes magic and lets me make a radio station
what is that
dunno an odd flag setting
can you send the VoiceManager class in a txt file?
if you got an IDE set up its in the external lib files
as for sharing the class files cant do that not gonna test morality/legalities, sorry.
but if you setup an IDE to make mods you get all that yourself
dang okey thanks tomorrow I will setup that
just like MC, dont share source since ya should be extracting it from your own install... sorry couldnt help more that flag seems to be related to either being Voice activated or PTT but then there another mode where both are off? which makes no sense unless maybe thats controller related stuff?
trying to find the actual client side interaction part this all seems like server side code and starting the channel server etc
but its def a starting point to look at
hello, so im a new to modding with PZ and im trying upload a texture for a mod im making but its doesnt seem to be working. its an item texture but just shows up as a question mark/ missing texture. im stuck trying think of ways to fix it, does it need be a certain size or is there a special way to make textures for the game?
I havnt been able find anything on online that rlly helps with item textures. kind stuck tho and cant rlly move forward
are you talking about an icon?
or on the ground it shows at ?
i can post the guide for setting this up
does somebody know an existing vanilla sprite of puddle or liquid on floor or similar to?
i found Steam/steamapps/common/ProjectZomboid/media/textures/puddles_hm.png
yea like the inventory item icon. wanted get that set before i add the world item texture.
what is the name of your texture file
if it's an item icon, it has to be item_yourItemType
example
yea its Item_SpiffoCard_back
also you icon i think is 22x22 or something around there. pan might be able to confirm there
off the top of my head so not 100%
it says 32x32 and mine was 32x23 but i changed it to 32x32 and still wasnt loading
ahh maybe that is the right size there
my icon is 32x32
here is the code
item SpiffoCard1
{
DisplayName=Spiffo Trading Card #001 - Spiffo,
Icon=Item_SpiffoCard_back,
Weight=0.01,
Type=Normal,
WorldStaticModel=SpiffoCard1,
}
here is the texture
i feel like im doing it right but idk why its not loading in game
where is that icon located? in textures?
yea
you are setting your module also?
no i havnt set those up yet, was just trying get the item texture to show up first
do i need do that?
just for now use Base module
yea
module Base {
} at end
good to go
you can use your own also
like module mymodule
setting your module will use that prefix when someone calls the items outside of the scope of your mod itself without importing your module first
if you set Base you dont need to import it
if you dont and you want to use without prefix then you import it after you set your module name
{
imports
{
Base,
}```
before i forget. if anyone out there with more sprite knowledge than myself (so pretty much everyone) i am trying to find if i can select a sprite for context menu without it grabbing the entire square all the way to the ceiling. i assumed it wasn't my sprite causing the issue but wasn't 100%. is there another way to grab it without grabbing the entire square?
i can be clicking WAY off from the sprite itself even though the condition is the sprite specifically, and it still grabs the entire square
im still having trouble getting this mod to work. my code looks right and everything works like its suppose to. my world item textures are loading find but my item icon textures just wont load.
if someone can give me some tips or point me in the right direction where you guys size your icons or what i could be doing wrong.
hello does anybody know how to get item's weight in Lua? If the item's weight is overridden by other scripts, I need to get the latest weight...
And I also need setter of item weight
@little kraken
function SusceptibleUtil.setWeightChange(item, key, amount)
local data = SusceptibleUtil.getItemModData(item);
local change = amount;
if data.weights[key] then
change = amount - data.weights[key];
end
data.weights[key] = amount;
-- UPDATE THE ITEMS WEIGHT
item:setActualWeight(item:getActualWeight() + change);
item:setCustomWeight(true);
end
Code from one of my mods that changes an items weight. Looks like ActualWeight is the one you're looking for.
.
Finally got an equipment UI working in Inventory Tetris
Still pretty raw, but it works and should scale well enough for the insane number of equipment slots in the game 
https://imgur.com/S88oiRn
Someone make a mod that lets you get on top of cars, The picture of the game is a guy on top of a car lol
The dream
MINDBLOWING
btw thanks for the info
curious how this will affect performance
anyone has idea how to add sound while performing recipe action?
should i put code on recipe file? or something below server folder? or someting below clinet folder??
Wow is this still a mockup or have you completed the thing? This is amazing
I recall you mentioned mockup before but this looks like yhe real deal
On the recipe itself
The txt file
can you give me the example if i may ask for a favour?
Im currently afk iwll have to get back to you
okie dokie i will check by myself.
just one last question at the moment, is any way to get "what day is it today in game"??
i mean in perspective of code. not watching your digital clock..
like in excel = today() something like this
The icon names should be
Item_filename.png
But on the item script you dont add Item_
yess thank you! Nippytime was able help me figure it out
I wouldn't call it complete, but this is all implemented and working.
Still a lot left to add, but I think the core ideas are all here.
Legend
Can anyone remind me if I can require a client lua in server lua?
Does someone here have experience with items giving someone a level up for a certain skill?
Let's say you create an implant item and want someone to be able to consume it for +1 Level of something. Please DM me I would greatly appreciate it.
cant you just hook onto oneat function, there should be something like that
Actually, scratch my last question, I got a better one.
I use ModOptions for my mod, and it's confined in client/ETWModOptions.lua. It stores all options in a table, right EvolvingTraitsWorld.settings = EvolvingTraitsWorld.SETTINGS or {};. Now, there's an option GatherDebug ( EvolvingTraitsWorld.settings.GatherDebug ) that I use to gather additional data if needed in bug reports. I have require in all other of my client/**.lua, require "ETWModOptions"; to make sure it runs first so it doesnt throw errors that options don't exist cuz the lua haven't ran yet. Now, I also have 1 lua in server/ folder, 'cuz I need to hook onto OnEat_Cigarettes, and inside of there I got following
local debug = function() return EvolvingTraitsWorld.settings.GatherDebug end
local original_oneat_cigarettes = OnEat_Cigarettes;
function OnEat_Cigarettes(food, character, percent)
if debug() then print("ETW Logger: detected smoking") end
local modData = character:getModData().EvolvingTraitsWorld;
-- rest of stuff
Now, I'm getting reports that it throws error when sm1 tries to smoke, error itself is that debug() tries to access null table.
I dont really have access to dedicated server to test this shit
So need some help
if anyone can
Path of least resistance: remove the debug statement
Can't offer much else, dont have the loading details of client/server/shared memorized properly
Oh, wait.
Move your mod options file to shared
Because I don't think the server loads anything from the client folder
The server and the client do not share lua state.
so if i move my modoptions lua to shared it should be fine?
You should be able to test it from the host option on the main menu. You don't need a dedicated server in my experience. Never saw any differences in testing with either.
how do I require it in my client then?
atm I have require "ETWModOptions";, if I move it to shared, should it be require "shared/ETWModOptions";?
well i dont get any errors
If i host
while people send me error logs
ok, so
Moving mod options to shared fixed the settings error, however now it throws error that SmokeSystem of non-table: null doesnt exist
local original_oneat_cigarettes = OnEat_Cigarettes;
function OnEat_Cigarettes(food, character, percent)
if debug() then print("ETW Logger: detected smoking") end
local modData = character:getModData().EvolvingTraitsWorld;
local smokerModData = modData.SmokeSystem; -- ON THIS LINE
local timeSinceLastSmoke = character:getTimeSinceLastSmoke() * 60;
if debug() then print("ETW Logger: timeSinceLastSmoke: "..timeSinceLastSmoke) end
if debug() then print("ETW Logger: modData.MinutesSinceLastSmoke: "..smokerModData.MinutesSinceLastSmoke) end
local stress = character:getStats():getStress(); -- stress is 0-1
local panic = character:getStats():getPanic(); -- 0-100
local addictionGain = SBvars.SmokingAddictionMultiplier * (1 + stress) * (1 + panic / 100) * 1000 / (math.max(timeSinceLastSmoke, smokerModData.MinutesSinceLastSmoke) + 100);
if SBvars.AffinitySystem and modData.StartingTraits.Smoker then
addictionGain = addictionGain * SBvars.AffinitySystemGainMultiplier;
end
smokerModData.SmokingAddiction = math.min(SBvars.SmokerCounter * 2, smokerModData.SmokingAddiction + addictionGain);
if debug() then print("ETW Logger: addictionGain: "..addictionGain) end
if debug() then print("ETW Logger: modData.SmokingAddiction: "..smokerModData.SmokingAddiction) end
smokerModData.MinutesSinceLastSmoke = 0;
original_oneat_cigarettes(food, character, percent);
end```
BUT
it correctly updates all the values?
like what
how the hell does it correctly update the values
if it throws error
which should interrupt the scope it's in
???

So it looks like moving that to shared changed your load order in a way that prevents your character's mod data from being initialized before OnEat_Cigarettes gets called.
but it updates all the values
correctly
it increased addiction counter
it reset timer
it done everything
You're saying OnEat_Cigarettes both works AND throws an exception?
Only explanation for that is it's being called twice, from two different places, one of which is valid, one of which isn't.
A function cannot finish running if it hits an exception.
Probably not gonna help. What mod has OnEat_Cigarettes originally?
vanilla game
Oh
lmao
it literally runs full scope
and throws error inside of it at same time
dafuq
yea ok idfk
How do you eat a cigarette? Lol is that the smoke function???
ye
sigh
Hmm I am actually not throwing errors when I smoke. Let me make sure I added ETW. I wonder if I need a certain trait to throw the errors.
ooof... lol but when I died
that is if you're hosting locally
(I was looking at your original, not the update)
The version mentioned in #mod_support did not generate the nonexistent mod option exception for me

Oh duh I didn't set the mod option
ohhhhhhhhhhhh I need Killcount
I don't have that dependency
Alright round 3
But how do you link it to a skill?
to actually level up skill idk, there should be some function to add exp to a skill
@dull moss Okay
It's the same problem
haha
π
Events.OnCreatePlayer.Add(createModData);
local function createModData(playerIndex, player)
player:getModData().EvolvingTraitsWorld = player:getModData().EvolvingTraitsWorld or {};
local modData = player:getModData().EvolvingTraitsWorld
Server file does not know you initialized that mod data on my character
Because you only did it clientside.
then how does it update the values correctly
Hmmm
Maybe the client AND the server call OnEat
In order to match the inventory on client and server
So it only fails serverside
But the client one works
Because mod data exists there.

That would explain things.
ye but this piece of code doesnt exist in client folder
You can call server code from client
Just not vice versa
So, yeah... I would try this:
function OnEat_Cigarettes(food, character, percent)
if isClient() then
if debug() then print("ETW Logger: detected smoking") end
local modData = character:getModData().EvolvingTraitsWorld;
local smokerModData = modData.SmokeSystem; -- SmokingAddiction MinutesSinceLastSmoke
local timeSinceLastSmoke = character:getTimeSinceLastSmoke() * 60;
if debug() then print("ETW Logger: timeSinceLastSmoke: "..timeSinceLastSmoke) end
if debug() then print("ETW Logger: modData.MinutesSinceLastSmoke: "..smokerModData.MinutesSinceLastSmoke) end
local stress = character:getStats():getStress(); -- stress is 0-1
local panic = character:getStats():getPanic(); -- 0-100
local addictionGain = SBvars.SmokingAddictionMultiplier * (1 + stress) * (1 + panic / 100) * 1000 / (math.max(timeSinceLastSmoke, smokerModData.MinutesSinceLastSmoke) + 100);
if SBvars.AffinitySystem and modData.StartingTraits.Smoker then
addictionGain = addictionGain * SBvars.AffinitySystemGainMultiplier;
end
smokerModData.SmokingAddiction = math.min(SBvars.SmokerCounter * 2, smokerModData.SmokingAddiction + addictionGain);
if debug() then print("ETW Logger: addictionGain: "..addictionGain) end
if debug() then print("ETW Logger: modData.SmokingAddiction: "..smokerModData.SmokingAddiction) end
smokerModData.MinutesSinceLastSmoke = 0;
end
original_oneat_cigarettes(food, character, percent);
end
And then just update the server with your new mod data using transmitModData from clientside if that's even necessary.
But server may not even need to know that, idk.
Anyone an idea why the text is so far right for the recipe?
i just finished my first mod!
This would prevent server from running your custom code and solve the problem if I'm right. @dull moss
thank you! I had the idea for awhile so am super excited to have finally done it! also surprised it wasnt already done
What'd ya do?
it def needs some fixes im going do tomorrow, its a trading card mod and i only been able find one other on the workshop and was a PKMN one
but here is mine https://steamcommunity.com/sharedfiles/filedetails/?id=2940688973
@dull moss In fact, that code should fix both problems.
two big things need fix are the spawning and the names for the item cards 2-5
You could leave Mod Options in client if that's the only place you tried accessing it from the server.
local SBvars = SandboxVars.EvolvingTraitsWorld;
local debug = function() return EvolvingTraitsWorld.settings.GatherDebug end
local original_oneat_cigarettes = OnEat_Cigarettes;
function OnEat_Cigarettes(food, character, percent)
if isClient() then
if debug() then print("ETW Logger: detected smoking") end
local modData = character:getModData().EvolvingTraitsWorld;
local smokerModData = modData.SmokeSystem; -- SmokingAddiction MinutesSinceLastSmoke
local timeSinceLastSmoke = character:getTimeSinceLastSmoke() * 60;
if debug() then print("ETW Logger: timeSinceLastSmoke: "..timeSinceLastSmoke) end
if debug() then print("ETW Logger: modData.MinutesSinceLastSmoke: "..smokerModData.MinutesSinceLastSmoke) end
local stress = character:getStats():getStress(); -- stress is 0-1
local panic = character:getStats():getPanic(); -- 0-100
local addictionGain = SBvars.SmokingAddictionMultiplier * (1 + stress) * (1 + panic / 100) * 1000 / (math.max(timeSinceLastSmoke, smokerModData.MinutesSinceLastSmoke) + 100);
if SBvars.AffinitySystem and modData.StartingTraits.Smoker then
addictionGain = addictionGain * SBvars.AffinitySystemGainMultiplier;
end
smokerModData.SmokingAddiction = math.min(SBvars.SmokerCounter * 2, smokerModData.SmokingAddiction + addictionGain);
if debug() then print("ETW Logger: addictionGain: "..addictionGain) end
if debug() then print("ETW Logger: modData.SmokingAddiction: "..smokerModData.SmokingAddiction) end
smokerModData.MinutesSinceLastSmoke = 0;
end
original_oneat_cigarettes(food, character, percent);
end
This version should work with mod options in client afaik.
Because then it won't try accessing EvolvingTraitsWorld.settings from server side.
@dark wedge thoughts on a shield mod?
@hollow shadow Hey did you ever solve that weird animation issue?
Nope
Damn, just keeps looping wrong huh?
If you zip it to me I can try to take a look locally.
Might not get to it immediately, but if you're stuck I can give it a shot
Main issue is that the animation only gets disabled when the gun is unequiped
So that's the only problem now?
No worries.
Also the code from dhert seems to do nothing
Hmmm, clearly there is a way unequip is being triggered without firing the right event.
Weird!
I would have to try things on my end to make sense of that most likely
Maybe in addition to listening for weapon equip / unequips you could try the OnClothingUpdated event. It gets fired right before you unequip stuff in the timed action for unequipping stuff. Alternitively, you could decorate various functions that show up in other situations where your item becomes unequipped in an unusual way, e.g., ISInventoryTransferAction.GetDropItemOffset gets called when you drop an item.
If all else fails you could check the player's weapons periodically... Probably wouldn't be terribly time-consuming or noticeable for users, though obv that's not optimal.
To spawn your items, you can use a pattern like this, based on ProceduralDistributions.lua:
I do some (very light) fancy stuff to get the rate purely because I wanted to let players customize that. Not required.
The rate should be a number from 0 - 100 afaik.
I'm guessing it represents probability of finding that item each time items get generated in that container on normal loot spawns or something close to that
And I think items get rolled 4 times for most containers.
You try that last snippet?
Will in a bit
Btw... @dull moss
As far as I can tell... these:
Are not showing here:
Sooooo not sure they are useful for your non-debug users
But I could be mistaken
I have been wrong... many times before.
Does anyone know how to access the friendly name of a container? container:getType() returns something decidedly user-unfriendly, but the loot panel when selecting objects uses a friendly name. I'm wondering about how to get ahold of that friendly version.
@flat cipher Would you mind if I patched these requirements out of your mod?
I can send you the code if you are still actively playing / updating mods.
Hey, I can have a look! This is here to catch misconfigurations and make sure people know what theyβre doing. Removing it may be trading a class of errors for another one
If those things need to add up to 100, you can ensure that in your Lua after getting the user data using algebra, instead of simply forwarding the user data as it was given.
You can make the numbers relatIve to each other.
Such that 25 25 25 25 and 100 100 100 100 do the same thing
Yes and you wouldnβt catch someone setting 50 instead of 5
And people inputting random numbers
If they set 50 instead of 5, they would generate far more zombies than they intended, but they wouldn't blackscreen and crash and think they need mod support.

They would just get overwhelmed by way more of that zombie than expected.
Thatβs not true, the number of zombies doesnβt change
I mean this proportionally.
They would experience a higher proportion of zombies in that category.
And therefore if they experienced 100 zombies, yes, they would see more of the zombie they overgenerated.
they do, just launched the game without debug mode
also
your fix seems to be working
cheers
very
indeed
Maybe that's the issue... maybe because I was in debug mode, it works differently.
huh
It works for me both in debug in without debug mode
i'm talking about PZ debug mode
Me too
You can see the file I'm searching in my screenshot
I'm clearly searching console.txt from Zomboid for the right string
Just... isn't showing up
But yeah no worries at all on my end
I don't need that feature
I am just trying to squash bugs
And reduce crashing
haha
I try
Yeah, @flat cipher, ultimately it's a subjective and personal decision whether you would prefer misconfiguration to lead to a crash or an unexpected user experience in-game.
Iβd rather fail early with a clear error message if the mod is misconfigured. In terms of mod support, people have been posting comments before checking their config anyway. Iβve had very few issues the way it is now
No pressure, just figured it would be something you would want to fix.
Itβs not a crash, itβs an error with a message
They come to #mod_support and make me help them with your mod instead.
So, you may not be seeing issues, but I see many.
Why would they come to you?
Because I help people in #mod_support and they go to #mod_support
It's an instinct many users have
Instead of waiting for help from authors.
Haha
But yeah if this is the outcome you prefer, no worries.
I mean, thereβs an FAQ and troubleshooting section in the mod description. Silencing the error does not make the root cause go away
I... figured it was just because you didn't know how to make it stop people from crashing. Clearly I was mistaken.
