#mod_development
1 messages Β· Page 78 of 1
is there a place to get started?
I want to edit the insurgent mod to add more traits
You cant edit some other authors mod without permission
Of course, I won't edit it without permisson (besides I don't have the skills to)
but uh
just the wkik?
U could just make yournown trait mods . You need to check the lua files regarding traits . Then it will depend on how the trait functions
You should probably want to look at multiple traits mod before starting to code just to be able to grasp the idea. And learn lua in general
that's how I learnt modding for another game so I guess I'll just do that
im having issues with getFileWriter and reader...
Can read a file and get the data from it, but when i try to write to it... nop... the file remains unchanged.
getPlayer():Say("file: "..tostring(file))
local reader = getFileReader(file, true)
local line = reader:readLine()
while line ~= nil do
-- Split the line into fields
line = string.gsub(line, ',', '|')
local fields = {}
for field in string.gmatch(line, '([^,]+)') do
table.insert(fields, field)
end
-- Extract the values of the Name, Reward Name, Cost, and Status fields
local name = fields[1]
local reward_name = fields[2]
local cost = fields[3]
local status = fields[4]
-- Print the values
print('Name: ' .. name)
print('Reward Name: ' .. reward_name)
print('Cost: ' .. cost)
print('Status: ' .. status)
-- Read the next line
line = reader:readLine()
end
reader:close()
this bit works... but after when i do
the bit to write the file with an empty string... nothing happens
even if its something simple like
getPlayer():Say("file: "..tostring(file))
local writer = getFileWriter(file, true)
writer:write("")
writer:close
dont see anything wrong in the code but i suck with lua...
i even went the simpler way and try to run the code by just reading 1 line, then closing the reader declaring the writer writing an empty string and closing the file... it reads... but the file isnt modified... and no errors... so im tottally lost
i even used pcall to try and catch any error... same thing
no errors no changes to the file
What error does it show
thats the problem... no errors
it just doesnt write the file
im prolly missing something stupid and simple... but i dont see what
Ow shiiz... Can you try and encapsulate it on a function and just trigger using debug
i started with a function...
then broke it down to just code to simplify since i was getting the same problem
the debug log shows no error
i even added prints for every bit of the code to show in the log what was happening
if i create a new file... it creates the file and whatever i pass to the writer shows up... but i cant be creating files for no reason... the point is to use only one file...
function ResurrectID()
local Graveyard = getFileReader("Graveyard.ini", true);
if not Graveyard then return end
while true do
local line = Graveyard:readLine()
if not line then
Graveyard:close()
break
end
print(line)
SendCommandToServer(string.format("/unbanid " .. line))
end
Graveyard:close();
GraveDig() -- then flush table data
end
function BuryFool()
local bdDude = getPlayer():getUsername()
local Graveyard = getFileWriter("Graveyard.ini", true, true);
local bdSid=(getSteamIDFromUsername(getPlayer():getUsername() .. "\n"));
Graveyard:write(bdSid);
Graveyard:close();
SendCommandToServer(string.format("/banid " .. bdSid));
print("RIP: " .. bdDude .. " " .. bdSid);
end
heres what i have
from old proj
hmm im missing 1 boolean it seems
yeah, will do so... missing one arg... damn... i need to go and sleep... thanks gonna try it out
Owryt goodnight
getFileWriter(filename, File Create Boolean, Append to file Boolean)
damn... one arg missing...
it works now... thank @ancient grail
thanks
π«‘
Hi, guys!
Is there a way to execute lua as a command to a server?
My case: I want to give a player not just an item, but a bag of items. Also, I want to be able to do it as a command that could be executed via RCON.
I couldn't find a command like "execute lua", so is Java-patching (adding new server command definition) the only way to achieve this?
Create a mod item that when u OnCreate it auto gives all the stuff
Send that item to the player
Its either that or create a rcon command using jabs mod
Oh, never thought about that! Thanks
Thank you kindly!
π«‘
cant sleep while the brain is still working π
so since all the heavy weight will be done by the app i coded in vb.net
local line = ReadReward:readLine()
local rewards = {}
local events = {
["zombies"] = function(value) zombieEvent(tonumber(value)) end,
["gift"] = function(value) giftEvent(value) end,
["airevent"] = function(value) AirEvent(value) end,
["random"] = function() RandomEvent() end
}
local action = events[reward_type]
while line ~= nil do
rewards[#rewards + 1] = line
line = ReadReward:readLine()
end
ReadReward:close()
if action then
action(rewards[5])
else
-- Handle invalid reward type
end
local WriteReward = getFileWriter("rewards.txt", true, false)
WriteReward:write('')
WriteReward:close()
the code above ( apart from a thing or two i still need to add, like the actual functions to the triggered) will be handling the game side bit of the mod , gonna have to credit @ancient grail on the mod, since he unstuck my brain after several hours of me being an utter idiot and not noticing an arg was missing π
yeah happens to me too if you cant like solve a problem lol
and its usually the easier bits that stomp me...
a comma out of place or a missing ) or whatever...
wasnt really a big deal i just gave you reference and you found the problem and solution on your own
lol
but thnx man π
im truely far from that 
Anyways does anyone know if i can auto toggle a sandbox
Like i have 2 sandbox bool
If on of em is true it sets the other false
Automagically
To be more specific
I have an option if it snares the zed and the other is if the zed is killed by the trap
I want to make it so that when u choose kill then the snare is auto off
I cant seem to find this anywhere
hey can anyone help me out? Im tryint to add a context option for the inventory page but it doesnt initiate it
show the code how you did it
Good morning.
function removeItem(item, player)
if item:getWorldItem() ~= nil then
item:getWorldItem():getSquare():transmitRemoveItemFromSquare(item:getWorldItem());
item:getWorldItem():removeFromWorld()
item:getWorldItem():removeFromSquare()
item:getWorldItem():setSquare(nil)
getPlayerLoot(player):refreshBackpacks()
return
end
if item:isEquipped() then
local playerObj = item:getContainer():getParent()
item:getContainer():setDrawDirty(true);
item:setJobDelta(0.0);
playerObj:removeWornItem(item)
local hotbar = getPlayerHotbar(playerObj:getPlayerNum())
local fromHotbar = false;
if hotbar then
fromHotbar = hotbar:isItemAttached(item);
end
if fromHotbar then
hotbar.chr:setAttachedItem(item:getAttachedToModel(), item);
playerObj:resetEquippedHandsModels()
end
if item == playerObj:getPrimaryHandItem() then
if (item:isTwoHandWeapon() or item:isRequiresEquippedBothHands()) and item == playerObj:getSecondaryHandItem() then
playerObj:setSecondaryHandItem(nil);
end
playerObj:setPrimaryHandItem(nil);
end
if item == playerObj:getSecondaryHandItem() then
if (item:isTwoHandWeapon() or item:isRequiresEquippedBothHands()) and item == playerObj:getPrimaryHandItem() then
playerObj:setPrimaryHandItem(nil);
end
playerObj:setSecondaryHandItem(nil);
end
end
if isClient() and not instanceof(item:getOutermostContainer():getParent(), "IsoPlayer") and item:getContainer():getType()~="floor" then
item:getContainer():removeItemOnServer(item);
end
item:getContainer():DoRemoveItem(item);
end
function removeItems(items, player)
for i, item in ipairs(items) do
removeItem(item, player)
end
end
local function RemoveItemContextOptions(player, context, items)
--if not (isDebugEnabled() or (isClient() and (isAdmin() or getAccessLevel() == "moderator"))) then return true; end
local container = nil
local resItems = {}
for i,v in ipairs(items) do
if not instanceof(v, "InventoryItem") then
for _, it in ipairs(v.items) do
resItems[it] = true
end
container = v.items[1]:getContainer()
else
resItems[v] = true
container = v:getContainer()
end
end
local listItems = {}
for v, _ in pairs(resItems) do
table.insert(listItems, v)
end
local removeOption = context:addOption("Delete:")
local subMenuRemove = ISContextMenu:getNew(context)
context:addSubMenu(removeOption, subMenuRemove)
subMenuRemove:addOption("1 item", listItems[1], removeItem, player)
subMenuRemove:addOption("selected", listItems, removeItems, player)
end
Events.OnFillInventoryObjectContextMenu.Add(RemoveItemContextOptions)
technically its only the removeitemtool from debug but only the inventory one and without the check for debug
but it doesnt pop up on the right click
try to add debug print in RemoveItemContextOptions function to check if it's even calls
but as I see it should work
Yea just found out the mod isnβt getting initialised at all
Like the files donβt even load in
nope it doesnt work at all
It triggers them but they still won't see you. They stumble toward the sound.
Idk tbh, maybe?
I dunno, when I setInvisible it just makes zombies not see me. What does Ghost do beyond making you invisible?
Meh... so I guess I cant achieve what I would like to get xD
You want them to attack you when they hear you?
Even though they can't see you?
Or you want them to see you if you make noise?
Well basically I would like to achieve that I can put zombie Guts on my clothes, the more you got, the harder it becomes for Zombies to notice you, you can walk up clother to them, so they will attack you later xD or only when you do stuff like shoot around.
XD only the zombie triggering change is still ??? For me xD
You could just disable the invisibility if you get too close to a zombie or move too fast, and reenable it if they get far enough away. Not sure how to use shooting your weapon as a trigger, but shooting naturally will draw zombies to you, so you could let proximity take care of that.
If i load up a mod with a wrong id or a non sensical one in its mod.info will the mod not get initialised?
Should work if it's not a dependency afaik
What could cause a mod not to load in then?
Missing dependencies for one
Maybe it needs Mod Options e.g.
Check MODS in main menu and find the mod in that list
Hmm I will give it a shot π
My mod does get loaded in but the only file it has is not initialised
And there are no errors or anything
Hmmm, in my experience, generally if a mod doesn't load and there are no errors, it's either because I'm missing a dependency, or the mod cannot be found because its location is not what the game expects.
Did you change mod's id AFTER adding it to server? That would not work
Say I want to add my own textures to the Fjord Mustard car mod how would I go about doing so?
without overwritting their stuff
No im doin the mod on my computer in sp
The file does not show up but the mod itself does in the pause menu under mods
I would inspect the file that isn't showing up carefully for weirdness, like invisible characters that don't seem to go away when you hit Delete.
Maybe something odd preventing file from being read at all or throwing errors.
You mean in the name or in the file itself?
I need help on exiting the interior of the bus in the rv interior mod
try to use different name for ur file
mb u have conflicts
Hmm I think I may have an idea on how to save some memory in the game with a Java edit. If I end up testing it, I'll mention the results.
It has to do with the core of the game's render engine.
Am doing deep edits to the render engine today. π A lot of fun.
An "Optifine" for PZ might happen if I keep walking through it.
sounds amazing
found out the error, no idea how but i forgot the media folder and added just the lua folder
Can someone help me with adding car textures to the autotsar mods?
shame they're overhauling it for the next build :/
I'd be like "Oh damn.." If it wasn't for the fact that the overhaul for MP was really shifting the server-side zombie simulation over to the client and a few other small things.
Yeah stuff like zombies and model animation states.
I wonder what will stop working after the overhaul
But seriously, they're rewriting it
A few blogs past there's a vid showing it
Tried to look for it. =/
now with laser attachment.
Does anywhere know the default path for getModFileWriter? I've saved info in a file and can pull that information back up but I can not find the file on my pc. I'm hosting a local dedicated server.
Nevermind, I found it. I thought I had checked /user/zomboid
Nevermind again. The file is written to your main mod folder, with mod.info.
This is a known issue idk if they fixed it but afaik its been like that for a long time
Im not sure how to that maybe doparm will work u might want to ask the author how as you ask permission at the same time
hello I am having an issue with my one of my first uploaded mods from the workshop. It works for single player but when I try and enable the mods on my server I get an error "server has stopped during launch (NormalTermination)". Any reason this might be? Thank you.
I found my problem. the visibility for the mod was friends only and I fixed it by making the mod public.
Is there a way to define male/female hairstyles in HairOutfitDefinitions? I know it can be done in ZombiesZoneDefinition w/ maleHairStyles= and femaleHairStyles= but I'm not aware of similar segregation on the outfit level.
I meant in the file itself. Sorry I didn't see this earlier.
Aha makes sense.
Im not sure about friends only. But that might be the case.
You can choose to set it unlisted it will still work
You might want to ask #modeling too
https://steamcommunity.com/sharedfiles/filedetails/?id=2909023974 works against zeds now too (customizable sandbox)
Honestly at this point I'd settle for just doing it in ZombiesZoneDefinition, but maleHairStyles and femaleHairStyles don't seem to work as expected either...I keep getting dudes spawning in with afros and stuff even when I have it set to a 100% chance of using one hairstyle for guys.
I even tried splitting out the men and women into two completely separate outfits and just defining it that way, but interestingly, it seems like even if the "chance" defined in ZombiesZoneDefinition adds up to 100, restricting the gender of a spawnable outfit introduces a chance of spawning a random zombie if it rolls opposite.
So, for example:
TestFemale = {
name="FemaleOutfit",
chance=50,
gender="female",
},
TestMale = {
name="MaleOutfit",
chance=50,
gender="male",
},
}```
This should, at least by my understanding, force only TestFemale and TestMale (w/ a 50% chance of either), with no chance for random zombies, but it actually seems to create a 25% chance for TestFemale and 25% for TestMale with 50% chance to spawn a random zombie when the roll fails to hit the preferred gender on both.
i dont think the chance is percent based
its just the chance
imagine the chance is like a ticket the more ticket you have the more chance of winning
The dev comments say:
-- Chance at 75 means 75% of the zombies spawning (except mandatory) will have this outfit, the other 10% will have generic, the total chance of them all should be <= 100
In that particular example 10% is left "undefined" to fill the generics, but the current version of my mod fills to 100% to cut out the generics and it works fine
It's just trying to control these damn hairstyles that is -- pardon the pun -- leading me to rip my hair out
AFAIK you can't set gender-specific hairstyle restrictions in HairOutfitDefinitions and the gender-specific restrictions in ZombiesZoneDefinition don't seem to work. So, you have one pool of hairstyles for both genders to pull from. But the individual hairstyle chances together can't exceed 100, and if there are female or male-specific hairstyles in the pile, it just ignores those and counts it as random, so e.g. you have a 50% for Donny and 50% for Long and it will spawn your guy with Donny 25% of the time despite the fact that Donny is the only male haircut in the pile...
And you can't set Donny to 100% without removing all the other hairstyles and thus forcing the females to go bald...
Is there a mod that allows admins to enforce moodles onto players?
thank you
i couldnt find any on test that checks if the food is rotten and if it is then it can be used to for cooking
anyone knows ?
#mod_development message
probably this
Spent my entire day modding but I got as much done as I wanted to.
I have GLSL shaders for diffuse and backdrop for UI.
recipe Empty Griddle Pan
{
destroy GriddlePanFriedVegetables,
Result:GridlePan,
OnGiveXP:Recipe.OnGiveXP.None,
Time:40.0,
Category:Cooking,
Sound:EmptyPan,
AllowRottenItem:true,
}
I wasted a few hours trying to use Isogridsquare:discard() to reset erosion data but nothing good happens
found this now i need to apply it on stew and soup but the thing is tthose are evolved recipe afaik
https://cdn.discordapp.com/attachments/1056970177641713774/1061758174820052992/image.png
https://cdn.discordapp.com/attachments/1056970177641713774/1061759618348486807/image.png
(If you kind of know what's going on here then you'll know this is somewhat significant)
evolvedrecipe Soup
{
BaseItem:WaterPot,
MaxItems:6,
ResultItem:PotOfSoupRecipe,
Cookable:true,
Name:Prepare Soup,
CanAddSpicesEmpty:true,
AllowRottenItem:true, /* <<<<<<<<<< will this work??? */
}
ehh so idont know how exactly im going to be able to use that π
Don't Evolved Recipes already allow some amount of rotten food based on your cooking level?
I imagine if that does work, it'd just make all rotten food usable regardless of level.
Kind of sucks that what I'm working on is so technical and deep modding but yeah the result will be amazing.
For those versed in render coding I'm passing the off-screen FBO texture to a shader for backdrop rendering for UI.
I'm working on having options to select a shader for a UIElement or the like.
So UI drawing can be offloaded to shaders and be able to do a lot more in realtime.
To sum it up: I want to do this in PZ:
Am half-way there. :3
ye thats what i kinda need for a trait
if you have that trait then you can cook rotten no matter what cooking level
goodluck sir
Thanks.
Oh and to show I have a diffuse shader for UI too:
AFK for probably a week. Cya.

Hi guys! I'm trying to search for a function that grabs the character's name and not the account username, currently trying to write out a way to replace usernames on the minimap for nearby players for character names
How would I start making mods?
getPlayer():getDescriptor():getForename()
getPlayer():getDescriptor():getSurname()
Hrm, so I was using the right function. Thank you! I'll continue to smash my keyboard until something works.
Blacksmith:addXPBoost(Perks.Forgaing, 3);
is there something wrong with it
Forgaing?
https://pzwiki.net/wiki/Modding:Lua_Events https://theindiestone.com/forums/index.php?/topic/2530-mod-permissions/ https://github.com/FWolfe/Zomboid-Modding-Guide https://steamcommunity.com/id/Dislaik/myworkshopfiles/?section=guides https://projectzomboid.com/modding/index-files/index-1.html https://gist.github.com/Konijima/7e6bd1adb6f69444e7b620965a611b74 https://theindiestone.com/forums/index.php?/topic/15188-item-and-recipe-script-variables-brief-description/ https://www.lua.org/pil/contents.html
Thank you
What kind of mod do you wanna make?
i think it's called PlantScavenging anyway
I mostly want to make maps and clothing
At the moment at least
I don't have much coding experience unfortunately
Good luck! Trick is to start with a small project, and then use the skills you learn from that to build out incrementally.
the blacksmith stuff is commented out on the vanilla lua
That was my plan, are there mapping tools or anything?
ok thx
I haven't done any mapping myself yet, so I'm not sure! But yeah, there's some sort of an ingame mapper feature IIRC.
I'll look around for it
My big goal over time is to recreate the Darkwood map in PZ
Iirc, Blacksmith was a new trait you were adding, correct?
The perk name in code for Foraging is "Perks.PlantScavenging"
Just don't get discouraged when you get stuck somewhere, it happens to everyone, 'sall part of the process
I've been smashing my head against hairstyles all day and am still no closer to solving my problem than before
I just gotta wrestle with ADHD
Ah neat
Alright, I'm 8 hours in, I've tried everything, nothing works. I'm fairly convinced at this point that the feature is broken. Has anyone actually gotten maleHairStyles and femaleHairStyles working in their ZombiesZoneDefinition?
It should not be this difficult to set different hairstyles for male and female zombies but apparently it is.
One of the first places I looked. They don't define any hairstyles in ZZD, only in HairOutfitDefinitions, and in all those cases it's WAD because the outfit is gender-limited, so there's no problem of male and female hairstyles being glomped together into a single outfit definition.
I tried splitting into male and female outfits but then that runs into the aforementioned issue wherein the area starts getting a bunch of random zombies because of the spawn roll system.
So it seems like, barring a fix/workaround that I've not yet found, I have to choose between either:
- Defining hairstyles for the male and female, but diluting the zone with a bunch of random generic zombies
- Keeping the zone's zombie distribution as I want it, but turning a bunch of them bald because the hairstyle roll doesn't ignore opposite gender hairstyles and will just generate a bald head instead if the hairstyle it hits is ineligible
This can't be right, but I cannot for the life of me figure out any other options.
It's especially frustrating because this should be incredibly easily handled by simply defining the male/female hairstyle pools w/ maleHairStyles and femaleHairStyles but those just don't seem to do anything at all.
What does this mean?
You have to follow that folder hierarchy to create a mod
oh ok thx
Uou cant just put files there like zips or exe or whatever theres a structure
@ruby urchin Hey, came to my attention today that my custom animation is not visible to other players when I do it. Only visible locally. Have you perhaps solved how to communicate the animation to other players? Would I need to tell the server to tell all clients to set my animation variable locally?
Make it server side or it will only happen locally
i had a similar problem with the integration
the target of the event would see the zombies... every other player would not
Okay so if I just do the player:setVariable calls server side, the animation will play for everyone?
you can try something simple as to keep your lua scripts in the shared lua folder
remove the poster.png
thats the wrong place for it π
I don't understand what you mean I can make it locally but it has to be server side?
mod code can be ran locally or server side
You mean in client or server right?
thats why you have the client , server and shared folder inside the lua folder
if you only have code on the client, its client only
server server only and shared both
gotcha I just wasn't sure if you meant clientside or something else when you said locally... That's why I was confused how I could run it clientside and serverside... but you meant run it in shared?
And that will be fine?
anything you put on shared will be available on both server and sp
Right
Understood. I will attempt to make it visible in MP by moving some code to shared.
im a lazy bastard an i just stick everything into shared when making mods that can be used on a server or a sp
and
Any know if you can stipulate which version or tint of a clothing piece an outfit should use in the clothing.xml?
where do i put the media folder
do i put it in Contents\buildings\creative\mods
???
and all the preview,workshop
and media stay in the for Main folder folder
correct
preview and workshop should be in the same folder as Contents
media should be in a folder alongside mod.info in Contents/mods
I can do that for you
U need an extra step idk what
Dislaik mentioned this to me via dm
Try asking #modeling sir. They might know more abt this
I know I am a bit late, but if it is a TimedAction you need to use the following to set the Animation variables in the Action:
self:setAnimVariable("Variable", "Value")
...```
Accepts boolean and strings, this syncs the animation state for the TimedAction across MP.
Setting the variable directly on the character i.e. `character:setVariable()` does not sync over multiplayer, regardless of where the code is located at. You need to do this yourself
Ahhhhhhhh, it is not a timed action so I do not think this would have worked, but I think I solved it using a little client-server chitchat. Nevertheless thanks for the insight, and that's nice to know for next time.
I got it working. I send a command from server to clients to let them know to update the appropriate player's animation state.
Do you by chance know how i can fix my beartraps stagger duration
I used a timer just to extend it
But what happend was when the original duration is done the player stands up on the other players perspective but the actual players perspective he is still on the ground
Pls do share the code
Just be warned. Sometimes performing a TimedAction resets your character's variable states, meaning any custom state you set will be lost. especially if you are changing vanilla variables. π
Are you tweaking the animation's speed locally or something, and that is causing the desync? I'm assuming that you're calculating the duration of the stagger which is set as the animation speed?
or something like that
How do i do that exactly?
Create a new xml file? Or lua? Is it possible to do that on lua
I wanted the duration to be configureable
Via sandbox
You could 100% do this via singleplayer, for multiplayer it would take some sync work on your part. In your Action definition (XML), just set:
<m_Name>NAME</m_Name>
<m_AnimName>ANIMATION_NAME</m_AnimName>
<m_SpeedScale>SPEEDVARIABLE</m_SpeedScale>```
Then in your action or whatever, it would be:
```character:setVariable("SPEEDVARIABLE", 5)```
Or whatever you wanted the speed to be.
Client:
Yogi.reportAnimation = function(displayName, state)
local arguments = {
displayName = displayName,
state = state
}
sendClientCommand("Meditation", "Animation Toggle", arguments)
end
Yogi.acknowledgeAnimation = function(mod, command, arguments)
if mod ~= "Meditation" or command ~= "Animation Toggle" then return end
local displayName = arguments.displayName
local state = arguments.state
local buddies = getOnlinePlayers()
for index = 0, buddies:size() - 1 do
local buddy = buddies:get(index)
if buddy:getDisplayName() == displayName then
if state then
buddy:setVariable("Meditative", state)
else
buddy:clearVariable("Meditative")
end
return
end
end
end
Events.OnServerCommand.Remove(Yogi.acknowledgeAnimation)
Events.OnServerCommand.Add(Yogi.acknowledgeAnimation)
Server:
local function changeAnimationState(mod, command, player, arguments)
if mod ~= "Meditation" or command ~= "Animation Toggle" then return end
sendServerCommand(mod, command, arguments)
end
Events.OnClientCommand.Add(changeAnimationState)
I pass true for state when activating the animation and false for state when deactivating the animation; I might be able to pass nil for state and clear variable by setVariable(name, nil) but I am too tired of experimentation to make sure it works lmao so probably not bothering for now.
I should use speedvariable instead of speedscale?
Gotcha ill try this
No, sorry that was probably a bad example. You can replace "SPEEDVARIABLE" with whatever you want the name to be
This action does not have a configurable speed. so you will need to make one
Ow snap
That complicates things
Can i make like the fall and the stand up 2 diffrent thing and just the layong on the ground is the configureable speed
And im aiming for mp . Cuz my version already works sp
Like i mentioned its not synced
So I'm working on a mod for a different character model and I can't seem to rescale the model. If I scale the Bip01 skeleton root and mesh together, when the game starts the model seems to be scaled to normal size no matter how I scale it.
But if I just scale the mesh, then it really messes up the animations since the skeleton is mis-sized for the mesh.
- okay, I figured out I just needed to "apply transforms" in Blender. But doing that results in the character being stretched out. I think I need to rescale all the animations for this character?
Yes, it is possible to do it that way. You could either chain TimedActions together, or do something intricate with Events in Animations to change the animation state as needed. Let me take a look at your mod, see what you're doing now so i can answer better. ha
Same problem @smoky meadow encountered
You mean this?
#mod_development message
So, you can definitely turn these into TimedActions and get better results, instead of it being a Timer. Essentially you would replace all of your:
pl:setVariable() calls into the appropriate TimedAction:
self:setAnimVariable("BumpDone", true) -- replaces player:setVariabla()
self:setActionAnim("BearTrapped") -- replaces player:playerEmote()
...etc...
All of the other player function calls (like pl:setBumpType()) would be done in the start() function of your TimedAction too. Those should be synced by the game
The only thing is the speed, which you will need to sync yourself if doing MP. But using that example @thick karma posted is a good way to get that variable to sync, and for that each player will need to have the player:setVariable() call made.
You will also need to convert your Emotes into Actions (just rename the folder to actions ) and change the condition <m_Name>emote</m_Name> to be <m_Name>PerformingAction</m_Name> The value for that condition should be what you want to set in setActionAnim()
Hope that makes sense, tried not to make a page and a half in this channel but still give info. lol
No i ment the model if you attach it the scale becomes small
Ye i tried doing the timeactio. By using the one i did before as template but i failed so i reverted to this way for now
Ah i did that to the lootlow emote its on the anim folder
I mean the emote. The problem with the emote however is that u can still move or cancel right
I don't quite understand. This is a character model. It's not attached to anything.
If theres a way for me to create a custom anim that cant move and use any emote then that might be useful
I still dont get much of whats goin on with xml but thnx for the advice i saved it as notes ill look at it again when im back doing this
The bip thing right maybe i misunderstood you
@dark wedge I have a head-scratcher for you if you're bored and lurking lol
Go for it. ha
I am trying to apply a function when the amount of light in the player's general vicinity is below a certain threshold. The catch is that the function applies light to the player's general vicinity, such that continuing to perform this calculation using, e.g., player:getSquare():getLightLevel(player:getPlayerNum()) will continue to yield opposite results in a dark space; the light function will be triggered, then disabled, then triggered, then disabled, etc.
You can definitely make a custom animation that stops movement. The "LowLoot" action file does that for sure. The only problem is that timedactions can be cancelled, so you would need to find a way around that. could possibly keep your logic and movement restricitons in a timer, but the animation in a timedaction
So the question becomes: how do I use the player's overall visibility or the overall lighting of the player's current location (even their square) in determining whether to continue lighting that square if the lighting of the square affects the condition of whether the square continues to need to be lit?
I would think a simple solution would be if your light is on, then you would use a new threshold of the old condition + your own expected light and maybe a buffer for some stutters. when its off, use the old condition
Hmmm changing threshold based on whether light is on... I'll consider this. Might actually work better than I thought it could at first... I'll give it some thought. At first I thought everywhere I went with my light reported a 1 at my feet which was not informative, but I did find a few places that reported less and I forgot to revisit this idea...
(1 on 0 - 1 brightness scale, which I thought was inevitable due to standing on a light source, but later it proved not to be... I found some places I could stand and only get .7, .85, etc.)
I guess I could require the lighting to be consistently different for a certain number of frames in a row to prevent flickering when walking in and out of dark corners or something
Oh, that would make sense that it would be more consistently showing 1 on the square you are on. Maybe you can get the light of the square in front, or to the side of you if there is a wall in the way or something?
Yeah the math gets complicated fast there. Is there a wall, am I in a room, is the other side of the wall outside my room, etc. Oof. Been considering looking into that more deeply but was hoping for a clever creative solution that doesn't require so many calculations per event.
If you get the adjacent square by getting the player's direction, you can use the "isWallTo" to check that relatively quick. it would be a bit of extra work, but possibly more accurate to check the external light level there if you are generating light
Yeah I see what you're saying
Just get a little further from the source and it'll be a more consistent difference from its unlit state in all/most unlit states (except I guess if I'm in an extremely bright area).
I guess I could isWallTo in the forward, left, and right direction and average them pretty fast. Maybe that data would be more reliably useful, given possibility of standing in corners and stuff.
if there's no wall, check brightness, add to avg
maybe 2 squares away each
Idk getting too tired to experiment fully but can't resist urge to brainstorm lol
I like that. if you're going 2 squares away though, i'd just get the immediate radius around you.
I hear you, I already have a radial loop but I think it's misleading because of squares that get reported dark behind you
Actually
Nah I need to fix something lol
Damn it too tired to write right
I feel that. I'm having a hard time focusing on writing my own code. ha. i keep getting lost in all of the tabs i have open
If that's the case, possibly the 3 in front and then the sides?
Average light level around player, no wall checks:
Darkvision.lighting = function(player)
local x, y, z = player:getX(), player:getY(), player:getZ()
local total = 0
for xShift = -3, 3 do
for yShift = -3, 3 do
local square = getSquare(x + xShift, y + yShift, z)
local light = square:getLightLevel(player:getPlayerNum())
total = total + light
end
end
return total / 49
end
All of the light! Forever! ha
And then when I ran the code and saw the same number a lot I figured gee nothing is wrong here
Ok thnx ill try to copy the stagger animation and replace the animation
But yeah I'll add isWallTo checks that would be a nice touch... maybe only go out to -2, 2 with isWallTo checks and see how it runs
Don't wanna go too crazy here
U trying to make stuff dark? Remember when we did that gui to block the heroin animation
I finally managed to extract the fadein and out of ui like from the sleep
I havent replace the one on the heroin mod but i jave the code to do it
For sure. You can also check if a square is outside, and do things accordingly.
Nah darkvision is for making darkness light
This seems to be yielding a number I could possibly work with:
Darkvision.lighting = function(player)
local x, y, z = player:getX(), player:getY(), player:getZ()
local origin = player:getSquare()
local total = 0
for xShift = -2, 2 do
for yShift = -2, 2 do
local square = getSquare(x + xShift, y + yShift, z)
if not origin:isWallTo(square) then
local light = square:getLightLevel(player:getPlayerNum())
total = total + light
end
end
end
return total / 49
end
Within the xml? I can do it on lua tho
But iwould still like the traps to function indoors so that wouldnt be necessary
oh yay
I can make the edit
the mod author says it's fine in his faq for the mod
Cool but would still be cool to credit him tho
yes don't worry
I credit people who just provide technical help as well
π«‘
I actually tell people not to use other people's mods in my mod descriptions
π
lol jk obviously
i usually tell ppl to use my mods at their own risk π
local playerOne = getPlayerByUserName("One")
local playerTwo = getPlayerByUserName("Two")
playerOne:say("Hello player two")
playerTwo:say("Hello player one")
I'm missing something real obvious here... I'm trying to write a MP mod for the first time and trying to access the 2nd player is a nightmare. So I tried using getplayerbyusername to ease the process since I know the username in this case
This is inside a basic function
The problem I had yesterday after discard square is, after exit / enter chunk the square become an invisible blackness. It blocks from entering it and with no clip it disappears him.
are you doing this serverside or clientside? Im not sure but my first thought is that the function may only work from serverside
Hmmm. I think need send command to another player client and call Say
After teleporting the square gets some random objects
Aiteron how to reset erosion data of square
What functional you want to do
Damn. So I put it in the /shared or /server folder in that case?
by function i meant the getPlayerByUsername function
im not sure, haven't used those functions personally it a while
Need write some code on client side, some on server side. So in client and server folder
the say function definitely work client side, idk about from serverside
@tame mulch
I'll be completely honest I read what the difference between those 3 folders is but I figure it's easiest to just put all in shared and forget about it (I know it's dumb but at this point idk what else π )
you would need to send a command from the server to the client
Thank you
Thank you as well β€οΈ
What you mean "data"?
You can disable erosion on square
square:disableErosion()
and remove erosion ("wall vines")
square:removeErosionObject("WallVines")
I want to update the regions when the floor is changed.
e.g commented out code in vanilla
square:getErosionData:reset()
Try
local erosionData = square:getErosionData()
erosionData:reset()
it's not exposed?
Oh, yep. This class not exposed. So you can't reset erosion data
not sure if there is a better example, but take a look at ISHealthPanel.lua and clientCommands.lua. at the very bottom of ISHealthPanel.lua, you can see how the client receives a command from a server, and from clientCommands.lua you can see how sendServerCommand is used to send the command from the server to a client
I wonder if I can safely discard a square, it calls reset there.
Deleting all objects, is acceptable loss, but I sure I could just add them back.
also it remove roomID, chunk and other stuff
--local slice = SliceY.new()
--local newSq = IsoGridSquare.getNew(cell,slice,x,y,z)
local newSq = oldSq
--local newSq = cell:getOrCreateGridSquare(x,y,z)
newSq:setX(x);
newSq:setY(y);
newSq:setZ(z);
newSq:getObjects():add(oldFloor)
--newSq:addFloor("blends_natural_01_64")
newSq:RecalcProperties()
chunk:setSquare(wx,wy,z,newSq)
cell:ConnectNewSquare(newSq,true)
--newSq:FixStackableObjects()
--createTile("blends_natural_01_64",newSq)
--DoTileObjectCreation(IsoSprite var0, IsoObjectType var1, IsoGridSquare var2, IsoCell var3, int var4, int var5, int var6, String var7)
newSq:RecalcAllWithNeighbours(true)
it seems to break when I exit the chunk, doing different combos seems to produce desired effect.
Hi sir aiteron how r u
Hi! I am very well! How about you?
Could this be used to restore disassembled container by griefers
No, it doesn't reload the chunk
I think no, because it set roomID to -1 and remove containers, so it can't restore container and spawn loot
Would that be possible to do? Like restore containers via lua
For restore I think better use some plugin outside pz, that remove some server chunks from save
but it restore 10*10 area
with walls, floor, etc
Do we have such plugins? Cant we manually delete the chunk instead
I still use your lock picking mod, a bit edited obviously but can't play without it. β₯οΈ
I use AuD alot . Edited too for debugging
@ancient grail
ask udderly I guess
https://steamcommunity.com/sharedfiles/filedetails/?id=2839582946
I actually know how to do it was just wondering if it would be possible lua side
For admin convinience
Like toss a debug function they can just run
It takes a long time to restore it with the chunk delete method
If you feel adventurous, check how vanilla deletes all map files from a save.
manipulateSavefile command.
Hmmmm... Ill pin that thought . Thnx
question:
Is this page incorrect for the player parameter? https://pzwiki.net/wiki/Modding:Lua_Events/OnFillWorldObjectContextMenu
Asking because if do this:
print(player:getX())
end
Events.OnFillWorldObjectContextMenu.Add(OnFillWorldObjectContextMenu)```
I get this:
STACK TRACE
function: OnFillWorldObjectContextMenu -- file: vendingMachineTest.lua line # 163 | MOD: Vending Machine Test
Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@8c04f4fb
function: createMenu -- file: ISWorldObjectContextMenu.lua line # 1543 | Vanilla
function: createMenu -- file: ISMenuContextWorld.lua line # 50 | Vanilla
function: createWorldMenu -- file: ISContextManager.lua line # 28 | Vanilla
function: doRClick -- file: ISObjectClickHandler.lua line # 60 | Vanilla
function: onObjectRightMouseButtonUp -- file: ISObjectClickHandler.lua line # 379 | Vanilla
LOG : General , 1673259707910> Object tried to call nil in OnFillWorldObjectContextMenu
LOG : General , 1673259707994> creating new sourcewindow: C:/Users/<meh>/Zomboid/mods/VendingMachineTest/media/lua/client/vendingMachineTest.lua
if I just print the player parameter out while playing Solo it shows as 0. So instead of the player parameter being an IsoPlayer is it just the index of the player?
Yes, it gives the player index. So you need to fetch the player object.
local playerObj = getSpecificPlayer(player)
perfect, thank you very much! π
Dont add print
It will spam it
Ow sorry om wrong
It will only print ehen u click the context. I misread
I thiught the print was outside the context
Cuz theres a mod that did this
Which reminds me
@sour island how do i use fingerprint
It still doesnt show the mod that prints
also, thanks to you folks I learned something else
I forgot to ask u this ... Damn i have so many stuff i need to do...

