#mod_development
1 messages ยท Page 86 of 1
Doesn't look like it. However, what you could do is use:
self.character:setForceRun(true)
If that trigger is pressed. can set this in the update function of your TimedAction, set it to false when its not
but making a tire blow? nop
i can even change the damn car color...
blow a tire? nop
๐
You are correct, it seems that the main joypad stuff is in the Java. But, I think just checking if the trigger is pressed, and setting that setForceRun on the player to true/false should work. If i just set it now to always true in ISWalkToTimedAction:update() my character definitely always runs when doing the walk action.
Sprinting may not be a thing, as that requires the "B" button which will cancel the TimedAction. lol
Unfortunately, it does not work.
I just tried to add it explicitly to the update function, which I had not tried.
I had already tried it manually 1000 times
But just to be sure, I threw it in update, and THEN threw it OnTick (I tried both ways separately)
Nada
when I am in Joypad mode, setForceRun is ignored.
If functions for setting run / sprint worked, I wouldn't need the B button, but I could also rebind it. I can stop it from cancelling action (already know how to do that) and also I already solved how to make it show Sprint during the timed action.
But none of that matters because I can't trigger jog or sprint during MoveTo on gamepad ๐ญ
Ok thnx
@dark wedge Just tried this:
function AutomoveAction:update()
print("trying so hard")
self.player:setAllowRun(true)
self.player:setAllowSprint(true)
self.player:setPathfindRunning(true)
self.player:setForceRun(true)
self.player:setForceSprint(true)
. . . . .
end
Universe still hates me. No dice.
Hmmm. Seems that function is just unreliable too, as some objects just override it just because. How odd, it works with KB/Mouse but not with a controller (dug mine out).
toggleForceRun() and toggleForceSprint() also bunk on gamepad
Does anyone knows how the "PoisonDetectionLevel" exactly works? This is an attribute of poisonous food items and can be accessed or manipulated via getPoisonDetectionLevel() resp. setPoisonDetectionLevel(). It has smth to do with your character being able to see whether a food item is poisonous but I am curious about how exactly it works.
Indie Stone whyyyyyyyy
lol. guess i'm a step behind you as I was just about to try it.
I just want to give the people autorun
Please just let me give the people autorun!
sigh
It just feels literally right there. Code has 99% of the major problems solved and yet this one limitation is huge and super lame.
I mean not being able to move faster when trying to automove across big distances is a major downside for gamepad players using this. ๐ฆ
I am inclined to find a way to disconnect and reconnect gamepad silently and see if THAT works.
And oof if I figure it out and it doesn't
Any good tutorial/ressource for modding PZ for placable/craftable stuff?
i should be able to set room defs via tile selection using this right?
if square:getRoom() then
local roomDef = square:getRoom():getRoomDef()
self:addLine("buildingID = %d", square:getBuilding():getID())
self:addLine("roomID = %d", square:getRoomID())
self:addLine("roomDef.name = %s", roomDef:getName())
self:addLine("bExplored = %s", roomDef:isExplored())
self:addLine("alarm = %s", square:getBuilding():getDef():isAlarmed())
local switches = square:getRoom():getLightSwitches()
local switchCount = switches:size()
self:addLine("#switches = %d", switchCount)
else
local roomDef = getWorld():getMetaGrid():getRoomAt(square:getX(), square:getY(), square:getZ())
if roomDef then
self:addLine("roomDef.ID = %d", roomDef:getID())
self:addLine("roomDef.name = %s", roomDef:getName())
else
self:addLine("roomID = %d room = nil", square:getRoomID())
end
end
What exactly do you want to craft for example? Items which are in your inventory but can also be placed in the world or some other structures like walls or crates and stuff?
only stuff to place
the bottom half really
Will this return error if the table doesnt have what you are removing?
I'm planning to make some kind of garden lamp ๐
just use tilezed and use tile property viewer to see how it's setup
you will see very quickly it's pretty straightforward if you setup how vanilla is and then make your specific edits based on your preferences from there
commander has a cheat sheet for how to use the tile properties editor
in mapping pins
I mean, deeper than that, the plan is to make the lamp continuously light the place even after power shutdown with an autonomous "solar battery"
you mean tiles have their own script?
I thought tilezed was only the visual part
Oof
okay thanks
nope
I wrote a player activity heatmap
?
tilzed has a properties editor that changes the entire functionality of a tile
@dark wedge And that's the story of how Auto Move became Auto Stroll.
Sorry, another convo in the background here.
Going to be working it into EHE - rather than using map zones for targetting
please tell us more!
I wonder if I can do a map of activity ala google
Currently trying to get the data to a point that's useful
also the cellsIDs should be sorting by hottest
seems to be working
you can just pop in tracking points with your own decided value of intensity
the centerX/Y of the cells is based on averaging the incoming noise factored to the intensity
a tiny new noise will pull the center of the cell over a bit
that'll be the tricky part
right now the trackers are tied to events -- I imagine I'd need to make them fire commands for MP
sending the data to the server to keep track
if heat >= 0.1 sendAllTheZombiesThere
make it rain
if that mod does that I think it does
๐
it's just tracking where events are occuring
can be used for a horde mod tho
eventually the plan - so I'm trying to keep the design open ended
yeee that's what 7 days to die does I think with zombies, whenever someone does something in a chunk ig the heat map updates, and sends like screamers (they attract hordes by screaming) and more and more
that's super cool btw
what you did
the people here get up to such cool shit it's really inspiring
working on a horde mod currently?
Events.OnGameStart.Add(function()
if not isClient() then
function clearDistrib(module, type)
RemoveItemFromDistribution(Distributions[1], tostring(module..'.'..type) , nil, true);
RemoveItemFromDistribution(SuburbsDistributions, tostring(module..'.'..type), nil, true);
RemoveItemFromDistribution(VehicleDistributions, tostring(module..'.'..type), nil, true);
RemoveItemFromDistribution(ProceduralDistributions.list, tostring(module..'.'..type), nil, true)
end
clearDistrib('Base', 'Apple')
clearDistrib('Base', 'Orange')
clearDistrib('MOD1', 'GreatestSwordEver')
end
end)
@vast nacelle
will work?
wandering horde mode
mod
i think there is a wandering mod already dunno
there were, from what I understand they're broken
well thanks to @drifting ore , got the tire event sorted... if setting the condition to 0 and the pressure to 0 doesnt blow the tire... just remove the damn wheel ๐
modern problems require modern solutions
btw is it normal that I start making 1 mod then think of a better one and loop until I reach the pinnacle, which is what I'm doing rn lmfao
until probably tomorrow when ill think of something even better to do ๐คฃ
that's kind of where I got the idea from
that happens to me when im producing music
The helicopters in EHE right now just use player's zones to create a weighted target list
more like making remixes... and i end up with a lot of unfinished projects... tbh every 100 i start i usually finish around 8 or 9
shit is exhausting tbf but it's so damn fun every day I think to myself god damn I wish the day had more hours
well... got 2 things done today... so dinner time ๐
my dinners gonna be 2-3 cigarettes then continuing on this ๐
bon apetit btw!
Anyone know why I am getting the error "failed to update workshop item, result=9" while uploading my mod ?
oh man that happened to me a lot I think, that or 6
I think it's because some of the folders / files are not in proper order
yea it's file issue one way or another
Hmm
I mean l did check it again
The only thing new is a .lua file l put in lua/server
My mistake was I put the mod in the C:/Zomboid/Workshop folder and not in the C:/Users/User/Zomboid/Workshop one
if that helps :/
Imma check that out but l dont really understand
There's 2 zomboid folders afaik
worst case just read this 10 times
https://github.com/FWolfe/Zomboid-Modding-Guide/blob/master/structure/README.md
One is in the main location like, when you enter your C drive, just at the bottom right there
you will figure out where you went wrong
Ah gotcha
and the other one you have to go into users, yourusername, zomboid, workshop
that fucked with me for so long
Im on linux so no C: , so gotta dig
oh yea and error 9 means file not found btw on workshop
so expected folder or file name is wrong
I wonder why there's 2 of those folders and they look exactly the same inside ๐ฎ
reason for extra folder. files where host runs, client runs, server runs, depending on what you have setup
aha
uses diff files for host and client
workshop is client, common/pz/workshop is host i believe
I am finding just one folder though
thats not your issue then
like i said that erro means you r are missing a folder it expects
or file
so either missing file or bad name
zombvoid workshop
thats where you are uploading right
yes
it's the mod itself with issue not your game fodlers
its zomboid/workshop/mymod/content/mod itself
like in example mod
unless that wrong ?
workshop/mod/contents/mods/modname/media/whatever else
make sure contents
and mods
not content
and mod
also in same folder as content you need workshop.txt and preview.png
clothing/clothing.xml and lua/server/mymod.lua and lua/shared/NPCs/zombiezonedefintions.lua
thats not the issue
Zomboid\Workshop\MODNAME\Contents\mods\SUBMODNAME\media
yes this
follow that exactly
your mod files and folderss are not the issue
oh so modname and submodname should be different ?
no
whats in between matters
workshop.txt
id=
title=MODNAME
description=
tags=Build 41
visibility=public```
leave the ID blank if you're creating a new mod
very nice lol so much more clear
one workshop can contain more than one mod
can see the whole folder thing up top
show first removeitems folder
screenshot it
yea looks good lol
you double check and make sure all your folders inside of media are named correctly?
done and done
though there was an id number in workshop.txt
take that out for sure
if you use a currently used one that could give error
because no permission to upload
should I add something to id in modinfo ?
riko showed
empty
to be more clear it is
Zomboid\Workshop\WORKSHOPNAME\Contents\mods\MODNAME\media
oh in modinfo you name id whatever
so indeed different names ?
can be the same
ah okay
it doesn't matter
removed the id number, going to try again
Steam with assign new ID
failed again
error=2 this time
id=modname in mod info. id= nothing in workshop.txt
if new mod
you have some identifier in the mod info file tho
id=MODIDNAME
description=Enjoy my mod
poster=preview.png
icon=icon.png```
name=removeitems
id=removeitems
description=toremoveitems
poster=poster.png
no icon tho
yes, just in case ๐
lolol alright fair enough
it will def work with em haha
well I did it as you said and it hit me with the error=2
error 2 is the most generic error and means you just did anything wrong lol
here's the thing
i just uploaded this mod brand new last night
I use to encounter this error too
you may try creating a new folder with different name
and it should work
I don't know why lol
actually thats a better idea
gonna try it
couldnt take a screenshot
even did the workshop.txt again
ill screenshot my mod i uploaded last night lol
if it's not those then you are misspelling a folder name
all you need for mod.info is
name=
id=
description=
fill all out no space in id. you had. in workshop.txt you can use same 3 also. keep id blank. now for folder structure
in media
lua
nothing else i can think of that would give you error besides any of those being named incorrectly lol
if non eof this helps then use that guide i posted earlier and rebuild the entire hierarchy from scratch
let me share my screen with you
np
hello
test successful. maybe
hm, I thought I could make start threads here ๐ญ
what's best way to get all local players? SP and Client
for i=0,3 do
local player = getSpecificPlayer(i)
if not player then break end
end
is it this?
you can use IsoPlayer.getPlayers() this returns a ArrayList<IsoPlayer>
thanks, I'll save this for later
Does anyone knows what poison level a food item must have so that it kills the player char?
Its still not working @cosmic condor
probably 100 @small topaz since it's max
I did double check it again, even remove a whole file that was not necessary anymore
nope, result=2
but there is this though
its on workshop, with no name ๐
it's corrupt dont mind that
just delete
Can you post your workshop.txt?
version=1
id=
title=removeitemsv2
description=removesitems
had to delete id several times after uploading as it assigned one but was corrupt
Try this?
title=removeitemsv2
description=TEST
tags=Build 41
visibility=public```
I typically have something like this in place before I tell PZ to upload
let me try it
nope, failed to update item result =2
How large is your preview.png file?
That should be fine.
Do you have files with the same name but different capitalizations?
nope, I checked through it several times and once with @drifting ore as well
Ye why not just set it to max
Or kill the player oncreate
Ok, I'm shutting down now but I began working on my first mod tonight.
Expect to see in the upcoming days, if I succeed at doing what I was planning, a solar garden lamps mod to keep your yard lit at night without the need of a generator in the sector :)
Tiles are done, in a cheap recycling way, might improve them later, but at least I've got some base to work on.
Next will be the properties, craft and other technical stuff :)
I can't wait to see were it will go :D
Bleach has 120 poisonpower. So I'm going to guess 100 poison power is the minimum but you need a bit more to account for natural recovery.
It is not that I want to kill the player. It is just that I can get an idea what poison level causes what type of illness.
what is different between <Model>x:skinned\clothes... and <Model>skinned\clothes.. ?
Use debug
Use doparam
@small topaz
Try #modeling

to reload xml, txt and java files i need to restart game or reload lua button will also reload that too?
reload lua works if you aren't using the files in question (from main menu)
No
It dont think so
no...
I tried it before didnt work
no for restart
for button
for both ?
Ye u should just restart
dam
Ik ow its a drag
that annoying
txt files reload
every error or test exit ... run game wait 2min to run start any mode wait next 5 min to start gameplay ... test mod in 2min and repeat
i haven't messed with the xml much but i think that reloads too
i'd be shocked if java did though
me right now

when you get that midnight burnout and you start looking at every little function much like you did in college when doing an exam and using the calculator for 1+1
i give up man, attempt to index table null value something.. I searched this channel in and out
all I could find is probably either folder order borked or file order borked... or maybe function order borked
but all of it seems fine
the files that have my table are in the server folder, the command that asks for them is in the client, the server command that gives them is in the server folder
idk
attempted index: functionName of non-table: null
local theFunctions = require 'itemListAndFunction'
returnValue = theFunctions.functionName(theKey)
me trying to use LoadChunkForLater and LoadChunk earlier ๐
ignore the naming scheme, just changed it for easier understanding
might've been counterproductive on second thought
anyone knows 1 line of code to transfer a specifc item to player inventory or floor
Yo @undone elbow since I caught you here last time about your mod, maybe you'll be able to fix another one of yours? ๐
Windows Everywhere make sandbox options crammed, just like the other mod was, any chance you could take a look at that, it's very convenient mod
--ISCraftAction:addOrDropItem
local function addOrDrop(character, item)
local inv = character:getInventory()
if inv:getCapacityWeight() + item:getWeight() < inv:getEffectiveCapacity(character) then
inv:AddItem(item)
else
character:getCurrentSquare():AddWorldInventoryItem(item,
character:getX() %1,
character:getY() %1,
character:getZ() %1)
end
end
i line is at top
not sure if it can be used for him
I mean, I can fit this into 1 line as well

either you don't return a table, or your require fails
r u sure u even do return module table at the end of file?
I mean
items = {}
items["Item"] = 1
I might be too tired but isn't this the right way to make a table
yeah I'm returning the table
and using require in the other file as well
oh boy...
i'm gonna work with the assumption that the require failed
since the table seems fine
check itemListAndFunction file in debug menu files list
if there's no file then it's problem with it
does anyone know how to get if the game is running in debug mode?
my brain is being fucked with because every time I search online how to correctly import functions or tables from another file I get 5 different answers
for each stack thread lol
So I've tried about 8-10 methods so far
isDebugEnabled()
ha wow, thank you
In the vanilla lua file server/Farming/farming_vegetableconf.lua, there are some comments stating how long the growth time for a given vegetable is. For example
-- Carrots
-- Need 12 seeds
-- Need 80 water at phase 1, minimum 70 at 2, then between 35 and 65
-- Grow in 17 days (68h per phase)
Does anyone knows whether those descriptions are still up to date? Or possible that the devs changes smth without changing the comments? Point is that the wiki tells smth different for carrots: It says ca. 12 days til harvesting and 50-55h per growth phase.
--module.lua
local module = {}
module.a = function()
print("a")
end
return module
--file.lua
local module = require("module.lua")
module.a()
can confirm this works, I use same stuff
hopefully it works because ive been sitting here not having a smoke for 2 hours already so my braing is going fuzzy, thank you for the effort B, don't have those letters on my keyboard so cant type full
Call him Vishnya
isn't that cherry

how come it's module.lua they always say online not tu use .lua
other than that no error so far but nothing is working either so gonna have to refollow the steps
when requiring i mean
local active_mods = getActivatedMods()
for i = 0, active_mods:size() - 1 do
local mod_id = active_mods:get(i)
end
How and where should I put this ?
because I enabled my mod in the menu and it crashes the game
oh stop, mb I don't get ur question correctly
read it so fast
yea, it's absolutely different XD
I thought u need to get if some mod enabled
yea mods from /Workshop folder have to be enabled as usual mods in mods list menu
welp, why is it crashing my game then lol
if u got crash then seems u have smth fatal error in ur mod
idk how to get it cos if there's typo error in file then it's just won't load
How do I set-up a function that will keep a character at 45% Stress as long as a condition isn't met.
I can use Events.EveryTenMinutes, but it is not enough to keep the character at a stable 45% Stress, since stress naturally decreases.
What can I do?
--example
x = 3
if x == 3 then
--function to keep character at setStress(0.45);
end
Please help ๐
what's the behavior of require in this version of lua? I'm used to being able to return a value at the end of a file, and this is passed to whatever other files require it, but that doesn't seem to work for me. does require just run the script if it hasn't run already?
Object tried to call nil
hop in boys, new error in town ๐
I'm not sure but event OnPlayerUpdate sounds like have to call when stress chaning
Is there a simple way to find out how many items are in a stack? Or should I iterate and count them
what a line?
local returnValue = module.a(args[1])
the argument it takes in is the item name
the argument gets sent here
r u requiring the module?
you can also use more frequent events like EveryOneMinute or even OnTick (see here for more info: https://pzwiki.net/wiki/Modding:Lua_Events). In that case, it might be the best idea to add your function to the event only when needed and remove when not needed anymore since those frequent events might lead to performance issues.
and did u have a function there?
module.a = function(itemName)
local returnThis = itemPrices[itemName]
return(returnThis)
end
#table works only for numerically and sequentially indexed tables
local module = require("itemlist")
boy, every day I try modding and every day I get stuck on the most dumbass inane shit
next time I'm gonna put one folder in the mod called clieservershared and jam every single file in there
Could I do this?
functionX
...setStress(0.45):
end
if x = 3 then
Events.EveryOneMinute.Add(functionX);
end
Would that work?
try to print everything
Not sure if this will work (not sure what "x" is and when it is 3) but smth like that will work. You need to make sure that your code starting with "if x == 3 then..." is executed at an appropriate place while game is running. Moreover, this code will execute functionX on every tick during the whole game which might not be the best idea since it may cause performance problems.
print this function at the end of file but before return
@livid geode do you need to keep the stress level during the whole game or only during certain situations?
and print each function after u did require
like for k,v in pairs(module) do print(k) end
Only during drug overdose regulated by some float..
So yeah.. only during some situation
sry for wasting ur time, i dont think im cut out for this, gonna sleep on it and see if im gonna keep up with this
been at this one problem since 10-11PM and its now 1:30AM
np, I hope u will find the problem 
Ok. Then I would rather use smth like this (note this is only pseudo-code!!!):
function functionX()
-- code for keeping stress level over 45
if Drug_Overdose_Is_Over then
Events.OnTick.Remove(functionX)
end
end
if Durg_Overdose then
Events.OnTick.Add(functionX)
end
Just before I go I need to know one thing tho. Why if I put in the server lua file where onclientcommand is, a function, it stops working?
as usual... everytime i clean up my code... something goes wrong... anyway wanna play the game what's the stupid thing that m3ss did?
local mycar = playerChar:getVehicle()
local TireSet = { "TireRearRight", "TireRearLeft"," TireFrontRight", "TireFrontLeft"}
if mycar ~= nil then
for i = mycar:getPartCount()-1,0,-1 do
local part = mycar:getPartByIndex(i)
local cat = part:getCategory()
local item = part:getId()
if item ~= nil then
if Mypart == "Engine" and item == Mypart then
part:setCondition(ZombRand(1,11))
break
end
if Mypart == "FlatTire" then
WhichTire = ZombRand(1,5)
VehicleUtils.RemoveTire(TireSet[WhichTire], true)
break
end
if Mypart == "GasTank" and item == Mypart then
part:setContainerContentAmount(0)
--part:setCondition(0)
end
if Mypart == "Muffler" and item == Mypart then
part:setCondition(0)
end
if Mypart == "Battery" and item == Mypart then
part:setCondition(0)
end
end
end
end
end```
Thank you.. will try it now
missing a few breaks i know...
Like, I have the onclientcommand thing in there and if you even put a small ass function in that file it stops working completely
or to many breaks i dont know anymore... i added the breaks for some reason but i forgot already ๐
This has legit replaced my cig addiction more or less and idk if thats good or bad
In a few years I'll see the outside world matrix style
Someone said I think if even one part of the lua file doesn't work it wont load the entire files functions no matter what I wonder if thats it
Maybe the table doesnt even get created because of one shit
yeah the code stops bein' read when it hits an error
I'll put the entire lua table into another file and test that might help
function TWECars(Mypart)
local mycar = playerChar:getVehicle()
local TireSet = { "TireRearRight", "TireRearLeft"," TireFrontRight", "TireFrontLeft"}
if mycar ~= nil then
for i = mycar:getPartCount()-1,0,-1 do
local part = mycar:getPartByIndex(i)
local cat = part:getCategory()
local item = part:getId()
if item ~= nil then
if Mypart == "Engine" and item == Mypart then
part:setCondition(0)
end
if Mypart == "FlatTire" then
WhichTire = ZombRand(1,5)
VehicleUtils.RemoveTire(TireSet[WhichTire], true)
end
if Mypart == "GasTank" and item == Mypart then
part:setContainerContentAmount(0)
end
if Mypart == "Muffler" and item == Mypart then
part:setCondition(0)
end
if Mypart == "Battery" and item == Mypart then
part:setCondition(0)
end
end
end
end
end```
just open the debug menu and try to reload ur file
Will that show the error
mb
Aight
#TireSet = 4
WhichTire = ZombRand(1,5) > 5
VehicleUtils.RemoveTire(TireSet[WhichTire] > value is nil, true)
btw u have no any args about ur vehicle
from where script have to remove tire
?
there's just a tire class and true
have to be like
VehicleUtils.RemoveTire(vehicle, tire, ...)
but u have just
VehicleUtils.RemoveTire(tire, ...)
i know where the mistake is
Error in objects.lua line 1 where it says objects { and nothing else
but you are wrong in one thing, but you spotted the error
objects?
what
zombrand always returns a number less than the second argument
it will never return 5 in this case
wtf
why..
objects.lua is ur file?
No
it just means the error handler doesn't even know what the error is
Lmfao
function TWECars(Mypart)
local mycar = playerChar:getVehicle()
local TireSet = { "TireRearRight", "TireRearLeft"," TireFrontRight", "TireFrontLeft"}
local WhichTire = ZombRand(1,5)
if mycar ~= nil then
for i = mycar:getPartCount()-1,0,-1 do
local part = mycar:getPartByIndex(i)
local cat = part:getCategory()
local item = part:getId()
if item ~= nil then
if Mypart == "Engine" and item == Mypart then
part:setCondition(0)
end
if Mypart == "FlatTire" then
if item == "TireRearRight" and TireSet[WhichTire] == item then
VehicleUtils.RemoveTire(part, true)
end
end
end
if Mypart == "GasTank" and item == Mypart then
part:setContainerContentAmount(0)
end
if Mypart == "Muffler" and item == Mypart then
part:setCondition(0)
end
if Mypart == "Battery" and item == Mypart then
part:setCondition(0)
end
end
end
end
end```
My entire code of the lua table has 1200 lines
like i said, you were right about where the error was, but not what was causing the error, but thanks
bruh
yep, good for u
finally 
Is it line 14?
it appears so
yea
O_O
RIGHT????
it's not a comment
๐
What
--[[ is a comment
comment --[[
[[ is a part of code
or --
[[ means string
WHY IS IT the same color then

anything you want the code to ignore --
Whats the point in living
the interpreter i mean
Bro... 3 hours on this

-- I wonder
--[[ If
Discord
Can tell
]]
the = [[difference]]
i've done a lot of typos worse than that one
Is it a diff color or the same????
Bro what
comented out is green
And which one is this
string is orange
LMFAO alright code
Couldve put it fucking blue or something
No love for colorblindness
in my case... string is lightGrey
You know when ure so mad at urself ure not mad ure just disappointed
yup
been there done that... several times today
tbh several times in the last 4h ๐
I must have checked this code 500 times in the last 3 hours and instead I did what I did as a child when I told people I liked coloring my code using /*
like you lost time because of that... i lost time because i was using the part name ( item ) and no the part
:/
but he spotted that i was doing something wrong with the VehicleUtils.RemoveTire
so,... he saw my mistake in 30s
i didnt in like 4 hours, welcome to the club ๐
Yeah, what a club ๐๐คฃ
he-he
im even scared of cleaning the traits code... ill prolly mess it up somewhere... so im just gonna chill for a bit
and trade raging at myself and my code for raging at rng in hs or something
Yeah burnt myself once cleaning the code next time gonna be extra careful
Also gonna double check colors fr now on
Or at least see if VSC has a colorblind option
you can personalize the colors so that you can see the difference
Thnks also, sry for all this
youre using visual studio code right?
Ye
i think the themes are compatible between vsc and vs
but im not sure
you can also download vs community edition, its free
but tbh i also use vsc for java, lua, python, etc
np 
how to make sure no underwear spawns on zombies ?
bad joke: give them the nudist trait ๐
a mod I am using has this -- used to spawn underwear automatically on zeds
UnderwearDefinition = UnderwearDefinition or {};
-- base chance of having a special underwear spawning, don't want this too high as it adds new items on dead zeds everytime!
UnderwearDefinition.baseChance = 0;
-- outfit name
but its not working
even if no special underwear appears on zombies
even naked, the model has underwear
well the mod that has this code is a mod called shadow zombies
so they are just pitch black
but the underwear messes it up
well this isnt the place to ask for mod support ๐

you should contact the modder
no but I am asking how to make sure it works myself
or try #mod_development
basically add it to my own mod
but if someone have same problem with that problem then is correct place right ?
yeah, the mods own underweardefinitions isnt working properly, so I am asking what I should do to make my own
i can't help you with that... its a vague question
but if anyone else can, go for it
UnderwearDefinition.baseChance = 0;
I mean this should do it in theory
buuut it doesnt
without more code to see, its still a vague question at least for me
check the code where it uses, mb it's broken by a part and create new mod for urself
function PrintOverdoseValue()
getPlayer():Say("Hello" .. OverdoseValue()); --OverdoseValue() is the same as overdosevalue
if overdosevalue > 0 then
Events.EveryTenMinutes.Add(PrintOverdoseValue); --if I run this at the end of the file without condition it works.. but within a condition.. nope
end--if
end--function
This did not work.. it just doesn't run the function at all..
Even if someone else but the pinged person knows a solution let me know. I'm trying to activate everytenminutes.add(function) only if a condition is met to avoid lag caused by constant running of 5 functions every 10min 
I posted it thats literally the all of it regarding the underwear definitions
-- used to spawn underwear automatically on zeds
UnderwearDefinition = UnderwearDefinition or {};
-- base chance of having a special underwear spawning, don't want this too high as it adds new items on dead zeds everytime!
UnderwearDefinition.baseChance = 0;
-- outfit name
the rest are shadow zombiex textures and blood and a zone definition which also did not work but thats fixed on my mod
mb he cached UnderwearDefinition in another file with different name
try to find just baseChance
@drifting ore you are asking for us to guess what UnderwearDefinition is
the only thing related is this but it also did not work
ZombiesZoneDefinition = ZombiesZoneDefinition or {};
-- total chance can be over 100% we don't care as we'll roll on the totalChance and not a 100 (unlike the specific outfits on top of this)
ZombiesZoneDefinition.Default = {};
table.insert(ZombiesZoneDefinition.Default,{name = "Naked", chance=100, maleHairStyles="Bald:100", femaleHairStyles="Bald:100"});
Has the variable overdosevalue the correct value in your code. It is not defined in the code you posted....
small question how to add icon for ItemList menu ?
@drifting ore i still think you should contact the dev of that mod
icons for players works in EQ but in menu are missed
can someone tell me more about how localization works? where do i put text files with localized text? how do I reference localized text from code?
mate look in game files
yeah gonna try it
i am
lua/shared/Translate
X:\STEAM\steamapps\common\ProjectZomboid\media\lua\shared\Translate
example: of a language file
UI_optionscreen_binding_STATSPZ = "Twitch Game Stats",
UI_TwitchInGameWindow_status = "Ingame Stats Window",
UI_Zkills = "Zombie Kills",
UI_AliveFor ="Time Alive",
UI_optionscreen_binding_STATSPZToggle = "Game Window Key",
UI_TwitchStatsTitle = "Game Stats"
}```
chose you lang and look how it should look
basicly you create a dir for the language you want to make the translation
to get translated text in ur code use getText function
so if i put text files there, the game automatically picks them up?
yep
no
you need to put in mod folder not there
Moreover, this can probably not work since the function which you would like to execute on the event is the same function that adds the function to the event!! The result is that the function is probably never executed in this way (except you also call it elsewhere in your code)!
why no
oh yea i gathered that
its not the game who picks it up
are you making mods or re-edit game ?
if he is translating a mod the mod only picks up if gettext if being used
so in the shared/Translate directory of my mod folder
getText returns translated text from Translate folder depends on ur language from game settings
local overdosevalue = 0;
function ConsumeCocaine()
overdosevalue = overdosevalue + 10
end--function
--so the character consumes cocaine.. and as tested before while making the mod, value does indeed change by 10
--then I do the following function which would usually make a character say hello00 or hello10 if the overdosevalue becomes 10, it works only if I put EveryTenMinutes event at the end of the file and not when I put it under the condition as in the following function
function PrintOverdoseValue()
getPlayer():Say("Hello" .. OverdoseValue()); --OverdoseValue() is the same as overdosevalue
if overdosevalue > 0 then
Events.EveryTenMinutes.Add(PrintOverdoseValue); --if I run this at the end of the file without condition it works.. but within a condition.. nope
end--if
end--function
no i'm not translating a mod, i just want to be translator friendly for a mod i'm making and i don't want to hardcode english everywhere
i like function ConsumeCocaine

already for 6 years
Ok. But see my second answer to your post: #mod_development message
So I should just change function that calls the condition? from the example you gave me I thought it was supposed to be the same
I got it
Nono, must be a different function. One idea might be to add the function to the event in your ConsumeCocaine() for example (assuming that the ConsumeCocaine() is called elsewhere in game...)
so if my translation file looks like
shared/Translate/Mod_EN.txt
Etc = {
ThisText = "Hello"
}
i can just use getText("ThisText"), am I understanding correctly?
yup
did you make any cloth item ?
got it, thanks everyone
function OverdoseCheck()
if overdosevalue > 0 then
Events.EveryTenMinutes.Add(PrintOverdoseValue);
else
Events.EveryTenMinutes.Remove(PrintOverdoseValue);
end--if
end--function
Would this work?
used by the game
ConsumeCocaine is called OnCreate with a recipe
needless to say this is much better thanks @pulsar heath
then it might work (but no guarantee here ofc...)
did u make any ui lib?
no worries, as long as it made life easier for you
and remember about definition for translation due different functions/items/scripts has different file name ... UI_ ,Items_ ,Farming_ ,Tooltip_ etc etc
Does anyone happen to know how to store some "global modData" which is not attached to a player or an item? Was it just
local data = ModData:getModData()
data.myNewData = "something"
and the to retrieve
local retrievedData = ModData:getModData().myNewData
??
function OverdoseCheck()
if overdosevalue > 0 then
Events.EveryTenMinutes.Add(PrintOverdoseValue);
else
Events.EveryTenMinutes.Remove(PrintOverdoseValue);
end--if
end--function
In this scenario.. must an OverdoseCheck be called within some other action in order to work or will it run automatically?
Would just simply placing it at the end of the code work or do I have to run it in some other function too? for example
function functionExample()
OverdoseCheck();
end--function
o.o nah im making models not UI
I'm making mods not models
ยฏ_(ใ)_/ยฏ
ModData.getOrCreate("Name")
local heatMap = {}
heatMap.events = {}
heatMap.cells = {}
heatMap.cellsIDs = {}
function heatMap.initModData(isNewGame)
local cellData = ModData.getOrCreate("heatMap_cellData")
if not cellData.cellsIDs then cellData.cellsIDs = {} end
if not cellData.cells then cellData.cells = {} end
heatMap.cellsIDs = cellData.cellsIDs
heatMap.cells = cellData.cells
heatMap.events = ModData.getOrCreate("heatMap_events")
end
Events.OnInitGlobalModData.Add(heatMap.initModData)
This is loading the modData into a module
Best is to call it within some other function where you can be certain that it is called at a correct time and place.
a bit more complicated is that I'm loading parts of the modData into different tables
You also want this running in /server/ if you want it to be consistent
If you want client side copies you can also do that
that heatmap thing youre working on, has so many uses
im already thinking of ways to use it in twitch integration ๐
that would allow to make some cool stuff happen
the heatmap alone would only be tracking what cells certain events occur - what did you have in mind?
triggering a wandering horde if a player enters a high heat zone
that will follow him and increase the heat map from where it goes through
kinda like a snowball
draggin more zombies into the horde, and generating even more heat and so on
is there a way to set a roomID for a room? or roomdef? either or. i can only seem to find how to get
might it be a bit easier if I just you smth like this
local time = GameTime:getInstance()
local data = time:getModData()
data.myData = "bla bla..."
?? Just storing in the game time on server side so that it is (hopefully) the same for all players?
or using it to generate sepcial zombies according to the heat level
if its a high heat zone, tougher zombies, random sprinters, etc
That was what people did prior to globalModData yes
I did the same actually for EHE
or even with EHE, if its a high heat zone, its would trigger only military air events
Finally made it work. You are the legend.. love ya and thanks again โค๏ธ
but i digress
I do not really get what this "getOrCreate("bla")" does. So maybe easier for me to use game time since I have more ideas what's going on. ๐
'getOrCreate' is a special function for globalModData
adds a subtable with that name as a key
it's = {}
local cellData = ModData.getOrCreate("heatMap_cellData")
``````lua
local cellData = ModData["heatMap_cellData"] = ModData["heatMap_cellData"] or {}
basically
where ModData also = {}
I don't think you can just use modData as a table though - hence why you have functions to add/remove/change
when you use ModData.get/getOrCreate, are you getting a copy of that data or is it the same table every time
it's the same table by reference
local heatMap = {}
heatMap.events = {}
heatMap.cells = {}
heatMap.cellsIDs = {}
function heatMap.initModData(isNewGame)
local cellData = ModData.getOrCreate("heatMap_cellData")
if not cellData.cellsIDs then cellData.cellsIDs = {} end
if not cellData.cells then cellData.cells = {} end
heatMap.cellsIDs = cellData.cellsIDs
heatMap.cells = cellData.cells
heatMap.events = ModData.getOrCreate("heatMap_events")
end
Events.OnInitGlobalModData.Add(heatMap.initModData)
This effectively creates a table you can save/load from automatically
oh okay
any changes to
heatMap.cells = {}
heatMap.cellsIDs = {}```Should also impact the modData table
kk
that kinda reminds of a public property name as dictionary
then is it not necessary to use ModData.add to save some data if it exists already or if the table was modified? i figured it was necessary and that's what i was doing 
Force closing local host is shitty compare to escaping on a remote server
Its cuz you terminate both client and server at the same time
Messed up my tiles and its harder to debug
Just sharing my frustration to you guys so that you dont do the same
/Save first if you think u need what you are testing to be preserved
you gonna have it force close client side then client command to server from there?
or you just trying something diff completely
question to anyone . is anyone familiar with any way to change the IsoFlagType.exterior to false on tiles?
i can only seem to get
i'm working on finding a way to set a roomdef or just start by changing exterior flag for now
If I store some modData in the GameTime instance and do this in the server folder, can I safely access those data in the client folder??
I also figured i can do this i saw some mod do it
uhh
Not sure if the gameTime object is sync'd between client and server
Chances are you don't need the client to know the information anyway
you can have commands coming from the server to tell the client what it needs to know
and updates from the client to change the server's
globalModdata has this a bit integrated in the form of recieveModdata events
you'd have to write your own if you're using gametime
In my current setup, the client definitely needs to know the modData. The modData stores some numerical value (which happens in server) and this value should in some cases be displayed the player's interface...
Or can I just store those GameTime modData in shared or client and it will still be the same for every player?
how to easy way add something to existing items in game but without overriding it (txt files)
No, shared doesn't work like that I believe
You'd have to call the information using a client/server command
are you willing to tell me how to do that? (in case you have the time...)
I don't personally do it - I use the modData method
If the information one way?
client's get updates- never the other way?
---This goes in /client/ somewhere
local function onServerCommand(_module, _command, _data)
if _module == "module" and _command == "command" then
--_data is a table provided in the command
-- do gametime modData editing here using the _data
end
end
Events.OnServerCommand.Add(onServerCommand)--/server/ to client
``````lua
---This is called in server
--do gametime modData editing here
sendClientCommand("module", "command", {key1=value1, key2=value2})
you could also send the entire modData as the argument to do a table copy
but this is unideal and why global modData is preferred as you can keep it to your own stuff
Only one way: client needs info from server.
And if I use this global ModData.getOrCreate("myData"), then I can safely access the data in client without further work?
no
you'd still have to call on update events
using 'ModData.request()'
this should collect the information to match client's lists
I personally grab the data from the lua event to parse it to the client's list
local ExpandedHeliEventsModData --.EventsOnSchedule = {} --.DayOfLastCrash = 0 --.DaysBeforeApoc = 0
local function receiveGlobalModData(name, data)
if name == "ExpandedHelicopterEvents" then copyAgainst(ExpandedHeliEventsModData,data)
end
end
Events.OnReceiveGlobalModData.Add(receiveGlobalModData)
many thanks!!
btw, if I store stuff in modData of an inventory item (not GameTime), do I have the same problem that if it is stored in server, I cannot access it in client?
inventoryItems are client side in nature (until on the floor/in a container)
you can use transmitModdata to update it across clients - in the case of an item being on the ground
infact it's suppose to work regardless of serer/client - if you called transmit from either side
so be careful using it
container = containers:get(2)
print('-----------------')
for j=1,container:getItems():size() do
local toSell = container:getItems():get(j-1);
if toSell and FunctionalATMs2.isSellable(toSell) == true
and not (toSell:isCustomName() and toSell:isCustomName() ~= toSell:getName()) then
--getPlayerLoot(0).inventoryPane.highlightItem = toSell
--toSell:getContainer():DoRemoveItem(toSell);
local piecePrice = FunctionalATMs2.checkQty(toSell)
print('sold '..toSell:getName()..' for ' .. piecePrice)
totalSellAmt = totalSellAmt + piecePrice
toSell:getContainer():DoRemoveItem(toSell);
getPlayerLoot(0):refreshBackpacks()
else
-- print('cannot sell '..toSell:getName())
getPlayerLoot(0):refreshBackpacks()
end
end
can some one pls help im almost done ๐ฆ
i mean my problem here is im deleting the item as i convert it to cash
i think its messing up the table's index?
idk
idk i just figured 1 was always floor i think
i thought it was 0 or 1
i really am not good at getting the container
try containers:get(1) ?
the error is essentially saying that it seems
2 out of bounds for length 1
Ye i tried to change that but u see that dorenove item
Doremoveitem
If i dont do that it doesnt give error
so the -1?
Idk i got that from vanilla
i actually saw that
I think what i should do it prevent the container from.acxepting anything else aside from the sellables
it's got to be how you are trying to use it vs how it's supposed to. enter smart experienced person
any time now lol
๐
Ye o understand but the problem is this the only one that worked
Lol
And idk why or how
loop from the end of the list not the start
Can anyone clarify the bare minimum required in an animation's XML file?
if you're removing items while you loop forwards it's going to mess things up
Why do you know everything?! Thnx albion!
for i = container:getItems():size(), 1, -1 do
making custom zombie outfits is kind of exhausting but
it's very satisfying to see them show up in game
Oh hey, I know this one:
<animNode>
<m_Name>NAME</m_Name>
<m_AnimName>Animation_Name</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SpeedScale>0.40</m_SpeedScale>
<m_BlendTime>1.25</m_BlendTime>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>CONDITION</m_StringValue>
</m_Conditions>
</animNode>```
This would be the minimum required for a TimedAction. The "PerformingAction" condition value should be updated to whatever you want the anim name to be called from your code via `self:setActionAnim("CONDITION")`
Hi im trying to spawn a zombie near myself when i press caplock key so I coded a LUA like so in the below
but it keeps giving me an error
could anyone help me with this?
not sure what i am doing wrong
this is the error i get when i try.. i guess the getVirtualZombie manager no longer exist in new build??
Sorry, I wasn't clear at all in retrospect.
I mean, what is the bare minimum to avoid throwing exceptions from a file being "too short"
I have 2 extra XML files in my set, I need them to basically do nothing, compiler is complaining even though stuff works.
I would like to eliminate those exceptions
I suspect deleting the files would cause worse problems for servers running my mod.
I have not seen this error before....What is the error you get? is the animation file formatted correctly? I just put in:
<animNode>
</animNode>```
And i received no exception for it being "too short"
Thanks. I tried:
<?xml version="1.0" encoding="utf-8"?>
I had to check console.log to see the error because it happens during server load and the game will not pause for it... If you're off doing things while your server loads, you'll miss it.
I will try what you tried
If all else fails, I'll try:
-- Old Sit Actions File
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>MeditatingActions</m_Name>
<m_AnimName>Meditating</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SpeedScale>0.40</m_SpeedScale>
<m_BlendTime>1.25</m_BlendTime>
<m_Conditions>
<m_Name>NeverGonnaGiveYouUp</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
</animNode>
-- Old Sit Ext File
<!-- This file never should have been born. -->
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>MeditatingExtensions</m_Name>
<m_AnimName>Meditating</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SpeedScale>0.40</m_SpeedScale>
<m_BlendTime>1.25</m_BlendTime>
<m_Conditions>
<m_Name>NeverGonnaLetYouDown</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
</animNode>
<!-- This file never should have been born. -->
haha. if the action file isn't used anymore, should be safe to remove it though.
Here's the error btw:
[Fatal Error] :3:48: Premature end of file.
ERROR: General , 1673932647828> 0> ExceptionLogger.logException> Exception thrown zombie.util.PZXmlParserException: Exception thrown while parsing XML file "C:\Users\Zen\Zomboid\Workshop\Meditation\Contents\mods\Meditation\media\AnimSets\player\sitonground\MeditatingAction.xml"
Caused by:
org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 48; Premature end of file. at PZXmlUtil.parseXml line:51.
ERROR: General , 1673932647828> 0> DebugLogStream.printException> Stack trace:
zombie.util.PZXmlParserException: Exception thrown while parsing XML file "C:\Users\Zen\Zomboid\Workshop\Meditation\Contents\mods\Meditation\media\AnimSets\player\sitonground\MeditatingAction.xml"
Caused by:
org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 48; Premature end of file.
at zombie.util.PZXmlUtil.parseXml(PZXmlUtil.java:51)
I am under the impression Steam will not delete it and therefore it will continue to remain empty in their directories.
Seems to imply maybe it expects something on line 3 of a file that I had reduced to a single line
Maybe that was an issue?
idk I am trying your version
yea its reporting the formatting is wrong:[Fatal Error] :3:48: Premature end of file.
odd.
Also, is that how the workshop works? if so, that would be gross....
I guess that would result in the user having to unsubscribe/resubscribe, which i knew was a thing that just had to be done sometimes.
I've heard it will cause signif problems for dedicated servers
So I am not trying to make anyone go through that headache
Bingo
Your guess was right; this appears to be the bare minimum to avoid the error I mentioned above.
Though part of me still wants to publish this instead lmao
Just for anyone who finds it
I'll have to keep this in mind then.
I tried to do a thing where I left a "Comment '<THIS>' on Steam if you're readding this" in a code comment, no one did or cared i guess. 
๐ญ
i've realised that trying to spread joy with my comments is futile
so now i deliberately use insane syntax in the hopes that it'll upset someone instead
use semicolons 
that's too much work i can't bring myself to do that
still waiting for a help here .. anyone would like to help a noob please?
i don't think getVirtualZombieManager() exists
use VirtualZombieManager.instance instead
ty for your response
declaration: package: zombie, class: VirtualZombieManager
although i looked up the class
it seems to exist
the class exists, but there isn't a getter function for it
i see isee
use VirtualZombieManager.instance instead, it does the same thing
could i see the code?
oh, instance is a field, not a method, just use VirtualZombieManager.instance:createRealZombieNow(X, Y, Z)
Oh wow that worked
thanks albion
but if you dont' mind and if it doesn't bug u too much
cuold you explain one more time why
including .instance (field)
worked
while VirtualZombieManager() fucntion didn;t?
virtual zombie manager is a singleton class, so you need to grab the instance of the class to use its methods - when they do this they usually have a static field 'instance' pointing to it
hmm
are u saying the other methods are under the instance then??
sorry i am still learning the python
shocked by how easy it is to make hair dye
modding this game is often much more complicated than it should be so
it's nice to find something that takes basically no effort and produces great results
If I wanted to change a specific item setting would I use script manager or the itemPicker?
specifically I want to change the KeepOnDeplete to true on propane tanks without overwriting the item definition.
Ye iknow right
Ahh the same question i have. @bronze yoke if you know how i can permanently change an item do i use onGamestart?
Also i didchange a static model but didnt reflect to players around me
the game doesn't let you make zombies spawn with items in certain condition, and it doesn't let you define a tint for a tintable object when it spawns on a zombies, but it gives you a fully automated system with simple RGB codes to make any hair dye you want in the space of a single item script lol
do you mean you want to change a parameter on the item script without overwriting the entire script?
I would think you need to get the item from the ScriptManager and use the DoParam on the item to set that
ScriptManager.instance:getItem("Module.Item"):DoParam("KeepOnDeplete = Value")
do I have to do what Clytch3r mentioned and set that to ongamestart to make sure it doesn't revert?
no
you just do it
if you want to be safe (especially if you're linking into another mod that might remove things with no notice), you can do
local item = ScriptManager.instance:getItem("Module.Item")
if item then
item:DoParam("KeepOnDeplete = Value")
end
I should do this in server not shared, right?
should be shared actually
it executes the same anyway, but you shouldn't hide it behind any checks or anything
you need to change the script on both
server and client's need matching scripts otherwise they flag the anticheat
ah, yea, good point
I had to write around something related to this - let me look up the reasoning
Seems like I had to include a 'already ran' check on the function for EHE - it is under ongameboot in shared
seemed to cause problems in MP (perhaps running once for client and once for server
But in my shops mod I do something similar in ongameboot and in shared and haven't gotten reports of issues so ๐คท
ah the EHE stuff was item scripts, shops is recipe related
I'll go look at it to see if it's something I'll need to worry about
I don't think any mods other than the workshop mess with propane tanks
i don't think this will be an issue if you just don't tie it to an event
and we're trying to phase that out of our server
hmm, I wonder how it changes the tanks to have a x/capacity
Wait so doparan is permanent? Cuz i thought if i use it on an instant then it wont change everything else that will spawn esp since i used debug console
it's probably cause you're doing it in console. Files load before the server starts
Okay, new puzzle. MoveTo appears to work by two mechanisms from the limited perspective of its own file content:
Step 1: player:getPathFindBehavior2():pathToLocation(x, y, z)
Step 2: On update(): player:getPathFindBehavior2():update()
I am aware of no other functions that are called to make the movement happen, and yet, for whatever reason, if I move this code outside of a timed action and try to call player:getPathFindBehavior2():update() on every tick (for experimental purposes), character does not proceed down path, but instead walks in place. Anyone know the secret here? Could I trigger this loop outside of a TimedAction if I do it right, or is there something subtle that stops me from calling the functions this way?
I've got autowalk working p well, but it would be cooler if I could use other TimedActions freely while I'm doing it...
it doesn't exist on instance
Ok
it only exists on the item script
does anyone know where the list of channels for tvs and radios is created?
the little dropdown
adding a channel after a game has already started will cause that channel to not show up in tvs you already looked at, so i'm trying to figure out if i can trigger the list to refresh
media\radio\RadioData.xml
sorry, I should have been more specific. I mean like the ui dropdown, when you click device options and you can pick different channels
search in the file for cat="Television"
I'm sure that I'm looking for lua code. I think I found it, but I have to find what triggers the channel list to update
Defeated by modding again. ๐๐ด
What's the best way to get the max capacity of a drainable? There's no maxCap function
currently I'm cross multiplying and it's not great
(((1 - tankDelta) * tankAvailableUses) / tankDelta) + tankAvailableUses
wouldn't it be 1/delta?
i mean the other delta
i'm not at a computer right now so i can't check the exact names (and i recall them being annoyingly similar)
but the max capacity is defined using a delta
1/delta = max capacity
there's getDelta(), getUseDelta(), and getUsedDelta() xD I'll play around with em in console and figure it out
I could do 1/(1-delta)
if you're bad with math, you can create a new instance item, use it until it's drained and return how many times you used it 
problem is I do this at 1-2am when I have the most time
1/useDelta is the simplest though
and brain has significantly diminished capacity for story problems.
I get derp moments like that too, no worries
oh, getUseDelta() is how much is used on each "use" of the item
I misunderstood that
i think we can all agree... there is no way this was simpler than using integers
yea, cause delta returns about 16 decimal places hahah
how's server/client communication work, is there a global function for passing data back and forth?
sendClientCommand(optional player, module, command, args) triggers OnClientCommand(player, module, command, args) on the server
and vice versa with sendServerCommand
ah okay, thank you both
That's just an effect of it using a floating point
I know, but they could do floats to like 4-5 points instead
That wouldn't be a float
They should have used integer values, though
There is no need for drainables to be floats
so i tried playing with doparam for fun
i wanted to make my weapon do all the swing types
but then it was permanently applied to the game items
i noticed the icon turned into apple ont the item picker
thres an error but this is the code
Events.OnPlayerAttackFinished.Remove(weaponStance);
function weaponStance(character, handWeapon)
local item = character:getPrimaryHandItem()
item:getContainer():DoRemoveItem(item);
character:setPrimaryHandItem(item)
local Script = ScriptManager.instance:getItem("Base.Katana")
Script:DoParam("AttachmentType = Knife")
Script:DoParam("DisplayName = GlytchBlade")
Script:DoParam("Tooltip = GlytchBlade")
Script:DoParam("Icon = Apple")
local item = InventoryItemFactory.CreateItem("Base.Katana")
local stance = ZombRand(1,6)
if stance == 1 then Script:DoParam("SwingAnim = Bat") ; character:setSecondaryHandItem(handWeapon) end
if stance == 2 then Script:DoParam("SwingAnim = Heavy") ; character:setSecondaryHandItem(handWeapon) end
if stance == 3 then Script:DoParam("SwingAnim = Stab") ; character:setSecondaryHandItem(nil) end
if stance == 4 then Script:DoParam("SwingAnim = Spear") ; character:setSecondaryHandItem(handWeapon) end
if stance == 5 then Script:DoParam("SwingAnim = Shove") ; character:setSecondaryHandItem(nil) end
character:getInventory():AddItem(item)
character:getInventory():setDrawDirty(true);
end
Events.OnPlayerAttackFinished.Add(weaponStance);
looks like fun
split screen question, if a player left, would there be an event? Would obj:isAlive() return false, or rather should I check if obj:isDead()?
*isAlive() just returns not isDead(), now that I look closer
`item AdvancedTradingPost
{
Weight = 1000,
Type = Container,
Capacity = 9999,
DisplayName = Trading Post,
icon = ATP,
ResizeWorldIcon = 2.0,
}
recipe Create Trading Post
{
keep BlowTorch,
SheetMetal=10/SmallSheetMetal=40,
MetalPipe=10/MetalBar=10,
Generator,
Result:AdvancedTradingPost,
Time:5.0,
}
`
Can someone help me with my recipe? its throwing errors and im not sure why
Seems like all inputs need to be on one line?
I changed it to this and it works -
`recipe Create Trading Post
{
keep BlowTorch,
SheetMetal=10,MetalBar=10,Generator,
Result:AdvancedTradingPost,
Time:5.0,
}
`
But I wanted options between large/small sheets and pipes/bars
MetalPipe=10/MetalBar=10,```
This doesn't work. Alternate ingredients have to have the same amount used and be of the form
```IngredientA/IngredientB;Amount,```
You'll have to have two recipes if you want the amounts to vary
Cheers @vast nacelle
no semi-colon though. it looks like this and works as intended.
`recipe Create Trading Post - Large Sheets
{
keep BlowTorch,
SmallSheetMetal=40,
MetalBar/MetalPipe=10,
Generator,
Result:AdvancedTradingPost,
Time:5.0,
}
`
hm, any suggestions for free courses for amateurs like me?
Free courses on what?
Ty, I'm excited to get this thing going
Amateur what are you talking about?!
Ow your name is back haha
game / mod development:
systems - models - sim, what would a person need to know
I'm trying to modify "Modified Backpacks" to create the different coloured duffelbags instead of just the default one. I managed to get it to do so by replacing all instances of bag_dufflebag with bag_dufflebagTINT but replacing the icon with DuffelbagWhite as is done in zomboids clothing_bags.txt has resulted in the icons being varicoloured questionmarks instead of duffelbags. Any way to fix this?
hey quick question
what would happen if I put the chance over 100 here ?
{
name="Naked",
chance=100,
}, ```
anyone know if it's possible to make a weapon associated with a zombie outfit always come with a specific set of upgrades?
for instance, if i have a zombie spawn that always has an M16 on its back, is it possible to add upgrades such as a stock to that M16 in any way, or does it just have to be a random version of it
uff finally manage to get real world time inside the game
local pzCalendar = PZCalendar.getInstance()
local hour = pzCalendar:get(Calendar.HOUR_OF_DAY)
local minute = pzCalendar:get(Calendar.MINUTE)
playerChar:Say("Hour: " .. hour .. ":" .. minute)```
dunno if anyone will have use for it, but i do so im sharing what i've learned ๐
Hi, this is my first time here. I'm looking for a way to identify different kinds of buildings. For instance let's say I've got an IsoBuilding instance from calling a getBuilding() method. Is there a way to check if that building is a school, a house, a firestation, etc ?
The ZombiesZoneDefinition states that every zombie zone except default should not exceed a total chance of 100. The loop I gave you is setting all zombie zones so I do not recommend setting that higher.
not sure this is possible, every building has a building definition though, you can check that.
For my purposes I check room types. Don't remember now, maybe it was just because it was easier or because the values weren't always set.
All right I'll just loop on the rooms until I find the ones unique to specific kinds of buildings then
There is this in media\lua\server\Items\SuburbsDistributions.lua:
VarmintRifle = {"x2Scope", "x4Scope", "x8Scope", "AmmoStraps", "Sling", "FiberglassStock", "RecoilPad", "IronSight"},
HuntingRifle = {"x2Scope", "x4Scope", "x8Scope", "AmmoStraps", "Sling", "FiberglassStock", "RecoilPad"},
Shotgun = {"AmmoStraps", "Sling", "ChokeTubeFull", "ChokeTubeImproved"},
Pistol = {"Laser", "RedDot", "IronSight"}
}```
I *think* if you add weapons and an attachment to this array, there's a chance that the weapon can spawn with an associated weapon upgraded. However, I'm not sure if this applies to Weapons attached to Zombies. It's probably used in the Java-side of the code. So I'm not really sure how it's used.
If I wanted to write a config file that only existed serverside so I could load admin options before basically anything else happens (ideally before traits get added so that I can make traits and their costs optional), where would I need to write from, and where would I expect that file to be saved? (@ anyone)
and even then, presumably it's just a chance, which wouldn't really be as functional for me as simply forcing the modifications to spawn in the zombie's inventory to make sure the player gets em
shame though, would've been cooler if they appeared modified on the zombie :p
if the file is on server, how do you receive the relevant data so early? I asked this yesterday, btw.
I am guessing that if it were on the server I could just read the file right before creating the trait; but I'm not clear on how to read/write a server-only config in the first place.
me too moment
Hm, I think you'd create a weird desync this way.
Client has A set of traits, selects based on that. Then the server kicks him or removes invalid traits based on B set of traits?
I am assuming that I may need to send the client a command. Hoefully that would be possible but I'm really not sure
I wish the gd sandbox options loaded before my files run
I was doing a "Forced and Forbidden Traits" mod a while ago, never finished it. But basically it removed or forced traits in character creation based on sandbox settings
It'd be hard to modify their cost on the fly tho
Possible to put another tooltip string below the existing one?
How long does it last
๐ฎ
gimme a second... ill get the frankenstein code and clean it up again ...
option.toolTip = option.toolTop .. "NEW WORDS";
Don't know which tooltip you are wanting to extend, but you can do something like that.
Na just a regular item was wondering if you can just underneath for example leather scraps put "Yeah this b letter scraps"
๐ซก burry agas names soo cool
So you get the item, get the tooltip option and modify it by making it option.ToolTip .. " New string"
Or do I have to go into scripts for it
Well, if its an item, I'd probably just create a new tooltip that takes the old one and adds your new text.
Do you wanna add a new box for a tooltip under the existing tooltip for the item?
Zing
Like
{
...
Tooltip = Tooltip_Original,
...
}```
Go find Tooltip_Original in the translations file in `media/lua/shared/translate/EN/Tooltip_EN.txt`
Then make your own Tooltip_EN.txt in the same file structure but in your mod and have something like
```Tooltip_EN =
{
Tooltip_New = "Stuff in Tooltip_Original + <br>your new text",
}```
and then make the item have `Tooltip = Tooltip_New,`
local pzCalendar = PZCalendar.getInstance()
local MyTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)
mytimer(5,MyTime)
function mytimer(timervalue, startTime)
local currentTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE) + timervalue
if currentTime - startTime >= 0 then
playerChar:Say("Timer ended!!!!")
end
end```
now to make it pz compatible ๐
hmmm still wrong had an extra * 60 which is not needed...
only need to multiply the hour value by 60
and in theory this should get me the start time in minutes
but im still doing something wrong... in the if
brain melted with something so simple... i need fresh air ๐
duh
local pzCalendar = PZCalendar.getInstance()
local MyTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)
mytimer(5,MyTime)
function mytimer(timervalue, startTime)
local currentTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE) + timervalue
if currentTime - startTime >= timervalue then
playerChar:Say("Timer ended!!!!")
end
end```
anyone know how .pack file loading works for mods? does it just pick up any of them in media/texturepacks/ and load them?
whith mistakes like this i really need to make a break and have some coffee ๐
still a big duh moment
local pzCalendar = PZCalendar.getInstance()
local MyTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)
mytimer(5,MyTime)
function mytimer(timervalue, startTime)
local currentTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)
if currentTime - timervalue >= startTime then
playerChar:Say("Timer ended!!!!")
end
end```
this one is the correct one ...
Is it not possible to use public void setTooltip(String tooltip)?
Or is that string in the brackets just what ID from the script file of the item you are pulling the tooltip
I have quite a few items to iterate over, hence the focus on trying to do this via a function and loop over items rather than do it manually
anyone know if the wiki's list of lua-exposed events is up to date?
also, slightly related - trying to see what the replacement for OnRenderUpdate is. I can't imagine the render loop and the game loop both run on tick
I think you need to define them in the mod.info.
ah, that makes sense. i vaguely remember that from custom map tiles that utilize them, so that's useful. thanks!
regarding this - looks like it's OnRenderTick most likely, but there's a hoop to jump through regarding the doRenderEvent bool that I'll have to figure out. seems pretty simple though, just not sure if there's consequences for not setting it back
local pzCalendar = PZCalendar.getInstance()
local timervalue = 0
function TWE_TraitCheck()
local currentTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)
if currentTime - timervalue >= startTime then
player:getTraits():remove("abc");
HaloTextHelper.addTextWithArrow(player, getText("UI_trait_abc"), false, HaloTextHelper.getColorRed())
Events.EveryTenMinutes.Remove(TraitCheck)
end
end
function TWE_addTrait()
if not playerChar:HasTrait("abc") then
playerChar:getTraits():add("abc");
HaloTextHelper.addTextWithArrow(playerChar, getText("UI_trait_abc"), true, HaloTextHelper.getColorGreen())
Events.EveryTenMinutes.Remove(TraitCheck);
Events.EveryTenMinutes.Add(TraitCheck);
end
end```
i think this it it ๐
trait abc is placeholder... will probably use a table with all the traits or something like that
Special Thanks to Fajdek for giving me permission to use some of the functions on this lua file
Special Thanks to dhert for providing me an improved player distance code and Cannibalize Animation
Special Thanks to BurryAga for lending me his Darkvision Code for Primitive Trait
Special Thanks to Cosmic B for helping me with the Believer Context menu contextmenu
Special Thanks to Albion for pointing out the OnPlayerGetDamage event
credits for the trait mod im done with it
the client will be the one to post it
yes sir
its not yet done for him i mean i did the traits functions but his going to make the profession..
so its currently hidden
ok ok, whenever its available let me know
but ill post it here when he outs it i doubt its gonna be soon cuz he plans to replease all his mod when he launches his server but the atm mod 2 is also done
hehe
new proj im working on
more like animations make available for roleplay purposes
im going to use dislaik's toggle functions for the setup (with permission)
damn wheres my workshop mechanic
Whats that

