#mod_development
1 messages · Page 163 of 1
ahh yeah understood
local orgISEatFoodAction = ISEatFoodAction:stop(); should be corrected, see fwolf guide
orgISEatFoodAction(self) should be called without condition.
player:setVariable("CombatSpeed",value) should be called after each pressedAttack call from IsoPlayer or it will be overriden after each attack. I suggest to call it OnPlayerUpdate.
To correct your event management, look for exemples of Events.OnPlayerUpdate.Add and Events.OnPlayerUpdate.Remove in existing code
damn yeah makes sense thx
Alright, I finally got permission to distribute my version of superb survivors... I am opening it up as a public repo; my plan is to upload it to the workshop this Friday (05/26).
There are still issues with the mod (specifically with the "AI") and sandbox options apparently not saving... but it is "playable" in that it shouldn't destroy your game performance after 30 minutes IRL and survivors won't RKO you when they see more than 3 enemies/zombies.
My hope is to have the sandbox options issues resolved before Friday.
https://github.com/shadowhunter100/SuperbSurvivorsContinued
If you're technical enough to do PZ Lua scripting, I hope you'll join the discussion on github:
https://github.com/shadowhunter100/SuperbSurvivorsContinued/discussions
otherwise, feel free to ask questions I suppose; the sooner I figure out the tasks/ai the sooner i can get back to actually playing the game
Does anyone know how to upload a mod to the workshop?
I would recommend going through the whole code and either commenting the prints or making them only occur in debug. Also remove any prints even remotely near gridSquareLoad
did you mean Events.LoadGridsquare?
yeah, I already removed the problematic stuff; but from what I can tell the squares needs to be loaded to load the npcs.
That's fine
so much to my annoyance, i still need to leave it in there
Just remove the prints
there are no prints in my version of the code, that I can assure you.
Also don't know why you're using Nolan's work tbh, you might be better off working off Aiteron's work
Not too late lol
frankly, I'll probably look at Aiteron's work for the AI/Task management stuff
theres like, 5000 lines of ... things i don't want to deal with
From what I saw there was fundamentally wrong stuff in SS
and rewriting from scratch may be better
Like forcing tables to use address 0 in numerically listed tables
Turning into a weird hybrid
Between keyed and unkeyed
yes... i can agree
i probably should and could have done better
but yeah, i wanted something in a semi-working state that could be fixed up (to the extent that i did).
i'm also waiting on build 42 to see how or if game resources management will be changed
(i also suspect aiteron's code was used in SS, given some of the function naming and the timeline, but I can't confirm it).
When Nolan returned he absorbed all the forks
So maybe he mistook Aiteron's idk
Last I saw Nolan he flipped his discord server over and left so
took it too hard did he? well, shi* happens when you merge without testing.
Nah that was weeks ago
Everything was as buggy as usual
There was no context I could see, he asked who wanted admin and transferred ownership
Gave it to the first to respond
Who then spammed racist stuff and a hour later it was gone
well, i wasn't too vested to begin with so, uh, no loss to me.
Me either, but I don't miss the days of several SS forks on the workshop
Especially the guy that made a new mod for every update
no idea who that is
i'm probably gonna be hands off for the most part after this is uploaded to the workshop
if things work out, i'll write something from scratch using what I've learned to do (and not do).
haha, thanks, maybe once build 42 goes live.
Godspeed dude, wishing you good luck as well!
Clean. Code.
it's not all clean 
It's clean.
i've only done enough to make sure my game won't implode from nested loops and unending grid squares
You clean as you cook.
Accepting minor code review?
Knowing you Omar you'll probably do this to Candle.
It's better to destroy this channel over coding practices and habits than type into the text box like an AI prompt when AI generated code doesn't work.
Trust me.
You're fine.
I meant here informally 😄 Just one thing:
local function x(y)
if not y then
return
end
-- do stuff
end
rather than
local function x(y)
if y then
-- do stuff
end
end
is a bit cleaner imo
in this case i'd point out that square will literally never be nil anyway
if you're critiquing the function that was posted
Even better lol, I didn't even see the event bit
Not far away form the player? Not at edge of the map?
actually the original function was fed some questionable inputs from other functions... but I, uh, won't go into it.
@sour island warned me about the SS development and I'm aware of some of the issues
it's attached to the event that fires when a square is loaded, which obviously won't fire if the square doesn't exist
If that was nil then there's a scary issue in the engine of the game.
I'm guessing cows meant from other Lua functions
hence I started looking for an exit strategy and yes, looking at a need to write a completely new system.
problem is i'm not 100% familiar with the Java APIs PZ has and what can be extended... so... yeah
that and build 42 promises to bring more performance optimizations and stuff
=)
onloadchunk my beloved
So we just made this issue have a solution.
i'm quite curious about how they'll handle the animals data
@lone nest Do you use EmmyLua?
no, uh, I think I was in your pipewrench discord using PZPW.
I'm (mostly) confident they'll do it with modders in mind, however it's done
¯_(ツ)_/¯
You have the ability to get the same information in Lua through my newest project "Candle". The collab project "Umbrella" comprises of Candle, Omar's WIP typings, and albion's Event API.
the way i look at the modding is staying on the surface level, don't mess with the backend stuff by decompiling and recompiling it with weird flavors.
you should definitely be decompiling
I think decompiling can provide a lot of great insights
Function names and javadoc can only get you so far
With IntelliJ IDEA, you can easily double-click on the class file when referenced as an external library.
=)
I should do a tut.
guessing at what a java method does is needless
let me highlight the 2nd part... decompiling is OK
i still had to decompile because intellisense wouldn't work properly
The decompile plugin works on IDEA.
I'm somewhat lost on what the issue is.
i couldn't search for all usages of a method for example
looks like i triggered something unexpectedly... now excuse me as I hide.
I understood that message as don't do X and don't do Y rather than don't do X then Y—we love structural ambiguity 😄
That's true.

I guess that I can find my way around compiled bytecode after over a decade of working in it.
lol
I sometimes do a full fernflower CLI decompile.
I did that after a while too because of the same frustrations
I have copies of jars I've built of PZ since build 30.
Changelog's got nothing on you

