#mod_development
1 messages Β· Page 302 of 1
I think you could use the oncraft function to push some lua in it for randomized loot
bruh i have no idea what i'm doing and i'm somehow doing stuff π
yeah! he could do that
yeah that's almost everyone here
i figured out modding like a caveman
In someways feel the same lol if it works, it works..
best way to learn is to learn from the ancients. see how other B42 modders did items similar to your concept
random number generators tied to loot π€·ββοΈ
yea that's 99% of my mods haha
well maybe not, 50% is Nik and others like you just now π
i really need help with a slightly difficult concept if anyone can
i want to make an item on the ground be a light source/give out light
the closest i found is the lanterns mod
but it wont work with me. i think something's broken/different in B42
i tried this
i based it off my heater script which kinda works but i obviously have no idea what im doing
looks like self doesnt make sense in your file because there's no class in context
try adding ISPortableTVLightObject = {} after your locals in the beginning and return ISPortableTVLightObject at the very end
hope that helps a bit
also, as a wise someone-in-this-channel once said: be careful about making your classes global
I saw a timed action lifecycle diagram online once. Does anyone know where to find that?
what are the sparklers used for in the aerosol bomb recipe? I'm assuming they're ground up and put in between the aluminum foil and the spray can.
Is this to produce heat? A spark? fire starter?
Asking because I feel it's absurd that the only item that can be used in aerosol bombs is sparklers, and want to expand on the ingredients possible
I'm thinking it's being used as a propellent, to ignite the spray can. So other things I'm adding as usable propellents should work too.
Unsure tho as idk what the thought process was behind making the item
And last time I tried to look up "aerosol bomb" google changed it to "airline bomb"
so I don't wanna google more
uh no what that's supposed to be
you could be taking the material that makes sparkles do their thing off the stick?
like scraping the red part of a match u know?
but im not sure how that works irl
cuz sparkler stuff while long-lasting is probably a shitty propellent specially for a bomb
well the actual propellent part of the bomb would be the aerosol, the sparklers are just to ignite that
like bullet primer vs gunpowder
that makes sense
also can we take note of how funny the firecracker recipe is
{
timedAction = Making,
Time = 100,
NeedToBeLearn = True,
Tags = AnySurfaceCraft,
category = Miscellaneous,
inputs
{
item 1 tags[Scissors] mode:keep flags[IsNotDull],
item 1 tags[Glue;Epoxy],
item 1 tags[Propellent],
item 1 [Base.SheetPaper2;Base.GraphPaper;Base.Brochure;Base.Flier;Base.Paperwork;Base.LetterHandwritten;Base.Doodle;Base.DoodleKids;Base.GenericMail],
item 1 [Base.Twine],
}
outputs
{
item 1 Base.Firecracker,
}
}```
why didn't they just make a tag for paper
Wait that's really good
tho a little bit confusing lol
hey guys, does anyone know how to check if the player is going through a window or climbing a fence to make them drop an item they have equipped?
in build 41.78.16
Have you checked the java doc if something is related to that ?
i havent, where can i find it?
what is this referring to? Tooltip = Tooltip_Briefcase,
In your translations file, there is a txt file for tooltips where u put information related to the item
U know that text that shows up under an itemβs name?
Usually telling you about its function or how it works
Like the sleeping bag
Thats a tooltip
I'm pretty sure Timed Actions flow has changed with B42. I switched some actions from "perform" (B41) to "complete" (B42) to get the same behaviour. moreover complete is not on the flowchart (so it must be B41). @fast galleon what about an update, you lazy ghost ? (just kidding, don't insult me back)
that's what i meant thanks
i've been reluctant to document the timed actions changes since it's not really clear what they're for yet
thank you ill take a look!
the intention seems to be that complete runs on the server and perform runs on the client
but since we're in singleplayer only it's hard to judge what the actual implications of that are yet
That's a good hint my mods will need rework when B42MP comes out.
i think the majority of lua mods will not work in b42 mp without changes, too much stuff has moved to the server for old code to be compatible
can someone explain what's the difference between those 2 files, "BodyLocations" and "AttachedLocations", they both have "getOrCreateLocation", what is the difference here
do you know where thatd be? im kinda lost π π
Javadoc Project Zomboid Modding API declaration: package: zombie.characters, class: IsoPlayer
And any inherited methods
thank you so much bro!
I haven't forgot that i promised you that briefcase. I'll do it and let you know once i feel bit better.
bodylocations is clothing
attachedlocations is holsters and stuff
It looks like when you use addXp(player, perk, amount) the amount received is modified, usually a much lower amount. Does anyone have a breakdown on what affects that? Been poking around and running tests but it doesn't seem consistent.
depends on player's xp multiplier and boost mostly
so dependent on starting skill level and books read
as I suspected... thank you, I haven't been able to get player:getXP():setXPToLevel(Perks.Cooking, 8) to work so I have been using AddXp to keep adding the difference until the next level is reached.
oh don't worry about it, i kinda got it to work with what Athens told me
just thinking maybe it'd be better to use something like a weapon instead of a clothing item for the prop cuz it has condition and insulation when you hover over it and it looks kinda stupid
You can make it purely cosmetic with none of those. Okay then, if you change your mind do let me know
Hi! The vanilla game contains a lua function in the shared folder. In my mod, can I safely access this function in my client folder? Using smth like
function Vanilla.Function(a,b,c)
vanilla_function(a,b,c) -- execute the vanilla code from shared
-- do some additional things...
end```
This code is in my mod's client folder while "Vanilla.Function" is in vanilla's shared folder.
yeah
thanks!
another question: does anyone know why TIS put some TimedActions in the shared folder and some in the client folder in B42??
presumably the difference is whether or not the server would need them
because multiplayer isn't done yet
it seems timed actions should be in shared in b42
there's a lot of pretty major changes to how timed actions work but not all have been updated, and it doesn't matter in single player
I can't wait for the screams of players when any mod using timed actions stops working when multiplayer is released, as they completely forget this is the unstable version.
I am afraid too...
In B41 and B42, I think the beard and hair growth is controlled by java files and not by lua. Is there still a way to detect whether hair/beard has grown in lua?
i have a q about variable efficiency, i'm playing around with Bandits Week 1 mod and wanted to track which room the player is in and for how long. I've implemented this as a local variable in a script that is run on each NPC. Would a global variable be more efficient?
Look in the LUA for the character interface where you can changes your hair/beard
no
there is overhead for writing/reading global variables, locals are always faster
globals are discouraged for many reasons but performance is a major one
Maybe getBeardStylesInstance():FindStyle(getPlayer():getHumanVisual():getBeardModel()):getLevel() for beard length
thank you
And for hair try getHairStylesInstance():FindMaleStyle(getPlayer():getHumanVisual():getHairModel()):getLevel() or if getPlayer():isFemale() go with getHairStylesInstance():FindFemaleStyle(getPlayer():getHumanVisual():getHairModel()):getLevel()
Because gender is apparently deeply ingrained in the hair code.
i didn't think they even had different hair styles
yes! thank you!
How difficult is it to add in a keybind for a joypad? I need to add a listener to perform an action from a joypad button/combo for my mod action
In case anyone interested, I think I found the answer in the game's java code: seems like the java code triggers the "OnClothingUpdated" event
in case you refer to my question, the code for the beard and hair interface only controls what happens if players actively change their hair/beard, not how hair/beard grows. This seems to be purely java
what makes keyrings psuedo equip themselves?
Also can I force items from the player's inventory into a container in their inventory?
I wanna make it so the player spawns with a wallet, and then stuff their ID & Badge and anything else into their wallet
Is it documented anywhere what info the different levels of Animal Care provide? I'm having trouble finding the animal info window code
not 100% sure how the new wallets in B42 work but if it behaves like a usual inventoryContainer, you can do this. use code like this:
wallet:getInventory():addItem(item)```
It acts like any other bag, yeah
Then my code example should basically work.
In case you want to add an item which is in player's inventory, you have to grab the item somehow, write it to a local variable like local item = ... and then use smth like
wallet:getInventory():addItem(item)```
So in this case, you have to make sure the item is removed from player inventory.
yee
razab is right. find items from inventory, store somewhere in your code, remove from inventroy and add to wallet
btw it's a great idea spawing with wallet I must use your mod when it's release π immersive!
now when you say it, it is indeed a better idea to spawn with a wallet instead of just your id card. never thought about this
dear lord they refer to "animal care" as "husbandry" in the code and most of the skills don't match up with their names...that is absolutely terrible for a game designed to be modded.
some of my personal favorites
item:getHungChange()
stats:setHunger()
---
item:getUnhappyChange()
body:setUnhappynessLevel()
maintenance sprints are a thing people!
Tbf it's not THAT bad
In fact we are lucky most of the stuff is fairly explicit
It is because it is not difficult to tidy it up. It's trivial even with modern editors. It's just neglectful not to.
Has anyone made a mixtape mod? That lets u put multiple VHS or CDs in one to play in a row in a car ect?
display names not matching internal names is pretty normal though i dont see what the issue is
its not like skills have overlapping names so it doesnt really matter
Looks correct; IsoGAmeCharacter has private fields for beardGrowTiming and heairGrowTiming, which are "how many hours of survival did the beard/hair last grow? Then if that was over 120 hours for beard/480 hours for hair it switches to the next hair size of beard/hair model.
But if you just want to know if it did grow, you could periodically check if the length of the hair/beard model changed. (which will always happen when asleep, which might make it easier for you to find a good trigger for checking)
You could stop growth by resetting the growth timer once a day... but actually changing how often it grows is 100% java
I just wanted to catch the exact moment when beard grows but this is possible via the OnClothingUpdated event
got it workin π
I had to do some diggin to learn how the player name is applied to ids n' stuff
you can just move the item into the other container instead of deleting it and spawning a new one
well that would have been helpful to know, this works fine tho
What you are doing is to completely delete the game's predefined id card and then create a new one. That's the reason why you have to setup the name again. But it is also legitimate way ofc
yeah I know why I had to do it
Is there a way to alter item names in base game via mod? For example atm Base.WinterBerry is just named βBerryβ in game, is there somewhere/someway to change every instance of Base.WinterBerry to βWinterberry? π
for anyone wondering, I found out in lua\shared\items\SpawnItems.lua
you could have used
wallet:getInventory():AddItem(IDcard)
instead. Then it pbbly won't be necessary to write the name again on it. That's also what albion suggested
yes. it should. but your way also does the trick.
the mod itself currently makes it so you can wear a wallet, spawns you with a wallet, and makes it so some more items can be put on your key ring
I have a general question concering the lua events:
Consider the following code:
local function myFunction()
triggerEvent("SomeEvent")
-- some additional here...
end```
When exactly ist the function "eventFunction" executed? Is it after the function "myFunction()" has been finished?
currently only makes it so 3 items can be put on your keyring, but I will be adding items as I see fit
same with wallet if I find something and go "why can't I put this in my wallet/keyring π€¨ "
anyone else feel like sunday driver should have a chance to spawn with a parking ticket? same way speed demon can spawn with a speeding ticket
when right before -- some additional here because you wrote above of it.
I haven't used custom event before but as far as I know.
wearing a wallet would be cool because i usually put 2-3 note papers IRL in my wallet just in case. but since wallet can't be worn in PZ, it has been useless until now.
so i might be working on a warewolf mod
and so i did my research in attempts to fetch if its fullmoon
and heres what i figured out
local function isFullmoon()
return ClimateMoon:getPhaseName() == "Full"
end
print(isFullmoon())
tho i explored a bit more and came up with other stuff and im sharing it here
for anyone working on moon related stuff
-- did not use this for the code below, but you might find some use for it
local MoonPhases = {
"New", "Waxing crescent",
"First quarter", "Waxing gibbous",
"Full", "Waning gibbous",
"Third quarter", "Waning crescent",
}
LuaEventManager.AddEvent("OnMoonPhaseChange")
local curDay = getGameTime():getDay()
local curPhase = ClimateMoon:getPhaseName()
local function checkMoon()
if forageSystem.getTimeOfDay() == 'isNight' then
MOONPHASE = ClimateMoon:getPhaseName()
local newDay = getGameTime():getDay()
if newDay ~= curDay then
curDay = newDay
if curPhase ~= MOONPHASE then
curPhase = MOONPHASE
if getCore():getDebug() then print(MOONPHASE) end
-------------------------------
--place your code if you want to trigger code everymoon phase change
-------------------------------
triggerEvent("OnMoonPhaseChange", MOONPHASE)
end
end
end
end
Events.EveryHours.Add(checkMoon)
local function OnFullMoon(phase)
if string.find(string.lower(phase), "full") ~= nil then
if getCore():getDebug() then
ISChat.instance.servermsgTimer = 9000
ISChat.instance.servermsg = tostring(phase)
end
-------------------------------
--maybe place your code here? if you want just the fullmoon same as what i need
-------------------------------
end
end
Events.OnMoonPhaseChange.Add(OnFullMoon)
yeah there's some wear wallet mods in b42 but I don't like them because they increase the carry capacity by a bunch, maximum item size, and make it reduce encumberance by 100%
I think the vanilla weight is 0.1 in vanilla, that number is just there in case I wanted to reduce it
No need to though, as equipping a wallet makes it 0.03
And the reason I'm against increasing the max item size is because it accepts any item from the literature category
the player does not need a library of skill books in their wallet
If an item comes up that's above 0.2 that I feel would still fit, I'll think about raising it
ok im starting to mess with stuff... What have i done here?
do you mean the animation monitor (text)?
go to option, click key bindings tab, look for debug section and animation monitor
or it should be one of f3 - f6 by default
oooh ok yea its combined with the speed keys, ok, dont do that hehe, ty
Does anyone know how to get the friendly name of a vehicle? I've only gotten as far as getting "SmallCar" for the Chevalier Dart with
player:getVehicle():getScript():getName()
print("IGUI_VehicleName" .. player:getVehicle():getScriptName())
IGUI_VehicleNameStepVan_Citr8 = "Citr8 Chevalier Step Van",
IGUI_VehicleNameSmallCar = "Chevalier Dart",
There's no way to call directly the real name as far as I know
ok, sorry, when i use f3 both the text and my character disappear
have ghost mode turned on?
hmm has multiple functions been bounded in f3 then? idk :/
I use = for animation monitor and 0 for log window and no problem at all
good! then f3 must be for invinsible cheat
i swear i trried it like 3 times
i didn't know that lol
must be
btw i really can't understand why they tied with speed multiple function by defualt lol
yea thats crazy lol
anyone able to help with a mod not showing up when installed locally
where did you install?
Ty comrad Coolfish2
where the example mod is
C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\mods\MixVaultVHS
go to %username%/Zomboid/workshop or %username%/Zomboid/mods/
for detail, see this page.
https://pzwiki.net/wiki/File_structure
Thanks! That will get me the key in the translation table, but there's no way to get a translation using the translation key from LUA?
sorry I didn't get. do you mean something like vehicle:getRealName()? I don't know what translation key mean 
just put that translation key into getText()
Question
will save(true) save zombie pop too? it's annoying when my game crashed and all zombies are disappeared. I'm thinking about auto-save mod myself if it's possible
does anyone know how to check if im colliding with a climbable object? got it working for windows but not for low/high fences
That's OK, your suggestion mixed with @bronze yoke 's did the trick π . Thanks both of you!
For the record if anyone is searching for this in the future, the way to get a vehicle's display name is:
print(getText("IGUI_VehicleName" .. player:getVehicle():getScript():getName()))
im using (instanceof(collider, "IsoWindow") or instanceof(collider, "IsoThumpable")
but it doesnt detect fences
ah i forgot getText π okay
isHoppable()
canClimbOver(player)
will work for low / high fences
ERROR: General , 1739249298871> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: new of non-table: null at KahluaThread.tableget line:1689.
ERROR: General , 1739249298871> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: new of non-table: null
at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:641)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1782)
at se.krka.kahlua.integration.LuaCaller.pcall(LuaCaller.java:76)
at se.krka.kahlua.integration.LuaCaller.protectedCall(LuaCaller.java:117)
at zombie.Lua.LuaManager.RunLuaInternal(LuaManager.java:564)
at zombie.Lua.LuaManager.RunLua(LuaManager.java:510)
at zombie.Lua.LuaManager.RunLua(LuaManager.java:496)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:342)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:264)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:391)
at zombie.GameWindow.init(GameWindow.java:1206)
at zombie.GameWindow.mainThreadInit(GameWindow.java:576)
at zombie.GameWindow.mainThread(GameWindow.java:489)
at java.base/java.lang.Thread.run(Unknown Source)
is anyone able to help with if my format is wrong ive looked over a few times and cant see my issue
new of non-table: null at KahluaThread.tableget i think its the null issue but i cant seem to fix it
Hello. help please, how to publish the translation of the mod in the steem workshop? What is needed for this?
what do you want to know exactly? how to upload in workshop or how to make a translation mod?
thank youuuu
Is there any tutorial with UI things? tbh, I have bunch of ideas related UI but it's really something else when I try to implement with lua.
I can draw what I imagine on photoshop but that's only I can do lol
how to properly arrange it for uploading to the workshop. I'm at the stage of "I've translated all the notebooks, but I don't know what to do next." how would everything work for me if I put these files in the shared folder with the translation, but I want to share it on steam.
I apologize in advance for this English, I'm in a translator.
https://pzwiki.net/wiki/File_structure
so start from creating correct folders to let workshop knows that this is an independent mod
Go to /%username%/Zomboid/Workshop/ and follow this guide
thanks
hint, βMyExampleModβ is the name of what? I can write anything here yes, what will it affect?
Zomboid/
βββ Workshop/
βββ MyExampleMod/
βββ Contents/
β βββ mods/
β βββ ...
βββ workshop.txt
βββ preview.png
I thought it was the name of a mod, but mod names should be in βMyMod1β, βMyMod2β etc? like in this example?
Contents/
βββ mods/
βββ MyMod1/
β βββ common/ <--- common folder is mandatory, even if empty !
β β βββ media/
β β βββ ...
β βββ 42/
β β βββ media/
β β β βββ ...
β β βββ mod.info
β β βββ poster.png
β βββ ...
βββ MyMod2/ <--- for extra mods, simply add a new mod folder
βββ ...
You can write anything in MyExampleMod. this will be exchanged to WorkshopID when player downloads.
However, you will need a unique name for MyMod1 / MyMod2. I usually set this same as ModID. (Idk what will be happened when folder name is conflicted. but that's how I learned at first.)
Also name of both folders do not effect anything visually.
- if you want to change title of workshop then go to
workshop.txt - if you want to change title in mod list then go to
mod.info
if the folder name conflicts nothing will happen
but it's weird for them to not match mod id and those do need to be unique
So it is better to name the MyExampleMod folder as MyMod1 ?
and it won't be a big deal because it will change itself when you load it into Steam Workshop
yes? xd
And how do you create a mod.info folder? Copy it from the original mod I'm translating?
Does anyone know how to output a single SingleTIlesheet.png in TileZed's PackViewer?
I've tried everything, but without any particular error, I end up with nothing output.
I need help converting item data in player inv. to display information on the web
Not familiar enough with this kind of stuff but you can write stuff in files to be read by other stuff on the server
Thanks for sharing! I have a plan for a mod that adjusts nighttime brightness based on the moon phase, but It got stuck on changing the night brightness in sandbox variables and having it take effect immediately. Which I know is possible because when I change it through the Sandbox Settings it takes effect immediately, I just need to find the the secrte used to make that happen.
Do you need help with the "getting info on player inventory" part or the "post to the web part"? I can help with the inventory stuff but have never looked into exfiltrating data from Zomboid to something else.
local sOpt = getSandboxOptions()
sOpt:getOptionByName("myModule.myVar"):setValue("sample")
sOpt:toLua()
sOpt:sendToServer()
print(SandboxVars.myModule.myVar)
i actually just figured this out 5 mins ago
Not sure what this is for
Changing a sandbox variabel and having it take effect rigth away (for the variables that can take effect right away)
i tested it earlier i logged in another instance and when i did something like that the changes synced
not sure what toLua does but sendToServer is the thing responsible fgor syncing it i believe
But it already updates right away
Unless you mean doing it server side
for the player that did the change yes
but for everyon else nope
It didn't when I changed a variable using lua to change night brightness.
tho you really shouldnt use sandboxoption as a means to sync things
I can assure if the client changes the value he directly has the new one
yep
But does the Java know that?
That idk
Adjusting the night brightness sandbox setting was the only way I could work out to adjust light levels at night.
right, thanks again tho i think what i have now is good enough, could be better tho idk if it's even possible, since the zombie can't hold anything in hand right
ahh i see ok then
same as the water and power
So what does toLua even do
I haven't tried changing those, but I did figure out how to tell if the power is on and if a square is inside and if a square is in range of a generator.
You might think "surely there is one method call that tells if a tile has power?" but you'd be wrong... you need to piece together if there should be power from multiple bits of information.
Which is stupid, but shrugs
so it ends up looking kinda stupid when the zombie is walking towards you with it's arms stretched forward heh
Loads Java sandbox options into SandboxVars iirc
Drinks some Kahlua and updates a java object.
So it's really toJava()
There's really no way to hold your arms out like that with a briefcase in hand and not look silly.
Luckily Zombies are not easily embarrassed.
yeah i just wish the briefcase would do some rotating or smh heh
Physics enabled attachments so the handle is linked to the hand bone and the case rotates freely based on movement.
Only slightly beyond the capabilities of the zomboid engine.
well that's how it is done with the regular briefcase, the handle is linked to the hand bone, but the rest of the briefcase is affected by the prop
but zombie doesn't use a prop so that's an issue π
Why are chickens 15kg and deer 6kg? How the $#%@#^ did someone come up with those numbers, even as placeholder values?
...now a cranky rooster just scratched me. On the head.
Hello all! Has anyone replaced the music tracks in Zomboid? I'm curious about the do's and don't's when replacing the tracks in Zomboid with your own.
Glad I have the power of debug mode and mods on my side or this would take forever.
Are there any existing mods that do it?
You might get realy lucky and just be able to put files with the same name and encoding in the same path in your mod.
$#^@#^$ rooster had another go at me and now they are going to die.
This is what I've been doing so far but while testing it, it seems that some tracks cut off abruptly. I think I read somewhere that they need to be the same length as the track you're replacing? Or maybe I'm missing another file that can edit playable track lengths, I don't know.
Can you find any files with the names of the tracks in them? If you give me a filename I'll do a quick check
I wouldn't be able to check at the moment, I'm not home at the moment, sorry. I'll definitely check later.
what code can remove a Specific option of default inventorycontexmenu
From my notes:
Bad copy paste sorry
What you want is ISContextMenu:removeOptionByName(optName)
So if context is the context menu object, context:removeOptionByName("Option I don't Like")
You can add a function to the OnFillInventoryObjectContextMenu to do that, since any function you add will run after all teh vanilal ones have put stuff in the menu so you can use whatever logic you want to choose things by name.
Or a postfix to whatever function added the option... depending on what exactly you need to do.
You can force player character to use animmask like umbrella one so left hand would not move. I'm not sure if zombies can be forced into it
thank you ,im trying to make a custom panel ,but dont know how grab all option always left one item
try to remove grab all and make a new one
You want a custom right menu?
It's very easy to add an extra right click entry to inevntory items or worlditems.
easy to add but not easy to remove
i built that panel , but if click grab all ,always left one item
but if i add a custom grab all option, it work fine
If you look at lua\client\ISUI\ISContextMenu.lua you'll see all the stuff the context menu object can do
There are a few different add options so you can find where the option you want to remove it, remove it, then put a replacment in the same place.
Do you know why the vanilla grab all does not work?
Might be easier to make that work that play with a custom function.
try lots of method but didn't figure why vanilla grab all does not work ,try the track the count number ,its correct
can i use the 'holding a bag' animation this way?
btw how can you define which part of the body gets protection from the worn item
Bloodlocation
and can i use everything from this list here ? https://pzwiki.net/wiki/BodyLocation
yes
Does anyone know if there's any util functions for searching for a specific tile close to the player? I know I could just do this with 2 for loops (excluding Z axis) but I was kinda hoping there would be a java function to offload some of the cost
i don't really get how those body locations work, like where is it defined where the body location actually is on the player
like i'd want to do something like this BloodLocation = LeftArm;RightArm, but stating more than 1 location is causing errors, and i don't want this cloth piece to be on the hands but rather on arms, but there's no 'both arms' body location, i could add my own location but how do i define where it actually is on the body, does that even matter?
Maybe you could use one of these
Oh I see, you dont want it on the hands ;-;
idk much about bodylocations so I can't say anything about adding custom ones
You might need to use a : instead of ; but unlikely to work. I think you need an item for each arm variant
Those are not valid blood locations, and if anything is the slightest bit wrong with blood locations everything explodes.
Here is a list of every BloodLocation used in Vanilla:
Apron,
Bag,
ForeArm_L,
ForeArm_R,
FullHelmet,
Groin,
Hand_L,
Hand_R,
Hands,
Head,
Jacket,
Jumper,
JumperNoSleeves,
LongJacket,
LowerLeg_L,
LowerLeg_R,
LowerLegs,
Neck,
Shirt,
ShirtLongSleeves,
ShirtNoSleeves,
Shoes,
ShortsShort,
Trousers,
UpperArm_L,
UpperArm_R,
UpperBody,
UpperLeg_L,
UpperLeg_R,
And from the message-of-the-day hidden in the translation files there are a few more that are not used but worked when I tried:
LowerBody,
LowerLegs,
UpperLegs,
LowerArms,
UpperArms
So if you want to cover both arms try BloodLocation = UpperArms;LowerArms,
see second message
i just want that damn piece of cloth on upper arms, not hands heh
BodyLocations:
AmmoStrap,
AnkleHolster,
Back,
Bandage,
BathRobe,
BellyButton,
Belt,
BeltExtra,
Boilersuit,
Calf_Left,
Calf_Left_Texture,
Calf_Right,
Calf_Right_Texture,
Codpiece,
Codpiece,*/
Cuirass,
Dress,
EarTop,
Ears,
Elbow_Left,
Elbow_Right,
Eyes,
FannyPackBack,
FannyPackFront,
ForeArm_Left,
ForeArm_Right,
FullHat,
FullSuit,
FullSuitHead,
FullTop,
Gorget,
Hands,
HandsLeft,
HandsRight,
Hat,
Jacket,
JacketHat,
JacketHat_Bulky,
JacketSuit,
Jacket_Bulky,
Jacket_Down,
Jersey,
Knee_Left,
Knee_Right,
LeftArm,
LeftEye,
LeftWrist,
Left_MiddleFinger,
Left_RingFinger,
Legs1,
LongDress,
LongSkirt,
MakeUp_Eyes,
MakeUp_EyesShadow,
MakeUp_FullFace,
MakeUp_Lips,
Mask,
MaskEyes,
MaskFull,
Neck,
Necklace,
Necklace_Long,
Nose,
Pants,
PantsExtra,
RightArm,
RightEye,
RightWrist,
Right_MiddleFinger,
Right_RingFinger,
SCBA,
SCBAnotank,
Scarf,
Shirt,
Shoes,
ShortPants,
ShortSleeveShirt,
ShortsShort,
ShoulderHolster,
ShoulderpadLeft,
ShoulderpadRight,
Skirt,
Socks,
SportShoulderpad,
SportShoulderpadOnTop,
Sweater,
SweaterHat,
Tail,
TankTop,
Thigh_Left,
Thigh_Right,
Torso1Legs1,
TorsoExtra,
TorsoExtraVest,
TorsoExtraVestBullet,
Tshirt,
Underwear,
UnderwearBottom,
UnderwearExtra1,
UnderwearExtra2,
UnderwearInner,
UnderwearTop,
VestTexture,
Webbing,
Wound,
ZedDmg,
yea and there's no both arms body location here π
BloodLocation is "what bits are protected" while BodyLocation is "which slot does it take up when equipped"
i can't wrap my head around how all this actually works, shit's defined in 100 places heh
So you could make an "amulet of protection" that equips in the neck BodyLocation but has the BloodLocation set to cover the entire body.
right, so i can just make my own body location called whatever, but use the bloodlocation for the upperarms, and that's it right
And just for fun, a lot of mods add extra body locations as a way of stopping equipmen conflicts.
yes, make you own bodyLocation == fine
kk great, thanks !
Do anything slightly unexpected with BloodLocation and the parser will throw an utter fit and just not load stuff at random and ruin your save.
yeah i already ruined a test save with this π
it even threw me ouf of the game back to the menu when i spawned a zombie in my outfit
I cant remember the lua for making a new body location, but it's easy to do if you just copy a mod like Canteen Slot or Wristwatches & forearm armor etc.
yea i have it done already thx
there's 1 thing i really don't like about b42, they removed the "add recipe materials" from the debug, so you have to manually add everything in your recipe to craft it
is it possible to hide what the output is on a crafted item?
In b41 there was hide result or remove result, that way it didn't show anything, but then items were given by lua. At least I think how it worked when I seen something like this
do you recall where you've seen it?
There is no definition where a clothing item of a specific location is attached to the players body. The locations are just used to organize clothing, to make it so that some clothes are rendered above other clothes, that certain clothes should hide other clothes and that certain clothes are incomaptible with each other and cannot be worn at the same time.
i see thank you!
Maybe take a look at dismantling various electrics. I don't think (or remember at least) if they show any results, but they do give items at random that are not assigned in recipes itself?
Sidenote as I'm in the same issue at the moment xD Does bodylocation and bloodlocation have the same specifications? I've been trying to make a kneepad, but so far been unsuccessful in making it only protect specifically left thigh/shin
Nevermind, I just saw the list you sent earlier for bloodlocations, I should have scrolled a little more for it
You could have the outputs be stored in an oncraft lua like how electrical dismantling works
That way you can also randomize the output
@tranquil kindle @vast pier aight thanks i'll look into that
slr
ive got 0 idea
i just saw it on the vanilla codes
that's not correct, it writes the current state of the java objects to the lua table
no java object is modified at all
^
doesnt it basically just update the SandboxVars global in lua with the java-side stuff?
yeah, that's right
Where do mods save their options that are set in B42? Not sandbox options but the new mod options
Zomboid/Lua/ModOptions.ini
Hmm did I add that to the wiki page actually ?
Perhaps I should
hi, I would like to know if I could have a little help on a part of coding that I absolutely do not understand, let me explain I redid the mod which allows the radio to be connected to electricity but I cannot change the fact that the radios already generated on the map continue to use the batteries. I would like to ensure that my mod is compatible in the middle of save and not just on a new one. All the scripts I have tested so far do not work. What basis should I start with to create my script in LUA?
thx a lot will look to that
Any luck so far? Need any help?
You need to change the deviceData for the radio; if you look in the RadioAction.lua file you'll see it accessing deviceData
I'm trying to find a good spot to make the change that doesn't need you to open and close the radio UI several times to take effect.
thx i start to check for the deviceData on my side but i cant get it work for radio that is already in game...
How are you doing the check?
trying to make a mod that focus on player effects and agriculture, any pieces of media that you guys think could help me understand better how to achieve my goals?
If you aren't already, look for mods that might accomplish similar objectives and look at their code
asking me to look at code its the same thing as asking a medieval knight to play minecraft
I'm willing to learn tho
I'm a bit familiarized with lua
trying to learn more about it and such
This really is the best way to learn if you can already read a bit of LUA
Mods that add in recipes and items don't contain much lua if at all, maybe some distribution logic so it may not be as bad as you're expecting
Do you have more specific goals? I'm not sure what "player effects" would cover, and there's a lot of stuff you could do at different places to agriculture (note that agriculture is likely to still get more updates in B42, so you nay need to adjust any agriculture related mods)
aww man this is going to sound silly
making a weed mod π¦
haha theres a few of those to reference
is anyone in this chat not making a weed mod??
You're talking to the guy who made the Brown Cows Give Chocloate Milk mod
And Start Game on Fire
can you please autograph my steam profile
hahahahaha
So i have plenty ideas to go around
That mod is literally one line to change one value but I love how much of a reaction it got.
I'm trying to make a mod that has a more realistic and useful approach to weed
and for that to happen i want to have multiple strains
some with high cbd some with high thc
thinking about integrating some traits into it
Different strains just means doing the same thingmultiple times with some slight changes.
masochist behaviour
Hemp & Tobacco
N&C's Narcotics
HGO Expansion (B42)
<B42>Reefer Madness
These are a few weed mods for b42 that ive come across, they would be a good starting point. Most have different strains and effects already
There were a few mods that did traits and other things in b41 but i dont believe they are updated yet
The alternative is you have to build an entire framework to add cbd/thc instead of just saying "this type does this, this type does thie, this type does this"
I'd break it down into the seperate things you want to add.
I'll take a look right now
Also keep in touch so our mods are compatible, i've been making patches for all those that i come across π
That's always a good way to learn. Try looking at what's broken with a B41 mod and try to fix it. Even if you don't feel comfortable uploading it, it's a good learning experience.
my digital footprint is a long way from salvation
ill post anything
More Smokes for B41 had traits and moodles for weed, it was pretty well done from what I remember
WHY!?
wdym ?
I can only rgb if I have two strings to input?
That's the B42.2 -> B42.3 changes for the API
Didn't notice the new string
I didn't know B42.3 was out
starts backups
I got up, went straight into a work meeting that is still happening, and havn't caught up on any news yet
But I'm on discord whiel doing this stupid "morning standup" that goes for an hour.
Yeah I just finished doing a massive refactor for work and now I'm deciding whether I want to work on my mod or just play
It just released tbf
Is there a way to integrate the library files into my IDE so I can use stuff like autocomplete?
i woke up to 15 comments telling me the update broke my mod lol
Yea, Umbrella
update got approved very quickly this time so the addon manager should already be up to date
- Updated Make Bowl of Oatmeal and Cereal recipes to require fluid in the bowl instead of a separate container, reduced amount from 0.4L to 0.3L as that's how much a bowl holds.
- Updated Create Brain Tan recipe to require water in the bowl, reduced amount from 0.5L to 0.3L since that's how much a bowl holds.
Finally, crafting can use an appropriate container with water instead of needing a sperate container
Milk is now 100% less stressful.
Good to know.
I forgot how ugly the default skin is. Thank you Spongie for saving us from that!
ive got a weed mod , it includes growing them but its unlisted unfortunately the client who commissioned it dont want it public
Weird, but I guess when you pay money for a mod you can ask for that.
is this gonna fry my cpu?
Depends how many zombies there are I guess.
next() does not exist in kahlua
Yes, zombies outside the active area are not getting updated every tick
grr
use a pairs loop, set a flag and break immediately or use numeric indices so you can check the length of the table
that probably wouldn't be cheaper than just not checking if the table is empty though
I'll just remove that check then and thank you <3
wait should I use LuaEventManager instead of handling everything on my own?
im so confused
that woudl be easier
doing it yourself in lua can be faster though i'm not sure if this approach is
pairs loops are kinda expensive
This sounds so unnecessary ?
What's your goal with that exactly ?
Use OnAIStateChange, and do an instanceof against the states for PathFindState2 and WalkToward* to determine when a zombie first begins moving, and ends moving... That is, assuming, just an enter/exit movement state is enough to satisfy your needs, and you don't need to constantly call the callbacks while the zombie is moving. Will take a bit of tinkering to get it to work the way you want, as, you'll need to monitor Climb* states, and switches from WalkTowardState to PathFindState2.
If you absolutely need to call those callbacks constantly, due to the way OnZombieUpdate behaves, you may want to use a delay/timer/cooldown so the callbacks aren't called more often than they need to be.
Is there a way to draw lines etc from lua? LineDrawer does not seem to be available.
@winter bolt hey man i've been following your custom voice mod guide and i did it all by instructions and it just doesnt play any lines for some reason. are there any common causes or issues that can make this problem
its usually some kind of typo in the sound scripts i think
what does the script and the voicestyles.xml look like?>
oh you didnt rename the sounds
wdym
you have to replace all "VoiceMale" with "VoiceJohnCreasman"
im not sure if notepad has a replace all feature but you can you notepad++ https://notepad-plus-plus.org/
way ahead of you jej
still silent for some reason
thank you
what does it look like now?
yeah i dont see any issues here
wtf
what do the folders look like?
I haven't checked out how it all works myself, but, shouldn't there be a comma at the end of the file = ... lines?
lua, shared, translate, en, that one file
scripts leads directly to the other file
sound, voice, johncreasman, all the voicelines
voicestyles leads directly to voicestyles
i did it like you wrote
oh
youre right its missing the comma
lmfao
if you search replace "ogg" with "ogg," it should work
holy hell
good news it works
thank you guys
i can finally play road of the dead 3
I mean I do kinda have to poll their position in a fixed update kinda way so idk if this would work for me
OnZombieUpdate won't help you then, either.
It's somewhat .. erratic, depending on what the zombie is up to.
And, assuming any other mod messes with the zombie position, it could take seconds before your mod would become aware of it while waiting for the OnZombieUpdate.
If you need accurate position tracking, you'd have to combine OnZombieUpdate with a custom rolled solution using OnTick that grabs the current position of a handful of zombies per frame. It's important to take note of the handful.
You could attempt using a metatable override for setX, setY, etc, to just try and catch mods messing with positions, but, I've had mixed success personally with the metatables overrides.
You could also just say "not compatible with <mod that messes with zombie positions>"
Depending on if that is likely to be a rare thing where people want both mods or something that will happen often enough you do do need to try and handle it.
how so?
wait are some events client side only?
WARN : Lua , 1739328819314> LuaManager$GlobalObject.require> require("client.MixVaultVHS") failed
anyone able to help with this? i can send the requesting filesif not could be a simple folder structure idk
require paths should be separated with /s and shouldn't include client/shared/server
local MixVaultVHS = require("client.MixVaultVHS") so i need to remove client for media/lua?
if your file is media/lua/client/MixVaultVHS you should do require("MixVaultVHS")
ahhh okay ill give that a shot thanks
hmm still failed is it an issue the file requesting it is coming from
media/lua/shared/MixVaultVHS_system
How do you use require for the file?
you can't require client from shared
folders load shared -> client -> server, require cannot jump ahead in this order
there may be an issue with your design if you need client-only code in a non-client-only file
i want it to work in a server
It's worth mentioning (I don't think it's changed), but, where you actually put your files doesn't matter in regards to shared/client/server, except for load order and requires. Files in server aren't limited to only be used by the server, for example. You specifically need to make sure the code only executes on the server, inside the code, if that's what you're after.
But, albion is right here. If you're trying to access something that's supposed to be client code, outside client code, you're taking the wrong approach. The code you're trying to reference should probably be moved to shared.
still says require failed ;-; its a small file if someone doesnt mind checking to see where i went wrong
its a 1 item mod
this isn't entirely correct, while the shared and server folders do load in both, the client folder does not load on servers
shrug, good to know, I suppose. Never bothered to pull apart the file loader, and I've never used client for code I wanted on the server π
yeah, i recommend still strictly sticking to as if they do work that way, it's just good design
so if i want this to work for server i need to but same files from client to server?
Exception thrown java.lang.RuntimeException: attempted index: new of non-table: null at KahluaThread.tableget line:1689. i get this now no require fail
Depends on what you're doing. PZ is in a strange place where the server doesn't have total authority over everything. Sometimes just doing it on the client works for MP, just depends on what you're doing.
We need code.
MixVaultVHS_System.lua is missing the require.
MixVaultVHS_System does not require MixVaultVHS, but tries to use it
hey guys do you know how i can upload a mod to the workshop
It's the workshop option from the main menu in-game
LuaManager$GlobalObject.require> require("MixVaultVHS") failed
it's not showing up. do i need to retain the b42 mod structure (modname - 42.0 - content)
i updated the require
horrific
folder-name
- Contents
-- mods
--- folder-name
---- 42.0
----- mod.info
----- poster.png
---- common - preview.png
- workshop.txt
btw whats the common folder even for
Loaded regardless of game version, basically the 'shared' folder in regards to media/lua
Of course, ignored in B41. It's a B42 thing onwards.
generally it's wise to put any assets in common
oh isnt that bad
as in
my voice mod has assets in its' mod folder
should i transfer them to common?
It's not strictly necessary to use common, but, if you do end up having to make fixes for specific versions, meaning multiple folders named like 42.0 (42.5, 43, 44...), you'd need to copy the assets again to each one
So, common is a great place for things that generally don't break from updates: images, sounds, etc
it is still not showing up LOL
what the hell
Did you restart after making the changes?
If so, check your console.txt, could be a hint there.
Wait. I just looked at that screenshot.
You want to use C:\users\<username>\Zomboid\Workshop (is that the Windows path?)
you have to go here
Yea, that. The Workshop folder in the game folder is used by the server.
Although it also uses the Zomboid/Workshop folder, to make it a little awkward.
If a player can learn any recipes from an item with this system, right-clicking on the item will provide a right-click option with a light bulb option to "Research Craft".
Throws away an entire mod he was working on that used this as a main feature
lol
this reminded me shoutout to Bjorn for putting me onto error magnifier because I felt crazy trying to figure out where the error was coming from with my mod when everything was working fine
and as it turned out, just missing a comma
Use a decent IDE that has LSP support, and, never miss a comma again.
Arguably, all the more reason imo. It screams the errors/warnings at you from the get go, so, y'know, there's no real guesswork.
there's nothing to justify, we use the software we do because it makes things the easiest
I use Doom Emacs, but, that one, definitely is not one you should use. That's one you could argue you need to justify.
Run VSCode, I think that's what everyone still on Windows replaced NPP/N++ with.
VSCode + Umbrella will save you from countless hours of minor issues
Also, free and easy to setup.
im the dumbest mfer ever
what the hell?
it's all here
I started in BASIC when you had to prefex everything with a line number. Then to make any changes you had to retype the entire line.
Is preview.png a 256x256 png image?
yeah
Yea, I remember. Good fun, the languages we used to use >.>
Did you put it there after you started Project Zomboid?
nope i restarted
The game is not great at noticing new files appearing
hmm
Try using the preview.png from the ModTemplate
In case it hates your png for some stupid reason.
better than workship.pdf.exe
@pseudo sleet
there's no way
im killing myself its over
like 40 minutes of troubleshooting
2 iq
thank you
very veyr much
i couldve never figured that out
Blame Microsoft for having extensions hidden by default >.>
all you have to do, is replace the masksfolders on all 3 alice suspenders ClothingItems files with this in the code
Does anyone know how to programmatically obtain all filenames in one of my mod's folders?
I heard there's a bug when player have thirst, and they filled a bottle with water, then calories are nil
I'm figuring out why it's happened, and i just found this code
local hookAutoDrink
hookAutoDrink = function(character)
if not ISTimedActionQueue.hasActionType(character, "ISTransferWaterAction") then
Hook.AutoDrink.Remove(hookAutoDrink)
end
end
if getCore():getOptionAutoDrink() then
Hook.AutoDrink.Add(hookAutoDrink)
end
any thoughts about this code? why this code removes/adds itself instead of Hook.AutoDrink.Remove(autoDrink) or local hookAutoDrink = character.autoDrink?
I'm not sure I think it's weird because of lack of my knowledge or it's really a weird thing.
is there an issue in my structure?
both MixVaultVHS_Items and MixVaultVHS_System call for MixVaultVHS
well require
actually i heard before i can require from shared to client does system need to move?
autoDrink belongs to IsoGameCharacter, which is called by updateThirst, which is called by calculateStats. That's how the auto drinking functions.
Per the comment just above that section of code, it stops the character from auto drinking water during transfer:
autoDrink attempts to trigger the function passed into Hook.AutoDrink.Add, and, if it does, it doesn't drink. The function then removes itself after the transfer is complete, so auto drinking can operate as normal.
but Hook.AutoDrink.Remove(hookAutoDrink) means they are gonna remove this function
function hookAutoDrink(character)
if not ISTimedActionQueue.hasActionType(character, "ISTransferWaterAction") then
Hook.AutoDrink.Remove(hookAutoDrink)
end
end
isn't it?
If so, how do they remove actual drinking function by that? shouldn't there be something like enable/disable auto-drink?
They don't remove the drinking function. The existence of that function prevents autoDrink from happening.. sec
lua\client\ISUI\ISInventoryPaneContextMenu.lua line 3998
oh so just disturbing the action instead disabling it?
hooks basically run instead of some vanilla code, if there's a hook added then the vanilla code won't run
they're barely used and the ones that do exist are basically just not useful so they're not well known
Hello, which of these commands is responsible for the frequency of item drop renewal on a dedicated server?
LootRespawn = 1
HoursForLootRespawn=576
okay so let me sort.
local hookAutoDrink
if getCore():getOptionAutoDrink() then
Hook.AutoDrink.Add(hookAutoDrink)
end
- so they override autoDrink() by this(with empty code) before transferring
function hookAutoDrink(character)
if not ISTimedActionQueue.hasActionType(character, "ISTransferWaterAction") then
Hook.AutoDrink.Remove(hookAutoDrink)
end
end
- after overrode, they removes empty code by this (so bring
autoDrink()back)
did I understand correctly? I didn't know hook will override the vanilla code instead adding
Basically, yes.
Not that autoDrink is ever really overridden
Just a specific part of it is .. intercepted.
Although, you did get that backwards: That function is added to the hook when transfer is happening, and removed when it's finished.
The new function is responsible for cleaning up.
oh yeah they defined earlier. i was talking with what i edited
I mean, it's really just a round about 'while' loop.
You could summarise it as while [ transferring water ]: do nothing
how to refresh texture cache without close the game
It would appear Water, TaintedWater, and CarbonatedWater are missing the 'Calories' property in media/scripts/fluids.txt
If anyone wants to test that to make a mod to fix it, go ahead.
Override that file and add the Calories properties to those three fluids.
but wasn't it okay until 42.2?
Tap water was still using the B41 water system before 42.3.
local function UpdateRadiosPower()
for i=0, getWorld():getCell():getObjectList():size()-1 do
local object = getWorld():getCell():getObjectList():get(i)
if object and object:getDeviceData() then
local deviceData = object:getDeviceData()
deviceData:setHasBattery(false)
deviceData:setUseBattery(false)
if not object:getSquare():isPowerOn() then
deviceData:setIsTurnedOn(false)
end
end
end
end
Events.OnLoadMapZones.Add(UpdateRadiosPower)
I got something Like that dont know if its shoulb be in this format
I've never used auto-drink ever, I always drank a bottle of water manually. or only auto-drink function is broken with calories?
odd..

like- when calories is nil, manual drinking does not pass nil but auto drink passes nil?
sorry if i'm bothering you :p i always have bunch of curiosity when encountered something like this.
it still is, just modified a little to be smoother
they rewrote a lot of the code to do with actually drinking fluids and i guess this slipped through
Yea, uh, the useWater, getWaterAmount, etc are all strictly the Fluid system now, no more references to the waterAmount key in the ModData table
no, the taps do still use that moddata
see IsoObject#setReserveWaterAmount and its reference in IsoObject#setWaterAmount
Oh I see, it's in a weird hybrid state.
Are you running that when a cell is first loaded?
The way I'm approaching it is to only make a change when the player uses a radio, and to swap back and forth between plugged in and powered based on the situation
Which is more complicated than I originally thought because a lot of the radios work both when placed and when held in the hand
Regardless, the items being filled are FluidContainers, and Water has no calories property ._.'
Does water need a calories property?
If it lacks one, does that cause issues or just get treated like zero?
I'm assuming so, other things that are 0 cal specifically have that property.
Nope, it should be fine.
Calories is defaulted in the properties to 0.
it was okay until 42.2 cuz I always drink my water manually. it was 0 instead of nil
I saw they changed autodrink to use the same function as drinking, which would fix the bug about autodrink curing thirst far more efficiently
More importantly it should allow a mod to autodrink whiskey.
I think the autodrink feature should be removed tbf
Is it nil, or NaN? It'd have to be NaN, surely, it's a float.
It just doesn't make sense to have autodrink as an option when your life is easier with the option. At least make it a sandbox option as it affects gameplay and should be equal between each players
nil
Tho not sure I understood your question right
I try both , one where I get two radio places by myself and try to get to a military base and test radio⦠its seeem Like the radio dont get uptade
Okay, what is it people are seeing that's making this visible?
autoDrink()
float var2 = this.stats.thirst * 2.0F;
float var3 = Math.min(var1.getFluidContainer().getAmount(), var2);
float var4 = var3 / var1.getFluidContainer().getAmount();
((IsoPlayer)this).DrinkFluid(var1, var4, false);
DrinkFluid(InventoryItem var1, float var2, boolean var3)
var6.setCalories(var6.getCalories() + var4.getProperties().getCalories() * var2);
what will be happened if we do * nil for * var2
NaN
.. is it a division by zero? Wouldn't java throw an error?
no, it'd result in NaN
It's a division by zero
NaN is returned whenever floating point operations are invalid
The pre-existing ones are not being updated? Are you sure your code is going through all places items correctly?
So... if they drink empty bottle which have no fluid types then it will be Nan?
Maybe, hold on, does autodrink check?
I'm too sick with COVID to be fooling around with this
oh hard to explain in English but anyways the puzzle fits together.
Like I mentioned, I'm going for a very different approach so I don't need to hit each existing radio... The npcs left them on battery because they used the power cords to tie generator manuals to their sledgehammers before throwing them in the river. Only you, the player, has the power to plug a radio in now.
i'm not actually sure if this should ever be null
it looks like it defaults to zero if not set
So I can trigger the code based on the player using a radio.
Which works great, except for when a radio breaks so none is the buttons work anymore which I'm trying to figure out the cause of.
so basically if var1.getFluidContainer().getAmount(); is nil or 0 then it will be Nan
and nan goes to DrinkFluid()
i tried throwing some of the stuff i've been saying into a java compiler and it doesn't actually result in NaN
Yea, it checks in getWaterSource for empty
the result of dividing by 0 is Infinity instead
So it can't be division by zero

Wait, what, LOL
Imagine checking the nutritional information on your bottle of drink and seeing Calories per Serving: NaN
I get an exception in a random online compiler shrug
Java versions ftw?
yeah probably language version specific, i did look up what i was saying and seemed correct before asserting it so potentially there are three different behaviours that can happen π
You mean its will update when a player place it ?
Or maybe i can try to make a recipe that change the radio behavior ?
north facing elevators are a go. you wouldn't climb 26 floors would you?
my friend said
// if var1.getFluidContainer().getAmount() is nan or 0 then
float var3 = math.min(var1.getFluidContainer().getAmount(), 1) // -> nan or 0
float var4 = var3 / var1.getFluidContainer().getAmount() // -> always nan
.
.
.
var6.setCalories(var6.getCalories() + var4.getProperties().getCalories() * nan); // -> nan is here because var4 was nan
// and will run without any error thrown
i'm a beginner modder, im trying to make these bank safes into containers. But in tilezed I can't find the safes or ATMs in location_business_bank_01 it's missing these 6 tiles. Where can I find them? All are in the brush tool though
ok yeah can verify, dividing zero by zero results in NaN
I've changed vanilla tile objects into containers by setting the tile properties in the event OnLoadedTileDefinitions
Finally! It's time to go to home from work now, and the issue torching me since this morning is also finished at the same time π€£ π
something like this should do that tile ```lua
local vals = IsoWorld.PropertyValueMap:get("container") or ArrayList.new()
local vals2 = IsoWorld.PropertyValueMap:get("ContainerCapacity") or ArrayList.new()
if not vals:contains("Safe") then vals2:add("Safe") end
for i = 1,20 do
local val = tostring(i)
if not vals2:contains(val) then vals2:add(val) end
end
Events.OnLoadedTileDefinitions.Add(function(manager)
local sprites = {
"Location_business_bank_01_69",
}
for _, sprite in ipairs(sprites) do
local props = manager:getSprite(sprite):getProperties();
props:Set(IsoFlagType.container);
props:Set("ContainerCapacity", "20", false);
props:Set("container", "Safe", false);
props:CreateKeySet();
end
end)
What I'm doing (and this isn't the only way, and probably isn't the best way) is using the Radio GUI as the trigger - the first try was to add code to the function behind the on/off button. Turns out the function behind that gets called 4 times every time you press teh button, and by that time the whole interface is already rendered and doesn't want to change. I'm working to change that to happen when the radio gui first reads in the radio data instead; I sneak in just before it reads the data and change the properties.
So I sneak my code in here:
And the code currently looks like this:
Found the division by zero.
getWaterSource allows empty FluidContainers to pass through if they're being filled
ISTakeWaterAction flags the item as being filled, and .. tada. autoDrink can now use an empty FluidContainer.
anyone got any example folder structures it has to be that causing my require error
If anyone wants to verify that, please do.
Maybe its more simple to make a recipe? u change only the radio u want to change when you came to base ? π€·π»ββοΈ
That is definitely a simpler way, make a withPlug version of each radio and then one recipe to convert to plug/one recipe to convert back, with input mapping for the different radio types.
This
I Think I Will do Like that but thx a lot for the help π
I'll get the radiomenu/lua thing to work one day, to give a different option for pluged in radios
If u manage to do it work, i will gladly integrate it into the file if u want π
adding world context menu for b42 is different now? i cant seem to add mine
i have not had issues appears the same to me
damn
function MixVaultVHS:addTape(tape)
table.insert(self.tapes, tape)
end
would this not work because tapes should be Base.VHS
tapes comes up as nil
so i got it to load i overlooked it simply had a unneccesary file now ingame trying to use item list to spawn it in debug i get a error and item lists shows 0 items any ideas?
ERROR: General , 1739358762036> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: missing argument #1 to 'lower' at KahluaUtil.getArg line:380. ERROR: General , 1739358762036> DebugLogStream.printException> Stack trace: java.lang.RuntimeException: missing argument #1 to 'lower'
Hey there smart people,I have a question with the new animals in b42 can you make a dog?
Nop
Only remodels and retextures exist for animals rn
What type of item is a backpack in the code?
Inventory containers not work for backpack
@tacit pebble Assuming you're N0wh3re:
The best way to do it, in my opinion, would've been to actually use the AutoDrink hook that you were confused about before to prevent autoDrink from triggering during ISTakeWaterAction, and auto cleaning itself up once it was finished.
Thank you but I'm worried about using anything which I'm not used in. (even it's everything what you and albion said, but still I have no experience...
)
I'm playing pz with a local mod which tweaked the part what we was talking already tho.
when I'm sure it's all good then I will update again π
And I don't want to start drama here or anything, I just want to point out: whenever people help you find a solution to a problem, it's polite to credit them. Not necessary, just polite.
ofc I will credit for both(you and albion) if I uses that hook function later. from now, I'm testing the function we talked about. until now the mod does what mod have done like before. store data somewhere in code and load the data when it's necessary. old and not smart way xD
Don't be worry!
All I did until now is changed my codes from DrinkFluids timedAction to FillWater timedAction to move the start point of storing data.
@drifting ore Oh, you deleted your message. I guess you found your solution before I could reply.
If not, just incase: instanceItem is what you're after to create a new item.
im just saying because I'm worried if you didn't mean about what I said:
Please feel free to tell me if you think my behavior is something wrong.(and with my weird English)
I'm not kind of smart person so I sometimes goes wrong π€£
don't worry about my mood when you think I did something wrong.
also I will tell you if I don't think something right. I guess this is how humans conversation. π
Pretty much all you have to do is copy/paste the existing code that you saw for the AutoDrink hook, and just change ISTransferWaterAction to ISTakeWaterAction, and do a "soft" override of the start() for ISTakeWaterAction.
No no, I have no issues with it. I was going to make the mod myself when I had the opportunity to do it, you saved me the trouble, along with having to maintain it and deal with support.
Generally speaking: modding is free game, anyone can do anything they want with it all. It basically falls under the 'beerware' licence. The only real exception to this is if someone explicitly states otherwise, or, you're dealing with assets. Legally it's kind of a mess, modding itself sort of falls under 'reverse engineering', and, in some countries in the world, that's illegal (except under very strict terms).
That said, wouldn't you want to be thanked for your contributions, when you're putting in time to help someone out, etc? The golden rule: do unto others as you would have them do unto you.
Modders have to deal with quite a bit of abuse (among other things..), so, it's always nice to let 'em know you appreciate them.
is there a way to get a table of zombies in loaded/active chunks on the server side?
I'm pretty proud of my newest update. Basically tracks your mods π https://steamcommunity.com/sharedfiles/filedetails/?id=3422448677
What's that ?
Mod manager I've been making for my server manager. Loads of detail on the page
Just updating up for what I showed there
getWorld():getCell():getZombieList()
is this how to get all active zombies?
I mean the server stats thingy makes use of it so ig?
yea
though you dont need the getWorld() call I believe, just getCell():getZombieList()
ty <3
If called on client it only returns zombie visible in player cell
If called on server it's very zombie in the virtual manager
good point I didn't even think about that, @thorn abyss do getWorld www
damn good stuff. thnx for this info. tho how exactly do you use it from server
so I do have to use getWorld?
the client and server stats gathering uses the same approach
local sz = zs:size()```
no i mean what for
not sure what that does but seems like a good way to sync stuff cuz ive been doing it by ping pong ive always wanted to just do it server side but didnt know if it was possible an was too lazy to test back then
can i do behavior commands from server using onzombieupdate and it will sync?
A few modders use persistent id for sync of special zombies
ive got my own way of doing it and i may have figured out another way
2 ways actually
1 is the walkspeed custom walk speed , since that syncs
2 different outfit but same appearance sorta like a boolean
Onzombieupdate is client side only afaik
sucjs, and yeah think i saw that from albions documents
You just want to use ontick or something from server side. Can get really heavy though
Is there a zombie version of climbThroughWindow that I can force them to use?
Really don't want psychic powered zombies going around busting windows for no reason
Is there maybe a way to check if the zombie is actively tracking a player's position?
having it only activate when directly involving a player, that would cut down on broken windows
Or even check if a player is in front of them and close by
I think it would be a nice touch if they just banged on your window like normal but if you got close to the window they bust through to try to get you
yeah just do it, if thats how the game does it then I'd trust it
why do you omit the getWorld() call here?
I am confused if you're supposed to use it or not, I was under the assumption that getCell():getZombieList() would give the same result
i've looked around in the channel to see if anyone asked the same questions as me, and it seems like they have but have never gotten a solid answer, is it possible to code my own stories into the game? like the randomized survivor stories you can find in buildings, like the skeleton psycho or the dead drunk story?
just using getCell seem to work
im guessing its just a shorthand for getWorld():getCell()
is there a way to show fps or frametime in debug mode?
thats wat I thought so too
I think if you press K, you can see a graph down the bottom left of the screen, idk how else though
thank you
Only zombies in player cell*
Not just visible
OnZombieUpdate is not a thing server side
2nd one is literally just the pID
But you don't have unique zombies, less at least
https://pzwiki.net/wiki/PersistentOutfitID
With pID not all zombies will share persistent data
That's what I meant. Visible being loaded in the player cell
Actually I suggest you make the distinction because visible zombies don't work like non visible ones to player sight
Non visible ones tick only every 2 ticks or so, and also zombies that weren't seen yet are not set visually
I hope one day we get access to the CombatManager or AnimationPlayer
Dang I hope in the future
Welp moving on I guess sadly but does anyone know how to make a custom trait I have looked and I canβt find a super dexterous trait thatβs not instant but just faster
it's completely unnecessary
IsoCell is a singleton, no matter what path you take to get to it you will get the same one
I thought so, but I was just confused. I initially told them to not call it but then lect replied, and I mistakenly thought he was saying you shouldn't do that, so I retracted what I said, and then he provides example code without using getWorld() so I was then confused ww
the IsoCell one is particularly annoying since there's methods all over the place that imply that there's more than one cell and that objects belong to specific cells
i haven't checked older versions but it seems undeniable that it wasn't a singleton in the past, there's way way too much code that makes no sense if it was always like this
i disapprove of the heavy usage of singletons but i suppose that's just the cpp programmer in me π
Well it sort of makes sense for IsoCell to be one because there is only one that is "owned" by the player, but then if every player loads a cell, you shouldnt have it as a singleton, but like you said the code is definitely wonky with cells
it's weirder than that, the cell can in splitscreen represent multiple separate areas
i dislike singletons because they're global state which makes testing difficult, and anything belonging to one is arguably also global state (and in this case that'd be nearly everything in the game)
in game development it's admittedly not something that matters much
and they do make more sense in java than they do in languages i'm used to using
but i try to avoid them as much as possible
I think I've only used singletons a handful of times. Most times you dont even need it.
Doesn't this also mean that by design a singleton cant be garbage collected like at all? That wouldn't be the brightest idea for a game imo
that's why it makes the most sense in games actually, because its lifetime is as long as the game anyway
singletons in things like libraries are bad because it lives forever even if whatever is linking to the library hasn't used it for ten hours
imagine a library your program only uses for initialisation, if it uses any singletons those are in memory until your program closes
that'd probably be the case either way in a game which is why it's not as big of a deal
the other reason i don't like them even in games is they have really unclear/vague order of creation and destruction (especially if you're using the lazy singleton pattern, it can be initialised literally whenever), but the first one doesn't always matter and the second one literally does not matter in java
good point
Does anyone know if there is a mod that enables you to get bricks out of the in-game tile "Pallet with bricks"?
idk if this is the right place for this question, but is there a .bmp file of the base map located somewhere? I'd like to use some of the vanilla fields in my own map, since I'm having a little trouble making my own look nice
and if that's allowed
https://github.com/Unjammer/PZ_Vanilla_Map-B41-/tree/main
Alree did reverse the vanilla map's files, you can view them (spare the TBX files, but the TMX is there) and do what you want with them
under the tmx folder lies the vanilla map
Thanks!
Does anyone know if B42.3 broke keybinds? I'm getting a lot of bug reports for ProxInv, but I don't have time to check mysel π π
is there a way to draw or do effects? The LineDrawer class doesn't seem to be availble from LUA =(
what am i doing wrong because there is no spawn to choose and the building aint even there?
ig to explain what im doing i am putting a building in west point and with the mod enabled it seems to do nothing
Hi, this question may sound silly but is it possible to add zombies with custom models, animations and properties? Or is that too far away right now?
Or can I try with the IsoZombie parameters?
Any ideas as to how youd go to implement being able to put my vhs box into a tv as its a container property not βnormalβ like other vhsβ would you modify the tv itself or make a ui to allow adding tapes and make it a βnormalβ item
Its all working now no errors just cant get it to go inside the tv player
why do you want the box to go in the tv
Its a VHS mixtape idea u can add vhs tapes to it and itll play all tapes in order or shuffle if toggled useful for music without having to keep swapping tapes
^
Oh do you have all of that programmed for lua or?
I think you would need to add storage to the tv itself
and then you would probably need to have it access the box one at a time and play them, detect once it's done playing, and then take it out and put in the next one
idk if the tape deck UI has any functionality for removing/adding items the way containers do
so why is the lots 45 25 when i had 38 22 selected?
i want 38 22 but its doing something else why?
Its all in the lua i cant necessarily check its all functional as i cant insert it where vhs can go
Is this a correct distribuition file? If so how can I make my item spawn there?
Distributions = Distributions or {};
local distributionTable = {
toystore = {
isShop = true,
counter = {
procedural = true,
procList = {
{name="GigamartToys", min=0, max=99, weightChance=100},
{name="StoreCounterCleaning", min=0, max=99, forceForTiles="location_shop_accessories_01_0;location_shop_accessories_01_1;location_shop_accessories_01_2;location_shop_accessories_01_3;location_shop_accessories_01_20;location_shop_accessories_01_21;location_shop_accessories_01_22;location_shop_accessories_01_23;fixtures_sinks_01_0;fixtures_sinks_01_1;fixtures_sinks_01_2;fixtures_sinks_01_3;fixtures_sinks_01_4;fixtures_sinks_01_5;fixtures_sinks_01_6;fixtures_sinks_01_7;fixtures_sinks_01_8;fixtures_sinks_01_9;fixtures_sinks_01_10;fixtures_sinks_01_11;fixtures_sinks_01_16;fixtures_sinks_01_17;fixtures_sinks_01_18;fixtures_sinks_01_19"},
{name="StoreCounterBagsFancy", min=0, max=1, weightChance=100},
}
},
shelves = {
procedural = true,
procList = {
{name="GigamartToys", min=0, max=99},
{name="StoreShelfCombo", min=0, max=99, forceForTiles="location_shop_generic_01_0;location_shop_generic_01_1"},
}
},
},
toystorestorage = {
isShop = true,
shelves = {
procedural = true,
procList = {
{name="GigamartToys", min=0, max=99},
}
},
crate = {
procedural = true,
procList = {
{name="GigamartToys", min=0, max=99},
}
}
},
}
table.insert(Distributions, 1, distributionTable);
--for mod compat:
SuburbsDistributions = distributionTable;
@bronze yoke Happen to read Game Programming Patterns in regards to singletons? π
Because Mapping tools still use 300x300 cells and coords
Once exported your map use the new 256x256 system so your cells in the new world coords is
38 x 300 = 11 400
11 400 / 256 = 44,xxxx
22 x 300 = 6 600
6 600 / 256 = 25,7xxxx
nope, i get my opinions from stack overflow posts
Could've fooled me, it's basically 1:1, haha.
sounds like an interesting read either way, i may look into it
The singleton issue your seeing these days really comes from working with Unity, and Unity like engines: the .. 'component' design sort of makes people feel like they need singletons for everything, and, everywhere they look, they're told to use 'em. They never consider other options.
"Managers" running rampant.
absolutely, i come off very harsh about them, but like most 'bad' design patterns there are situations where they are genuinely useful - just not most of the ones i see
It would be a complete replacement, not something to integrate. Would you prefer to do that as a new version of your mod, or I can make a seperate mod for it? (once I chase down the why-did-this-radio-break bug and test some more situations, make sure I didn;t break car radios or televisions...)
Could be management wanting The New Thing even though it's not a good choice. Or a dev adding The New Thing because it's shiny and new. I've seen both in software development.
Just wait for my AI-powered blockchain mod for Zomboid!
You'd have to post that to nexus, Steam cracked down on all that nonsense just recently π
I saw they got rid of add-supported games, I didn't even realize they were becoming a thing on PC. They are already a cancer on mobile.
Happen to remember the Facebook/meta thing about pushing ads in VR? ._.'
Free space in in-game virtual billboards, so, why not profit on it >.>
ngl this sounds simple but my brain is not putting the pieces together, does it have something to do with this?
we talk about two separate things
To be simple, your cell 38x22 (in B41, 300x300) is now 44x25 (in B42, 256x256) period
oh im dumb i get it now
good read, yeah that is pretty similar to what i said π
ok so now why is it not loading it shows up in the mod menu but the building nor the spawn choice is there
Really, the way I feel about singletons is the same way I feel about all coding in general: do what makes sense to you, and makes it easiest for you. Programming is challenging/stressful enough without having to worry about following best practices/standards all the time.
... as long as you're not doing cursed cast chains and pointer black magic when you really, really don't need to be.
best practice should be something that you build from your own experiences
no map.info file, no objects.lua, no spawnpoints.lua, no worldmap.xml
You should try #mapping and at least read pinned message and add map.info file
Look slike you just rushed your map
I do feel there's things some people definitely need to be taught, but, it really only matters for large projects, just so they could avoid the future refactors and spaghetti code.
oh it changed a lot then from b41 then i didnt know
Learning that by experience kinda sucks, ngl.
nope all these files were also in b41
and map.info was always mandatory as it contains information about "how the map should be spawned in the world"
yeah that's true, i just stress that you shouldn't stick strictly to 'rules' because most rules aren't entirely true anyway - this will inevitably cause you problems but solving those problems is the only way to really understand the rule
Well, is it that the rules aren't true, or, they're only true from project to project, company to company? π
Would it be possible to make tvβs automatically cycle vhs tapes from a container? I understand as suggested before i may need to make a container slot to allow it to be placed in the tv itself
Id either need a timer per vhs or maybe a end function is already in vhs for when it finishes
well when it comes to things like project style rules you should strictly stick to them since a project being consistent is the most important thing for maintainability
huh weird in b41 i had the old version of custom building work with just the map.info
That's just it: it's all circumstantial .. even when the circumstance makes absolutely zero sense. "Because the manager likes the code that way."
yep and your actual folder miss this map.info file
Did u sleep properly π
5am to 1pm so prob not
Those sleep schedules usually make u feel tired from experience
If I wanted to make a mod that removes zombies from a specific location, is there an easy layman's tutorial I can look into?
Since its your hardwork i let you doing a separated mod dont want to get award for something I donβt understand for now π
Btw I got some trouble to integrate my recipe in game β¦
Where can I find how the folder should be ?
I don't know about a tutorial, but for example, this is my function to get all zombies within a certain distance from a given character into a table:
function GetNearbyZombies(character, radius)
local zombies = {}
local x = character:getX()
local y = character:getY()
local z = character:getZ()
for _x = x - radius, x + radius do
for _y = y - radius, y + radius do
local sq = getCell():getGridSquare(_x, _y, z);
if sq then
for i = sq:getMovingObjects():size(), 1, -1 do
local movingObject = sq:getMovingObjects():get(i - 1);
if instanceof(movingObject , "IsoZombie") then
table.insert(zombies, movingObject)
end
end
end
end
end
return zombies
end
Then you can do:
local nearZombies = GetNearbyZombies(getSpecificPlayer(0), 15)
for _, zombie in ipairs(nearZombies)
zombie:removeFromWorld()
end
I have absolutely no idea if removeFromWorld() does what I think it does (I've never tried to remove characters), but if anything, this should hopefully point you in the general direction and someone can correct me.
You can find the LUA documentation in https://projectzomboid.com/modding/index.html , in case you didn't know. "Documentation" might be an overstatement, though.
package index
Thank you!
In all honestest - it's mostly laziness that pushes me to look into this - there's a specific cabin I want them removed from so I can just "move in"
In that case, I think just firing up PZ in debug mode and removing all zombies in the area should do the trick.
Anyone have advice on how to add a custom keybind for a controller?
for a mod
oh not sure about that but u should be able to find the controller binds in
C:\Users%user%\Zomboid\joypadBinding.config
might be able to do a r3+ x sorta thing potentially
The answer to this is ISButtonPrompt if anyone else needs this 
I was doing some reading and saw some discussion about player:getCell()
Can anyone confirm? Is player:getCell() a predetermined area of a map or is it a sort of floating cell/amount of tiles relative to the player's position?
Is it possible that the player function for getCell is floating/relative to the player, whereas the IsoGridSquare function is fixed?
(My concern is functions utilized by the return of player:getCell() will not grab data needed from very close, neighboring cells - ie. closeby zombies near the player, but just over the cell border)
It follows the player
getCell standalone too does that
getCell():getZombieList() gives zombies loaded by the player cell
Player cell which is the area surronding the player based on render distance which varies from MP and SP
optimizing the function of this to make it so it checks if the zombie currently has a target to prevent random window exploding, and also adding in the option to include fast and slow shamblers instead of only sprinters
The target check is being added because I noticed that if a zombie loses aggro on you, they'll touch the window and cause it to explode just to stand there in front of it awkwardly.
So what you end up with is psychic zombies exploding windows for fun, instead of hungry zombies throwing their entire body weight into the window to kill you
Is there a way to target a zombie's strength the same way as speedType ?
local strength = character:strength()
print(strength)```
doesn't seem to work
Hello there, with B42.3.1, I got: WARN : Mod f:0, t:1739471105456> ChooseGameInfo.readModInfoAux > can't find "..\MoodleFramework\common\mod.info" My mod.info is under ```"..\MoodleFramework\42.0\mod.info"
if the mod is working i'd just ignore it
Another thing which is going to bloat the fucking console π
We already didn't have enough of the 2000 lines of "workshop ID not found" or whatever this shit is
weird, i don't have any warnings like this in my log
That's because Albion 
this is what I used. idk if it works in 42 but I don't see why it wouldn't. pass it an IsoZombie and a string like "strength." This is a pretty slow way to do it, btw
local function getZombieJavaField(daZamby, whatUWant) -- (IsoZombie, "strength")
local offset = string.len(whatUWant)
for i = 0, getNumClassFields(daZamby) - 1 do
local m = getClassField(daZamby, i)
local mval = getClassFieldVal(daZamby, m)
if string.sub(tostring(m), -offset) == whatUWant then
return mval
end
end
return nil -- you ain't livin right, son
end```
could maybe store the index because I don't think they change
You can just use Starlit library to have easier access
You can just use Starlit library to have easier access
Ok lol ?
Starlit is awesome, I didn't think about it but it's a bit more than what they asked I think
They already know about Starlit, they already used it, I already helped him with that
ok Sir, I'll be on my way
Why are you having such an attitude lol ?
didn't know I had an attitude. I agree with you that Starlit is easy, I didn't know you had helped them, but really I still think based on the info I saw, it's a bit heavy for what they asked. Maybe they need more than I know about. It's all cool
just reading and learning new things
Idk just this
Just copy pasting a message like that is often kind of insulting, meaning you just didn't give a shit and if you did there's just no need
Also this
I'm 47 years old, y'all are lucky I don't type in all caps like a boomer. I didn't know copying something was insulting. I was agreeing with you about Starlit.
Guessed it yeah
you got it handled, I'll keep out of it
That's fine we're cool, missunderstanding happens
Also you're welcome to help others, my message was mostly that they are already using Starlit to check for the speed of zombies
So it's fine if they use to access other stuff on the zombies
And tbf it makes life way way easier to just use Starlit and not bother with the massive code needed just to access a field
now we got a problem. what u mean? :/
Guessed the agreeing with Starlit after seeing your answer to me finding you rude
you know way more than I do about modding this game. I would believe you over me any day
ok, I thought you meant the age
No lol dw
Eh I'm still fairly new, there's a lot of stuff idk about
In fact accessing fields I'm grateful you shared a clean example because I've been wanting to add the method of accessing fields in the wiki
I would rename the args. I write stupid ish in my functions
No worries your example is fairly clean but I'll clean it up a bit out of respect to not just copy pasta the whole thing/give a more general example than just zombies
ya rewrite it like a normal person. I do a lot of checks before I get to that func is called
π
LOG : General f:0, t:1739480255586> [craftRecipe] removing script due to load error = CraftHamRadioMakeShiftToAC
ERROR: General f:0, t:1739480255594> ExceptionLogger.logException> Exception thrown
java.lang.Exception: CraftRecipe error in CraftHamRadioMakeShiftToAC at CraftRecipe.Load(CraftRecipe.java:409).
Stack trace:
zombie.scripting.entity.components.crafting.CraftRecipe.Load(CraftRecipe.java:409)
zombie.scripting.entity.components.crafting.CraftRecipe.Load(CraftRecipe.java:263)
zombie.scripting.ScriptBucket.LoadScripts(ScriptBucket.java:265)
zombie.scripting.ScriptBucketCollection.LoadScripts(ScriptBucketCollection.java:122)
zombie.scripting.ScriptManager.loadScripts(ScriptManager.java:1643)
zombie.scripting.ScriptManager.Load(ScriptManager.java:1566)
zombie.GameWindow.initShared(GameWindow.java:161)
zombie.GameWindow.init(GameWindow.java:1437)
zombie.GameWindow.mainThreadInit(GameWindow.java:694)
zombie.GameWindow.mainThread(GameWindow.java:589)
java.base/java.lang.Thread.run(Unknown Source)
hey can someone help me with this error type im trying to make my recipe but something went wrong and idk what i try to change my recipe.txt nothing is working ...
if its can help you this is my recipe.txt for the HamRadioMakeshift
recipe Craft HamRadioMakeShiftToAC
{
PowerBar,
ElectronicsScrap=3,
ElectricWire=1,
[Recipe.GetItemTypes.Aluminum]=4,
HamRadioMakeShift,
keep [Recipe.GetItemTypes.Screwdriver],
NoBrokenItems:true,
Result:HamRadioMakeShiftToAC,
SkillRequired:Electricity=1,
NeedToBeLearn:false,
Time:100.0,
OnCreate:Recipe.OnCreate.RadioCraft,
OnGiveXP:Recipe.OnGiveXP.RadioCraft,
Category:Electrical,
}
craftRecipe CraftHamRadioMakeShiftToAC
{
timedAction = DismantleElectrical,
Time = 100,
needToBeLearned = false,
SkillRequired = Electricity:3,
Tags = AnySurfaceCraft,
category = Electrical,
AutoLearn = Electricity:9,
xpAward = Electricity:20,
inputs
{
item 1 Base.PowerBar,
item 1 Base.ElectronicsScrap,
item 1 Base.ElectricWire flags[NoBrokenItems],
item 4 tags[Aluminum] flags[NoBrokenItems],
item 1 Base.HamRadioMakeShift flags[NoBrokenItems],
item 1 tags[Screwdriver] mode:keep flags[MayDegradeLight;NoBrokenItems],
}
outputs
{
item 1 PoweredRadio.HamRadioMakeShiftToAC,
}
}
}
are u writing for B41 or B42?
b42
recipe Craft HamRadioMakeShiftToAC
{
PowerBar,
ElectronicsScrap=3,
ElectricWire=1,
[Recipe.GetItemTypes.Aluminum]=4,
HamRadioMakeShift,
keep [Recipe.GetItemTypes.Screwdriver],
NoBrokenItems:true,
Result:HamRadioMakeShiftToAC,
SkillRequired:Electricity=1,
NeedToBeLearn:false,
Time:100.0,
OnCreate:Recipe.OnCreate.RadioCraft,
OnGiveXP:Recipe.OnGiveXP.RadioCraft,
Category:Electrical,
}
this is a B41 recipe
it'll cause crashing if its in there
unless u were just giving it as an example
my game crash so yep its that
yeah the second one should work properly. but the first one is from B41 and would break the game since recipes are no longer coded this way
item 1 Base.HamRadioMakeShift
also
is this from ur mod?
if it is, you need to replace Base. with your module name
you should find it at the top of ur item scripts
module SupportCorps
{
for example
i was thinking its was the base name of the item according to the items.txt i search in
its got another name ?
nah, base refers to base-game.
you're telling the script to spawn an object from base game files that doesn't exist.
unless u chose ur module name while modding to be base.
then it might work.
but if its another module name you should change it to that (if its an item from ur mod)
for example, some people do this with their item scripts
module Base
{
module PoweredRadio
{
item HamRadio1ToAC
{
DisplayName = Premium Technologies Ham Radio To AC,
DisplayCategory = Communications,
Type = Radio,
Weight = 15.0,
Icon = HamRadioCivilian,
BaseVolumeRange = 10,
ConditionMax = 100,
DisappearOnUse = FALSE,
IsHighTier = FALSE,
IsPortable = FALSE,
IsTelevision = FALSE,
MaxChannel = 500000,
MicRange = 5,
MinChannel = 10000,
Tooltip = Tooltip_item_Radio,
TransmitRange = 7500,
TwoWay = TRUE,
UseDelta = 0.010,
UseWhileEquipped = FALSE,
UsesBattery = FALSE,
CanBePowered=TRUE,
WorldObjectSprite = appliances_com_01_0,
}
so this is my item script , only one in the example but i got the 3 ham radio in it
and the thing is , i want both radio , the AC one comming from my module (PoweredRadio) and the base one comming from items_radio.txt from the game file , from where i found the name of the radio... how can i do it ?
why do u want to do that?
i want to made a recipe that convert a radio to use electricity and one to revert it back to battery
im not sure if radios can use electricity.
but that wouldn't help u make a recipe
I must have misunderstood something somewhere then π
this is how i handled my lantern conversions
i essentially added three lanterns, one that uses candles, one that uses batteries, and one that can be placed on the ground
this is similar to what u wanna do with radio converting
u just have to program the radio items have them switch through a recipe
can i pm u ? i late from here and my brain dont want to understand π€¦ββοΈ but I think I have the idea I just don't have the formatting
and i keep my item.txt like it is ?
go ahead man π
don't copy it. your code works, i dont see any problems with it.
u might need to make some patches tho
we agree that I do not put my recipes in the same folder as my items
I'll start from the basics π
YEAH dont do that
recipes go into their own file
you should have a file called script that contains a file for items and one for recipes
models should be in scripts
to be sure its 42/media/scripts/ and my .txt item and recipe ? sorry brain go in vacation 
yep
like this
models go outside, items in items, recipes in recipes, moveables in moveables, and etc.
evolved recipes may go outside i think im not sure
i have like 20 model files haha
but u can put them all in one
i think
remove a doubt from me? what exactly do the models do