local function OnFillWorldObjectContextMenu(player, context, worldObjects, test)
-- Your code here
end
Events.OnFillWorldObjectContextMenu.Add(OnFillWorldObjectContextMenu)
how did I not know there's color coding for languages in discord π
it's commonly called "syntax highlighting"
I'm confused as to what the item type or name is. Like, if I'm using getItemCount("Type"), what goes in type? Its name, it's id, it's category?
generally full type is a string like "Base.Item"
if you break it down it's module.type
you find it in scripts
module myModule { item myItem {} }
@drifting ore
What does it show?
So, those of you who have lots of clothing mods, I don't know if it the "Rip clothing" lag bothers you, but it bothered the hell out of me:
https://steamcommunity.com/sharedfiles/filedetails/?id=2915430406
Nothing really..
I might be doing it wrong or somethings conflicting
https://steamcommunity.com/sharedfiles/filedetails/?edit=true&id=2857842616
i wanted to share that i just now released a huge update for my music mod, adding a whopping 90 more lore friendly or lore friendly-adjacent tracks! i continue to toil away at making the best possible true music mod i can produce, and i think it's almost to the point where i'm out of new things to do! haha
What do you expect to be happening?
Like you can determine what mods are doing the prints
Congrats
Last I checked it worked, I don't think anything was changed. What is your print that you're testing?
Or what print are you seeing in the log that you want to figure out the origin of?
Also, did some work on the debug tools - https://media.discordapp.net/attachments/852632065022099591/1061909127049265172/image.png
Made the panel from AUD pull the options off the cheats menu and convert them into buttons
Im testing on a local host now but i also installed it on a mp server
Trying to figure out what mod is causing a print spam whenever u hover on an inventory item
Didnt tell me anything
Is the print going to client or server?
Search steamapps/workshop for a literal piece of the print statement
What is the print message?
If it doesn't show a mod next to it in console then it's vanilla
How do I make my code dependent on another mod's code?
Just use names used in the other mod?
if u want to ur mod can't be turn on without other mod then just add this line to ur mod.info
require=MOD_ID
u can add a few mods by separate mod_id by comma
if u need to get exactly in-game if any mod is activate then u can use getActivatedMods()
it returns array with mod_id of all activates mods
works same for mp and sp
Anyone know whether it's terribly compatibility unfriendly to add new clothing categories as some mods do? Or is it just a matter of giving the clothing item a unique category name?
Considering feasibility of a "Hair Extensions" category so that people could add highlights and other color patterns to their hair.
hello, how do i make traits that aren't compatible with professions?
for example
a trait that gives +4 mechanics to not be compatible with the mechanic profession
first two models done. both are shown with laser-upgrade attached.
That looks awesome
Question, i've been trying to make a gun mod- specifically, the Silver Ghost handgun from RE4. I have it set up, but when i enable it to test it my game freezes on LUA, then i get 3 errors and im stuck in a hudless menu until i close the game, then it wont launch until i delete the mods folder. i dont really know what to do
i'll take a look but i'm also still new to it so not sure if i can find something. you can attach the error-log too? /users/zomboid/logs
thank youu
have you tried removing the distribution and instead spawn it in with debug-mode?
I dont get it
i havent, but if i enable it at all, once it starts loading lua i get stuck forever in loading lua, and then i get 3 errors and im stuck in a hudless screen and have to restart and delete the mods folder so it disables the mod. if i enable it in a server, the server takes forever to load and then crashes, and if i load it in the actual menu, it does that :/ w
If you could clarify your question.. people might be able to help u
Its doable and its not a terrible idea
I havent logged back in yet cuz in building a mod. But i might hop on the server and il show you the print
okay soooo i removed distribution and enabled the mod annd it froze still
then i just get stuck on this screen forever
okay one sec.
ok D: i stayed up all night trying to get these mods (few mods for my server i was making, which includes that silver ghost) so i reallllyyy hope we can get it to work, then at least 2 out of 3 of my mods would have worked lol.
try to remove the fix weapon code.
and see if it works.
you can insert it back after. there's some issue with it.
yes
Yeah, that fixing recipe is incorrect.
You're using your display name in the ingredients.
It should be your Type (e.g. item silver_ghost)
{
Require: silver_ghost,
Fixer: silver_ghost; Aiming=3,
}```
:(
i just wanted someone to make mod idea happen
Then work on it or spent on it why is this hard for you to understand man
Im not the first person who said this
removing it hasnt fixed it, once i enable it i get reloading lua for a bit adn then a freeze and the hudless screen
hhhhhhhhhh
and plus my salary is less than 30 dollars
no offense but thats true
Go anywhere in the world and ask if they are willing to work on your idea no matter what industry try it
Let us know if you succeeded
1 error each time.. hm
It's not even about that
It's about the fact that you've been asking ppl here for 1 month
Just stop
If you want your mod to happen, do it yourself
Like 90% of people here
09-01-23 10:05:51.982] LOG : Mod , 1673280351982> loading SILVER.
[09-01-23 10:05:52.000] LOG : General , 1673280352000> translator: language is EN.
[09-01-23 10:06:51.814] ERROR: General , 1673280411814> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method)..
[09-01-23 10:06:51.817] ERROR: General , 1673280411817> DebugLogStream.printException> Stack trace:.
You dont have the cash then spend the time learing, working, coding.. not posting same stuff here
Its a frowned upon thing but its not against the rules
My advice is just learn to code we will help you
Is moddata limited in any way? I have a table A in it. Table A consists of quite a few Table Bs. Each Table B holds quite a big amount of integers. Can running something like that throw this error?
[29-12-22 22:10:21.487] ERROR: General , 1672348221487> 0> ExceptionLogger.logException> Exception thrown java.nio.BufferOverflowException at HeapByteBuffer.put..```
i dont have time and i dont have cash
thrats why
:(
well then it's not going to happen
I dont think there a limit
Line 26 of your distribution lua file. You have a random 't'.
Thought so too, each table B usually would be up to 30k integers which is honestly not a lot in programming terms
Spamming here aint going to produce the mod i tell you.. find a better job or organize your time thats it.. im stopping now
oh my god
If it doesnt work use modwritter
ok
30k integers is only 120kB of data, not much
ye but
i have no idea how that got there, im testing it rn, i would not be surprised if that is why it was broken lol
if there are multiple tables of them
https://media.discordapp.net/attachments/852632065022099591/1061909127049265172/image.png
My eventual plan is to have everything - even vanilla stuff on a giant panel -- while super unwieldy -- it will be paired with another tab, and you can drag buttons to it like a hotbar of sorts.
Not sure if this is the best way to do it.

I may also look into grouping buttons a bit
With categories
And I need to look into supporting custom buttons
a searchbox would come in handy for that
well
like if your building customizeable thing
heres what i got from my error log when i try and load it into my server
[09-01-23 10:14:07.878] LOG : Mod , 1673280847878> 718,690,542> loading SILVER.
[09-01-23 10:14:08.500] LOG : Lua , 1673280848500> 718,691,164> Loading: media/lua/shared/Sandbox/Apocalypse.lua.
[09-01-23 10:15:47.474] ERROR: General , 1673280947473> 718,790,137> Exception in thread "main" .
[09-01-23 10:15:47.475] ERROR: General , 1673280947475> 718,790,138> java.lang.OutOfMemoryError: Java heap space.
[09-01-23 10:15:47.475] ERROR: General , 1673280947475> 718,790,138> at java.base/java.util.Arrays.copyOf(Unknown Source).
[09-01-23 10:15:47.475] ERROR: General , 1673280947475> 718,790,139> at java.base/java.util.ArrayList.grow(Unknown Source).
[09-01-23 10:15:47.476] ERROR: General , 1673280947476> 718,790,139> at java.base/java.util.ArrayList.grow(Unknown Source).
[09-01-23 10:15:47.476] ERROR: General , 1673280947476> 718,790,139> at java.base/java.util.ArrayList.add(Unknown Source).
[09-01-23 10:15:47.476] ERROR: General , 1673280947476> 718,790,139> at java.base/java.util.ArrayList.add(Unknown Source).
[09-01-23 10:15:47.476] ERROR: General , 1673280947476> 718,790,140> at zombie.scripting.ScriptParser.parseTokens(ScriptParser.java:303).
[09-01-23 10:15:47.477] ERROR: General , 1673280947476> 718,790,140> at zombie.scripting.ScriptManager.ParseScript(ScriptManager.java:71).
[09-01-23 10:15:47.477] ERROR: General , 1673280947477> 718,790,140> at zombie.scripting.ScriptManager.LoadFile(ScriptManager.java:147).
[09-01-23 10:15:47.477] ERROR: General , 1673280947477> 718,790,140> at zombie.scripting.ScriptManager.Load(ScriptManager.java:758).
[09-01-23 10:15:47.477] ERROR: General , 1673280947477> 718,790,141> at zombie.network.GameServer.doMinimumInit(GameServer.java:1393).
[09-01-23 10:15:47.478] ERROR: General , 1673280947477> 718,790,141> at zombie.network.GameServer.main(GameServer.java:688).
i have 32gb of ram so i feel like its endlessly repeating some part of the code until it overflows, leading to that? that would be my guess
One of your scripts is busted
heres mine i often change the functions based on what mod im working on
loading the mod single player:
[09-01-23 10:17:24.931] LOG : Mod , 1673281044931> loading SILVER.
[09-01-23 10:17:24.949] LOG : General , 1673281044949> translator: language is EN.
[09-01-23 10
23.023] ERROR: General , 1673281103023> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method)..
[09-01-23 10
23.026] ERROR: General , 1673281103026> DebugLogStream.printException> Stack trace:.
Hm..
Even if it's a bit overwhelming - the intended use would be to put your go-to buttons on the quick bar or whatnot
Would be nice if I could put the "Select Zombie" and "Make Selected Zombie do X" Right-Click options in an easier to access spot when setting up photo-ops.
Do more trees actually spawn in game, or just once? Erosion seems to be a one time thing.
well you know what
two things:
the code i based that gun on was outdated
and all my sounds were .wavs
oops
how to check if game is singleplayer or multiplayer? I want to run function only if its singleplayer
getGameMode()?
most common is probably
if not isServer() and not isClient() then ... end
why not isclient?
SP is not client
Can anyone help me with my gun mod that refuses to work no matter what i do?????
dont ask to ask. Nobody wants to commit to helping you if they have no idea what your issue is. Post your problem and then anyone can evaluate for themselves if they can help
@dull moss
need a short description to find relevant info faster
No problem 

