#mod_development
1 messages · Page 193 of 1
I've a question, in regards to an idea for a mod that might be relatively simple, or might be impossible, depending on how accessible a certain aspect of the game is without touching the actual code.
Does anyone know if the .lua-s handle in any way the incoming and outgoing messages and/or VOIP in the radio system? I feel like it could reasonably be content that's hardcoded and unmoddable, but it would be really neat if there was a way to play around with it.
Can anyone point me in the right direction on whether the moddable envoiriment handles sending and receiving radio transmissions, and if yes, where to begin looking?
EDIT: (For added context, while I don't want to wall of text the channel with the full reasoning, I'd like to try and create a version of Radios that allow you to listen to multiple (fixed, probably only 2) frequencies at the same time, and on top of that, allows you to rebroadcast what you receive on one frequency to another. Think of someone running a radio station on an RP server, and having a separate frequency where people can 'call in', and the host can go: "Caller, you're on the air". Or, alternatively, players could set up their own mobile carrier for lower powered walkie talkies, where anyone with two walkies can talk to people across the map, because powerful radios in key places upcycle the talking frequency to the listening frequency and rebroadcast it for greater distance.)
i made this
print("option is working")
end
local function CustomContextMenuOption(player, context, items)
context:addOption("Custom Option", player, contextMenuDoOnClick)
end
Events.OnFillWorldObjectContextMenu.Add(CustomContextMenuOption)```
and that adds to the context menu Custom Option? and prints option is working? thats great its a good start
yes, you can try it if you want
thanks man just made my life a bit easier

i wouldn't have a problem figuring things out if the devs just added some comments in their code! or if there was some documentation of how things work anywhere 
VOIP is entirely hardcoded in java, text chat is all in one lua file
VOIP is also very broken atm at long distances
and a bunch of other threads on here since
i tried to even javamod it back server-side, seems it'd require client mods too or else we missed the mark
TIS says it was a security measure but it didn't make a lot of sense to me
side effect of preventing people from getting others' location via lua cheats
but most cheats are java or external so meh
also changed getOnlinePlayers breaking a bunch of mods that needed it
Alright thanks, it's a little disappointing that I can't mod it in personally, but hopefully one of the devs sees and likes the idea enough to eventually implement it on their side.
now that said, VOIP already has frequencies
on the radios
if they worked, that is
so you could already have that sort of system
Hm... Alright, then I'll have a more in-depth look over the files later, see what's accessible. Thanks again.
If you happen to know which file handles incoming and/or outgoing messages, I would appreciate it, as on the first check, the system seemed pretty byzantine
Hello
I have an issue with my lua script
Specifically an OnCreate script
I checked everything and fixed problems but items still wouldnt spawn in my inventory
I even took code from another mod and it doesnt work for some strange reason
post the lua
It would help if you showed the lua, but I will say that the OnCreate script doesn't create items but rather is a function that is triggered upon an item being spawned
player:getInventory():AddItem("Base.GoldScrap", zombrand(3));
player:getInventory():AddItem("Base.CopperScrap", zombrand(5));
player:getInventory():AddItem("Base.SilverScrap", zombrand(3));
player:getInventory():AddItem("Base.PalladiumScrap", zombrand(2);
player:getInventory():addItem("Base.PlatinumScrap", zombrand(2));
player:getInventory():AddItem("Base.MetalSlag", zombrand(2));
end```
Wow that looks terrible
There we go
The formatting isnt like that but that should be enough
First glance, you have an addItem mixed in with AddItems.
I'm no expert at Zomboid, but the game might disregard the file at start up due to the syntax error
also zombrand should be ZombRand
Alright
Let me see
Still doesnt work
There's something about getScriptItem() in the logs
@bronze yoke @ebon lion
what does your recipe script look like?
Category:Electrical, AllowOnlyOne: false, Base.Electronics Scrap,
Time: 60,
OnCreate:ScrapElectronicRummage_OnCreate,
OnGiveXP: Recipe.OnGiveXP.ScrapElectronicRummage, Result:Base.ElectronicScrap, }```
Wait
That's another versio
Category:Electrical,
AllowOnlyOne:false,
Base.ElectronicsScrap,
Time:60,
OnCreate:Recipe.OnCreate.ScrapElectronicRummage,
OnGiveXP:Recipe.OnGiveXP.ScrapElectronicRummage,
Result:Base.ElectronicScrap,
}
there we go
C:Users\yourusername\Zomboid\Saves its in a txt file called mods atleast thats where your singleplayer ones are
i dont think you need the Base. infront of electronics scrap
It does work with base but i guess that's redudant
and your custom items in your lua is contained in it?
i would name it something else, it shouldn't affect anything but it is best practice. i doubt that would fix it but if you rename it then it would be "yourmodulename"."itemname" when called in the lua. also is your lua file placed in the proper folders?
Its in lua/server yes
recipe code should be in server
The recipe code is in server
the recipe tables will not exist before server runs
even for the vanilla game recipes
So do i have to put it in shared?
every mod seems to put it in server
no, keep it in server, it will break in shared
ah well im wrong lol
yeah id check your log and if it is a lua problem it will give you the line
thats weird though when deciding what file to put things in i couldnt find much on exactly where to put it so i put recipes in shared and the 2 mods i have worked fine in server... i should change that shouldnt i?
Oh my god
i missed goddamn closing bracket
'holy shit
Also my keyboard is kinda broken right now
so dont mind the spelling
atleast you fixed it! despite my questionable help! gj
I think it's still broken
For some reason it still wont work despite fixing that issue
pulling all nighter to finish mod
is it giving errors?
Nevermind
You are putting your recipe on a text file, yes?
there was another error
but the game didnt read the updated script unless i restart completely
se.krka.kahlua.vm.KahluaException: recipecode.lua:32: function arguments expected near `:` at LexState.lexerror line:278.
I guess i used the wrong function
Here's the code
player:getXp:AddXP(Perks.MetalWelding, 0.1);
player:getXp:AddXP(Perks.Electrical, 0.2);
end```
have you defined "player" ?
getXp() not getXp
just getXp()
Alright
It's not spitting anymore lua issues
But it still doesnt work
It's just java errors now
Callframe at: PerformMakeItem function: perform -- file: ISCraftAction.lua line # 58 | Vanilla
sounds like an item required by the recipe is null
Is it on the lua side or the script side
it's happening in the java, so it's hard to say - more likely to be script i'd say
function: perform -- file: ISCraftAction.lua line # 58 | Vanilla i'd look at what function this line calls, since that's the one that leads to this error
Dont know where to look for that
Okay i found it
It's this
local resultItemCreated = RecipeManager.PerformMakeItem(self.recipe, self.item, self.character, self.containers);
does the isOutside() class work for player built structures?
Just tested, yes it does
How can I load elements dynamically?
I want to load elements on the map in the parts that are far from the character.
on "rare" loot settings i'm still getting about 12 backpacks per school when i set the chance to 0.01, doesn't seem like it's working like i think it does?
there are 5 total backpacks with this code
how do i increase the zombie spawn rate past 4?
One message removed from a suspended account.
Yeah 100% try looking at something simple though
Just looking at mods wont teach you all but it 100% helps, it helped me a lot
Reason: Bad word usage
Hello, is there any way to change the weight of items in the game by lua script, instead of having to do it manually in the item script?
I've already tried item:setWeight(), but it doesn't work, it's the only attribute I can't change. I'm trying to change the weights of a bag of food, it's a food type item.
Have you looked at the item class? Don't think there's a way to set weight like that
I looked if the class has some method to set the weight, but it seems that there is no way. At least I haven't found any way
local trueItem = getScriptManager():getItem(itemName)
trueItem:setActualWeight(trueItem:getActualWeight() * multiplier)
end
then all you do is pass it v and an array
for example
weightApplication(v, woodWeightMultiplier)
end```
That worked!
local function scriptInit_setWeight(itemName, itemWeight, multiplier)
local item = getScriptManager():getItem(itemName)
item:setActualWeight(itemWeight * multiplier)
end
for itemName, itemWeight in pairs(objList) do
scriptInit_setWeight(itemName, itemWeight, 10)
end
Thanks @tulip cipher
Anyone experience a weird bug where added context menus to the world somehow breaks that square for context menu? no errors to work with
Nvm, I think I solved it last night and forgot to test - some UI was invisible but ontop of the area
odd
is there something i can use so that when I wanna reload my mod i dont have to launch pz again? I saw that there was something like that but the page for it got removed
https://steamcommunity.com/sharedfiles/filedetails/?id=2909488957
This uses AUD's lua reloader. But you have to be mindful of what you're loading cause it can jam up your code and you need to restart anyway.
Anyone know if PZ has anything for pack()? 😦
I know unpack() is used instead of table.unpack().
I dont know but if unpack is used then i think it would be
vehicle modding question
what do I do if my car does not have wheels.
the vehicle im making wont have wheels so im at a loss
What is the vehicle?
idk if you need to make that a baseVehicle
I was thinking of maybe using the superhuman genes as a template but I dont know how id get it so it would need gas
Im really new so I am at a complete loss for even where to start
actually nvm
this is insane
i gotta pick something a little easier to do for my first vehicle mod
Hey, does anybody know how to change the player and zombie models bone local xy scale in game? (to make them look fatter or thinner)
Hello, Representative of Last Light here. I'm looking to hire a mod developer to code us a smart Type Indicator. By smart I mean less prone to desync and is optimal for server resources. We will pay for full ownership if the price is reasonable. I Apologise if this is not the place for such a request.
Could you clarify what you mean by type indicator?
We're a roleplay server and we have an issue where people doesn't know if the other is typing to reply or not. So when someone is typing in the chatbox, we'd like for there to be some kind of indication to show that they are typing.
We have a roleplay chatbox mod that it needs to function with.
there is that chat bubble mod for mp
That mod unfortunately doesn't function well for us. As far as I know with the way its designed it costs too much resources
Which is why every large roleplay server has their own indicators tailored to them, we used to have our own but stuff happened, so we're in need of a new one
Does poly count for a model matter in PZ? I know everything is relatively lowpoly but is there a limit?
Just wondering if my model isn't loading due to it being too "high" poly around 3k tris
there's no hard limit
Cool, thank you
helo can u play doom in zomboid?
Is there a way to modify the MaleBody.X shape to make it look fatter?
I can import the file to Blender, but can't export as an .X file?
(even if it works just naked)
ah nice tyty
Sorry if it's a bit of a weird question, just new and trying to get a grip on recipe scripting, but when you use the "Empty Frying Pan" recipe how does it give you a pan with the same condition that it had been in before you started cooking
Just using the one for emptying pan fried vegetables:
recipe Empty Frying Pan
{
destroy PanFriedVegetables,
Result:Pan,
OnGiveXP:Recipe.OnGiveXP.None,
Time:40.0,
Category:Cooking,
Sound:EmptyPan,
AllowRottenItem:true,
}
I think I'm just not understanding the destroy function, but shouldn't this just destroy the original pan and give you a new undamaged pan?
does anybody know how to edit a players animations?
yep seems like it, will give you a new instance of pan
Which is strange, because it doesn't! Trying to figure out how it knows to give you a damaged one
does it, that's interesting
I originally thought it'd be something similar to the battery code in luaexamples, but this recipe doesn't call any lua functions, unless im missing something
Just trying to figure out how this works in the base game because I want to understand the base game recipes to start writing my own but I just can't seem to get a grip on this one specifically
share the link here as well
maybe break the window of car as well while being shot inside the car, could choose a random window for the future updates.
I actually planned on doing that but I had just wanted to release the base mod for now and add a lot more details later
I pulled an all nighter so I just wanted it finished

Yea i feel you, sometimes finishing a project is really important. It's always Work in progress anyway.
I realized something today, if you leave space between name and modname in your mod.info file. It just says unnamed mod on mod selection menu.
@bronze yoke Do you know anybody with experience modeling (Players/Zombies specifically)
?
Im trying to make the naked player character fat, but can't get it
nope
tried to, but got no reply
gotta try again, that's your best shot. Try searching in chat using #modeling to limit search to particular channel. I often do that to find matching keywords and then you sometimes find interesting conversations on the same topic.
is there a way to validate an item by name? for ex before adding an item Base.Needle i'd like to verify if it exists or something like try and catch in lua to atleast not throw errors
you got it working? cant tell
Checking nil before spawning the item maybe?
Yeah yeah, the infopanel is very small 
but if you open on the browser you will be able to see
so somehow it goes back to focus power settings
It saves what generator you select to focus
when that on it's disabled somehow, reset to split
if it got turned on again, it got the focus again
you think its the game files messing it up?
no, no, that's a feature actually
because if the fuel empties out, and you fill it up again, you don't need to set it to focus again
there's two modes basically, Split and Focus
Split share the power consumption between all generators
Focus takes the total power of all of them and focus on one generator
the others consume 0 L/h
ah
is that way to ease filling up with fuel on a very big base
makes sense, you dont want to run again and again to set things up
Validate?
im thinking if someone were to typo and say goes with Base.Noodle right, then i'd like to handle that error or atleast avoid pulling this item.
Run it against a table of all base items, if it matches set a boolean to true,
Then use the boolean false as a "ERROR: no item detected"
ye just found teh script manager, might be able to pull the item list
:D
ty😄
You've given me far better advice, trying to repay my debt XD
if ScriptManager.instance:getItem("Base.Needle") returns nil, the item doesn't exist
how can i get all sounds from directory? my directory for sounds: media/sound/MySounds
ye i went with this one instead of pulling the list and checking every item, this is much better.
local sounds = {}
local function getRandomSoundFromDirectory()
local soundList = getFileList(soundsDirectory)
for i, sound in ipairs(soundList) do
if string.endswith(sound, ".ogg") or string.endswith(sound, ".wav") then
table.insert(sounds, sound)
end
end
end```
i think this should work
so i have error in 1 line:
local soundsDirectory = media/sound/MySounds
i fixed this but have a new problem in this line:
print("sound:" .. randSound)
randSound:
local randSound = sounds[randIndex]```
https://steamcommunity.com/sharedfiles/filedetails/?id=3030571779 i feel like modders could use this one more often, personally hated to add items each time through itemList. Hopefully this one's useful.
can anyone help pls? i have 2 errors
1 error:
error -> local soundList = getFileList(soundsDirectory)
-- Get sounds in directory
for i, sound in ipairs(soundList) do
-- Check for sound file extension
if string.endswith(sound, ".ogg") or string.endswith(sound, ".wav") then
table.insert(sounds, sound)
end
end
end```
2 error:
`getRandomSoundFromDirectory()`
the second error is in another function that is calling every ten minutes
is getFileList a function you wrote? if not, the error is that that function does not exist
I still have no idea what broke my oncreate script
no its not my function, but what i should to use instead to get all files in directory?
i don't think it's possible
it's something i was interested in before and i couldn't see a way to do it
it was for something completely custom so i just made it so a filelist.txt had to be included that would point to all the files but that won't work for most usages
wdym
i have folder for sounds in mod but how to get their path or load them
yes, but how to define them in lua code??
you mean how to do the script that you showed in lua?
i mean it already works in lua
i mean how to use it in lua
i mean how to play them
module Base
{
sound EnterSoundScriptHere1
{
category = Zombie,
clip
{
file = media/sound/yoursound1.wav,
}
}
sound EnterSoundScriptHere2
{
category = Zombie,
clip
{
file = media/sound/yoursound2.wav,
}
}
}
oh
i think i know what you are talking about
C:\Users\Your-Pc\Zomboid\Workshop
?
nooo, how to play sound
wait a minute
and what sound it is
can you send me the file you're working on
send it as a zip or something
i have to write just like local sound = and what in there, path or it name or what???
i don't get it, i have client side lua, where i receiving command from server and then play sound but how i have to define this sounds?
audio.loadSound( "yoursound.wav" )
thanks a lot
does this work
that what i meant
i'll check it
try this if it don't work Sound:Load("media/sound/yoursound1.wav")
on pz i recently did mp3 it didnt work
thanks
i always use waw
its for new sounds?
for any sounds here
its necessary or not?
here
this is my level up sound mod
take a look
why u using lua for a basic sound mod tho
script is necessary or not?
its not just a sound mod
vanilla sounds
If you don't write which sounds will be changed, game won't recognize it
it's like going to a doctor without telling them whats wrong
lets say u are editing death sound,
u have to add the death script name
then just unpack the bank file
that way u can play and use them however u want
rar archive with the required files: https://drive.google.com/file/d/0B6lZQuvhP7D5aDUyQkJ3ZkEzN1U/view?usp=sharing&resourcekey=0-HGk-gO5SaE4GmOZSASo9-g
Source and where credit is due: http://aluigi.altervista.org/
thanks
yeah
I don't know why they made the other sounds in a bank file
maybe it reduces file size, maybe they dont want their work to be stolen, maybe its bcz of copyrigh
there are MORE sounds in the bank files
i gotta sleep its 4am here
any questions
np
what are you doing with them?
just playing random sounds near the player
something i've been working on. have plans to add more colors and ability to place on any bed with context menu. curious if anyone wants to help out
which type i should use in sandbox options to make a choose of settings?
can anyone help pls? client side not receiving command
server:
there are all sounds
}
local function sendCommandToClient()
local randIndex = ZombRand(1,#sounds)
local randSound = sounds[randIndex]
------------ DEBUG ------------
print("sound:" .. randSound)
------------ DEBUG ------------
sendServerCommand("randomsound", "sound", {randSound})
end
Events.EveryTenMinutes.Add(sendCommandToClient)```
client:
```local function playRandomSound(module,command,sound)
if module == "randomsound" and command == "sound" then
local soundObject = sound[1]
local soundManager = getSoundManager()
------------ DEBUG ------------
print("sound:" .. soundObject)
------------ DEBUG ------------
local player = getPlayer()
local x,y,z = player:getX(),player:getY(),player:getZ()
soundManager:PlayWorldSound(soundObject,false,nil,x,y,z,false)
end
end
Events.OnServerCommand.Add(playRandomSound)```
are you testing in singleplayer?
server commands don't fire in singleplayer (but client commands do
)
Question:
Is there a way to figure out the killer and cause of death of a zombie?
I want to access the inventory of a zombie if hit with a specific weapon. Reading the chat history it looks like the zombie’s inventory does not exist until the OnZombieDead function is triggered and it may not contain all of items that will be on the zombie’s corpse if I understand it correctly.
I am currently using the OnHitZombie function to detect when a zombie is hit with the weapon. Killing the zombie with zombie:die() and then attempting to access the Items arrayList in its inventory results in a null reference. So, I don’t think I can access the inventory of the zombie in the OnHitZombie function since not enough time has passed and/or Lua waits for the function to complete before running OnZombieDead.
Any suggestions on how to find the cause of death of a zombie in a way that I can access their inventory? While maintaining a reference to the killer?
Or how I could somehow flag the corpse to do things in the OnZombieDead function?
Anyone messing with icons knows that custom items and icons need to use the media/item_ prefix. This does not however mean the file itself needs the prefix:
Helps a lot more with organization purposes
I thought icon files had to have item prefix. I'll try this out.
oh thanks
Do the ProceduralDistributions.lua tables have a size limit? I'm getting an out of bounds error when trying to add a lot of new items. Works fine when it's just a few
Hey guys
There are a lot of music files in the game, but where can i learn what triggers them to play?
For example, when and what triggers the exploration music? mx_exploration_pressing_on_main_75bpm.wav
...What triggers the tension musics?
Thanks.
which type i should use for choice in sandbox-options and how to use it
or tell me pls how to make custom sandbox option
Use type enum
yeah, wait a minute
VERSION = 1,
option RandomSounds.OnceInTime
{
type = enum,
default = 1,
page = RandomSounds,
values[] = {Option1, Option2, Option3},
}```
You need 'numValues'
instead of values[]
{
type = enum,
numValues = 3,
default = 2,
page = pageName,
translation = optionTranslation,
}```
like this
thanks
how to translate all of this?
Sandbox_optionsTranslation_option1 = "option 1",
Sandbox_optionsTranslation_option2 = "option 2",
Sandbox_optionsTranslation_option3 = "option 3",
...```
thanks
or you can use 'valueTranslation'
how to translate this?
{
type = enum,
numValues = 3,
default = 2,
page = pageName,
translation = optionTranslation,
valueTranslation = dropdownTranslation,
}
Sandbox_optionsTranslation = "option name",
Sandbox_dropdownTranslation_option1 = "option 1",
Sandbox_dropdownTranslation_option2 = "option 2",
Sandbox_dropdownTranslation_option3 = "option 3",
...```
translation is working without this
yes it is. just optional
oh i get it
thanks
but how to translate this one?
You should make your own tranlsation file in lua/shared/Translate
i made it, just want to know how is defining this to translate it
other translation is working correctly
Would you show yours?
option RandomSounds.OnceInTime
{
type = enum,
numValues = 3,
default = 2,
page = RandomSounds,
translation = rSCTranslation,
}```
Make a translation file for your sandbox options, then define it here translation=yourtranslationfile
i already done it
Sandbox_rSCTranslation_option1 = "10 минут",
Sandbox_rSCTranslation_option2 = "30 минут",
Sandbox_rSCTranslation_option3 = "1 час",```
yes
in lua code?
yes
almost same with other options
It's saved as integer value (index of chosen option)
just
if Sandbox_rSCTranslation_option1 == value then ?
thanks
every sandbox option value are stored in SandboxVars as table
so for option 1 i need to use this? or how to do it SandboxVars.RandomSounds.OnceInTime[1]
No

For example, if you choose first option then SandboxVars.RandomSounds.OnceInTime = 1
i get it, thanks a lot
Nah, I was messing with getTexture and gettryTexture and they behave differently in the java - and learned that the item code uses gettryTexture and it actually just looks in /media/ as with getTexture and adds "items_" to the entered in variable which in scripts is icon
So "/media/icon_icon"
So icon=folder/file works
For /media/icon_folder/file
It's a little goofy - not sure why the icon prefix is used tbh as it throws off a lot of new modders -- but it's better than being forced to dump all the images into media - especially if you have more than say a dozen
i have an error LuaManager$GlobalObject.require> require("sounds") failed in this: require("sounds")
sounds.lua is in media/lua
The require should include everything after client/server/shared
And the require needs to be calling a file from the same subdirectory or shared
Lua files can't just sit in /Lua/
Needs to be in one of the three subdirectories
Use just require "sounds"
i used this but have this error
Everything after client/shared/server
Hey! is there anything wrong in this code?
player:getStats():setFoodSicknessLevel(player:getStats():getFoodSicknessLevel() + 10000)```
Why does that throw?
`Object tried to call nil in DealDamage`
If sounds is in the same sub directory as the file you're using require in - there should be no issue
You would need to break up the line to identify which method is incorrect.
setFoodSicknessLevel & getFoodSicknessLevel are in BodyDamage
Not in Stats
player:getStats() -> player:getBodyDamage()
try this
how can i call function every 10 minutes if sandbox value = 1
Events.EveryTenMinutes.Add(playRandomSound)
end``` dont think this will work
if SandboxVars.RandomSounds.OnceInTime == 1 then
-- TODO
end
end
Events.EveryTenMinutes.Add(hello)```
local function hello()
if timeCheck > 0 then
timeCheck = timeCheck - 1
return
end
if SandboxVars.RandomSounds.OnceInTime == 1 then
-- TODO
timeCheck = 3
end
end
Events.EveryTenMinutes.Add(hello)```
thanks a lot
Thank you!
also want to ask how to check player playing mp or sp
just want to use EveryTenMinutes but before use something like OnServerStarted
use isClient()
how to use it?
and can't i just write Events.OnServerStarted.Add(Events.EveryTenMinutes.Add(getSandboxTime)) ?
if getPlayer():isClient() == true then
getSandboxTime()
else return
end
end
Events.EveryTenMinutes.Add(checkIsClient)``` is this right?
getPlayer():isClient() -> isClient()
thanks
i have an error in this line: playRandomSound()
playRandomSound() function:
local randIndex = ZombRand(#sounds) +1
local randSound = sounds[randIndex]
local soundObject = randSound
local soundManager = getSoundManager()
------------ DEBUG ------------
print("sound:" .. soundObject)
------------ DEBUG ------------
local player = getPlayer()
local x,y,z = player:getX(),player:getY(),player:getZ()
soundManager:PlayWorldSound(soundObject,false,nil,x,y,z,false)
end```
i fixed this, but now after few changes, in log i see only "you are in local game"
before i added this to server lua:
if isClient() == false then
print("you are in local game")
else
getSandboxTime()
print("you are in server")
end
end```
IsClient will return true if the code is being run in MP
but i have 3 lua files, 1 server and 2 clients, 1 server and 1 client is for game in server, and 1 client for sp
I am not able to decipher that lol
You don't need entire files to be different depending on MP or not
sorry, i'm bad in english
Server code is ran by clients - no matter what
If you want the code to be entirely server side you'd have to put a not isclient check
Hello everyone. Does anyone have an example about dynamically loaded? even if it is very basic. But I need to place notes all over the map. the problem I'm having is that I can't just do it with "AddWorldInventoryItem" because this only works on the tiles that load when the character spawns. but not in areas of the map that have not loaded. They told me that it had to be dynamically loaded but I have no idea how to do it. Will someone have a little sample code and I'll look for more information from there.
abstract fmod.fmod.Audio
PlaySound(String name, boolean loop, float maxGain) what is maxGain in there?
you might have to work with onGrindLoadSquare function i think, a while ago Poltergeist also shared a resource from workshop to use instead of this function i believe.
or how to play sound bcs i found many playsound and other functions?
https://projectzomboid.com/modding/zombie/characters/BodyDamage/Metabolics.html trying to access Metabolics constants, how can i do that?
declaration: package: zombie.characters.BodyDamage, enum: Metabolics
is there any way to increase moodle UI size with mod without changing resolution?
In javadoc there's public function to set UI size and position of MoodleUI, but I don't know how to access through Lua
i wrote a mod that does this, and the answer is basically just no
moodles aren't really moddable at all, to resize them i just rewrote them completely in lua
Does anybody have any experience with adding items to ProceduralDistributions? I'm getting the error "java.lang.ArrayIndexOutOfBoundsException: Index 200 out of bounds for length 200". The index is always 200. I've counted and no table I'm adding things to exceeds 200 values. I've also hunted for missing commas and such and while I found a few stray things I'm still running into issues.
I'm adding things with the template below, and I have a bunch of those arrays and loops because most of them only add to one loot table each and I've split up the items array into different item types. So it can be a few loops in the table loop.
I seem get the error if I have too many loops. It doesn't matter which ones I remove or leave, but at a certain point I get the out of bounds error and I don't understand why.
If anybody as any idea please help me because I'm about to go insane here.
"ListName1",
"ListName2",
}
local ITEMS_TEMPLATE = {
"ItemName1", 2,
"ItemName2", 4,
"ItemName3", 6,
"ItemName4", 8,
}
for i = 1, #TABLE_TEMPLATE, 1 do
for j = 1, #ITEMS_TEMPLATE, 2 do
table.insert(ProceduralDistributions.list[TABLE_TEMPLATE[i]].items, ITEMS_TEMPLATE[j])
table.insert(ProceduralDistributions.list[TABLE_TEMPLATE[i]].items, ITEMS_TEMPLATE[j+1])
end
end```
is it giving you a line number? i can't see why you'd be getting this error since you aren't using any arrays (explicitly) to begin with
depending on how many 'too many loops' is, your file could literally be too big - i've heard there is a limit on how much Stuff a lua file can have, but i've never managed to run into it
if the loops are all copy-pastes of this with different values using a function instead of copy-paste would probably fix that
if you have mod for that- can i get name? if uploaded to workshop?
This is the error that I get. There's nothing useful in it that I can understand at least.
the call stack makes it look like you've hit a variable limit
there are too many items in the stack. maxes out at 200. try and reduce local variable count
items meaning variables, functions, tables etc.
Ok, thank you so much for the help! I will consolidate some stuff to get blow the limit. Is it an overall thing or per file?
Yeah :p just wanted to be sure. Thanks again!
well for any given stack, so files and functions various blocks of code etc
Guys,anyone here experienced with animated cars??
Did anyone experiment with adding functional speakers to TrueMusic?
More specifically;
Allowing attaching speakers to a ghettoblaster, to expand the radius the music plays at, or to play it play on several floors without "turning down volume"?
(I see the vinyl player requires a speaker, but it doesnt actually allows expanding sound radius, it just enables the vinyl to start off with)
Anyone know where the pages read in an xp book is kept?
ah that one...
Just trying to re-write just like you, because of the bug about panic bug mentioned in comments
nobody's been able to give me a reproduction method so i can't fix that yet
Anyone?
I've had assertive reports that same problem was 100% due to Moodle Framework (spoiler: it cannot be). So take their reports with care, most do not know what they are talking about (which is totally OK) and pretend to know (which is not OK at all).
can anyone help?
I have the following code but it seems to give an error during LUA loading. Although when loading the map no error is marked I have not been able to make it work.
local function LoadGridsquare(sq)
if sq:getWindow() and sq:getX() == 3148 and sq:getY() == 7228 and sq:getZ() == 0 then
print('1qX ---->' .. sq:getX());
print('1qY ---->' .. sq:getY());
local sqNote = sq:AddWorldInventoryItem("Base.wicked_lab01_SheetPaper", ZombRand(0.1, 0.5), ZombRand(0.1, 0.5), 0);
end
end
Events.LoadGridsquare.Add(LoadGridsquare);
I have seen many mod use TimedActions/ISBaseTimedAction
Especially the "Snake Pack". In all hidden events they use that library but I don't have a clear example how to use it. Maybe this will help make things load on the map.
i used getPlayer():getEmitter():playSound(soundObject) for sound and have this warnings:
GameSounds.getOrCreateSound> no GameSound called "hunterShot.wav", adding a new one
GameSounds.getOrCreateSound> couldn't find an FMOD event or .ogg or .wav file for sound "hunterShot.wav"
what sort of error?
If I don't put the conditional. The game hangs or just crashes.
and with the conditional apparently it is never fulfilled because the print() is not generated and the object is not added
the game hangs without the conditional because prints are extremely expensive and when you first load in loadgridsquare can be called tens of thousands of times at once
you have to be careful when using prints on events like that, and it's why prints in most cases shouldn't make it through to release code
for the conditional not working, you should verify that:
- you are actually at those co-ordinates
- there is a window on that square, and that the game considers it on that square and not an adjacent square (since windows are on walls, they're sort of 'between squares' and which one it actually belongs to is unclear)
Can someone help me figure out how to call methods from another lua file? I'm trying to use lua_timers api but I keep getting an error pointing at line 439
what error?
looks like they didn't write it as a module so you don't need to require it
remove the require line and change timer**.Create to timer:**Create and it should work
i was sick about my simple sound mod not working
then i figured i was typing waw instead of wav in the scripts
LOL
Is PZ musics mono or stereo?
guys, help me pls
how do you find the player's levels in different categories?
you need to make the sound on a script
like this
but why if its vanilla sound?
you need to pass the name of the sound script, not the file
so i need to write all this sounds in script?

if you are adding the sound to the game, you need to make a sound script, and pass the name of the sound script
the vanilla ones should already have scripts
ok but all sounds just from vanilla
so i should write the name same as in script?
yeah
ok, thanks
I checked with grep -rnw '.' -e 'hunterShot' and found no results in the scripts folder
that sound is probably unused
you will have to make the sound script

Something like this:
Name: sounds_{yourmod}.txt
module Base
{
sound hunterShot
{
category = Object,
clip
{
file = media/sound/hunterShot.ogg,
distanceMin = 5,
distanceMax = 50,
reverbMaxRange = 10,
reverbFactor = 0,
}
}
}
and then call hunterShot
thanks
if it is used it's not too likely the fmod double would have the same name
I got a question about setting a models mesh
I want the player to have a model different than zombies, and clothing also different than zombies
is there a way to set the players model (I already have the models)
no
the usual workaround is to use a clothing item that masks the entire body
and has the new model
so if I make the base model Fat, every naked zombie will be fat?
i think they use the same model, so probably
and there is no way to change this?
not to my knowledge
Ok, I checked the javascript guide
apparently, IsoGameCharacters have a getModelInstance
ModelInstance has a Model
and I can create a new model, using the class constructor Model(AssetPath assetPath, AssetManager assetManager, Model.ModelAssetParams modelAssetParams)
I'll have to review how this works in Lua, but perhaps it is possible (?)
Does anybody know the creator of Special Zombies mods? (like CDDA Zombies, or the Last of Us)?
I gather they had to do what I'm trying to do to make their special infected, so I'd like to contact them to learn how they did it.
how do you get a player's level on a certain skill?
player:getPerkLevel(Perks.PerkName)
thank you 😊
Were you using if statements
how to check like this?
install a shell like cygwin or mingw
(I'm going to assume you're on windows because you'd otherwise already have one)
Hello. If I want to make a custom action that can be done with an item, I do need to extend ISInventoryPaneContextMenu.createMenu or should I do something else? As in, I want the player to be able to right click on an item and do something with it. The final result is me trying to let player pour ethanol between containers that can hold it, much like water
The dreaded if then end if then end, wall of text
There's also elseif statements
If you really have to go down that route
It's like nesting but not really
I think I have 1 else in my whole 200 lines
And it's right at the start to stop nill or 0 error
I've moved my loop code into a separate function just so I can break the current iteration withoit leaving the loop
I got basically no code experience under my belt
So i dont know much about functions and all that
Especially the shitshow that is lua and java
It's all about slowly learning, ain't no need to sprint
had to make sure of a lot of things
I know a lot about modelling though
even though I could have done it with one statement
So there's that
function myFunct()
return
end
while true do
myFunct()
end
Hahahaha, I feel that
Here's the example that does absolutely nothing
I do pass an argument to the function but otherwise, yeah, that's the code
does anybody know the file that determines clothing conditions? (holes, patches, how to add or subtract clothing condition, etc)
You do all that redundancy so someone that uses your mod gets into a problem you dont even know was possible
Well, I could use someone with experience rn
lol. I just did it to seperate each line of code so I can pinpoint the fuckup
Have you guys seen the code for a lot of the weight reduction mods?
Like it works, they did a good job... But it's hundreds of if then else......... 😭
Can I check if a player is under the influence of pills like beta blockers or something like that?
local playerStats = self.character:getStats()
local currentPanicLevel = playerStats:getStats():getPanic()
local PanicLevel1 = currentPanicLevel + 20
local newPanicLevel2 = currentPanicLevel + 60
if player is under (beta blockers) then
playerStats:getStats():setPanic(PanicLevel1)
else
playerStats:getStats():setPanic(newPanicLevel2)
end
My lua code doesnt even work regardless of if else or no if else
If I see more than one "if x then" I start spazzing out
Something about referencing a null object
There are some ways, yes... Let me check the code
Make sure the object you are referencing actually exists WHEN you are assigning it
thanks, I will wait :3
Yeah i have all the items already in game
Odd... You don't mind sending it?
It's OnCreate
Appears to be this in IsoGameCharacter
public float getBetaEffect() {
return this.BetaEffect;
}```
thanks
Are you referencing the original item AFTER crafting, (it no longer exists)
Yeah, you can getBetaEffect from Lua
Show it
I do have the error that pops out from it
Sure
Whats your oncreate code?
This too
player:getInventory():AddItem("Base.GoldScrap", ZombRand(3)); player:getInventory():AddItem("Base.CopperScrap", ZombRand(5)); player:getInventory():AddItem("Base.SilverScrap", ZombRand(3)); player:getInventory():AddItem("Base.PalladiumScrap", ZombRand(2)); player:getInventory():AddItem("Base.PlatinumScrap", ZombRand(2)); player:getInventory():AddItem("Base.MetalSlag", ZombRand(2));
end```
You could probably tell what im trying to make here
For some reason the copy paste broke some things
But it should look proper where i have it here
Wish I wasn't on mobile rn
Would recommend to store the inventory in a variable
at zombie.inventory.RecipeManager.PerformMakeItem(RecipeManager.java:1302)```
If I wanted to add a hole to clothing, would i use this
Hey everyone, Is this the right way to make ModData?
at the start of a new character, and only that. it throws an error. attempted index: dosage of non-table: null
I'm new to coding so i really don't know what's the problem. (or how to fix it.)
function initializeDefaultRadiation(dosage)
local player = getPlayer()
local RadiationModData = player:getModData()
RadiationModData["Radiation"]["dosage"] = 0.5
local dosage = RadiationModData["Radiation"]["dosage"]
return dosage
end
function loadPlayerRadiationDosage()
local player = getPlayer()
local RadiationModData = player:getModData()
RadiationModData["Radiation"]["dosage"] = RadiationModData["Radiation"]["dosage"] or initializeDefaultRadiation(dosage)
local dosage = RadiationModData["Radiation"]["dosage"]
return dosage
end
Where are you calling these?
Event.add?
OnGameStart doesn't get local player radiation before you are using it
try with set numbers first
i thought thats what the or initializeDefaultRadiation(dosage) was for?
my only thought is that you could get a 0 and the game doesnt how to handle it maybe
Can you Elaborate, Please? I'm confused.
No idea, I don't ever init, I only ever directly sign the variable
But i did this before without the numbers (so it pretty much gives a single quantity) and that doesnt seem to work either
From what I can tell your code is: 1, getting the player 2, asking for the player "dose"... Of which it doesn't know yet
Then it says its null
Then you set it, and then don't use it
Personally, it only makes sense to... Get the player, set the moddata for it, then read the moddata after, then use it
Otherwise if it doesn't start with the moddata and then tries to read it, there's not even a data entry, so it returns null
Any ideas on what caused this?
No idea I haven't learned anything for recipes yet, just finished my chem paper for uni XD
still have 0 clue what IsoGameCharacter means, can anybody help?
Where's Albion when you need her 😭
Anyone have any idea why i'm getting this error when equipping my custom weapon?
ERROR: General , 1693912264916> ModelManager.newInstance> Model is null.
ERROR: General , 1693912264916> ExceptionLogger.logException> Exception thrown java.lang.NullPointerException: Cannot assign field "parent" because "<local7>" is null at ModelManager.newStaticInstance line:1798.
ERROR: General , 1693912264916> DebugLogStream.printException> Stack trace:
java.lang.NullPointerException: Cannot assign field "parent" because "<local7>" is null
at zombie.core.skinnedmodel.ModelManager.newStaticInstance(ModelManager.java:1798)
at zombie.core.skinnedmodel.ModelManager.addStatic(ModelManager.java:1762)
at zombie.core.skinnedmodel.ModelManager.addStaticForcedTex(ModelManager.java:1847)
at zombie.core.skinnedmodel.ModelManager.addStatic(ModelManager.java:1812)
at zombie.core.skinnedmodel.ModelManager.addEquippedModelInstance(ModelManager.java:1055)
at zombie.core.skinnedmodel.ModelManager.DoCharacterModelEquipped(ModelManager.java:976)
at zombie.core.skinnedmodel.ModelManager.ResetCharacterEquippedHands(ModelManager.java:842)
at zombie.core.skinnedmodel.ModelManager.update(ModelManager.java:1254)
at zombie.gameStates.IngameState.updateInternal(IngameState.java:1698)
at zombie.gameStates.IngameState.update(IngameState.java:1333)
at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:101)
at zombie.GameWindow.logic(GameWindow.java:298)
at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
at zombie.GameWindow.frameStep(GameWindow.java:765)
at zombie.GameWindow.run_ez(GameWindow.java:681)
at zombie.GameWindow.mainThread(GameWindow.java:495)
at java.base/java.lang.Thread.run(Unknown Source)
DisplayCategory = WeaponCrafted,
MaxRange = 1.65,
WeaponSprite = stuartSpear,
MinAngle = 0.8,
Type = Weapon,
MinimumSwingTime = 2,
KnockBackOnNoDeath = FALSE,
SwingAmountBeforeImpact = 0.02,
Categories = Improvised;Spear,
ConditionLowerChanceOneIn = 10,
Weight = 3.7,
SplatNumber = 1,
PushBackMod = 0.3,
SubCategory = Spear,
ConditionMax = 12,
MaxHitCount = 2,
DoorDamage = 10,
SwingAnim = Spear,
DisplayName = Stuart Little Spear,
MinRange = 0.98,
SwingTime = 2,
KnockdownMod = 0,
SplatBloodOnNoDeath = FALSE,
Icon = SpearMachete,
RunAnim = Run_Weapon2,
IdleAnim = Idle_Weapon2,
TreeDamage = 0,
TwoHandWeapon = TRUE,
CriticalChance = 30,
CritDmgMultiplier = 10,
MinDamage = 1.3,
MaxDamage = 2,
BaseSpeed = 0.9,
DamageCategory = Slash,
DamageMakeHole = TRUE,
BreakSound = SpearMacheteBreak,
HitFloorSound = SpearMacheteHit,
ImpactSound = SpearMacheteHit,
DoorHitSound = SpearMacheteHit,
HitSound = SpearMacheteHit,
SwingSound = SpearMacheteSwing,
SoundMap = SpearStab SpearMacheteStab,
AttachmentType = Shovel,
Tags = FishingSpear,
}```
model stuartSpear {
mesh=weapons/2Handed/stuartSpear,
texture=WorldItems/stuartSpear,
attachment {
offset = -0.0100 0.3400 0.0000,
rotate = 0.0000 0.0000 0.0000,
}
}```
Wait, so with my current code, i'm not making a ModData ?
Sorry for all the questions
Ngl it's 29c rn and I'm stood waiting for a pick up, I'm heat stroked af, the second I get in all boot up vsc and help but rn I'm dying XD
All is well man, take care of yourself and stay hydrated.
does anybody know what IsoGameCharacter means?
its the player. local player = getPlayer()
I'm going through Pepsi like an African elephant
so getPlayer() is the same as IsoGameCharacter?
Pretty much?
Okay so how do i put "inventory" in a variable
I just use getSpecificPlayer(0)
Like local inventory = Inventory() sort of thing?
its saying I need IsoGameCharacter for this
getPlayer():getInventory(), you can checkout most methods available for player object here https://zomboid-javadoc.com/41.78/zombie/characters/IsoPlayer.html
Javadoc Project Zomboid Modding API declaration: package: zombie.characters, class: IsoPlayer
what does "iso" mean
No just getPlayer()
Have no clue tbh, but yes you can pass player object (isoPlayer is a child class of iso character)
Isometric (basically a 2d object rendered in 3d, polygons basically)
so just a naming convention to represent that
I'll try that once i get to do more debugging, thank you
But from java to Lua
(if you ONLY want the particular client that's running the code use getSpecificPlayer(0) but honestly that's rare)
I dont think you need to do that for crafting
Nope
I dont see that being used in the vanilla recipecode.lua
from what i have heard for SP, getPlayer is fine but for MP i think getSpecficPlayer(index) is suggested.
Yee
is that a method available for player? i dont think so. Also always try to convert it to a string value before printing. Can use tostring(stuffHere) or do something like print("this is something"..stuffHere) (note the two dots in between that's lua's way of concating strings)
Send error too
Even then i don't think you can print out complex objects, If i wanna look at objects i usually use debugger and mark break points. That way i can look at if im pulling a null obj or what exactly does the object hold.
it's not a method available for player obj, only for item objects
so how do I find the item that the player is wearing?
function backpackFlags.wearThis(stuff, texture, name, reverse)
local player = getPlayer()
local inv = player:getInventory()
local equip = inv:AddItem(stuff);
equip:getVisual():setTextureChoice(texture);
local playerObj = getSpecificPlayer(0)
if not playerObj then
return
end
local wornItems = playerObj:getWornItems()
for i=1,wornItems:size() do
local item = wornItems:getItemByIndex(i-1)
if reverse then
if item:getFullType() == "backpackFlags.PoleReverse" then
item:getContainer():DoRemoveItem(item)
end
else
if item:getFullType() == "backpackFlags.Pole" then
item:getContainer():DoRemoveItem(item)
end
end
end
player:setWornItem(equip:getBodyLocation(), equip);
name = "Backpack Flag ("..name..")";
equip:setName(name)
end
i think, if im not wrong clothing items are in inventory right? If that's the case then you can get inventory items and iterate over it. Not sure if theres a way to pull equipped items.
this is how I handle it in my backpack flags mod
thank you
also does anybody know how to add holes/worsen the condition of clothing? I can find how to patch clothing, its bite defense, and a lot of other stuff
but not holes or condition
what is "int"
Int is anything up to the integer limit
I believe condition cant go above 100
Or else the item would invariably break
oh okay
so I tried doing print(getPlayer():getWornItems()) but it doesnt return a list or anything, just a set of numbers
that's because it's an object. It returns its address. You must find what type it returns, and possibly iterate over them. You can try a "ToString"
you have to do it like this
Question: If I want to make a custom action that can be done with an item, I do need to extend ISInventoryPaneContextMenu.createMenu or should I do something else? As in, I want the player to be able to right click on an item and do something with it. The final result is me trying to let player pour ethanol between containers that can hold it, much like water.
local wornItems = playerObj:getWornItems()
for i=1,wornItems:size() do
local item = wornItems:getItemByIndex(i-1)
console.log(wornItems:getItemByIndex(i-1))
if item:getFullType() == "YOURITEMTYPE" then
// do whatever
so you get an object of worn items
you then loop through that object
each item is retreived and checked against the item you're looking for
I think context menu is the way to do, I don't know about extending to it but I used the other way of creating context menu.
The other way? Elaborate please, I don't have my workshop downloader on me
local function OnFillInventoryObjectContextMenu(player, context, items) -- # When an inventory item context menu is opened
local playerObj = getSpecificPlayer(player);
items = ISInventoryPane.getActualItems(items); -- Get table of inventory items
local isStuartSpear = nil; -- Define a variable to hold the potential vape item
for _, item in ipairs(items) do -- Check every item in inventory
if item:getFullType() == 'StuartLittle.stuartSpear' then -- If item is a stuart little spear, it is caught in a variable.
isStuartSpear = item; -- We check if it's our item first to reduce load time since this is called every time an option is right clicked.
-- // (item:getFullType())
break
end
end
if isStuartSpear ~= nil then -- # if the clicked item is stuart spear, add the decoration context menu item
local isFav = context:getOptionFromName("Favorite");
local opt
-- // print(CMIcon)
if isFav then
opt = context:insertOptionAfter("Favorite", getText("UI_stuartSpear_action"), isStuartSpear,
callStuartSpearAction, playerObj) -- !! Need to also pass the player object here so the timed action can use it | Insert after "favorite" so it's in the normal "smoke" position
else
opt = context:insertOptionAfter("Unfavorite", getText("UI_stuartSpear_action"), isStuartSpear,
callStuartSpearAction, playerObj) -- !! Inserting option after unfavorite. If neither exists, it will just add it to the bottom of the stack by default.
end
end
end
Events.OnFillInventoryObjectContextMenu.Add(OnFillInventoryObjectContextMenu) -- !! When vanilla code is ran, add this custom code```
check out this code i just did for my mod
its adding a context menu that links to a custom function
what is the " i "
alternatively, check out my GnomeBar Vapes mod, it does exactly that
it takes a custom context menu and does a custom timed action when clicked
i is just a variable. short for "index". It's used to keep track of the index number
what is an index number
it's... a number that states in which position something is
There's two events you could use, one's for inventory items and one's for world stuff. Right click on any will pop up a context menu with options which on click will trigger your lua function. That's the idea.
I see. I will need both, so it's actually amazing it's so easily extensible
It's only the second time I praise the codebase
After 10 mods
you can also create entirely custom context menus
like i did here
oh wait
that's a tooltip
i'm tired
You would need to put a check tho to select certain type otherwise it'll pop up for every item. I can share some code later for reference if you want.
my bad lol
I just want to write a custom pour action, since I'm running ethanol instead of water
These are the events btw, except the 2nd one.
did you have a rubber ducky moment?
i had "attachment" instead of "attachment world" under the model definition
Ah... I don't know much about those yet
@tardy wren
#mod_development message
found the stuff when I was working with context menu.
Thanks. This seems to be with world objects?
Ye it's same for inventory ones just you need the diff event for that.
I just realized that I will need to make the context menu multi-level
Since the player will have to select the item to pour into
It will take some fanagling...
Yea, not sure if I can help with that.
But there's already code for the water, so I should be able to do this
Maybe not in the best way, but it will be done
In that case I think it's best to do what game does, I think you could hook into timed actions I'm a bit iffy on that barely used it once.
You could also maybe store the container info somewhere to use that later if you don't wanna go the multilevel route.
I'll see how it's implemented with water, and try to recreate it with what I have... Which is hashmaps of ReplaceOnUseOn
That's the first time I praised the codebase
function Recipe.OnCreate.CreatePetrolManual(items,result,player)
for i = 0, items:size() - 1 do
---@type InventoryItem
local item = items:get(i)
if item and item:hasTag("EmptyPetrol") then
local fuelContainerType = item:getReplaceTypesMap():get("PetrolSource")
local fuelItem = player:getInventory():AddItem(fuelContainerType)
fuelItem:setDelta(fuelItem:getUseDelta())
end
end
end
If I wanted to pick solely clothing in a certain area of a person's body how would I do that
maybe
getCategory()
local wornItems = playerObj:getWornItems()
for i=1,wornItems:size() do
local item = wornItems:getItemByIndex(i-1)
console.log(wornItems:getItemByIndex(i-1):getCategory())
if item:getFullType() == "YOURITEMTYPE" then
// do whatever
i'm not sure honestly
i'm better at making models than lua haha
i starts at 1, tables start at index 0
so it decreses i by one to account for that
you could just do i=0 i think
no that returns the item category as a string
what is the difference between an index and a table?
index is position in the table
getBodyLocation() is what i think you need
oh alright
ive been trying to use getBloodClothingType
local wornItems = getPlayer():getWornItems():getBloodClothingType()
it doesnt work
I might know why one sec
anyone know the function that gets the direction an isoobject is facing?
ah thats probably right i was searching the wrong things
How feasible would it be to transfer images from host to client?
I imagine there's no practice way to do it, I was thinking of adding jigsaw puzzles to the game night - but I thought it would be cool if you didn't need to make a submod for thst
RadiationModData["Radiation"]["dosage"] = RadiationModData["Radiation"]["dosage"] or initializeDefaultRadiation(dosage)
`````RadiationModData["Radiation"]`` hasn't been initialised yet, so it is null, so ``RadiationModData["Radiation"]["dosage"]`` is attempting to index a non-table (null)
you can fix this pretty easily by adding```lua
RadiationModData["Radiation"] = RadiationModData["Radiation"] or {}
```before that line
You are so cool, thank you!
is this the proper way to find if a worldobject is a bed getProperties():Is("bed") ?
Does anyone know this mod?
this is a linux command, It recursively searches all files in a folder for a keyword, like 'hunterShot'
can i do it in windows?
Hello, a popular cheat for the game has been released, which works on both the pirated and licensed versions of the game. So... I keep a modeless server and I want to protect it, so there is only one way out - to change the Java code of the game. I have some small operational developments in Java for the server, which limit cheaters a little, but this is not enough. Does anyone else have similar developments?
you should be able to search using your IDE, ctrl+shift+F to search through directory and ctrl+f to search in file.
its taking too much time to check all scripts
I don't know, you will have to research it. you can get Windows Subsystem for Linux
it is a command line
i think you can do it in powershell but i'd just use ide search
ye there's prolly powershell alternative for this but IDE is a bit less complicated if you don't wanna dive deep into commands
ohhhhh chatgpt helped me
findstr /S /M /I "your_keyword" *.txt
its working
i just tested this
I work more with console and powershell than scripting
just run powershell and make the path you need and then type this just change your_keyword to word you need
oh
i have a problem
if i'm trying to cd C:\Program Files (x86) it shows error
oh, i need just to put "C:\Program Files (x86)"
also if there is nothing in output its because your word haven't found
One message removed from a suspended account.
you don't need 1 in Events.EveryHours.Add(spawnWaterBottle)
One message removed from a suspended account.
damn
pretty good tbh, you might wanna validate if you found your player obj as well. Don't wanna call stuff on nil just to be on the safe side.
it's kind of longwinded
ye but i think it's coz gpt wants to make it easier for user to understand.
If you need to explain it to someone, this seems perfect
i wouldn't say adding completely unused variables is easier to understand 😅
the x,y,z doesn't do anything
tru tru it be like that sometimes
One message removed from a suspended account.
they prolly mentioned to spawn at player loc
basically the entire thing could be replaced with a single player:getInventory():AddItem("Base.WaterBottleFull")
One message removed from a suspended account.
ive tried it and chatgpt uses functions that don't exist and ads "end"s that aren't needed. its decent at the logic and steps required to get what you want though
ye gives you direction if you have experience, otherwise youd be more confused
but then again if you know the right questions to ask
i wonder if you could feed it the entire binaries and it could spit out something useable
is it possible? think it works better with human readable languages (saying that with no idea how language model works)
it seems pretty decent at reading code, it's only source is whatever was on the internet 2 years ago though
it's always going to make stuff up since it's only trying to convince you it generated code
plus it can't do maths 👀
One message removed from a suspended account.
One message removed from a suspended account.
how can i check amount of players on server?
or get all players
just like getPlayer()
not exactly sure, but could try getPlayer():getPlayers():size
that's a static method so you would just call IsoPlayer.getPlayers(), but iirc that's local players only and the size is always 4
if i remember right it just translates an IsoPlayer[4] array into an arraylist since arrays aren't a thing with kahlua
ah
i found getPlayerCount
actually not sure how size would behave with that but either way it wouldn't be the total server count
its very hard making your code a static amount of lines no matter how much to client would like to do
unfortunately when called on the client getOnlinePlayers doesn't count players you haven't been near yet
Isn't it return all players when called on server side?
yeah
yeah but i think it includes the host or AFK invis admins too
Of course it does
i found another function named getPlayerCount
It's almost same with getOnlinePlayers() when called on server side
Difference is getPlayerCount returns int and getOnlinePlayers returns list
oh thank you a lot
How do you trigger a sneeze or a cough? this code doesn't work, it throws an error but. there is no error.
just says this
`STACK TRACE
Callframe at: setSneezeCoughTime
function: do_sneeze -- file: Cure.lua line # 256 | MOD: psst
`
function do_sneeze()
local player = getPlayer();
local bodyDamage = player:getBodyDamage();
local get_sneeze bodyDamage:getSneezeCoughTime();
if (ZombRand(50) == 1) then
--sneeze
if (ZombRand(0, 1) == 0) then
print("sneeze?)")
bodyDamage:setSneezeCoughActive(1);
bodyDamage:TriggerSneezeCough();
bodyDamage:setSneezeCoughTime(get_sneeze, 1);
--cough
elseif (ZombRand(0, 1) == 1) then
print("cough?")
bodyDamage:setSneezeCoughActive(2);
bodyDamage:TriggerSneezeCough();
bodyDamage:setSneezeCoughTime(get_sneeze, 1)
end
bodyDamage:setSneezeCoughActive(0);
end
end
typo local get_sneeze bodyDamage:getSneezeCoughTime();
missing the = so get_sneeze is initialised as nil
Does anyone here make mods? Looking for someone to create a custom mod for server.
Not for free either lol
Good spot, it still throws the same error. though. it "partially" works by making the character sneeze 24/7
Doesn't setSneezeCoughTime have only one parameter?
setSneezeCoughTime public void setSneezeCoughTime(int int1)
does anybody know where the code is for clothing condition and how to set holes in clothing?
public void setSneezeCoughTime(int SneezeCoughTime)
wait, so its 1 parameter?
you're confused - int1 is the name of the int
Yes, it has one parameter, but you put 2 args in your codes
oh dang it, i thought it was two parameters
In java the type of the arg is written out
we out here using k, v in pairs like a clown 🤡
finally its infinitely expandible and will only use two k, v in pairs
Im troubled that you're using k in the second one
WE BALL
everyone hated that
ehh, if it's a load time event the performance penalty of pairs really doesn't matter very much
if it makes the code prettier i wouldn't avoid it for stuff like this
Wait, if the keys and values are 1 to 1 why not use a keyed table?
its changing every item the client wants in sections to whatever weight they want, regardless of other settings :D
because im new to lua and have no idea what you are on about magic man... (THATS A THING???)
this took 2h...
You can make a table with string keys, like
Multipliers = {foodmulti=multiplier}
or just my_table["Table Key"] = "Table Value"
Does anybody know the code for clothing getting ripped or holes put in them
if it's a string with no spaces or weird characters you can do```lua
my_table = {
TableKey = "Table Value",
}
my_table.TableKey = "Table Value"
you out here.... making me rewrite it all.... because you simply know more - hats off honestly
i need to rewrite my code brb XD
i'm a pretty huge fan of the table.key syntax but i understand a lot of people don't like it
Sorry my pseudo code is bad, just had to stand out in like 95F weather
i feel ya - was talking code in 27c... wasnt fun or accurate
🤽♂️
I learned using the text macro (if it's called that) -- I do prefer it for legibility with emmyLua but at the same time it's not needed
I usually use [""] for the top tier of the data, and straight var= for the inner
Also stuff like getModData().var looks so weird
iirc a lot of people don't like it because it doesn't look like an array access like it would in another language, and prefer to only use it with pseudoclass properties
which makes sense, and having rules is likely more legible, but... i don't wanna
soooo I would make a table, lets call it Keyed_Items_Multipliers
then I would add both the Item table and the multiplier? {WoodItems = woodWeightMultiplier, ...}
ive tried to make it very easy to understand but im heatstroked so...
Just to clarify, you have settings for each category of item?
is it possible to make gui without java?
if yes how to make gui
i want just a small black box
wait i can just do a multi-dimensional array - so ill start with making two arrays (array 1, Type ; array 2, Multiplier), adding 5 key-value pairs (5 keys to the first and 5 values) then call them both separately but call the same index?
You can
It if it's one to one that may not be necessary
You can also make either key or value a table in of itself
But then things get wild
i found a mod for developers that help make ui https://steamcommunity.com/workshop/filedetails/?id=2760035814
so that woodWeightMultiplier goes hand in hand with WoodItems
Yes either that or make item type as index of your main table
You can do
table = {key = {var1, var2, var3}}``` where table.key[1] would be used to access the data. Or ```lua
table = {key = {a=var1, b=var2}}``` Where you'd use table.key.a to get var1.
little issue ive read up on it, and i just dont get the syntax
yeah
You can make the category the keys
And the values = to the multipliers
Then when you're applying the changes to items
Multipliers[item.category] would get the associated value/multipliers
You should not need to use for() basically ever unless the order is important
And in associated pairs there is no order
so basically its two sperate arrays that are just using the same index and lua combines them?
I can't find a GitHub link for making GUI. But if you can search through earlier texts, might be able to find it.
1 list... 1 pointer value... finds 2 values?
In Lua the index is the "key"
should just use pointer XD sorry
If the keys are not numeric from 0 to n then you can't actually iterate over them
You can make keys anything other than a number
Ye I think that's the one
You can even make keys or values functions given they're not called
Cause even functions are stored in a table to call on
hmmm
When ever you call on a table and supply a key it will grab the associated value
A clean way to check if somethng is in a table is to actually fill the keys with the intended thing, and fill the values with true
Otherwise you're stuck using for()
Which isn't that big of a deal, bug depending on how often you need to do it - or how long the list is - it can be a bad idea
I'm very lazy, so I'll write a table normally with as little typing as possible and include a for() running when the Lua loads to assemble the list of trues
how to check is player a creator of MP?
isHost()?
Check IsoPlayer class file
found one
public long getSteamID()
so i should use getSpecificPlayer(index):getSteamID()?
You get use getPlayer() if you're not interested in co-op
Which is the same as getSpecificPlayer(0)
i asked how to check the creator of MP so logically i'm interested in co-op
is it possible to create new command?
Co-op is not the same thing as MP though. It's split screen, coops max player is 4.
oh sorry, dont know it
@sour island I'm trying to make a mod that makes your character model fat when you are over a certain bodyweight. I have all the clothing models, with a fat version. the problem I have is that if I change the naked model, It will affect all players and zombies.
Is there a way to tell which models to use when for which characters?
You can make the fat model a clothing
co-op is often used to refer to in-game hosted multiplayer
there's no consistency with the terms
I have ran into a conundrum
I've been trying to organize my code into modules, but now... I am worried
In one mod, I have this code
Daikon = Daikon or {
ApocalypseBiofuels = {
}
}
return Daikon
in a different mod, I have this code
Daikon = Daikon or {
SandboxOptionsSyncing = {
},
Commands = {
},
CommandHandlers ={
}
}
return Daikon
Will they conflict somehow?
no
it's not really modular if you use a global table though
well it is but it sort of misses the point
oh wait, yes
these do conflict 😅
wouldn't the item be visible?
if you do it like```lua
Daikon = Daikon or {}
Daikon.SandboxOptionsSyncing = {}
but if you define the table's contents using the or statement, if it already exists nothing will be added
It will conflict in that one won't be accessible?
One will be overwritten
Not overwritten - never used
not written in the first place
First come first use