=)
But yeah @lone nest if you don't want to use PipeWrench you can use Candle.
i need a break first, maybe in a few days or weeks
Hey does anyone knows how to upload a mod to the workshop? im trying to upload a silly retexture a did for baseball bat but i just dont know how to even upload it
is there a way to block someone from leaving comments on your workshop item
i have a particular individual who likes to leave several paragraph long irrelevant comments on every single release I make and its getting annoying
block the user.
oh its that easy? nice ty
you should be able to click into their profile
on steam, and from the dropdown --> block user.
feels bad having to do it because they use my mods but dang its annoying
don't, remember modding is done by you at your own pleasure, you weren't paid to do it
if you were, well, hope that fella wasn't paying.
develop mod for commission
client leaves comment
block them
this is the way
💀
If you've made the mod already, you can upload it via the "workshop" option ingame. It'll prompt you for some stuff
agghh, this is causing insanity for me; I have question about sandbox options (again)
So I've managed to get the load and read the sandbox-options.txt values from the media folder
in-game at the sandbox options menu, I would modify the value of 1 of the options like so
then I would call a debug logger function in-game to verify the sandbox values to match the value set earlier in the sandbox options menu
the game still returns the default 50% chance
So I need help to understand why the sandbox values set at the in-game sandbox menu aren't being used.
to give honor, respect, recognition or whatever.. here are some flag textures i did that will be added to @fading horizon 's flag mod
in case you your flag to be removed let me know
you added pipewrench haha
Woaaa funny flags!
Yes to honor sir jab
Are there any mods that let you actually take a bath and sit in the bath or take a shower and actually stand in it
not really possible with pz's rendering
I'm having an odd issue with intercepting vanilla lua.
local ISRackFirearm_animEvent_old = ISRackFirearm.animEvent
function ISRackFirearm:animEvent(event, parameter)
if event == 'changeWeaponSprite' then
if parameter and parameter ~= '' then
if parameter ~= 'original' then
self.gun:setWeaponSprite(parameter)
else
self.gun:setWeaponSprite(self.gun:getOriginalWeaponSprite())
end
end
else
return ISRackFirearm_animEvent_old(event, parameter)
end
end
when it tries to run the original, the parameters just don't make it correctly
you have to call it by passing self as first param
return ISRackFirearm_animEvent_old(self, event, parameter)
because
ISRackFirearm:animEvent(event, parameter)
uses the : which mean that self is automatically passed.
but ISRackFirearm_animEvent_old is only a reference to the function so when calling it you have to manually pass the self as first param
Trying to upload a modpack, but the "Mod Template" file is the only one that appears.
did you copy the mod template in mods or workshop?
Workshop
did you change the mod info inside the folder?
ModTemplate/Contents/ModTemplate
wait that shouldn't be necessary nvm
show the full path to your workshop dir
its not the correct path thats why
Where should it be
yeah annoyingly zomboid has like 5 folders, where it'll load things from 3 of them (I think?)
anything in the user dir is usually for developping mods.
the one when you subscribe to mods shouldnt be edited.
pretty much
so technically there is two place, the user dir and the steam workshop one
it's confusing for people who are starting
mods vs workshop is just an optional thing, workshop dir has priority over the mods
i prefer making my mods directly inside the workshop dir. Instead of later copying over from mods to workshop
depends on the mod I'm making
if it's intended to go anywhere or if it's a meme/testing tool
how do i preform a health check? trying to create a mod that gives health until the player is at full health
Think itd getOverallHealth or. Something
i dont see where anything says max health
Overall Health is from 0 to 100 if im not mistaking, otherwise it may be 0.0 to 1.0
getPlayer():getBodyDamage():getOverallBodyHealth()
Its 100
add or remove general health
getPlayer():getBodyDamage():AddGeneralHealth(1) -- add overall health
getPlayer():getBodyDamage():ReduceGeneralHealth(1) -- remove overall health
ill link what i have hold on. Im trying to make it give health everyTenMinutes until max health is hit
function InjectPropital(items, result, player)
local char = player
local bodyDamage = player:getBodyDamage()
local AddHealth = 50.0f
-- Flag variable to track if the player is at full health
local isFullHealth = false
-- Adds 50 health every ten minutes
local function everyTenMinutes()
if bodyDamage and not isFullHealth then
bodyDamage:AddGeneralHealth(AddHealth)
-- Check if player reached full health
if bodyDamage:getCurrentValue() >= bodyDamage:getOverallBodyHealth() then
isFullHealth = true
print("You are at full health")
end
end
end
-- Subscribe to the everyTenMinutes event
Events.EveryTenMinutes.Add(everyTenMinutes)
end
i been just messing around trying to figure things out
i know its crappy how i wrote it
@dusty wigeon ```lua
function InjectPropital(items, result, player)
local bodyDamage = player:getBodyDamage()
-- Adds 50 health every ten minutes
local function everyTenMinutes()
if player and bodyDamage and bodyDamage:getOverallBodyHealth() < 100 then
bodyDamage:AddGeneralHealth(50)
-- Check if player reached full health
if bodyDamage:getOverallBodyHealth() >= 100 then
Events.EveryTenMinutes.Remove(everyTenMinutes) -- Unsubscribe from the everyTenMinutes event
print("You are at full health, stopping effect of Propital")
end
end
end
-- Subscribe to the everyTenMinutes event
Events.EveryTenMinutes.Add(everyTenMinutes)
end
I guess you could try to unsub the event when it's completed, otherwise it will run for ever
Hey all, what's the require "" for using Events?
You use require for lua files
Not for events
Im pretty sure im not clear...
Hmmmm....
I see.
No you are
Do you know where I can find Events in the decompiled code files? I see Event, and an add/remove addition, but not Events (plural).
LuaEventManager has the list of all events used (and not used?) in the game
Thanks much
hello, can someone help me figure out why i get an error when trying to craft an item i managed to mod in (i don't really know how to mod, i just copy pasted stuff from some other mod and edited it xd)
here's the code, on left the item script, on right recipe
the item is working in game, i can spawn it in and wear it / put it on ground, it has the icon and everything, but in recipe window it doesn't have the icon, nor is the recipe showing any result, the revert recipe doesn't have any ingredients, and when i craft the bag it gives an error in right bottom corner, and it gives some wall of text error in debug console
you might have to try removing the module prefix from the item name in the recipes
Hey guys, we got some code working with Events.EverytTenMinutes(HealPlayerAlittlebit).
We wanted to add it to something that happens more regularly like EveryFiveMinutes, but that did not work.
I feel like I've seen, in passing, someone implement something like that.
I'm curious to know if they made their own event timer, or if there are other Every(Int)Minutes that I don't know about and where might I find them?
Sure, you can make your own every five minutes event or use the OnTick event or the EveryOneMinute event.
You should check pzwiki for modding resources.
Hey I have a really good mod a idea but idk how to make mods and o don’t know if it’s possible or already made but someone should make it so you can open garage doors without having to get out of the car
@mystic ledge A garage door opener mod? That's actually a pretty good idea.
Yea I always hate having to get in and out of the car every time
There is a mod that you can craft a gate controller that automatically opens gates that you have attached it to.
"Gate controller" is what I think it is called.
Failing that, if you don't know how to mod, and you don't want to learn how to, people do take commissions to create mods.
do u know if theres a way to create a single recipe that could result in several different items depending on the item it used
or would that be an oncreate thing
oncreate
ok
Hey everyone, I'm planning to go back to my mod (https://steamcommunity.com/sharedfiles/filedetails/?id=2888099799) and add some new features.
I've detailed what I'm looking for here: https://theindiestone.com/forums/index.php?/topic/66643-changing-zombies-sighthearing-dynamically/ but the forum seems a bit dead to be honest, at least for what I've used it in the past. Do anyone have any hint/help on what I'm looking for? Even a mod that does something similar would suffice so I can extrapolate "how to do it" from it. I learn faster with example rather than autogenerated documentation 😛
i tried it and it didn't work, any other ideas?
Hey I'd like to know whether there is a possibility to have a mod be Serverside only.
I know that you can use "media/lua/server" but I was wondering whether it was possible to have that mod only on the server without distributing it to the client.
I assume when one doesn't check for mod integrity this might work but that's something I'd like to avoid.
oh wait i think i know why
remove the underscore from the recipe name
for some reason you cant use them for recipe names you can only use spaces
ok now the crafting recipe is working, but the revert one isn't
ok nvm i had a big B in SchoolBagRed there, now it's working xd
one more question then, i added 2nd texture to that same item, so now it randomly gives the red one or the new one, is it possible to make the recipe not random, lets say give red one with a strawberry and new one with a cherry?
Just declare a second recipe that makes the second bag
but i mean, it's the same bag, i only added 2nd texture, so now it randomly gives me one of 2 with that recipe i have
that's how it looks now
You could just make a second bag that has the second texture
yea, was just wondering if that's possible since the basic in game bag has few textures in 1 item
I think they are randomised but not for recipes
It would be better practice to make a second item that has the texture
ok guess i'll do just that, thank you! 🙂
@winter bolt Thank you very much for helping me fix the mod! 😄
You could additionally look into the xml of the base schoolbag ti see how they do it
basic bags aren't craftable tho, i'll just make a new one, it's all way too complicated for me as it is already lmao 😄
I mean for the texture swapping
i mean it randomly gives me one or the other bag so it's working
you can actually
on the recipe you can add a function and in the function you can change the texture the item will use
lemme get mine one sec
inside the recipe add the line
OnCreate:Recipe.OnCreate.FUNCTIONNAME,but replace FUNCTIONNAME with whatever you want and then inside your mod create the folder path "media\lua\server" and make a .lua file that looks like this ```
function Recipe.OnCreate.FUNCTIONNAME(items, result, player)
local newVisual = result:getVisual()
newVisual:setTextureChoice(1)
end
i cant really test it but it should hopefully work
@drifting ore
you can replace the number in setTextureChoice() to be whichever number texture you need
actually if the item in the recipe is a bag then it might be better to just use my full function so it keeps all of the clothing and container stuff
hey, using autotsar motorclub mod but for some reason cant ride any of the motorbikes, this is the error that shows up
wdym by that?
i did this but it still randomly gives me one or the other textured bag
also how would i add the other ingredient to this recipe, so i could craft the 2nd one with a cherry? or i'd need a 2nd recipe for that?
i did this but it didn't work
it randomly picks the texture with each game restart for both recipes
you wouldn't be able to change the texture of the recipe icon that way
that should change the item you actually get though
but it doesn't, i keep crafting one or the other textured bag randomly, i think the script needs to reference somehow to that .lua file doesn't it, like if i call that .lua file "blabla" shouldn't i put "blabla" somewhere in the script? does the .lua file need to be named exactly as the FUNCTIONNAME? is that the reference? can i put both functions in one file? idk how it works
oh i see
Recipe.On**.**Create.PICKBAGTEXTURE2
in your script
you can put both in the same file, the filename doesn't matter
so how does the script know to read from that file?
the game loads all lua files, it finds the functions by name
i see, well it doesn't work, any idea why
the meru recipe has this typo that will stop it from finding that function
the first one seems like it should work
the setTextureChoice calls might need to be zero indexed
meaning starting from 0? i fixed the typo and changed 1 to 0 and 2 to 1 but it's still random
it might just be better to use two different items, seems like you have to do a lot of work to get around it this way
i mostly want to make it work to add way more textures without having to make a new mod for each of them
now that i think of it i think i heard there were issues with trying to mess with an item's world model live - not sure if that applies to the clothing model too
You might need to call resetModel on the item or the player
where?
In the OnCreate
Have you confirmed that your function is called? This can be done adding prints for example.
If the function isn't found there should be a log about it.
i haven't, i don't really know what i'm doing
oh lol i just checked and all the crafted bags are actually the red bags when i craft from red bag recipe, but they have random icons in inventory
same with the meru recipe, in inventory there are random icons but on back/ground it's always the meru bag
can i somehow add idk, setIconTexture to that .lua file or smh?
setTexture i think
that's for the item texture tho isn't it, i already have that set up
that should be the icon
Good morning.
items didn't have models until recently so the method names might not be structured around that
PZ is way overdue for an internal cleanup and API-breaking upgrade.
I'm thinking about adding Python 3 support for modding PZ.
my attitude is basically that mods are going to break with major revisions anyway
i mean look, that's the .lua file and it sets the backpack texture on characters back/on ground to red or meru textures, but the icons in inventory are random, so for example red bag has meru icon
print('Hello, World!');
I've seen a lot of code here but I haven't seen camelCase mixed with all-caps function names before.
Little 3D code is straightforward.
something like```lua
-- outside of the functions, probably at the start of the file:
local redTex = getTexture("path/to/your/texture.png")
-- add this part inside your function:
result:setTexture(redTex)
i have 0 coding knowledge all i do is mix and match stuff i find online/get from game files/here xd
Ah. My first advice is not to learn the habits of the game's code. They do not follow industry-standard when it comes to Lua.
I'm a professional programmer. This is my career.
Stick to camelCase or PascalCase. E.G:
function Recipe.OnCreate.PickBagTexture2(items, result, player)
-- ..
end
(Uses PascalCase)
Keeping things consistent does wonders for not only yourself but others who help you.
=)
i'd recommend naming them something a bit clearer in general, e.g. Recipe.OnCreate.PickBagTextureRed Recipe.OnCreate.PickBagTextureMeru
right, thanks
i should put that in as many times as there are textures?
yeah, grab all the textures outside of the functions and then set the texture in each respective function
haha no way, it's working 😄
now is it possible to set the correct texture for crafting window icon? xD
i guess not cause it's showing a random "New School Bag" item, or is it? 😄
you'd probably have to hack the crafting ui for that one
allright i can live with that haha, thanks for help 😄
Thats why it would be easier to make 2 items and swap between them
yeah but i wanna add like lets say 10 different textures, and that way i can have it all in 1 file, idk if that makes any sense haha
where i can find the textures for weapons?
textures/weapons
and then?
they are arranged for what kinda weapons you need 1handed 2handed firearms etc
they are all pngs
i'm looking for the machete
i don't find it
thanks
anyone know a good way to save a table of inventoryitems?
where do you get those inventoryitems from?
alternatively you can save the names of the items as a string in a table and then put them in the playermoddata
does Events.OnPlayerUpdate.Add(ApplyStimEff) mean that on every instance where the player gets updated, the function ApplyStimEff runs ?
or that it runs once onplayerupdate and then never again ?
Hello developers! I was looking for a way to let the player to be visible on screen, but not visible by zombies. I found that the IsoMovingObject exposes a method setZombiesDontAttack(boolean), but the only effect is to not being attacked. Zombies will continue to follow the player. 🤔
I add them to the table when they are crafted
I would save the item's ids or something, but I need references to the exact item instance when the game starts
I'm thinking about just saving the positions of all the items and checking that way
don't know if this helps, but there is a debug cheat that does this, "ghost" I think
maybe that is in the lua source
unfortunate that there's no getitembyid
when the game starts? what if it's unloaded?
hello! replying to my own line in case anyone has a chanece to follow-up
the spiffo is aggressive in reactions.
or whenever it is loaded might work, it's for a custom drainable system
Yes, I was looking at this. When the "ghost" is enabled, the player will be invisible to other players also. :/
burryaga's meditation mod achieves this, maybe check how that works
I’m not really familiar with how the loading system works in this game. If I go with the saving positions approach will there be a problem if I look for items in a space that isn’t loaded?
You're running it from the Host menu? From what I remember from debugging the bug shouldn't affect it, but including bc potentially related: #1067210244159193108 message
What does the debug code look like?
yes, for the most part no objects beyond an area around the player exist
the values are assigned before the debugger
what event is this attached to?
i assigned the debugger call to a key press
numpad 5 specifically, but it shouldn't matter, I think.
to be sure, the values are read on the key press?
What about the definitions?
That is, are the variable definitions tied to an event
this specific block of code happens on keypress is what i'm trying to be absolutely sure about
Does that run only the function in the first image or does it also run the code in the second image
thank you, is there an event called when squares are loaded? Do you think it would cause problems if I check if that square matches my list of positions?
the first image only
that's your problem
Oh! I think I get it
you're reading the sandbox options before they're assigned, so it's just giving you the defaults
OnInitGlobalModData is the earliest event after sandbox option load
though in many cases i would just avoid caching sandbox options
Poor Lua is always catching strays 😢 it is not at fault for this
Fortunately they're going to make sandbox options available sooner in the next build if I remember correctly
Yeah there's a lot of build improvements from what I can understand... hence I became less keen on devoting more time to the current SS.
better to wait for the base game resource management improvements and build on top of that then continue beating a semi-dead frankenhorse.
i mean, the next build will literally have (lobotomised) ai
i imagine that's when we'll see a multiplayer compatible npc mod
and it'll probably be much easier to develop something like that
except npcs will have no mercy and no hesitancy if no safeguards are in place.
sorry, real life lessons are creeping in. <_<
interesting, I wasn't aware of the OnInitGlobalModData in Events
and you're right, I'm looking at some other mods that use sandbox-options; caching seems to be... never used*
admins can change sandbox options live so caching them can be awkward
Yeah that makes a lot of sense
i'm looking at binki tools for examples.
looks like I should go back and remove the cache references...
and reference the SandboxVars directly.
you can cache the SuperbSurvivorsContinued table for shorthand
if anyone's interested i uploaded the mod i managed to make with help from people from this channel to steam workshop, Workshop ID is 2980535389. Once again, thanks to everyone that helped! 😄
since tables are by reference
something like this?
That will still cache them unless you call it repeatedly (i.e., every time you need an option), but calling it repeatedly just to get one sandbox option would be unnecessary
local SS_SandboxOptions = SandboxVars.SuperbSurvivorsContinued
no function needed
it just makes things a bit shorter when you're referencing sandbox options constantly
Is there a way to mark your mod as being incompatible with other specific mods? Sort of like the opposite of a pre-req, so that if you try to enable both the game will actually prevent it?
no, but you can identify it inside your mod and pop a dedicated error log. it won't protect you from complaints though.
OK, so I reworked the order of the code files for the sandbox options as such
... now to see if the values hold up after being set in the sandbox menu.
I see, I think I understand what is going on now
the Lua code is compiled running as soon as the game app finishes launching...
so the ss_options is already reading and setting the values for the mod.
I need to actually include events to handle initialization of all the functions and options.
lua is never compiled, but yeah it first runs when starting the game (or any lua reload)
Yeah, now I think I got an idea why the sandbox values isn't updating even after being set at the sandbox menu.
SS never bothered with the Events.<action> stuff so all the Lua is loaded at start.
Better designed mods have an initailizer() kind of function to ensure everything is loaded in a managed order.
I am trying to make a single recipe that takes multiple things and inserts them into an item but it gives a result item based on what items were used. How would i go about that
recipe Remove Vial from Auto Injector
{
AutoInjectorHemoA/AutoInjectorHemoB/AutoInjectorMorph/AutoInjectorProp/AutoInjectorZombX,
Result: ,
Time: 30.0,
Category: Stims,
}
this would be an insert and remove thing
have an OnCreate function that checks the type of the ingredients and adds a result based on that
so would i remove the result section and change it to onCreate
or would i be able to make the recipe a little different
Clothing can be containers correct? Like cargo pants (I know bags are containors)
you have to have a result or the recipe menu breaks
but you can set RemoveResultItem:true so that it doesn't actually spawn
ok so i would just put something as the result and then have it removed but how would i still get the item from on create wouldnt that break it
or is the oncreate result a different thing than the recipe one
?
Or am i just understanding completely wrong
the oncreate result is the recipe result, but you can just add an item to the player's inventory in the oncreate
I completely forgot about that but i thought that what that created had to be in the Result slot. idk what im thinking
sorry im very bad with explaining my thought process
me and MrBuskett had fun with getting this one going last night ```lua
PropitalTicks = 0
function InjectPropital(items, result, player)
local char = player
local obh = player:getHealth()
local AddHealth = 25.0
-- creating the function to add health
local function everyOneMinuteah()
player:getBodyDamage():AddGeneralHealth(AddHealth)
-- starts the tick for propital
PropitalTicks = PropitalTicks + 1
-- checks if 5 ticks has passed, removes the event, and resets tick count to 0
if PropitalTicks >= 10 then
Events.EveryOneMinute.Remove(everyOneMinuteah)
PropitalTicks = 0
end
end
-- Adds the event to add 25 health every 10 minutes in game
Events.EveryOneMinute.Add(everyOneMinuteah)
PropitalTicks = 0
end
although forgot to update the comments lol
would i need to create a table of possible results as well as the table for what items are used?
a lookup table that matches ingredients to results would be the best
Is there a sequence list of what Events.<context> are fired before Events.OnGameStart fires?
no, i've been meaning to write one - pretty much everything following the OnInitX or OnXInitialised pattern fires before that though
aghh, yeah, I can confirm Events.OnCreatePlayer fires off before OnGameStart
Is there a mod that has pants that can hold items? Im trying to code some cargo pants
Im not sure if you can turn pants into inventory container
damn.
You can remove
char =
Wheres yiur everyone minute function
in the middle?
everyOneMinute is a base game function
Right i didnt noticed that
Its a nested function
the base game has an everyTenMinutes and a everyOneMinute
Will that work? It added everyOneMinuiteah
Outside of the InjectPropital
So its not really adding anything
Yes those are called events
that's inside
the everyoneminuteah is what i named the local function
the indentation is a bit off but the scope is correct
@bronze yoke what indents are off im still learning
the last two lines are indented one too many
@bronze yoke , thanks again, turns out I still need a function so I can specifically tell SS mod to load the sandbox-options values during OnInitGlobalModData
😇
otherwise it'll continue to load as soon as app launches and never uses the user specified sandbox-options
right i had to view it on pc for me to understand cuz in mobile the tabbing is shit
this is how i should create the table right?
local KIStimCraftedItems = {
["CraftedMorphineVial"] = 1,
["CraftedHemostaticAVial"] = 2,
["CraftedHemostaticBVial"] = 3,
["CraftedPropitalVial"] = 4,
["CraftedZombXVial"] = 5,
}
i would do it like ["CraftedMorphineVial"] = "ResultItem",
How do I determine what item spawns where? Id like to make ceartin items spawn only at military bases
#mod_development message
You can do something like this and print anything you want every time an event is triggered, for debug purposes.
albion im still not understanding how that would work
so for example (probably not working code)
local KIStimCraftedItems = {
["CraftedMorphineVial"] = "TypeOfAnItem",
}
local resultItem = KIStimCraftedItems[item:getType()]
if resultItem then
player:getInventory():AddItem(resultItem)
end
would this give me an option of which one to craft if i have multiple items in my pockets?
this is what i have
local KIStimCraftedItems = {
["CraftedMorphineVial"] = "AutoInjectorHemoA",
["CraftedHemostaticAVial"] = "AutoInjectorHemoB",
["CraftedHemostaticBVial"] = "AutoInjectorMorph",
["CraftedPropitalVial"] = "AutoInjectorProp",
["CraftedZombXVial"] = "AutoInjectorZombX",
}
local KIStimsFoundItems = {
["MorphineVial"] = "AutoInjectorHemoA",
["HemostaticAVial"] = "AutoInjectorHemoB",
["HemostaticBVial"] = "AutoInjectorMorph",
["PropitalVial"] = "AutoInjectorProp",
["ZombXVial"] = "AutoInjectorZombX",
}```
i think you'd pick using the normal recipe ways (either selecting it in the recipe menu or by right clicking that specific item in your inventory)
am i at least on the right track
Can someone please tell me what are all the integer/numbers in BodyPartIndex?
from the lua side this is what i saw
https://projectzomboid.com/modding/zombie/characters/BodyDamage/BodyDamage.html#SetBleeding(zombie.characters.BodyDamage.BodyPartType,boolean)
actually, is it all of it here?
https://projectzomboid.com/modding/zombie/characters/BodyDamage/BodyPartType.html
yeah, though i don't think they're in order
i would just use the enum instead of integers
got it, thanks
What are "subitems" in clothing.xml ?
It can be item with a probability to spawn in the current outfit instead of the parent item.
I'm new to clothing though..
player:getBodyDamage():RestoreToFullHealth() - appears to work...
player:getBodyDamage():SetBleeding("Foot_L", false) - doesn't work.
Where did I screw up? :(
https://projectzomboid.com/modding/zombie/characters/BodyDamage/BodyDamage.html
I have a suspicion that RestoreToFullHealth prevents zombification when called, but I'm unsure
ah thats why I want to do! Make a random chance of certain clothes colors.
"Foot_L" is a string you need an index or a BodyPartType
<m_items> <!-- Jacket_samurai_black_01 -->
<probability>0.5</probability>
<itemGUID>f533e4d7-05d0-4746-948e-bd0d518009b9</itemGUID>
<subItems> <!-- Jacket_samurai_classic -->
<itemGUID>392e2cb5-42cf-4ad4-8a5e-c7f6bb5eafbd</itemGUID>
<probability>0.1</probability>
</subItems>
<subItems><!-- Jacket_samurai_black_02 -->
<itemGUID>b146dde0-7b50-4134-8fdf-e84af320abf2</itemGUID>
<probability>0.5</probability>
</subItems>
<subItems><!-- Jacket_samurai_black_03 -->
<itemGUID>d7441aed-fa06-438e-b471-4d9d52c58548</itemGUID>
<probability>0.5</probability>
</subItems>
<subItems><!-- Jacket_samurai_brown_01 -->
<itemGUID>acce3420-52fc-4087-86f1-b621743773ee</itemGUID>
<probability>0.5</probability>
</subItems>
<subItems><!-- Jacket_samurai_brown_02 -->
<itemGUID>dd3fa03a-d87c-413a-b090-1ea393cba9e3</itemGUID>
<probability>0.5</probability>
</subItems>
<subItems><!-- Jacket_samurai_brown_03 -->
<itemGUID>0ec29db6-c261-4904-84e7-8cd863b270f5</itemGUID>
<probability>0.5</probability>
</subItems>
<subItems><!-- Jacket_samurai_white_01 -->
<itemGUID>af9cced2-5b27-4e1b-abd7-e7a77320f24d</itemGUID>
<probability>0.5</probability>
</subItems>
<subItems><!-- Jacket_samurai_white_02 -->
<itemGUID>985e6f77-bdae-4ae6-b3e6-e2de71aae0af</itemGUID>
<probability>0.5</probability>
</subItems>
<subItems><!-- Jacket_samurai_white_03 -->
<itemGUID>bca25394-1b78-4c1a-8201-9563ade251ab</itemGUID>
<probability>0.5</probability>
</subItems>
</m_items>
Is this right?
is there a way that i could "delete" or skip this occupation and trait selection screen? so players on my server dont have any occupation and traits when creating a new character
like when they choose the region they want to spawn then it goes to selection of trait and occupation and then character appearence, name etc... can i skip this screen?
you want BodyPartType.Foot_L
u would need to make a mod that removes the professions i guess for 1
Having an issue with doors being able to open from anyone without a key. Wondering if anyone has seen this issue before.
is there a way to make a gun change the entire model of the weapon when an attachment is attached
Hello guys)
What characters are allowed in the categories and their translation strings?
Item categories ofc
anyone know how to fix this?
cap is clipping into the center of my head
messing with the model in blender w scale/position doesn't help
theres a way to change position through the code idk how though
Hello everyone, I want to start modding project zomboid, does anyone know where I should start?
From here)
pzwiki
Should the pack export work at all?
last version of steam tilezed
Just silently exporting nothing
It works with the right settings.
ps: I'm not using steam version
Can you look version of your installation?
All i found on forum is 2022 version
lol
Without prefix and with right slashes its works))
Ah java coders...
Here is a kind of silly question: can i overwrite vanilla lua method defined in the ClassName.MethodName form?🤔
in a lua file with a name ≠ vanilla lua file name?
i just don't want to overwrite the whole file😢
Yes
so how? just writeClassName.MethodName = function(...? do i need to require anything?
Well normally you would save the old function somewhere like old_method = ClassName.Methodname,
But then yes you can just say ClassName.Methodname = function(….)
Also maybe require the file you want to overwrite the function from
🤔but somehow it is not working, whether do i require the vanilla lua or not. by the way i named the file with another name.
Whats your code?
by the way I've tested the method by overwriting the whole file and it works.😢
the traits and occupations are defined in media/lua/shared/NPCs/MainCreationMethods.lua, maybe you could make a mod that overwrites that file and just doesn't add any traits
Bump
check tech support or mod support
Gotcha, ty
Alrighty Someone smarter than me want to tell me why holding a gun, and running around randomly boots us out of the world
large pack of z's is the trigger
is it possible to
print this from lua
you can get the ArrayList of textureChoices using clothingItem:getTextureChoices() and after that you can print each item
https://zomboid-javadoc.com/41.78/zombie/core/skinnedmodel/population/ClothingItem.html
Javadoc Project Zomboid Modding API declaration: package: zombie.core.skinnedmodel.population, class: ClothingItem
You can probably get in-game value from ItemVisual. If you just want the value from the file, you can use Lua or other languages.
clothingItem:getTextureChoices()
i will try this now thnkx
it will return a set of objects for some reason. I'm not familiar with this class, so I can't say exactly why it returns a set of objects. But I assume you need to iterate that set and output the objects one by one.
Also first you need to get corresponding object clothingItem from somewhere
can anyone help me? i'm using ItemZed but he seems not to find my mods folder, am i missing something?
only examplemod show ups
my mods are located here "C:\Users\saro8\Zomboid\Workshop"
nope couldnt print anything only error
local wornItem = getPlayer():getWornItems():get(0)
print(wornItem)
------------------------ ---------------------------
local wornItems = getPlayer():getWornItems()
for i=1,wornItems:size() do
local item = wornItems:get(i-1):getItem()
print(item:getClothingItemName())
end
this is how i got the clothing item
but when i added the
:getTextureChoices()
it errors
What's the error
If this is not a mod you're developing, see #mod_support. Otherwise, provide more detail
me? non table
Where did you add :getTextureChoices?
item should be an InventoryItem; you want a ClothingItem, so you'll likely need to use getClothingItem first
Is getTextureChoices attached to the item script and not the inventoryItem?
you have nils
local wornItems = getPlayer():getWornItems()
for i=1,wornItems:size() do
local item = wornItems:get(i-1):getItem()
print(item:getClothingItemName())
print(item:getVisual():getBaseTexture())
print(item:getVisual():getTextureChoice())
end
found it
the 3rd print worked
ah shit nvm
just realized it returned interger instead of string
i needed the string name
it is. i am the primary dev of this particular mod, the issue seems to be when holding mainly the hunting shotgun. when around roughly 15 or more z's the game boots me, throws a few errors, not much recourse to be found in the log except the chunk provided really. no other mods loaded.
What are the client and server logs exactly when this happens?
no server, ill go hunt for them.
so it's co-op?
happens either on a server used p2p or alone, mainly single testing currently
function TakeAdrenalin(items, player, item)
local body = self.character:getBodyDamage();
local health = body:getOverallBodyHealth();
if health < 99 then
body:AddGeneralHealth(math.min(health+14, 100)-health);
end--if
end
can someone help me ? my code doesnt work...
i assume you need to use player:getBodyDamage() instead of self.character
Good morning.
Is there a way to retrieve the item ID of the weapon that is used to kill a zombie?
I found the event "Events.OnZombieDead" but it is only aware of the zombie killed, not by who the zombie is killed (right?)
Hello there!
While exploring local conversations, came to conclusion that creating extra body locations
'getOrCreateLocation'
Is a bit unstable and prone to bugs thing. So the questions is... how to create couple extra body locations and not to destroy humanity?
you can use the OnHitZombie event and check if the damage is enough to kill the zombie instead
so im trying to fix my mod but when im testing its doing something that no longer should be happening as i removed that part. Ive tried resetting the lua but that didnt work?
any idea how to get the changes to go through
im not subscribed to it on the workshop
doing some validating
that didnt work
i am so confused right now
think imma go to bed and try again later
Check the different potential version locations for your mod: 1=%username%/Zomboid/mods 2=%username%/Zomboid/workshop 3=[steam workshop subdirectory]
That has tripped me up so many times, I nuke every instance of my mod when devving, and output it with a debug/test workshop/modinfo id 😅
wheres the sub directory i only know of the first 2
You can have a look at KillCount as it is exactly what is done by the mod.
what was the issue?
it was within my workshop file that i forgot about
from when i uploaded it. I had a saved copy i that i edited then put into the mods folder so it was trying to read from the workshop version
Hello ! I'm developing a small mod, and I noticed the BodyDamage class has a FakeInfection variable. I can use it in singleplayer and seems to be working perfectly (so far), however when I host a server, the fake infection always defaults to a 14 hours duration, instead of the time i specify with InfectionGrowthRate.
So my questions are :
- does anyone have extensive knowledge about FakeInfection, and how it works in mp ?
- anybody knows of a Java class that updates infection other than BodyDamage (which i already dissected heavily) ?
- or if none of the above, could someone direct me to a Java server class that manages player variables such as debuffs and wounds or, you guessed it, infection
Thanks in advance, I'm sorry if this is a lot to ask
Does anyone have a mod for door padlocks that works w Multiplayer? I know there is one on the workshop however it seems buggy and allows players to open doors at times when they don't have the key(s). Sorry if this is the wrong channel.
Does anyone know how the superb survivors quest system works?
Im thinking of making some rudimentary quests for a tiny endgame mod
Trying to write my first mod, I've encountered an issue and changed the code, but the game refuses to reload the file at all. I have tried disabling and reenabling the mod. I have also tried reopening the game, but the same lua error appears even though the code it is referencing is not even there anymore. Even if I change the file name, it still says that the error exists in the old filename that no longer exists.
I see, thanks
frenchie cap
Good afternoon.
Updated PZStudio see changes here:
#1109540587075539104 message
is there a lighter version of the "OnTick" event? Like, something that is fired often, but not too often?
everyoneminute i think is the closest
What about on playerupdate?
that's heavier than ontick
Ah, wow, okay, thank you.
I have noticed that calling player:getWornItems():size() inside OnClothingUpdated can be very inconsistent and the :size() can be wrong compared to what's actually on the screen
So, I was thinking about using an alternative way to check for the real value using a different event
Thanks for the response but i already did it, removed all traits and occupations just by making a mod and commenting the lua code, but it kinda broke the game and made errors
you should find the ui code responsible for moving onto that page and just make it move on past that instead
what determines how much "Wet" a towel can remove per use?
no idea where to look for that >.<
how would I remove a default item from the loot pool with an insert distributions .lua file
You can use this function.
RemoveItemFromDistribution(_dist, _item, _chance, _dorecursive)
ex:
RemoveItemFromDistribution(SuburbsDistributions, "Razor")
RemoveItemFromDistribution(SuburbsDistributions, "MyMod.Item1", nil, true)
Look at ProjectZomboid\media\lua\server\Items\SuburbsDistributions.lua line 35 for more info about it.
What do the variables stand for
Thanks
UseDelta = 0.1,
is what you are looking for
think i figured the dryness thingy.
seem sit removes a set amount of wet per use.
the lower the use delta, the more times you can dry before having to wait for the towel to dry.
trying a 1.0 use delta would make the towel wet instantly and not dry me.
instead, changing it from .1 to .01 allowed me to dry off more of my character at max wetness.
thank you, use delta works to get where I needed to be. but still, exactly how much each use dries, where is that stored?
That might be into a TimedAction if there is one for this otherwise it may be hardcoded in java.
gotcha, its ok. use delta will do jsut fine. thanks 🙂
its tricky, if you set it too low, you wont use the towel and it wont convert, leaving a half used towel in this case
set it too high, you need 3+ towels just to dry yourself
look at ISDryMyself timed action: ProjectZomboid\media\lua\client\TimedActions\ISDryMyself.lua
ooh ty, will look into that
they decrease character wetness this way:
self.character:getBodyDamage():decreaseBodyWetness( self.character:getBodyDamage():getWetness() / 20 );
so it never really dry fully, it seem to remove 20% of wetness everytime.
and they call that action this way:
local useLeft = math.ceil(item:getUsedDelta() * 10);
ISTimedActionQueue.add(ISDryMyself:new(playerObj, item, (useLeft * 20) + 20));
in ProjectZomboid\media\lua\client\ISUI\ISInventoryPaneContextMenu.lua line 2166
im not very bright with code, how would I add something like that to this?
i went into the file you told me to look in and it looks completely alien
You create a file similar to this:
myMod/media/lua/server/myMod_distribution.lua
then you add it in there
RemoveItemFromDistribution(SuburbsDistributions, "MyMod.Item1", nil, true) -- removes MyMod.Item1 from the distribution recursively
So just add it onto a line
you might have to do it into an event like the example in ProjectZomboid\media\lua\server\Items\SuburbsDistributions.lua
Hey all! Is there a way to alter the default commands on a server? Trying to do this but it comes up with a Attempted index: Add of non-table: null
-- Function to override the /all command
local function onServerCommand(module, command, player, args)
if command == "all" then
-- Check if the player has the access item
if not hasAccessItem(player) then
-- Player doesn't have access item, so block the command
player:Say("You don't have permission to use this command.")
return false -- Return false to prevent the command from executing
end
end
-- Return true to allow the original command to execute
return true
end
-- Hook into the OnServerCommand event to override commands
Events.OnServerCommand.Add(onServerCommand)
@quartz badge
local function postDistributionMerge()
RemoveItemFromDistribution(SuburbsDistributions, "MyMod.Item1", nil, true)
end
Events.OnPostDistributionMerge.Add(postDistributionMerge)
this event will make sure that you remove it from the distribution after it is merged.
still does not work
Should i put base. before 308clip
Thats probably my bad
Welp, it wasnt, still doesnt work
only if it was added into the distribution with the base.
base stuff is never added with base.
Either way it didnt work
What do you mean it didn't work?
what is it spawning into?
you may have to remove it from the procedural distribution too.
how would I do that
call the same function with ProceduralDistributions
RemoveItemFromDistribution(ProceduralDistributions, "MyMod.Item1", nil, true)
so do i make a procedural distributions file too?
no need
oh i see
local function postDistributionMerge()
RemoveItemFromDistribution(SuburbsDistributions, "MyMod.Item1", nil, true)
RemoveItemFromDistribution(ProceduralDistributions, "MyMod.Item1", nil, true)
end
Events.OnPostDistributionMerge.Add(postDistributionMerge)
thanks, it worked
procedural distribution are just list of distribution under alias, pipeable into the suburbDistribution
nice, your right when you said it never really dry fully.
been messing with the values and cannot seem to get a 100-0 change.
but I did manage to get one towel to be able to dry yourself with 2 uses.
I have the list of the entire distribution arrays
I actually found a mod in workshop called remove vanilla occupations, you could check on that
Does anyone know how to make the Player nauseous?
I was messing around in debug mode and you cannot modify the sickness status nor did I find anything in code from a quick glance. Modifying fakeSickness works but also can't find it in code and it doesn't seem to reduce on its own, like it does when you are near dead bodies.
There should be a sickness bar in general debuggers mood and stuff, etc...
Yes but you cannot interact with it
And there's no reference in code it seems
It's ok though, I found what I wanted
Just finished one of my mods, but I noticed that for it to work well, I'd need to disable players from seeing /all. Is there any way to do that?
Can you share what you found ?
Just set the player's foodSickness value. Not what I wanted, but it works.
Any idea where I can find the PZ format of .pack files ?
Maybe I misunderstand the question, but maybe this will help you.
For audio you need the fmod unpacker?
For packs in texturepacks you can use the TileZed view pack > extract images.
That's close, I want to generate .pack files from an external software. I need the format definition of the .pack file.
is there a console command to set the time of day
i'm trying to take a screenshot and having to FF through the night
lol
if player:isAdmin() then
print("Player is an Admin. Skip radio check.")
accessStatus = 0
end
Is this not how you detect if a user is an admin?
isAdmin should be a global function, for players it's isAccessLevel. (?)
That did it, thanks ;v;
Is this a bug or something in the workshop ?
I genuinely cant believe that of 44 visitors 39 of those suscribed,seems weird to me
You need to consider MP, people subscribe without visiting.
I got one mod with a ratio of 8.8 subs/visit. 😄 probably most users do not even know they got it in their library.
One of my more recent mods made me double take
sh*t, so I do not have the best record on that..
At least I should beat you with the worst like/unlike ratio 😄
got 31% dislike. I'm not even sure it is a review-bomb.
sorry
Was a joke lol
new update coming for my backpack flags mod
now you can wear two flags
added 30+ new flag textures
no more clogging up the crafting menu, now you change your flag texture on the fly with a context menu
huge thanks to @ancient grail for his hard work and help coding this.
Thanks! Still got a few kinks to work out but I'm pretty happy with it now
Already fixed the issue with admins not being to use global chat
The idea's been in my head for literally months
But it took me 4 hours of debugging to make it work well
Super proud of the radio-by-radio basis
Next I have to work on making desk radios work
And a real dream would be having the /all chat not display at all without a radio
What mod
does anyone know how to create new challagnes?
I took CDDA, changed starting items and spawn location and its giving me an error
ERROR: General , 1685191655026> ExceptionLogger.logException> Exception thrown java.lang.IllegalStateException: Failed to find any .lotheader files at IsoMetaGrid.CreateStep1 line:1459.
ERROR: General , 1685191655027> DebugLogStream.printException> Stack trace:
java.lang.IllegalStateException: Failed to find any .lotheader files
at zombie.iso.IsoMetaGrid.CreateStep1(IsoMetaGrid.java:1459)
at zombie.iso.IsoWorld.init(IsoWorld.java:2305)
at zombie.gameStates.GameLoadingState$1.runInner(GameLoadingState.java:268)
at zombie.gameStates.GameLoadingState$1.run(GameLoadingState.java:225)
at java.base/java.lang.Thread.run(Unknown Source)
Take ltber mods is genwrally frowned upon
huh
i assume he's using it as a template and not actually taking it lmfao
yeah
Ayt
Was just informing . Cuz some people dont know about the modding policy
Can you show the code
that's vanilla challenge also
Like side to side both the original and the modified one so we see whats the problem
This is CDDA original code:
Ah didn't know that cuz i never played sp
Thnx for clarifying
and this is modified
The error is map related so I guess it's problem with location.
Yeah I took the tiles and x, y from the map website
You should not do that?
why not
Sorry I'm on mobile.
{xcell = 42, ycell = 13, x = 117, y = 67, z = 0}
this should point nearby Louisville
oh, I was about to type about converting.
This should be ok?
yeah its all from CDDA except I changed the numbers
I think Louisville is accessible, but can you try from CDDA to see if it really is?
Because Muldraugh Map might not include it.
there's one confusign thing tho, in CDDA there's this code:
which looks like location is specified once, then there's a list of location to choose randomly from
I'll try to put some location from here and see if it works
There was probably only 1 spawn originally, or they just needed a default
display roles in chat
My guess is some big server(s) got their hands on it
Ah for dotd
Nice..
I think these are legacy, unused spawnpoints.
I previously had a separate item for each backpack flag in my mod. Now theres a dummy item that changes based on a context menu.
Is it safe to delete the code for all the old flags or will that mess up peoples game saves that have previous flags?
such as the item definitions and stuff
Well, the game launched, so the coordinates were really the problem
but also
none of the items from the code were added lol
or traits
amazin
Removing items is tricky, and if there were items on the floor it would cause a world dictionary error bricking games.
ill leave it in then
You can write a soft remove patch
theres no way to get them besides spawning in anyway
oh
You can make their display names blank if they're not used at all
and flag them as obsolete
and additionally run through player's inventories onplayercreate
replace it with the new dummy item
CDDA.x = CDDA.spawns[rand].x;
CDDA.y = CDDA.spawns[rand].y;
CDDA.z = CDDA.spawns[rand].z;
print ("Set to :" .. CDDA```
Maybe its this @fiery hollow
I could find the obvious problem
But maybe its this cuz i dont see rand being declared anywhere
well, setting the default CDDA coordinates launches the game but
when I launch it, right as I start it I see the ERROR 1 messages at the bottom right for a second
I have nothing in my inventory
so the adding items to inventory code isn't working for some reason
Damn. Im too sleepy for this
If you havent solve this by tomorrow ill try and look at it again. Cuz im currenly usingmobile
@fiery hollow
you want me to try CDDA locations?
Start challenge, try to go to LV.
yeah, thats gonna take some time to do lol
These coords looks wrong, I try to teleport there but it's all black.
wait wrong coords
I wanted to do this basically
I thought cell was for xcell and rel was for other x and y
you can teleport there after you start the challenge 🤔 maybe it's something else.
Is there a way to add a dropdown as a sandbox variable?
You can override ISChat.addLineInChat for this
Will definitely have to look deeper into it. I'm using a framework atm that does most of the heavy lifting :v
Yes, use the enum type. See #mod_development message
However you end up doing it, mind that mods sometimes call it with "fake" message objects for their own purposes. I get around this by explicitly checking for the original ChatMessage and ServerChatMessage metatables
Under the assumption that if it has the metatable it is likely a real object
I only mention this because you'll need some methods that the vanilla Lua doesn't use to check the chat type. Since the vanilla Lua doesn't use them, modders often don't bother including those methods in their fake objects
If anybody here is an artist or at least is relatively decent at making textures / sprites and would like to do a quick Collab, let me know 💖
what do you need?
also, does anyone know how I can change the processGeneralMessage function? it currently does [Account]: Message when I'd rather it be [Character Name]: Message
This can be done by overriding getTextWithPrefix on ChatMessage
@ancient grail
:O
thank you omar
truly a blessing
local _ChatMessage = __classmetatables[ChatMessage.class].__index
---Override to modify chat format.
---Decorates the original getTextWithPrefix.
---@return string
function _ChatMessage:getTextWithPrefix()
-- `self` will be the ChatMessage; see the javadoc for available methods
-- process the message and return the entire string that you want to display in chat
-- note that lines are separated by <LINE>, not the newline character
end
No problem. Excerpt is an example of how I did so
I'm not too familiar with Lua other than the basics. Would I slot this into my script somewhere, or is there some extra step or two?
The skeleton of that will be what you need; let me edit it to exclude more irrelevant details
The javadoc I'm referring to: https://projectzomboid.com/modding/zombie/chat/ChatMessage.html
declaration: package: zombie.chat, class: ChatMessage
I see, this is def a huge help
im probably gonna try to get some shuteye, ill read back on this convo tomorrow :)
Does anyone know the difference between setWorldTexture() and setTexture()
yeah
hello bruh yeah i can provide you with the graphics you need. but ive sent you dm before cuz i wanted to show you a link with your mods packed and you didnt return fr so i cant dm you 
hello, when using getModData(), do I need to separate mod data and local variable in such fashion :
local function LoadPlayerData()
player = getPlayer()
playerModData = player:getModData()
playerModData.ICdata = playerModData.ICdata or {}
playerModData.ICdata.shouldHeal = playerModData.ICdata.shouldHeal or false
dataTable.shouldHeal = playerModData.ICdata.shouldHeal
end
local function SavePlayerData()
playerModData.ICdata.shouldHeal = dataTable.shouldHeal
end
Events.OnGameStart.Add(LoadPlayerData)
Events.OnPostSave.Add(SavePlayerData)
or can i just use mod data directly and it won't change impact on performance ?
I'd have to check to confirm but my assumption would be that world texture is for the texture that appears on a world item vs in the inventory
Without the local keyword or an earlier declaration, those are global variables. It shouldn't be too bad to access it directly. Since OnPostSave only runs on exit, I wouldn't rely on it to save your data if this mod can be used in multiplayer (or if it's just for singleplayer, for that matter). If you want to ensure the values stay up to date I'd just keep a reference to the table, personally
they are declared earlier
as local (sorry i forgot to include this in the code)
thanks for your answer i'll try to do it this way
encapsulate the setting and reading in dedicated functions and use direct moddata read/write. If you meet performance problems, it will be easy to change / optimise those afterwards. Premature optimisation is the root of all evil. That said, you can also embrace evilness 👹 .
I just pushed a big update to my backpack flags mod if anyone wants to check it out.
• You can now wear the flags on either side
• Wear two flags at the same time
• 30+ New flags added for servers & tributes
• Flags now spawn on zombies
thanks ill try
I wanted to ask here since I know it would be a really big challenge but the idea has peaked my interest. How possible would you guys think it'd be to make a VR mod for PZ? I know there's a lot of challenges already like trying to figure out how to render the game from third person to first person or adding functionality to the controllers but it'd be doable right?
it wouldn't be doable, you'd be developing an entire game
there's really not much about pz that works as a foundation for vr
Hello there, sorry to bother with that noob question but what is the way you'd advise to check the type of a variable in lua ? equivalent of myVar instanceof IsoDoor I remember there are two ways but I never can remember the writting and I also would like to know what is the right way to do it.
Hello! I'm trying to make the player smoke from a context menu in the game world. The action is not being executed. Does anyone know why?
function EntradaWorldContextMenu(player, context, worldObjects)
-- code
context:addOption(getText("Prender Pucho"), worldobjects, FuncionWoldContextMenu, player);
-- more code
end
Events.OnFillWorldObjectContextMenu.Add(EntradaWorldContextMenu)
function FuncionWoldContextMenu(worldobjects, player)
local playerObj = getSpecificPlayer(player);
local playerInv = playerObj:getInventory();
local items = ISInventoryPane.getActualItems(items)
for _, item in ipairs(items) do
if item:getFullType() == 'Base.Cigarettes' then
ISTimedActionQueue.add(ISEatFoodAction:new(playerObj, item, 1))
end
end
end
instanceof(myVar,'IsoDoor') is one of the two ways
is it type(<variable>)?
i might be wrong, lua is still new to me, but I thought there was a global type() function
type(foo) == "table"
thanx
thanx U2
memewhile i'm pondering which modding tool to try.
might also help if there's a boiler plate for PZ Lua modding.
try pzstudio
https://github.com/Konijima/project-zomboid-studio
umbrella should help with lua modding
pzstudio uses umbrella, it is also a boilerplate
you create your project anywhere on your pc, and running build & watch it will copy and make the structure automatically into your workshop dir.
great for a mod git repo where you can install anywhere
heres how it look like https://github.com/Konijima/MileageExpansion
the mod uses km codewise, but convert the value to miles visually only
it consider 1 tile = 1 meter but it's arguably inacurate
oh don't get me wrong, if I'm going to measure something in software, I think metric is better.
But my every day is somehow supposed to measure in gallons, ounces, pounds... with mile, yard, feet/foot, and inches before reaching the centimeter.
nevermind the units of scoop, tablespoon, teaspoon, and pinch.
sigh add until saltiness and/or sweetness can be detected.
It might be because FuncionWoldContextMenu is defined after the context:addOption(getText("Prender Pucho"), worldobjects, FuncionWoldContextMenu, player);
Try Moving FuncionWoldContextMenu above EntradaWorldContextMenu
<m_HatCategory>nohair</m_HatCategory>
is there a hat category to only hide the top of the head?
so for example this item is a helmet
i don't want mohawks to show through the top, but i want long hair to come out of the bottom
is that possible?
look for MohawkFlat keyword in lua code. it is very specific and I think it is related to what you want
That sounds exactly like what i need honestly
thank you
ill look around
I posted some ideas and suggestions for the mod
Check them out
It's great content btw
And a very cool idea for a mod in general
Anyway
Where could I request/suggest a Mod idea?
I would like to be able to craft different types of Curtain Walls, like the curtains in Hospitals, but more homemade and varied
Actually this could come with a blanket expansion for beds, as well as new towels
Like the Classic Tiger Blanket
Maybe maemento mori could consider that idea for the future
Perhaps
But idk how to do tiles so it will be a while before I can do anything like that
Thank you for your suggestions, I'll definitely implement some of them
anyone got any thoughts on these slides for my mod? tossing around ideas for 'em
I would add a box / blur around the text personally. The text kinda gets lost in the background
Or alternatively blur the background
Other than that they look great, good job
like this?
eh
that looks kinda messy
i meant more something like this
how it is on the left
heres the psd if you like it
Thinking about your Backpacks mod, I remembered some ideas I've had in the past that may suit your kind of content
I've been wanting more Punk stuff to be in the game, but so far I've only seen Gothic content
There are Mohawks but the hair gets covered quickly
So, I thought, how about a Punk Helmets mod?
I'm actually working on a goth helmets mod rn
just need more ideas for it
plus ive been busy working on some commissions
Starting from different Mohawk Wigs that can be weared over anything, passing through Punk Hats, ending in actual weird Helmets with protection, spikes and all that
idk i'm mainly going for cute stuff honestly haha
i made the whole goth backpacks mod bc i have the backpack and fanny pack irl
and i just wanted them in game
lol
same with the goth hats mod
tired of using another mod for their hat so i made my own
and i figured i may as well make a mod out of it
But consider the wigs idea, and having Nails, Knive tips and Scrap Metal crests
This is cute to me
I actually dig having this thing in game not gonna lie
Wigs could go a long way
Ah, yeah, different Horn Accessories
I have always liked the style they give you
Besides some helmets with horns, horns that can be weared with anything would be great
Hello everyone,
I want to retrieve the public server-side method getTotalKills(username, value) from this mod:
https://steamcommunity.com/sharedfiles/filedetails/?id=2857273296 located in the file media/server/Server.lua .
-- get/set TotalKills public functions
function getTotalKills(username, value)
return ladder.zKillsTot[username]
end
In my client-side mod: media/client
require("Server")
local character = getPlayer()
local userName = character:getUsername()
print(getTotalKills(userName, nil))
But the response is always nil.
Where am i wrong?
Thank you
I checked this mod. This function not used.
If you want to use it, need call it in server lua file
The getTotalKills(username, value) method would be helpful for me to perform calculations in my mod.
I need to retrieve the values form the ladder table,
I don't understand how to invoke/call it from the server file.
client side
Thank you
Try send from server to client data
by sendServerCommand
Ok I will try to understand how to use sendServerCommand function. Thank you
I might be old, but I found out that Baretail is still very good to read the live logs from the console.txt file give it a try -> https://www.baremetalsoft.com/baretail/
Does anyone know how can I make this code work with the Java's array list?
local function forEach(array, callback)
for index, value in ipairs(array) do
callback(value, index, array)
end
end
-- Example usage
local myTable = {1, 2, 3, 4, 5}
forEach(myTable, function(value, index, array)
print("Index:", index, "Value:", value, "Array:", array)
end)
Working on a UI mod, currently deciding whether to support controllers. I don't use a controller, no one I know uses a controller, and the systems for it don't seem particularly nice to implement. Anyone personally use controllers, or have made a similar mod and had controller support be asked for much?
Use a numeric for loop from 0 to :size() - 1, then call :get with the loop counter. I don't see why you'd want a forEach function in most cases anyway, though
I like to use forEach because I come from JS and it allows me to tidy up my code, eg:
current code:
TransmogDE.patchAllItemsFromModData = function(modData)
for originalItemName, tmogItemName in pairs(modData.itemToTransmogMap) do
local originalScriptItem = ScriptManager.instance:getItem(originalItemName)
local tmogScriptItem = ScriptManager.instance:getItem(tmogItemName)
if originalScriptItem ~= nil and tmogScriptItem ~= nil then
local originalClothingItemAsset = originalScriptItem:getClothingItemAsset()
if originalClothingItemAsset then
local tmogClothingItemAsset = tmogScriptItem:getClothingItemAsset()
tmogScriptItem:setClothingItemAsset(originalClothingItemAsset)
if originalClothingItemAsset:isHat() or originalClothingItemAsset:isMask() then
-- Hide hats to avoid having the hair being compressed if wearning an helmet or something similiar
originalScriptItem:setClothingItemAsset(tmogClothingItemAsset)
end
end
end
end
-- Must be triggered after items are patched
TransmogDE.triggerUpdate()
end
Current code, using foreach
forEach(myTable, function(originalItemName, tmogItemName, table)
local originalScriptItem = ScriptManager.instance:getItem(originalItemName)
local tmogScriptItem = ScriptManager.instance:getItem(tmogItemName)
if originalScriptItem ~= nil and tmogScriptItem ~= nil then
return
end
local originalClothingItemAsset = originalScriptItem:getClothingItemAsset()
if originalClothingItemAsset then
return
end
local tmogClothingItemAsset = tmogScriptItem:getClothingItemAsset()
tmogScriptItem:setClothingItemAsset(originalClothingItemAsset)
if originalClothingItemAsset:isHat() or originalClothingItemAsset:isMask() then
return
end
-- Hide hats to avoid having the hair being compressed if wearning an helmet or something similiar
originalScriptItem:setClothingItemAsset(tmogClothingItemAsset)
end)
I understand its use in general, that just doesn't really look cleaner to me 😄 I find map far more useful—imo if it's gonna be slower, it could at least have a good purpose. To each their own though
Do we have map in zomboid?
I'm assuming you want it to work with both tables and ArrayLists from context—you can use instanceof & type to check for that (really one or the other, depending on whether you check for table or ArrayList)
Nah, I meant a map function I write
Ahh, okay
I would be happy with using two different functions for ArrayLists and tables
Disregard that last bit, in that case
Hi everyone, someone has a animation tutorial for a mod creating using blender?
How can I start?
does anyone know where are challangemaps are located
I thought challanges where just spawnpoints in main maps certain locations but apparently not
Hey! I'm working for a little mod for myself - what is the file that plays when radio / TV is on?
name of the file, imean.
sound
the interview one, or is that only for TV's and I'm miss remembering?
yeah, sorry, it's only for the TV's
Good morning.
How can I remove a train from the trait selection? I'm setting up a server for my newbie friends and I want to disable things like sunday driver, asthmatic etc etc
there's a mod balled remove burglar
you can probably can just change it
to remove other ones
oh wait thats a profession
Hi!
You've been away. How are you?
I also have some goodies that you should know about.
I was ill for several weeks. Now I'm fine)
Glad to see that you've recovered and sorry to hear this.
What is new?
There are two new projects since you've been away. The first one is called "Candle", which is a formal rewrite of the core code that is used to render PipeWrench. Instead of Typescript, it's EmmyLua typings.
The second project is called "Umbrella", which is a collaborative project by @bronze yoke ,@frank elbow , and myself. This is Candle packaged with albion's events typings project, and Omar's special typings for Lua utilities.
This is the most comprehensive take on Lua typings to date. There's no need to decompile the game in order to use these typings.
I basically wanted to kill off Capsid.
And then there is me who made a CLI tool to generate and build mod project, which uses umbrella
https://github.com/Konijima/project-zomboid-studio
As for the ZedScript extension for VSCode, I've temporarly shelved it after working on the linter for the format.
That's basically it for me while you were gone.
Interesting. This projects very cool! I will check them soon
Thanks. Both Candle and the collab Umbrella are and will be more powerful than PipeWrench.
@red tiger thinking of adding a plugin system to the build of pzstudio, where we can run script to analyze/alter the output of lua script.
Shadows would be false projections of 3D lighting.
It'd need to take into account several things that the tiles don't have data for something like that.
You could do basic window & solid walls as projections but then the world would need to define where the light source(s) are.
This would be something deep enough for the devs to need to develop this if they wanted it.
What would be a good place to post a mod trailer?
If its a mod you created you can post it here or in #old_showcase i supose
hey everyone, i'm struggling a bit to call a millis timer starting from zero wich is supposed to feed a sinusoidal. right now it (somehow) do something. But i could use some help to get it right :
if drunklevel > 0 then
local secz = getGameTime():getCalender():getTimeInMillis()
local drunknesstime = 3e3*gametimemul
local oscillationamplitude = 0.8+(drunklevel*0.25)
local oscillationoffset = 0
local drunkennessAdjustment = oscillationamplitude * math.sin(2 * math.pi * (drunknesstime * secz)) + oscillationoffset -->> y = A * sin(2πf(x - h)) + k
Advanced_trajectory.aimnum = math.min(math.max(Advanced_trajectory.aimnum + drunkennessAdjustment, aimin), aimax)
print ("secz ==== ", secz)
print ("Drunkess Adjustement ==== ", drunkennessAdjustment)
else
local drunknessAdjustment = nil
local secz = nil
end --Drunkness ```
If you put ``` at the start and end of your message, it'll enable code formatting.
makes it a lil easier to read and stops discord parsing * as italics
They're backticks, not " or '. Above tab, for me.
gametimemul is getTime():getMultiplier()
Bonus tip: ```lua at the top set for syntax highlighting
Can you clarify what the problem is? It doesn't do what you're expecting, I think—but what's the expected vs. actual behavior?
https://pzwiki.net/wiki/GameTime
You can see here why it wouldn't be 0.
the timer is a gametimecount, probably timing from gamestart, can't find a way to make it start from zero. Plus it's quite slow for gametimemilliseconds. Is it rads ?
i dont FUCKING get it its been weeks and noone can figure out why my items dont apear ingame while my others work
my code is fine istf
im sorry to inform you, but your code has clinical Lua.
it's terminal :(
generally the game uses the worldAgeHours to keep track of time since game start. Nights survived + time of day.
wym
lua's a nightmare to debug in because it won't tell you when certain things don't exist
(noobish question) can you confirm there is no getCore():getTime() class in PZ library ?
Have you done the recommended step from before of removing values from the item definition to see whether one is causing issues
what
I'm fairly certain we talked about this before and that was what the end of it was, unless I'm thinking of someone else
i still dont understand
item X {
Key = Value,
Key2 = Value,
Key3 = Value,
}

❤️