alternatively you can copy links to msg somewhere else but that requires extra actions so fuck that
If there are, I doubt they will be any more receptive to "can anyone help me?" without any details

mb but there're definitely less peoples
Okay, the details are this: I am making a handgun mod. I have it set up, however when I launch a server with it, it stalls and then crashes with the "NormalTermination" error. When I launch it in single player, it hangs on reloading lua, then kicks me to a hudless menu, where i then have to restart my game and delete the mods folder so i can actually get in again. I have several error logs that I will provide you with. As well as the actual .rar. People told me it was a random typo in the code, and i fixed that, and it still kept freezing. I even went and redid the entire mod, and it still is freezing and its making me very upset because i spend way too long on it and i did not sleep last night. I am at a complete and total loss.
For instance, heres one of the server debug logs.
Then here's a debug log from singleplayer. Both are with that mod, and show what happens every single time i have tried to get into the world with that mod. I feel like I am overlooking something very simple and it's getting on my nerves.
@wide oar You're missing a closing "}" on "model silver_ghost {". With that, it loads to main menu.
like that?
No. You need a closing bracket after the attachment world block
ah my bad, like this:

{
model silver_ghost
{
mesh = Weapons/Firearm/silver_ghost,
texture = Weapons/Firearm/kp94,
attachment world
{
offset = -0.0190 -0.1670 -0.0040,
rotate = 50.0000 2.0000 -4.0000,
}
}
}```

It's ok, we all started coding somewhere, I was just like him at some point π
it's tough when you don't have any experience
You'll get there
we all start somewhere, but just... look at the vanilla files. like, you must have gotten the format somewhere from an existing example - stick to it 
@wide oar Also, make sure you aren't subscribed to your own mod on the workshop. PZ will prioritize loading that version before your local version that you've modified.
ohhhhhhhhhhhhh yeah thats a good tip, that's probably part of my problem. thank you ._.
Although you really gotta understand the concept of code blacks before you start doing them
π
if you open something - make sure you close it, simple as that
on a wholly unrelated note: does anyone know if docs exist for any of the C/C++ code that the game utilizes? you can kinda infer some of the usage via the native calls, but not really
Intellij does a decent job of catching lua typos, but not scripts
aand this is also why tabulation is important, you get to see all the blocks you have
isnt game using java?
the game is, but there are custom C/C++ libraries that the devs created for things like zombie population management and a few other cases
I think Bullet is C as well
RIP
@sour island Would you be open to adding a mod option to Named Lit for hiding this on gamepad?
I'm not even sure what is rolled back
You mean the fact titles don't wrap?
No I mean the overlay that covers what you're selecting
Isn't that base game behavior?
It's a little weird knowing what you're highlighting when it's got such a black overlay over most of your selection
@dull moss No
Here's a normal book with the tooltip drawn in normal place:
Ah i see what u mean
Here's how it shows if you use custom text for the built-in tooltip (though it's less flexible afaik because the tooltip text is in an item script file):
I'm sure the Named Lit box looks good for most people on KBM because its location is probably determined an little differently, e.g. by the mouse location
But it's just a little in the way on gamepad defaults
I personally β€οΈ Named Lit but a new friend was having trouble navigating inventory with Named Lit in it and was asking which mod was blocking inventory like that
I feel like moving the overlay would take a lot of rethinking how stuff is laid out... e.g. you would probably have to set its (x, y) after you knew how tall it was... In the meantime I would legit write you the Mod Option if you'll add a little boolean flag for it to your ISToolTipInv:render()
I would prefer to just be allowed to hide it haha
I don't want to stress you out about relocating it
Hiding would be sufficient.
I can look at how it's adjusted in vanilla
Wouldn't be that hard
Might even handle the wrap too now that I have a text wrapper
Is there any way to avoid a recipe showing up in the inventory context menu?
Or altering the options provided. I have a first aid kit which can hold multiple bandages, and I simply want the kit to have a context menu option like: "Take Bandage > Adhesive Bandage / Bandage / Sterilized Rag" instead of "Take Adhesive Bandage > One / All", "Take Bandage > One / All" and finally "Take Sterilized Rag > One / All"
Hey! Quick question. I believe this has to do with the fbx or some such, but when I load in game, i can spawn my gun and ammo and all that, and it works great! the sounds are there, too. however, the gun itself is completely invisible.
If you leave only one recipe it would fix the problem?
No, the issue is that the One / All comes from deciding how many times you want to do the recipe in question.
you can check ISInventorypaneContextMenu.addDynamicalContextMenu
I bet you can hook to remove your recipes from the list or something
Could be a couple of things.
Could have the wrong module on your WeaponSprite (or you didn't specify one and the model script entry is different than the weapon).
Could have the wrong paths on your model script.
The model file it self could have issues, like lacking UV maps or something.
It's the second one though. You have the FBX in "models_x/Firearms" but your path in your model script entry is "Firearm"
yeaaaaaaa
i was looking through it and saw that and i was like "ohh"
LOL
now i just need to rotate it
any blender export settings i need to be aware of for weapon models?
I recommend pressing Ctrl + A in object mode and then Applying All Transforms (or at least Orientation and Scale) before you export. Makes positioning less headache inducing.
local player = getPlayer()
sendClientCommand(player, "Money", "requestMoney", {id = otherPlayer:getOnlineID()});
Doesn't work for some reason. I get the print that it got to this snippet of code but I think it gets stuck here because anything after this, doesn't happen.
Am I using the "sendClientCommand" right? My code doesn't pop up any errors so idk where to start :/
I didn't wanna post more code to avoid spammin ya'll
if module == "Money" then
if command == "requestMoney" then
local otherPlayer = getPlayerByOnlineID(args.id)
print("The player " .. player:getDisplayName() .. "is requesting" otherPlayer:getDisplayName() .. "$")
local hisInventory = otherPlayer:getInventory()
local hisBalance = hisInventory:getItemCount("Money")
sendServerCommand(otherPlayer, "Money", "Send", {balance = hisBalance})
print("We've received the amount he has and sent the command to send it")
end
end
This is the receiving end of that command. I feel like I'm using you guys as a Troubleshooting window in Windows and feel so bad
If it's too much ignore me
ahh okay
HWhat do you do about a gun that is backwards and wont go forwards no matter what lol
._.
guys know why this isnt working
local function adminDeleteOnDeath()
if isAdmin(getPlayer()) then
getPlayer():clearWornItems();
getPlayer():getInventory():clear();
getPlayer():resetModel();
end
end
Events.OnPlayerDeath.Add(adminDeleteOnDeath)
try OnCharacterDeath
didn't use these hooks before but sounds like player for mp and character for sp
not sure
Β―_(γ)_/Β―
Why the hell is my gun backwards and how do i make it stop being fucking backwards
i've rotated it in blender and that did actually nothing lol
mine is a gun not a person
local function adminDeleteOnDeath(player)
if isAdmin(player) then
player:clearWornItems();
player:getInventory():clear();
player:resetModel();
end
end
Events.OnCharacterDeath.Add(adminDeleteOnDeath)
@smoky meadow this one worked
ill update my mod and it will include this
2hrs from now?
oops
check if it works for mp
wrong thread
it did thnx
cool
imean on local hosted
you should apply the rotation in blender
need to test..
all in blender anyawy
apply all transforms right?
don't try this at home?????
sao
yeah
do u think it's won't work at home?
Π±ΡΠΎ
better invent Zombie virus, if you have nothing else to do
but its not i my hands
u did rotate in blender?
yeah
for i=0,TraitFactory.getTraits():size()-1 do
local trait = TraitFactory.getTraits():get(i);
if trait:getCost() >= 0 then
if not getPlayer():HasTrait(trait:getType()) then getPlayer():getTraits():add(trait:getType()) end
else
if getPlayer():HasTrait(trait:getType()) then getPlayer():getTraits():remove() end
end
end
i just noticed my function isnt adding the custom traits
with the knowledge i gained from making this mod i feel comfortable making others
thank you guys so much
Ok how the fuck are we supposed to make our mods work with superb survivors if getPlayer() grabs fucking npcs
getSpecificPlayer(0)
so if I replace all my getPlayer() with getSpecificPlayer(0) it should work? Will this apply to MP or do I have to make specific if case to catch if superb survivors is running?
it'll work in singleplayer. the 0 in that function is the player's index, so if you run that on a server you're going to get the player who's been connected for the longest (I believe) rather than "the player" in-context
getSpecificPlayer is for coop players
all my luas are in client folder, don't have any server-sided scripts
only? I assumed index 0 is still index 0 no matter what
if its anything to do with split screen players then getSpecificPlayer
if you want to grab other players other than local in multiplayer then its getOnlinePlayers
I want to grab the player
but with this mod https://steamcommunity.com/workshop/filedetails/?id=1905148104 it grabs NPCs as players
my thinking is that superb survivors probably doesn't emulate multiplayer, so none of the NPCs are ever going to be index 0
but maybe that's incorrect
it creates fake players
getPlayer is just getSpecificPlayer(0) in disquise

and without looking at code the way its created is probably replacing the main player instance
but those must be splitscreen/co-op players rather than actual multiplayer players, right? because it only runs in the singleplayer "version" of the game rather than a localhost server
therefore getPlayer giving you an npc likely the most recently created
no its because it wouldnt be able to create fake players in multiplayer
you can have splitscreen players on a server
it uses SurvivorFactory.CreateSurvivor(); from the looks of it
also wild, didn't know that splitscreen worked in MP
and cool fact all the split screen players in a single client share the same connection
never tested or actually looked to verify but weve theorized before you might be able to get 400 players in a server
servers do up to 100 client connections
and since split screen shares the same connection it might work
This is true
browser's distinction is important though, if the IDs are client specific
(not in the case of singleplayer though)
SSIsInventoryTransferAction.ISInventoryTransferAction.perform = ISInventoryTransferAction.perform
function ISInventoryTransferAction:perform()
print("SSIsInventoryTransferAction perform");
if(self.item ~= nil) then -- edits
local ssquare = getSourceSquareOfItem(self.item,self.character)
--print(tostring(ssquare))
if(ssquare ~= nil) and (self.destContainer:getType() ~= "floor") then
local OwnerGroupId = SSGM:GetGroupIdFromSquare(ssquare)
local TakerGroupId = self.character:getModData().Group
if(OwnerGroupId ~= -1) and (self.item:getModData().FreeToTake == nil) and (TakerGroupId ~= OwnerGroupId) and (self.character:getModData().ID ~= self.item:getModData().LastOwner) then
print("ga stealing detected!")
SSGM:Get(OwnerGroupId):stealingDetected(self.character)
end
end
end
SSIsInventoryTransferAction.ISInventoryTransferAction.perform(self)
end
function ISInventoryTransferAction:perform() -- confirmed working
local player = self.character;
local item = self.item;
local itemWeight = item:getWeight();
local modData = player:getModData().EvolvingTraitsWorld.TransferSystem;
--print("DTW Logger: Moving an item with weight of "..itemWeight);
modData.ItemsTransferred = modData.ItemsTransferred + 1;
modData.WeightTransferred = modData.WeightTransferred + itemWeight;
original_transfer_perform(self);
end
so these 2 things conflict somehow, top is superb survivors, bottom is mine. Throws error that there's null table at
local modData = player:getModData().EvolvingTraitsWorld.TransferSystem;
function: perform -- file: ZOverrides.lua line # 23 | MOD: Superb Survivors
ERROR: General , 1673295914432> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: TransferSystem of non-table: null at KahluaThread.tableget line:1689.
ERROR: General , 1673295914432> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: TransferSystem of non-table: null```
My guess is that my moddata is not initialized for NPCs?
this mod is only singleplayer
bruh
fuck it i'll jsut disable inventory transfer stuff if this bullshit is enabled
compatibility achieved

Thats a solution tho not bad
I mean if 98% of my mod works with it, single if statement can make 100% of 98% of the mod work
then it's technically 100% of mod working

is there a way via code to tell if a user is in the forest?
my first instinct is to check amount of trees in vicinity
there might be more elegant solution or existing function ofc
Ye its not really that big of a. Deal if u have just one aspect for a mod like if its mp or sp
Thats all cool i think
Unlike my problem
I published beartraps and a few servers use it excpt for the server who comissioned the mod cuz its causing error for them
But looking at the error logs.
Its cuz of their tile definition is overwritten by some mod
Which i cant fix
The problem is im using vanilla tiles for the mod so theres no way to fix it

forage zones
Nah your idea is spot on
... theres a zombie zone definition thing right idk if its something that could provide the solution
Ow forage zones nice
Well now u have multiple ways to explore
(to elaborate on this, I think you can probably just do square:getZone() where square is the player's current square - but there are likely other pathways to essentially the same thing)
Maybe returns true when you move more slowly cuz you in the trees?
Like u know when u in forest your speed drops to shit
when you try to go through trees and stuff
this returns true ONLY if the tile you're in
- has a tree in it
and - that tree is larger than size 2 (there's 4 sizes, 4 being the largest)
it also appears to check for hedges and returns true in that case
and also bushes
basically... i want to damage people if they are in the forest.
but what's "the forest"
that's a very vague concept
forest ZONES? within any tree? next to a tree? etc.
if it's vague, use the zones
Dmg them when they are next to atleast 4 trees maybe
that'll kill performance
okay yeah, i would just use zones
not if you check every minute
if you check every tick then maybe
to check every minute, you'd still need to either a) have a conditional on the update loop or b) hook into an event handler that fires every minute
both sound like more of a pain in the ass than it's worth when you could instead just check foraging zones
that's B
Hmm i would probably do what i suggested
Like ontick that regularly check if isInTheJungle()
Lol
Name sucks
Also another check if the event is going on like its not a forever thing .. its just there during this whatver thingnubare doing that seems like its an event
there appear to be NO zones here.
Yeah maybe foraging zones the best answer
Then dmg if theres no zone
Lol
then it's a map issue, the zones are baked into the map itself
If theres zone kill
If its both zone and no zone then ban
Lol im sorry im just too sleepy i guess
tilezed or worlded?
Maybe it needs searching on to check
try the other, whicever one you're in
that's not a thing in the editors
worldzed
O ithiught u running on debug
it shows them in the other citires.
But for some reason i was able to upload screenshot . Yet not see the img i uploaded

i checked this area in-game, looks like the entire thing is actually inside a DeepForest zone
even the buildings
so you're SOL there
yeah so that's what i mean. can't use the forages.
what's the goal?
i dm'ed you it. it's a bit much.
Hello modders! Thanks to @autumn garnet's idea I have written a modding project notebook for our Roleplay Serie "Deads & Undeads"
We are looking for modders who would be willing to take those bounties!
We add bounties regularly, don't hesitate to check the page and contact me on Discord if you want to work on one of them
The commissions are paid
bounties 

also im r-word
instead of disabling whole transfer system
I can just check if whoever performing the transfer is a player
local original_transfer_perform = ISInventoryTransferAction.perform;
function ISInventoryTransferAction:perform() -- confirmed working
if self.character == getPlayer() then```
and if not, just let original fucntion run

started writing changelog
General:
- Added partial support for Superb Survivors!, traits tied to "Items Transfer" system won't be dynamic if you run it. Problem is that Superb Survivors! uses ISInventoryTransferAction:perform() to make NPCs move items and I use moddata there that doesn't exist for NPCs. If I find a better solution, I'll implement it```
and I was like "Wait, I can just check if action is done by player"

will those end up equivalent? I know IsoPlayer inherits IsoGameCharacter but I'm not sure if they're implicitly equivalent in lua
sure, but is it working because the code isn't running? because if the code never runs then of course the code wouldn't run 
oh u mean if it actually goes into loop
YEYEY

"it works cuz it never runs"
also a solution you gotta admit



LOG : General , 1673298532032> DTW Logger: Moving an item with weight of 0.5```
all good
π
goes into if
man its so convenient to just leave loggers inside the code and just uncomment them when you need them
or you could just add a debug flag but that works too
adn then put every print into if?
that'd net too many prints
I'd rather do it 1by1 depending on what i need
it's just like
if isDebugEnabled() then <do thing> end
given that prints are usually pretty short, you could inline the whole thing like that
yea but
and i have a bunch on stuff on everyminute/10minutes
so that'd be a lot of prints
true
does somebody know if there's a mod that can attach flashlights to weapons (that actually work)?
Hello, can someone help me with a problem that I have in my zomboid project that the game does not open for me?
Hi. is there a mod like airsoft? and players/pvp will just be knocked down(prevent dying)
Reminds me I need to add on a debugPrint thing that's more convenient
I haven't tested this with Lua but does table["a"] and table.a under any circumstance not refer to the same entry?
I was thinking debugPrint(object, "var") could create a label for the print
Also thinking a parameter could lump the message into a temp list and output it into 1 message
lemme ask my friend
my friend says yes

as you can see, my friend is very smart
π€
another tree question, would a tree change sprites, grow, etc if it's not in erosion?
is it possible to completely override vanilla features with a mod (i.e. changing either wound infection, advanced recipe mood buff or moodle effects) without completely replacing them? I have no idea how I would do anything like this I'm just wondering if it's possible
override without replacing wat? wdym
Friend on gamepad has an oddly bugged state after running some mods that persists into vanilla (gamepad is now bugged even with mods off); wondering if anyone has seen it. They get caught in an infinite loop while inventory is open in which the game seems to be trying to set their focus to the inventory pane repeatedly, but failing, seemingly because it stops here:
function ISInventoryPage:onGainJoypadFocus(joypadData)
ISPanel.onGainJoypadFocus(self, joypadData)
local inv = getPlayerInventory(self.player);
local loot = getPlayerLoot(self.player);
inv:setVisible(true);
loot:setVisible(true);
getPlayerVehicleDashboard(self.player):removeFromUIManager()
self.inventoryPane.doController = true;
end
...where it tries to remove the vehicle dashboard from the UI but apparently gets null in Java when trying to obtain said vehicle dashboard. Anyone have any ideas about how this weird loop gets triggered?
PS: Why would the vehicle dashboard appear to return nil when the self.player seems to exist (since inv and loot are set visible successfully)?
Can you not replace/remove items from an inventory from the server side?
it's strange, when I process the items, the server seems acknowledge they're no longer in the inventory but the client doesn't reflect it
like overriding without having to program your entire own system and then have some way of activating your system when it would otherwise active the normal vanilla - so basically just editing something
depends on how much of the system is written with lua
lua can be hooked into/overwritten (overwritting typically is bad though)
if it's on the java side, you can hook into it with the tools provided but not overwrite it.
do you know how to make a Moodle Framework Trait AKA Virus
???
you would have to find the container function that sends those changes to the clients.
OR make your own onServerCommand function which would be triggered adn run on each client when you send the command from the server
if ran on client it only effects client, if ran on server only effects server etc
looks at the container functions here:
https://projectzomboid.com/modding/zombie/inventory/ItemContainer.html
declaration: package: zombie.inventory, class: ItemContainer
might just need to add
biowastecontainer:sendContentsToRemoteContainer()
right after your remove \
test it ofc
and this assums your processing this code on the server not the client
looks like that's depereciated, but there's sync and serverItems
do you know how to make a Moodle Framework Trait AKA Virus | Like Nuclear Winter
Anyone have experience with sandbox options and ZombiesZoneDefinition? Wondering why this doesn't work:
local femaleChanceSetting = 50
if SandboxVars.ModName.GenderRatio = 1 then
femaleChanceSetting = 0
elseif SandboxVars.ModName.GenderRatio = 2 then
femaleChanceSetting = 25
elseif SandboxVars.ModName.GenderRatio = 3 then
femaleChanceSetting = 50
elseif SandboxVars.ModName.GenderRatio = 4 then
femaleChanceSetting = 75
elseif SandboxVars.ModName.GenderRatio = 5 then
femaleChanceSetting = 100
end
ZombiesZoneDefinition.School = {
femaleChance = femaleChanceSetting,
Student = {
etc.```
The sandbox options appear properly in the sandbox settings and all that so it isn't an issue with the variable names or what have you.
Do I need to use the string defined for enum option1, option2 etc. instead of the numValue defined in sandbox-options.txt? Or is it just not possible to run code directly in ZombiesZoneDefinition?
just print the SandboxVars.ModName.GenderRatio
and check if changed vars initialised before ur mod lua
cos idk when they are
Logs are throwing a syntax error for now, gotta try to fix that first. Will report back once that side of things is handled.
If this is your actual code, you are doing assignment and not a comparison:
if SandboxVars.ModName.GenderRatio = 1 then
Should be:
if SandboxVars.ModName.GenderRatio == 1 then
and so on
...I think literally every time I have posted a question here the answer has been embarrassingly stupid. Good catch. I swear I'm not usually this incompetent.
Sometimes you just need another set of eyes. ha
Thanks for being mine this time! π΅βπ«
Has anyone by chance made a python script or similar that can take script files and generate translate files for recipes and items?
how do people make armor???
Give it high Bite and Scratch defense and you've got armor.
i swear you are like a BIG help
Do modded enum sandbox options work? No matter what I set mine to I can only ever get them to return their default value. This occurs even with the "example" sandbox mod posted on the wiki (on this Discord, by a TIS dev).
This post, in question.
Set CustomOption2 to Value #1, 2, 3, 4, or 5, it will always write CustomOption2= 1 in the console.
did u set value in sandbox settings before loading to world or trying to use mod like change sandbox settings in-game?
The former. New game, set value in sandbox, loaded game, exited to menu after spawning in, checked console.
I've confirmed that integer and double sandbox options work fine, but the enum and string options seem to only return their defaults.
try to print in exactly in debug console after spawning in
btw yea, it works for me
enum too
wat
Okay, at least it's something on my end, though no idea what I could be breaking with a mod I haven't touched...
What do you mean by this?
do u use debug mode? -debug startup setting in steam for pz
I've just been checking console.txt, as far as I can tell that's where the example mod prints to.
Nothing from the example mod shows up in the debug console on spawn (unless I edit it to do so) by default.
Oh, I get what you're saying
Okay, yes, it does actually return the right value in the debug console, just not in console.txt
If the sandbox vars are not initializing before my mod lua (not 100% that's the issue, just guessing), what's a good way to correct this? I'm trying to modify the ZombiesZoneDefinitions per sandbox options, so that lua is always going to load early, with the other shared files...
Toss your code in a function and add it to Events.OnGameStart?
The first round of Zombies that are spawned at world gen might not reflect your changes, but the rest from then on would.
Not sure on the order of events there.
The first round of Zombies that are spawned at world gen might not reflect your changes
Hmm. It's not perfect, but zombies are spawned in chunks, right? So, as long as the player doesn't start in one of the areas I'm trying to define, that wouldn't matter much -- do I have that right?
Yes, that is how it works. Only the zombies in the player's immediate area are spawned.
If it works it's an acceptable interim solution. Though, it could be limiting in the future, as one of my planned features involves a start in the defined area in question. But I suppose I can cross that bridge when I get to it.
Presumably there's a way to delete and force zombies to spawn in an area. Maybe some sort of workaround like "on load, delete all zombies in the chunk, then spawn new ones" (which by that time would draw from the updated ZoneDefinitions) would mitigate the problem.
Eyo, I would like to commission a mod, if somebody would be willing to take it up. Shouldn't be too hard to make either, its just a clothing mod
So if anybody is interested, DM me and we can talk numbers and stuff
OnInitGlobalModData is the earliest event that loads after sandbox options (afaik), and it probably runs before zombies are spawned
Oh man if that works it'd be perfect
This will have to be a tomorrow project
It's always the "quick fixes" that balloon into multi-day ordeals and require you to learn new sections of the code :P
So, I'm deleting an item from a container on the server side, and it's not updating the inventory on the client side. I tried doing a onServerCommand and it's container:requestServerItemsForContainer() and container:requestSync()
what method are you using to remove the item?
biowastecontainer:Remove(item)
I also tried DoRemoveItem
The server knows it's gone
but the client doesn't reflect it until I reload the isoobject
Is it just not updated in the Inventory Window you mean? Like, by "reload the isoobject" you mean have the loot panel regen the item list? If so, in your event put:
ISInventoryPage.renderDirty = true
That should force the player loot panel/inventory to regenerate on next render tick
Do I need to do that from the client side?
an example would be stellar
Just put that on the last part of your function on wherever u did the change
Yes, needs to be run on the client. Literally just put:
ISInventoryPage.renderDirty = true
I havent tried server sided editing world objects so i really dont know. Most of the stuff i did are client or shared
if closing the inventory and reopening it still shows the deleted item, i don't think this will help
As a matter of fact i havent written anything that used OnClientCommand
Or OnServerCommand
Ah then refresh inventory
And refresh loot
setting that flag should tell the InventoryPage to perform a refresh for all inventory pages for all players on next render tick
U mean the render dirty?
yup. on next render run it performs the refreshBackpacks for all players on their inventory and loot
Did it work for you @humble oriole
no, its defined as a global


