#mod_development
1 messages ยท Page 257 of 1
Hey lads, sorry to be a pest but I'm in the midst of putting a very small mod together to fix an item spawn. I'm not particularly techy so I'm doing this by editing an existing mod, and I think I've got most of it down, I just need some confirmation on the last few bits if that's okay.
working with loot tables?
you can type Back tick twice in discrod to paste code (`)
This is the stage I'm at right now. I've done the top paragraph (changing the item to spawn and the spawn locations), but the paragraphs below that are completely foreign to me. I don't know if I need to change them or delete them or whatever.
Ooh, noted. I'll do that next time, cheers for the heads up.
what are the items you want to spawn?
Just the gray hunting vest. I'm trying to set it to spawn with the same conditions as the other 3 hunting vests in the game.
the LocalTargets are all the normal overworld spawn locations, with the same rarity.
i'd delete these sections, they don't seem relevant to what you're doing
also after DeskGeneric = 3, you need a } to close the targets table
Ah, that makes sense. Thanks! For my own knowledge, what do those highlighted areas do?
the first one is an easter egg from the bic pen mod i assume you got this from, it has a somewhat low chance to spawn an insanely overpowered bic pen sword
the first part of the second one spawns items in zombie inventories and a couple other odd containers, and the later part spawns items inside of bags
So it's basically saying "If the easter egg option is ticked then this spawn point has a very low chance of an easter egg spawn"?
yeah (though 0.01 it's not really as rare it sounds
)
I figured they weren't percentile chances haha
What does the top part of the second paragraph do, if you don't mind me asking? Anything I need to change there?
you don't need to change anything - it goes through the targets table, finds the container based on the name you gave, and then adds the item to that container with that chance
I think I getcha. So the top paragraph designates spawn locations, and the second actually spawns them?
yep!
Right! So all I need to do now is upload it to the workshop and hope for the best. Fingers crossed!
Thanks Albion - I really have no idea how this works xD
Okay, having a minor issue. In order to upload to the workshop I require a mod.info file. Can I make that manually?
Albion, you have no idea how happy it makes me to see this one item in game after two fucking years of searching
There should be an example mod you can copy and replace with your info
I made liberal use of the example mod, it was very helpful for getting the directories right! Really glad they included that haha
Would fixing more items be as simple as adding another paragraph and doing the same thing?
As far as I recall, there's quite a few items nestled in the code that don't have allocated spawn locations yet. I don't think I've ever seen a raccoon hat.
ello how do i make a players entire body heat up/cool down with a crafting recipe i couldnt figure it out for some reason
You'd have to trigger a lua function with your craft
ah
how would i do that? i know lua but not how it works with pz
ik a bit of fivem lua if that helps?
no idea
ok
declaration: package: zombie.characters, class: IsoPlayer
whats this
What you'll need to learn how to heat up the character
I don't remember what you have to use to trigger lua functions from scripts so can't help with that part
ok
i dont really know pz lua either so idk how i would trigger it with a craft
just gotta leave the idea for some other day i guess
thanks for helping
What are you trying to do exactly ?
make a player heat up after a craft
This kind of thing ?
uh well not exactly but the same mechanic ig?
i didnt wanna heat up the player to benefit them
it was more of a blacksmithing thingy
I see
since u hit hammer need heat to soften metal and stuff
Yeah you'd have to trigger a lua function
yeah i get that part
recipe Open Box of Dust Masks
{
destroy DustmaskBox,
Result:Hat_DustMask=10,
Time:5.0,
Category:Misc,
Sound:PutItemInBag,
OnCreate:OpenDustmaskBox
}
function OpenDustmaskBox(items, result, player)
player:getInventory():AddItems("Susceptible.EmptyDustmaskBox",1);
end
OnCreate
And the name of the global function
Okay, now that i have my e-girl bathwater item mostly made, how do I export the 3d object from blender (with textures) in a way that zomboid understands?
Click here to support Atlas and get awesome perks in return.
oop I did not expect it to do that here, I thought it was going to be a client-side message, ignore me and above
Hello. Ehhh... could I have some help? I'm trying to get the script to make the SlowDown effect modifier only work if the "walking only" option is activated. Apparently, if I remove the "--" from the functions I made, the script stops working.
check the error log
it says where exactly script crashed and for what reason
if there's no error, you might have a logical condition conflict which makes your function return early either way and prevents the code from executing
Check log and use debug mode (use -debug launch parameter) too
when does sprinter slow players down?
I think they mean when sprinters are about to grab the player causing a slowdown. sprinters would be a hell of a lot easier to escape from without that effect
Yes I've heard that sprinter does this but its been along time since i played the game i dont remember them doing it
so i wanted to know when you get slowed down
fun tip of the day: if something iterates over your inventory, don't execute that code every tick! big laggy
depends on what you do exactly
i hazard a guess that doing items:get(i) is a fair bit less CPU-intensive than getPlayer():getInventory():getItems():get(i)
also inventories tend not to change at completely random points in time so normally you can latch to some kind of event or function rather than running this every frame
what is items here
One of the mods on a server I play on loops through the player's inv every UIElement.render call...
anything is possible I guess
Even though the loop through the inventory costs basically double the rendering of the ui element
it's player():getInventory:getItems()
Does anyone know why the game is giving me this error?
The translator doesn't accepts arbitrary file names. Only the names from a hardcoded list are loaded.
you can use "UI_EN.txt"
or i guess UI_RU.txt in your case
oh yea, even though to some people it seems like it's doing the same thing
but it is the same thing if you use it the same way!
it performs the same function, but it takes longer to execute
the arraylist containing items never changes in your loop, but you execute a command to re-fetch it every time anyway
rule #1 of code optimization: don't run the code
if you can arrive at the same result without running the code, then don't run it
also before you have the same error again. The string identifiers must start with the same prefix as the file name. I.e. UI_RU.txt must contain entries that start with UI_
by the way, does this method affect compatibility with other mods?
No. Your string entries just need to be unique.
If you have a unique mod ID then you can use that as a second prefix. That's a good way to make sure that your UI strings don't produce data collisions.
thank you, I spent half a day on this
@drifting ore everything works through the original file, but through the mod files it produces a mess of letters
make sure the file is saved with UTF-8 without BOM encoding
your editor probably defaulted to CP1251
translation and lua are saved with utf 8 without bom
huh, yeah, apparently it needs to be the other way around
so the file needs to be saved with CP1251
in notepad++ it is impossible to recode a file to cp1251 etc.
the game apparently uses old 8 bit encodings for most languages, utf-8 for chinese and utf-16 for korean
so it supports all of the options but only uses a specific encoding for a given language
Windows-1251
I think that is the same as CP1251
it's how microsoft notepad calls it
or i guess microsoft in general
it invented a whole bunch of 8 bit code pages, but then renamed some of them from CP#### to Windows####
this is an option for reading and not for converting, it seems
I copied UI_RU.txt to the mod translate folder, added my text and for some reason everything worked
the original file is in cp1251 encoding, that's why everything worked. thanks for the help
Hi, how can I add IsoTree on square? is this possible?
I add isoobject but it can't be cut
It's not, not if you want the tree to have animations I believe
It doesn't properly act as a tree
Sadly it requires a java mod to do so
does anyone know any random reasons this could be happening? no loot will generate in any wardrobes of any kind
i have added some items to loot distribution pools, but i havent touched wardrobes at all, so im very confused\
Show the lines of how you added the loot
Just show a sample of it, or send the file
Why are your parsing itemJackPicker ?
honestly, because someone told me to
When is that function running ?
OnInitGlobalModData
And I'm not sure it's a good idea tho idk exactly what it does
Yeah that's good
Add a print within the function and check console to see if loot is properly added
im just not sure why wardrobes specifically arent generating
it is
ive been testing it for a while
Confirmed with lootZed ?
maybe all loot pools EXCEPT ones ive messed with arent working?
I understand that probably a method for isotree.new is needed, I was hoping that it would be possible to convert isoobject to isotree...
I'm trying to make a tool for filling voids, it works with grass, but there's a problem with trees.
in theory i can add a check for spritename validity to the tree cutting for isoobject, but i'm afraid it might affect performance
upd. If anyone is interested, I did it. I used the ISBrushToolTileCursor:create method
nope not that, ill get rid of the parse thing
Check other containers types
i did
All were broken ?
Yea remove your parse thing
what do you mean other container types
Literally idk where you got that thing from lmao
But I have never seen anyone use that
i checked some kitchen cabinets and stuff
I myself have never used it
Yeah I wouldn't be surprised if it's that parse then
If you are on admin mode, you can right click the container and Refill the container
yea thats what i was doing
yea
They know
i know all about lootzed
ive been working on this mod for a month or so, so ive at least picked up the very basics of how to troubleshoot in this game
if you added it into the distro and it shows up in container then cycling refill should eventually populate it
unless the chance is really small, it might take like 200 clicks
Again, the problem is not there I think
yeah no the issue is nothing is spawning from some distribution tables that i havent messed with at all
It highly sounds like it's their ItemPickerJava.parse()
Just remove the parse thing already
i did
still not working
ill search Wardrobe in the console, doubt thatll show anything though
What's that for
ProjectGurashi.LootableMapRemoval = function()
for i = #ProceduralDistributions.list[MapDistributions].items-1, 1, -2 do
if ProceduralDistributions.list[MapDistributions].items[i] == MapsToRemove then
table.remove(ProceduralDistributions.list[MapDistributions].items, i+1)
table.remove(ProceduralDistributions.list[MapDistributions].items, i)
end
end
end
You remove items with that
ah taht was me testing how to remove maps from the distribution table
i didnt get it working so i commented it out
do you even add it to WardrobeMan?
??
tho idk how that would remove every containers, if you said none work
doubt thats doing it but ill try doing that
You removed all the parse ?
in the file you linked, when i search wardrobe i do not see anything
right
see the image
unless you have it on another file
Reload your game, just in case
im not trying to add items to wardrobes
the issue is vanilla game loot will not spawn in wardrobes
absolutely nothing is spawning in wardrobes
for what?
Have you tried another wardrobe? Not the same one you tried on before. Or rather create another world.
yeah ive tried that
this is like day 3 of trying to figure this out
but im stupid so idk how to fix it
testing something now
True
yeah, still nothing @bright fog
i have an idea tho
table.insert(SuburbsDistributions.all.Bag_Satchel.items, 8)```
when i had this in any function, it would completely break the function so it just wouldnt work
all
i wonder if any of this could randomly be causing it
table.insert(SuburbsDistributions.all.inventoryfemale.items, 1)
table.insert(SuburbsDistributions.all.inventorymale.items, "ProjectGurashi.BrokenMobilePhone")
table.insert(SuburbsDistributions.all.inventorymale.items, 1)
table.insert(SuburbsDistributions.all.Bag_Satchel.items, "ProjectGurashi.BrokenMobilePhone")
table.insert(SuburbsDistributions.all.Bag_Satchel.items, 8)```
I highly doubt it
Tbf idk, I'm not enough familiar with problems related to loot spawn that could be causing that
Are you reloading your mod ?
yea
And you don't have the workshop version downloaded ?
If you have it on the Workshop already
theres no version uploaded to the workshop
No duplicates anywhere ?
nope
all other changes i make work fine
its gotta be something wrong in that file
just to make sure though ill comment out the entire file and test if loot spawns
You sure 100% your functions are running when they should ?
like 90% sure?
Did you test on a fresh map ?
not yet
Do it
uh well
i completely removed this entire file from my code
and its still not spawning loot
adding a couple items, and a map
yeah
but its a cheat menu mod and custom tiles
Use your mod in standalone
๐ค
Is your loot removal code still active ?
You sure ? Reloaded game ? New save ?

load a new game with no mods
What is the rest of your mod ?
and see what happens lol
basically its a standalone map that adds a handful of items to fit the setting
Wait so that container is on your standalone map ?
so, the mod includes custom tiles, items, like 2 recipes, a single item model (im lazy), and thats about it
yeah, if disabling mods doesnt work im gonna try to do it on base game's map
in your standalone map, you need to do a few extra things to make stuff spawn iirc
you should ask in mapping discord
not really
this is like the 4th month ive been working on this map
its been working fine until like 5 days ago
im not sure whats wrong now
revert to last week's work and work forwards from there ๐ค hard to debug
ill do that if all else fails
if the week old backup even has that working
i just noticed this happening
it might have been an issue for longer and i never noticed it
i mean, its just one wardrobe...
its happening in all wardrobes
then its probably something that changed between now and a week ago, just gotta isolate it out if thats the case
and honestly it might just be related to just like
i dont see a reason in your code that wardrobe would be affected though
yeah, same
when the game is loading the loot tables are converted into a faster accessible format by ItemPickerJava.parse() - if you modify the loot tables later than that happens you need to call that method to re-parse them or your changes won't be reflected by the actual loot
there might just be an issue with my game itself
it is absolutely not the cause of your problems and removing it will actually cause your distributions to stop working if you don't move it to an earlier event
i've never seen ItemPickerJava.parse() called in any mods that add items to the distribution though - is this an issue?
it's an issue if you add your distributions late, which they do
the main reason you would want to add them late is so that sandbox options are available
what are the consequences of adding it, say, on PreDistributionMerge
that's fine, i think only PostDistributionMerge onwards is too late
what the fuck

Did you fuck up your loot settings in one ?
my mod has no sandbox settings
i saw loot spawn and my jaw was genuinely just hanging open
i love modding this game sometimes
by default i was on a setting where guns and ammo wont spawn
Sapph Cooking does this, because as albion said, it has the option to set the loot rarity of items in the sandbox options.
the loot setting for them was set to none in sandbox settings
apparently this caused everything in a loot pool that has a gun to not spawn at all
genuinely what
Interesting
which is just weird because like
in LootZed it showed guns with a 0% spawn rate
so it DID change their spawn weight to just be 0
it must be some bug or something
Game told you fuck you
well . now not sure what to do
if player:HasTrait("fast") then
if (player:isSprinting() == true or player:IsRunning() == true) then
SpeedFramework.SetPlayerSpeed(player, 2.0)
end
end
end
Events.OnPlayerMove.Add(Quick);```
I'm having problems with this code, the speed buff gets applied but I still have it if I walk or go in combat stance and then goes away after 10 seconds or so. I want the extra speed to turn off the moment the player stops running or sprinting
the map is set in japan where theres pretty extreme gun control laws so i had set it to default in apocalypse to have gun spawn rates at "none" in sandbox settings
Mod sandbox options load after init global mod data, so if you load on pre distribution it should get the sandbox cars
function Quick(player)
if player:HasTrait("fast") then
if (player:isSprinting() == true or player:IsRunning() == true) then
SpeedFramework.SetPlayerSpeed(player, 2.0)
else
SpeedFramework.SetPlayerSpeed(player, 1.0)
end
end
end
Events.OnPlayerMove.Add(Quick)
Will need some optimization to check if the speed boost is here or not
predistribution is too early
So you don't update it uselessly
And don't override other mods speed boosts
Tho idk how the framework works
there's no way to use sandbox options for items without using that method to re-parse the sandbox options, the default parsing always happens before sandbox options are loaded
Thanks! I just figured it out myself and did exactly like that and it worked perfectly lol
There's one problem
You'll force set it to 1
But if another mod tries to set it
I don't know if you have resolved this since I haven't read that far down but itempickerjava.parse shouldn't stop things from not populating outright
You'll override it
this can be annoying in testing because there is an exception where when creating a new singleplayer game, your sandbox options *are* available early because you just set them, but in all subsequent launches of that save they won't be
yea resolved
Is there another way then?
Like I said, idk how the framework works
sorry I was still reading all the text lol
I did it without java modding :)
Is it animated ?
I know there is a problem somewhere with these, I don't remember what exactly
nil will deactivate. according to the author, maybe I should use that instead of 1.0
Same problem
ah
You'll force it to nil
It's not the animation that doesn't work, it's that the other tree saplings won't grow, or for example, they won't be covered in snow, they won't wither in the fall.
iirc someone did this already
nit sure if it was xyberviri or gravy
Ah yes
Yes, sure.
This will be your problem @nocturne swift
I always forget what the exact issue is, but yes it's this
Iโll work on this, the main thing is that I was able to get an object of type isotree, for me this is a victory, I tried to figure out how to do this for several hours, thanks everyone)
Gravy fixed these issues with a java mod:
#mod_development message
yea like I mentioned, requires a java mod
every time I think about Java mods I just get sad that we can't do them, its kind of a cycle
only lua, I think this can be worked with, I plan to plant and grow trees, but for now this is only an administration tool for me
Well, I improved the code, but it still doesn't work. If the checkbox is unchecked, I want the effect to be disabled for that movement, also if the value is 0 it should disable it. But as I said, it doesn't seem to work.
It seems as if the game is in โdefaultโ (talking about sprinters).
Look at your console to see what the error is
What is your mod doing
so i made a gun, with textures and everything, but i also wanted to make a book in order to craft said gun
ive got no clue what im doing wrong
Hi guys. Thanks for the help yesterday. I almost got my mod ready. There's only one pending issue.
I was unable to use the lua file to hide the recipes added by a mod (Since I couldn't modify them, @bronze yoke suggested to mark them as hidden but I must have messed up because the recipies are still there)
Can you help me review the code to find out where I screwed up?
``Events.OnGameBoot.Add(function()
local recipes = ScriptManage.instance:getAllRecipes()
for i = 0, recipes:size()-1 do
local recipe = recipes:get(i)
if recipe:getFullType() == "Susceptible.Open Box of Face Masks" then
recipe:setIsHidden(true)
end
if recipe:getFullType() == "Susceptible.Put Face Masks in Box" then
recipe:setIsHidden(true)
end
if recipe:getFullType() == "Susceptible.Open Box of Dust Masks" then
recipe:setIsHidden(true)
end
if recipe:getFullType() == "Susceptible.Put Face Masks in Box" then
recipe:setIsHidden(true)
end
end``
(Sorry in advance if I don't reply quickly, something came up. We can check this later, sorry to interrupt you all)
And missing ) at the end
if this is the full file, you're missing a ) at the end (to close Events.OnGameBoot.Add( )
sniped...
:3
this is what i deserve for doing it to shurutsue all the time

@bronze yoke Thanks mate!
hey yall, im making a mod that changes the pizza system so that pizzas with different ingredients will have different sprites and names
so instead of getting a pizza called Sausage Pepperoni Pizza and its just a pepperoni pizza sprite, you get Meat Lover's Pizza and its a custom sprite of a meaty pizza
ive got a very basic framework for the code but i have no idea how to hook it into the game and make the mod do the pizza particulation

Howdy yall! Lua question.
Is there a known or proper way to store/serialize items and their state into a modData table?
I would like to serialize an items state and support save/load and replication. Any pointers?
sorry for such a short and disappointing answer but... no
oof ._.
there's no better method than manually saving all the relevant properties of the item into the table and then creating a new item and manually applying all of those properties to load it
Daaaaaaamn. That makes sense though. I was trying to make headway with byte buffers but couldn't get it to stick. Thanks so much for your advice. I'm pretty new to Lua.
Second question, are the InventoryItem** getters + items mod data sufficient to record all of the items state? Or is it sort of mostly good and I need to make some design concessions to support the shortcoming?
to my knowledge it should be fine, just tedious
I'll take tedious. Thanks so much Albion! ๐ซก
I guess cloning an item won't work ?
if you're trying to store it in mod data you probably want it to be persistent and then anything that relies on an object won't work
True
As a third question actually, is there a good method for cloning runtime items? ๐ฎ
My hack that I came up with was incredibly silly and if theres an item:clone method i'd love to know about it
well, I got a new issue now, I got the initial one to get resolved, but now when I try to craft the gun, the craft option remains grayed out
Your.... hack ? 
The hack that I came up with was to send an object refrence of InventoryItem via sendClientCommand to the server, then on the server make a new item from that same type, and copy the new items ID to the sent item, then try and store it
Thats how I was "cloning" items for storage into my moddata table - but they don't serialize xD So its a goofy concept in general. But if theres a better way to do it I'd be curious to know it, but it's not needed per-se for my mod ๐
For context, this is for a marketplace economy / auction house addon I'm building so that players can list items for sale on a public marketplace.
But idealy, I want to store the full state of any given item so that players can buy half eaten food, customized firearms, etc ๐
Does the "player:isMoving" function work when the player is walking?
no, weirdly it only returns true if the player is using the 'walk to' thing when you right click a square
use player:isPlayerMoving() instead
I see, thanks
Hey guys. After many attempts I just could not disable or replace the recipes I needed, guess I'll just have to put instructions to replace a file manually
Does folder path structure matter when you want to override a mod's recipe script?
filewise probably, but if the issue is still the script you're also missing an r on 3rd line, additionally, unless you use Accessible Fields you're accessing ScriptManager wrong. Easier to just use getScriptManager():getAllRecipes() instead.
(I also see a global with the same method name, so potentially not even necessary to get the scriptmanager, but yeah)
no, ScriptManager.instance doesn't require any mods
it doesn't? ๐
public static fields are already accessible
accessible fields allows you to access instance fields (regardless of other modifiers)
alright, I definitely stand corrected, didn't know that 
What is the difference between that and getScriptManager()? or do people prefer it because it removes the extra function call that seemingly does the same thing..
Probably because of one less function call.
It's strange that I can replace the vanilla recipies effortlessly, even for multiple items. Override: True, works just fine
but then I do that with a module that isn't Base it suddenly breaks
When a mod adds a module, all recipes and items are ModModule.Item yes?
Or it gets assigned into the Base module?
i have not double checked but i assume it saves a function call
'assume' because in theory it has to be either querying java state or syncing it to lua or else the statics would get out of date and the latter seems more difficult
i guess in this case it's final anyway, maybe it's only final fields and therefore not in need of any querying/syncing - i've only really made use of stuff that would be final anyway
nice to know
Hello everyone, I'm working on developing a mod. But the game still crashes randomly when I test it. Unfortunately the error message doesn't give me ANY clue (in any case I don't see any link with my code).
Do you have any idea what type of error this could be causing?
I dissected my code from A to Z, I deleted and put back elements and files. but nothing to do, I still have the same error. ๐ญ
here is the error in question:
i seem to remember having an identical issue
for more information, this crash happens even when I don't take any action
yes when zombies attack a door or a window, this crash triggers, which happens very fast
this happened to me when I was messing with items, or inventory
i can't recall exactly what was the cause, but the remedy was to simply fix malformed code
Really strange, I don't have any interaction with zombies in my mod.
moreover my inventory does not contain any objects from my mod
thanks
as long as the object exists in the game the problem can manifest
ok
I'm going to test by temporarily deleting all my moded items, thanks for the info
ah yes the doorknob
when a door is destroyed, a doorknob is created in the java code. If the game can't find this item, it will crash.
The problem comes from one of my items, thank you I finally have a clue
any way (through lua) to force a translation file to be selected?
Language reloading is done through Java (or most of it) and only the selected language's translation files get loaded at one given time. The game only loads a certain set of translation files (the ones included in the vanilla game) and you cannot give them custom names.
i already have the translation and everything done!! i just need a way for it to get forcefully loaded whenever the player picks a specific trait
lua is preferable but if i need to learn to mod in java too i can do that
@grizzled fulcrum
There are mods that replace shouting. Check how they do it, should be very easy
its not just the shouting that gets replaced
and i need it to not affect english translation too
So "Puppy" is a language in the game you select like English, Japanese, Spanish etc and you want it to load Puppy translation files instead of English etc
?
yes! that
Although I am confused that you want to make a new language for it since you could do it much easier if you just used each respective language (and also the fact that some languages have different ways to express pet sounds like barking/woof/dog sound in Japanese is not latin "woof" but ใฏใณใฏใณ), but if you really want to go this route then I will have to check if it's possible to load it from Lua, just give me a minute or two.
Also what method did you use to add the language to the selection? If you overwrote any, that might cause a problem instead of adding it like Translator.addLanguageToList()
the ui file is UI_ARF.txt
I meant the Lua code you used to get it into the selector (to add it to the list)
Or did you just replace the translation name of the language from an already existing one (bad)?
i dont think i used any code?? i just have it in the translate folder
I thought the game manually adds each language, but maybe it detects it from the translation folder? I am unsure, but I will check to see how it does it
I think changing translation would cause reloading lua as well?
So if you really wanna limit it to a trait, this might... cause issues where the user will forcefully reload their lua as well?
(Not to forget the potential issue of having to set it back to whatever it was when dying or quitting and all that)
It does load it from language.txt the more you know
i didn't know this! if this is really an issue, i can give up on this aspect of my mod lol
yeah, but forcing to a different language.... i don't think that's the ideal approach for a mod
that's why I am so confused because you could just do:
IG_UI_EN = {
IGUI_MyMod_DogSound1 = "WOOF!",
IGUI_MyMod_DogSound2 = "BARK!",
IGUI_MyMod_DogSound3 = "ARF!",
/* ... */
}
and then you can use it when you use Say like
-- There's maybe a better way to get randomness?
player:Say(getText("IGUI_MyMod_DogSound" .. ZombRand(1, 3)))
I mean yes you would have to do this for all language files, but I think it is worth the hassle imo
removes the whole lua reloading aspect of it all
alternative (although not sure how nice that'd end up as) would be patching the getText method to include a modded key part, like DOG and attempt said entry ๐ค
Though that'd provide heavily wrong output when not having said entries translated (ex.: modded content or whatnot)
(seeing the item translations as well)
i completely didnt want to understand that i could just add new lines to the english translation
this might be the solid solution im looking for, and gives me opportunities to expand if i want to hire translators
for other languages
and if you plan on changing other translations too, just depends on your use case
Good luck for (apologies for the phrasing) your weird endeavours!
hooking getText func is not needed here at all, that would just make more problems down the line
I feel like there should be a hooking/function patching library to prevent these conflicts, but even with one, most people would likely not use it
was just meant in case of wanting to "translate all" without switching the actual language kind of approach.
It will lead to problems, but so will patching everything that asks for certain translations
what is "patching everything" btw I am confused?
my translation doesnt change EVERYTHING, just some lines (barking, item names, character talking text)
If you want to change the shouts, you'd still have to patch (decorate) the shouting function to include your custom shouts and skip the vanilla ones.
If you then also want to translate other stuff (items and whatnot) you'd have to patch(decorate) the functions that get those.
In which case, patching the "getText" method would be an easier approach, in comparison to going for every single function where it may attempt to access that
Items don't have translation strings?
or do you mean where it's like item:getName() and it doesn't return the getText or something
they do, but if you do want to change their text based on trait, you'd likely have to patch where it attempts to get them, so it requests for a different one.
if only there was a mod that does something like that ๐
mh?
I don't like self-advertisement though but I was working on a proof of concept that works (with some quirks)
as usual I kinda pushed it to the number 2 slot in the queue in my brain because a server owner requested a mod and I for some reason just keep ignoring mods I have to work on
mod id is AoqiaDynamicTranslationsAPI on workshop
gotta fix some bugs yet and an issue with hooking getText is coming back to haunt me related to the vanilla game too but it's the best I can think of right now
so this does take the approach of patching the getText as I mentioned ๐
like probably the biggest issue I've ran into since I last worked on it a couple weeks ago was that since I cache the translations and the game doesn't explicitly call my API to update the specific translation, it asks for it again expecting a different translation but doesn't get it (have to look more into it)
Yes but I think it's the only thing I can do honestly
I feel like patching methods in lua shouldn't be done on a whim and just that getText hook alone has already caused some issues with other mods and even the vanilla game, so I am very hesitant to respond with that as an answer
first mod ive made, so what im doing is probably really fucking weird and obtuse
and also the fact that getText is called a lot nearly every UI render call so I have to optimise the living hell out of it (working on that on my local build)
I sound pretentious as fuck but I really really mean it, going on a patching spree like some mods do can break stuff and why would you patch something if you don't need to??
wait, you can have dots in translation keys?? (I see, it's to do with module)
I've only ever saw that with SandboxEN translation
I sound pretentious as fuck but I really really mean it, going on a patching spree like some mods do can break stuff and why would you patch something if you don't need to??
finish the full unbuggy version of something before releasing it imo always
Like I said, everything got pro's and con's.
What you suggested however was more on the patching spree with patching every method that wants certain "other" translations, hence, depending on amount, patching the actual getText would be the simpler approach ๐
(If it were just shouting, it'd be better to patch that method instead of getText, ofc)
@grizzled fulcrum btw, i love these thumbnail images they're so cool
true, in my head it's constantly a battle, like I don't release it broken but I usually release something and then go "wait I need to add this" so then I update, then repeat like 500 times until I am so frustrated I just go onto another mod
also art isnt my expertise so I just mainly slap some random thingy as a picture lol
true, I don't know how the game handles shouting so if the only way to change the language of the shouts and stuff is to patch getText then that is what you have to do I guess
Also I didn't mean to indicate that patching getText would be a "patching spree" but that other mods I saw in the past have done it
Oh, no, for shouting you could patch the method that requests the shouting translations.
But if you attempt to have it at A LOT of places (not just shouts), with items, shouts and lots of other things, it would probably be easier to just patch the getText instead of 100 other methods ๐
that's what I meant
I see
that is one of the reasons why I made this proof of concept api mod, because I wanted to change UI elements dynamically based on outside factors like traits, health status etc to add spice to the UI
but then the moodle UI is in Java so I had to rewrite that, never got around to publishing it though
my plan was to rewrite all UIs in the game, but then university started...
I mean most of the mod anyway is cache trickery and trying to make the user feel like it changed (even though technically it didn't) so it's not that crazy
I know this feeling
Also I plan on it
I think I will ditch it though, because I am not good with UI stuff at all and also because I want to rewrite the lighting dlls and that will take more of my time than the UI I think so I have to choose which one to do
hang in there 
What do you study?
computer science ;-;
although I kinda hate it because it brings me away from the things I want to do like modding
and instead of using my break to catch up with some of the work I am using it to work on mods lol
Yea, I gave up on compsci. I study English now 
Turned out the things I liked doing as a hobby weren't cut out as a job
university is a scam
your one and only reason to go there should be the desire to become a scientist
besides getting science knowledge, you learn absolutely nothing, and you get a piece of paper that certifies that you in fact learned absolutely nothing of practical use. Except places like law firms, people can hardly care less.
I know, but I have to (or feel like I have to) it's basically my only option
Most jobs if not all that I've looked at require a bachelors of CS minimum
letalone any actual language experience which those are usually 5 years experience and stuff like that
if you're a nobody from the street then a bachelor's CS means you are marginally more qualified than the next random person
even though I might meet the language experience, they still want a degree
what actually matters is your ability to do your job, and CS degree has absolutely nothing to do with it
the hiring managers I've found didn't really care about language experience though which is annoying and is why I feel like I have to study to get some sort of qualification
if the company you're applying to doesn't cares about practical experience and wants a degree instead, you shouldn't apply there
wat
university is a scam for way different reasons than that
but yes, the job market is also a joke
the one and only question the people who'd actually have a say in hiring you ask, is what's the extent of your practical abilities
FAANG will not consider having a CS degree to be a hireworthy mark on your resume
they look for the projects you worked on
Ah yes. The projects that you got hired to work on from nothing
That is because if you do not have it, your resume wont even land in front of them.
also that
Of course you need more than that, but their resume filter thingies literally just decline your application if it doesn't meet the minimums they ask for
This is only true if you're a nobody from the street with zero credentials of any kind.
In this case, and this case alone, CS degree has great weight.
I don't mean to offend but on what basis do you say this, exactly?
This applies to literally every applicant no matter of skill
because to me it sounds like you're talking out of your butt
To me it sounds like you fell for "a degree is this great thing that unlocks amazing prospects" meme. What are the odds your degree will be used as a burger wrapper? I don't know, but they're not small.
Mate
it's more that degrees are a basic requirement these days
not something that unlocks great prospects
Not being able to find a job with a CS degree is close to #1 complaint of people with a CS degree.
yes
Most if not all companies not even exclusive to FAANG use algorithms to sort through applicants to filter through the raw amount of applications. These will nearly always decline your application if you do not meet at least the minimum requirements for that job. It sucks but it's what they do, and I can't really meet a bachelors in CS or higher plus 8 years of experience whilst being a person who just obtained their CS degree and no years of experience in professional software development environment.
and the people without one can't even bother to complain about it
^ exactly because they in 99% of cases wont get their application in front of hiring managers
This is all to add onto the current state of hiring not just in software engineer jobs but literally every job
It used to be that way to an extent, but now it's completely down the drain
that's not true my man. The basic requirement is, always has been, and will be for all forseeable future - being fit for the job. The fact that you learned a bunch of boolean algebra doesn't mean you can support a legacy backend. Again, if you have no credentials whatsoever, then it's an indication that you at least didn't fail some extremely basic programming lessons, some youtube tutorial tier stuff. If you have the credentials, some practical experience in some company, then nobody even looks at hte degree.
What exactly do you work as? And on what do you base all of that
Ok idk why you are still citing how hiring used to work in the 80s, it isn't like this anymore
It's a collective experience of 100% of professional coders I know, with my brief professional career - myself including.
I don't even have a flippin degree.
I'm a certified marine vessel engine technican.
The hiring managers don't even give an ounce of thought of the basic requirements of the job because they only look at resumes who meet the basic requirements already
well I guess this applies less to startups since they're usually more lax but for FAANG it's like 200%
I mean hell, there are companies and degrees dedicated to educating people on how the application filtering algorithms that are used work. I know because I was required to take such courses that were mandatory, and it's annoying because they weren't even that useful except 'something something you need the minimum requirements something something' and "don't use these keywords in your resume" and that was it.
A degree is not a requirement. Experience is a requirement. If you gonna pay however much your tuition costs + learn all the stuff that has nothing to do with the job as a programmer whatsoever, purely for the sake of networking at uni, then it works all the same. But at that point you're conflating the degree and what you did while getting the degree.
Posted 2 days ago, Microsoft asking for software engineers.
Required literally means required
see that line at the bottom?
Yes I do
they specfically say they don't care about the degree
You know what a broke college student who just completed a CS degree has? It's definitely not experience
as long as you're a competent coder, it's a fair game
And they want 6+ years engineering experience
if you went to uni and didn't get experience, it'll be a lot worse than if you straight up never went to uni
Like I could say "technically since I've been programming since I was 10 I technically have 8 years of experience" but would that be feasible?? Most likely not
yeah well i've been drawing since I was 10 and I have less chance of getting admitted into an art school than that one austrian painter
length of time alone here isn't indication, nobody knows what you actually did
By technical engineering experience I assume they mean in a professional environment, which you do not get at uni unless you are really lucky to get a scholarship with IBM or something (which is what im going for rn)
let's back up. How old are you, and how far are you into education?
Actually the age part isn't important, it's implied.
Yes, and I'm like 5 subjects in
I mean how many years.
which is not a lot but I've been told it's not far from the main path
lol years
yes years. How many years have you been studying at the uni this far?
I haven't got that far, I've probably only been at it for a year or something like that
out of 2 or 3, however long it is
Is it correct to say that you mainly form your opinions on this subject based off of assumptions about how things are and will be, and how you were told about it by people like yourself? Is it correct to assume that you don't talk to people who are right about to get their degree, who have gotten it 10, 20 years ago?
Also I was saying this as in future-tense
based off of assumptions about how things are and will be
I.e. you don't actually know for a fact, you're just really sure of it.
Yes I form my opinions about it based on how others who have been through this process have told me it is
Ok, did they mention the importance of things like internships and networking? Particularly those who got a job as a programmer at some point.
I am talking with intent because when you hear specifically from people around you doing the exact same things as you including teachers that x is how it was when they were young and y is how it is now then I am going to make reasonable conclusions based on those two
Yes, no doubt that these are insanely important and can even bypass the requirements of the degree requirement, but that is assuming you have good networking and or get an internship (not handed out like candy where I am)
What I'm getting at is that you might be missing the forest for the trees. Internship = practical experience at a real company. Networking = knowing people who can say a good word for you to the right person.
I am speaking purely for myself here when I say that I have a really slim chance already at getting a job, so this CS degree is basically my only option
what -_- I know what these two are
like no hiring manager is going to give a fuck if I come in saying hey here's my resume, I don't meet the minimum requirements for the job but, well, I have some C++ projects on my computer and did some lua for a game once!
you said it in a self deprecating manner but that's how it is indeed. You've got no accomplishment of importance to your name.
the only thing I can think of somehow getting networking is if I create a project that gets enough attention, but it seems more difficult to do nowadays considering everything I think of is already created, and in a better manner too.
Word of mouth is not a thing, come on.
Let me put it another way. Networking = nepotism.
it's not as important as it used to be, but the amount of people who get jobs purely from seeing their work is a lot
like a guy who made cheats for Counter Strike getting a job at Epic Games, like who teh fuck? (or some cheat developers getting jobs developing anticheats (riot vanguard comes to mind) directly because they worked on a cheat)
If the guy can make working cheats for CS clearly he has a lot of skill and dedication.
well think about it
most of it is boilerplate
he reverse engineered a protected game and evaded detection for quite a long time
the hardest part is keeping up with the anticheat updating
In the context of cs, you can literally disable VAC to get your cheat up and working with the game, and then all that's needed to evade VAC is some things like hooking winapi funcs that vac uses, some people use virtualisation for their cheats and stuff
has anyone trifled with downsizing playermodels/player rigs ingame before? wondering if that's even plausible
well in any case; I don't have a psychology degree but I did learn about it in the uni (it was a waste of time like everything else but I can do a parlor trick, watch this).
you might be suffering from a fair world fallacy. Like if you work hard, you will be rewarded. And the people who you find underserving, shouldn't be. That's not a thing.
ok this is getting really off topic lol I will stop but it was a nice ramble
yeah i guess. As a closing statement, a friendly reminder that nowdays people with CS degree are a dime a dozen.
my personal advice is to swerve into a law school
@drifting ore How can I prevent the "walking" function from interfering with the "running" function?
if these sandbox options should always be mutually exclusive, you can simply create them as enum
oh wait you made them as numbers
I think your problem has more to do with the fact that you only set the player slow factor on game start
I can't really do that, because the mod expects the player to choose the desired values. The values โโmean the strength of the slowdown effect when sprinters attack players.
and there's a pretty good chance that at that point in time the player is not moving at all so nothing happens
i think the event you're looking for is OnPlayerMove
In fact the values โโdo work, but the only thing that doesn't work is the "walking" function set to 0 while "running" has a value of 100.
The "running" function set to 0 and walking 100 works
oh i misread that, you are already using OnPlayerUpdate which is also fine
well both of these functions activate on the same frame. One of them always sets the walking modifier if the player is moving at all. If that function executes second, its effect overrides that of the running function.
player:setSlowFactor(0.5 * (SandboxVars.MSZ.ModifierWhileRunning / 100))
elseif player:isPlayerMoving() then
player:setSlowFactor(0.5 * (SandboxVars.MSZ.ModifierWhileWalking / 100))
end```
you might need to set it like this
since neither the original nor this variant do anything if the player isn't moving, you can put it in OnPlayerMove callback and remove the walking check.
I see, thanks, I'll try to reprogram the code to see if I have any luck.
doesn't player:isPlayerMoving() get called when sprinting as well? so DisableWalkingSlowdown will process both when you're walking and running?
Hello everyone!
I need support...
I'm creating a mod that modifies the zombie infection.
With the help of chatGPT I'm building it
The mod should modify the zombie infection in this way:
It will no longer be like in the vanilla game with the classic % of infection, and therefore I would like the bite to no longer be a death sentence (100% chance of infection)
I would like the infection to arrive only after a certain number of wounds suffered by the zombies. 100% must be reached in a counter and each wound will have a different percentage
At the moment I have only created this part of the code to eliminate the vanilla infection (the mod checks every hour if there is infection and removes it)
in the testing phase I noticed however that if I suffer a bite the mod removes the zombie infection which however after a while reappears... until it leads to the death of the character.
Where am I going wrong??? if anyone has ideas to suggest they are welcome!!!
below I leave the code I created
-- RemoveInfection.lua
local function removeZombieInfection(player)
local bodyDamage = player:getBodyDamage()
if bodyDamage:isInfected() then
bodyDamage:setInfected(false)
bodyDamage:setInfectionLevel(0)
-- Fai dire al personaggio una frase
player:Say("Mi sento meglio, l'infezione รจ scomparsa!")
-- Debug: stampa un messaggio nella console
print("Infezione zombie rimossa per " .. player:getDisplayName())
end
end
local function onEveryHour()
local player = getPlayer()
if player then
removeZombieInfection(player)
end
end
Events.EveryHours.Add(onEveryHour)
i think that's just normal wound infection, not zombie virus
no, it's zombie infection
the reason it reappears is because you remove the infection from the overall character, but not from the actual bodypart, so when it checks for infected bodyparts it re-infects the character
try adding this after removing the infection```lua
local bodyParts = bodyDamage:getBodyParts()
for i = 0, bodyParts:size()-1 do
local bodyPart = bodyParts:get(i)
bodyPart:SetInfected(false)
end
thank you very much. i will try to add this part to my code asap. and sorry for my bad english ๐
As soon as I change the code I'll try it and let you know
Hi guys. Is it possible to import 2 or more modules into a single script file or that causes errors?
example:
module ModModule { imports { Base ModModule }
separate them with commas
thx
I've been searching the workshop for mods that modify the recipes from other mods, they just seem to add the Override,true, line at the end of each recipe. It's strange it didn't work in my case. I'll keep trying a few more things before I go for the ol' reliable "Hey, original author, can I upload a standalone version of your mod with my changes?" lol
Is there a method to change the chance of a character falling and is there a method to change the chance of knocking a zombie to the ground?
Hmm no I don't think so
You can however stagger manually the zombie and can stop the zombie from getting staggered by attacks, so you could stagger based on your own chances
then in that case is there a way to customize character falls? I think with ZombRand you can increase the chance of being knocked down, is it possible to do the same with a chance of falling or is there a method to instantly get up from the ground?
do you mean hitreaction?
hmm, thanks, I'll try this idea
ZombRand simply gives a random number
I'm not aware of any method which allows you to increase the chance of falling, if you find that tho I'm interested out of curiosity
And for getting up instantly, I think you might be able to but not sure
I think trying to implement this through hitreaction would be a good idea
I think this can be done by speeding up animations
when a zombie is close, we speed up the animation of getting up
Yea that can be done
Hi all, I'm using a mod on a dedicated server that requires chunks to be loaded client side to work. If I run a client on the server always connected as admin, would that prevent me from playing the game using the same Steam ID on my personal PC?
yeah
Is there any other way to have a proxy user connected to the server?
how can I get a deadBody object from an ID (i.e if I'm passing the id via sentClientCommand)?
local corpseID = body:getObjectID() -- This is fine and gets a short ID like 30230
local corpse = IsoDeadBody:getDeadBody(corpseID) -- This is throwing an exception with MethodArguments.assertValid
you can't i'm afraid
dead body ids are shorts and kahlua doesn't pass shorts to methods correctly, throwing that exception
if you want to identify the same object between different game instances send the object square's x,y,z and the object index
thanks, shame about the shorts limitation. You wouldn't happen to be able to point me in the direction of how to get the object index and then find that object again once I have the x,y,z and index?
use body:getObjectIndex() to get the index, and to get the object from it use:```lua
local square = getSquare(x, y, z)
-- if square is nil then that square isn't currently loaded on this instance, usually this is expected and fine
if not square then return end
local body = square:getObjects():get(index)
thank you
is there anyway to make an IsoPlayer appear 'dead'? I can stop movement with character:setBlockMovement(true) but how can I make the animation/model stance lie on the ground?
where would I find the correct variable and value to set?
there isn't one already for just being flat on the ground?
so like Zombie_Death? I would just character:setVariable("Zombie_Death", true) or something?
that was in media\AnimSets\player\death
my internet sucks i cant view the image
anyways theres a also a dragdown version
dont use the dragdown
it will kill your player locally
if youre playin mp
other players will think your alive
which will lead to bugs
oh thats not a variable thats an anim file
the image was of media\AnimSets\player\death\default.xml which had a <m_AnimName>Zombie_Death
AnimName is what you name the the x / fbx files
just do time action or emote
or hitreaction
just specify your own var
these are the 3 ways you can set animations
sorry, I'm quite lost with all this. Is there a guide for dummies on anims and variables somewhere?
nope
animation is one of the least documented areas of pz modding
i learned it by looking at the animsets
thats about it really
I feel it should be fairly simple as far as anims go though, as I'd just like to use the preexisting anim for a dead body, or a tripped over/fallen character
yeah wish it was that simple
I copied original zombie and player Animsets and trying to use zombie Animset with player Animset "Loot", cuz my character does a zombie Animset while standing, please help me to understand what's wrong:
Loot xml file
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>ZombieLoot</m_Name>
<m_AnimName>Bob_IdleLooting_Low</m_AnimName>
<m_Looped>false</m_Looped>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_SpeedScale>0.80</m_SpeedScale>
<m_BlendTime>0.40</m_BlendTime>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>ZombieLoot</m_StringValue>
</m_Conditions>
<m_Conditions>
<m_Name>sitonground</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>false</m_BoolValue>
</m_Conditions>
<m_SubStateBoneWeights>
<boneName>Dummy01</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Translation_Data</boneName>
</m_SubStateBoneWeights>
<m_Events>
<m_EventName>SetVariable</m_EventName>
<m_Time>End</m_Time>
<m_ParameterValue>ZombieEatingStarted=true</m_ParameterValue>
</m_Events>
</animNode>
Zombie eating xml file
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>Zombieeating</m_Name>
<m_AnimName>Zombie_IdleEating</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_SpeedScale>EatSpeed</m_SpeedScale>
<m_BlendTime>0.50</m_BlendTime>
<m_Conditions>
<m_Name>ZombieEatingStarted</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
</animNode>
lua timed action, start():
self:setActionAnim("ZombieLoot")
what happens when you try to do the action?
Starts looting animation, then when animation ends player begins to stay still
Is the zombie animation different when played by the player?
So it starts with ZombieLoot and then when it stops, the player goes back to idle animation?
I am unsure.
Cuz when I tried to apply animation without looting animation, using only zombie animations, the player didn't sit on the ground as it should be
Yep
I think that the zombie eating animation wont trigger just by the condition alone
You have the condition as ZombieEatingStarted must be true to start the animation, but you don't start it anywhere
if you do in your lua action, add this function:
function MyAction:animEvent(event, parameter)
if event == "ZombieEatingStarted" then
self:setActionAnim("Zombieeating")
end
end
Maybe it will work
Also change MyAction to your action name too
Or maybe you can add a transition xml instead of the lua code above, idk how it works fully since I never did animation outside of 1 anim, but there are transition xml files that the game uses
eg look in media/actiongroups/player/*
no, that doesn't work either
I didn't quite understand you, please tell me more
and also, could it be that self:setActionAnim("ZombieLoot") takes the place of the animation and until the current action is finished it will be impossible to use another animation?
It might be the case, but I am not experienced enough to know
For example, look at media/actiongroups/player/defaultTimedActionsTransitions.xml
Or I will just show here:
So it transitions to media/actiongroups/player/actions when IsPerformingAnAction is true and when isTurning is false
I think asSubstate might be a substate of the current timed action (what you want)
I think it would be easier to visualise media/actiongroups/player/sitonground/timedActionsTransitions.xml
An edited version of the above file mentioned:
<transitions x_include="../defaultTimedActionsTransitions.xml">
<transition>
<transitionTo>Zombieeating</transitionTo>
<asSubstate>true</asSubstate>
<conditions>
<eventOccurred>ZombieEatingStarted</eventOccurred>
</conditions>
</transition>
</transitions>
As I said, this is only speculation as I've never done any of this stuff, just going off of what the base game does
So maybe if you put the above file in say media/actiongroups/player/ZombieLoot/timedActionsTransitions.xml and then that will maybe transition to the Zombieeating action, then you (maybe optional) have a file in media/actiongroups/player/Zombieeating/timedActionsTransitions.xml that has this:
<transitions x_include="../defaultTransitions.xml">
<transition>
<transitionTo>idle</transitionTo>
<conditions>
<isTrue>ZombieEatingFinished</isTrue>
</conditions>
</transition>
</transitions>
the above second possibly optional xml requires Zombieeating action xml to set ZombieEatingFinished, but maybe it will go back to idle without this xml???
thanks for this option and detailed explanation, I will try it a little later when I am free and will let you know the result
I'm having a funky issue with implementing sandbox vars.
I've added a sandbox-options.txt file
At the top of my lua file I have a
local foo = SandboxVars.foo.bar
along with a
print(foo)
in my custom function.
But for some reason even if the boolean is set to true, once in game the function returns false. The sandbox vars don't have their non-default variables picked up.
Oddly if I reload the lua file once in game, it does correctly register it as being true. Anyone an idea what could cause this?
Any idea why the context menu looks like this?
{
DisplayCategory = Clothing,
Type = Clothing,
DisplayName = Military Rhodesian Brushstroke Pants,
ClothingItem = HNDLBR_Trousers_RhodesianBrushstroke,
ClothingItemExtra = HNDLBR_Trousers_RhodesianBrushstroke_Tucked,
ClothingItemExtraOption = Tuck Pants,
BodyLocation = Pants,
Icon = HNDLBR_Trousers_Brushstroke,
BloodLocation = Trousers,
Insulation = 0.5,
WindResistance = 0.3,
WaterResistance = 0.3,
FabricType = Cotton,
WorldStaticModel = LongShorts_Ground,
}
item HNDLBR_Trousers_RhodesianBrushstroke_Tucked
{
DisplayCategory = Clothing,
Type = Clothing,
DisplayName = Military Rhodesian Brushstroke Pants,
ClothingItem = HNDLBR_Trousers_RhodesianBrushstroke_Tucked,
ClothingItemExtra = HNDLBR_Trousers_RhodesianBrushstroke,
ClothingItemExtraOption = Untuck Pants,
BodyLocation = Pants,
Icon = HNDLBR_Trousers_Brushstroke,
BloodLocation = Trousers,
Insulation = 0.5,
WindResistance = 0.3,
WaterResistance = 0.3,
FabricType = Cotton,
WorldStaticModel = LongShorts_Ground,
} ```
when lua first loads sandbox options aren't set yet so you just get the default value
wait until OnInitGlobalModData to cache the value (or don't cache it at all)
You need to add language translation in media/lua/shared/translate/EN/ContextMenu_EN.txt
Like so:
ContextMenu_EN = {
ContextMenu_UntuckPants = "Untuck Pants",
}
and change ClothingItemExtraOption to UntuckPants
no space
and do it for your item too, people will thank you ๐
like this:
// in item script
DisplayName = RhodesianBrushstroke,
and in the translation file here: media/lua/shared/translate/EN/IG_UI_EN.txt:
IGUI_EN = {
IGUI_ModuleName_RhodesianBrushstroke = "Military Rhodesian Brushstroke Pants",
}
change ModuleName to your item script's module (should be your mod id you set in mod.info file)
Much appreciated! I will get on this. Cheers. โค๏ธ
Can I ask the benifit of using the ModuleName?
you replace with recipe module name or your mod ID
the purpose is solely to prevent data collisions
It's the highlander kind of deal - there can only be one.
@worthy pawn (i forgot to reply lol)
Well for creating display name translations, you literally need the module name of the item script. if you do not use it, the translation will not work.
This functions unlike other translation keys which do not require the module name to be in the key, but I do it anyway to prevent accidentally overriding other people's translations. and its good to use the module name as your mod id, its so bad when people have their mod id as JimsTreeMod and then have all their items defined in the TreeMod module or similar, as its just less uniform and more annoying overall (personal experience on this last one).
oh and btw I'm already in bed so I can't check this but its either the part in display name that judges the key name or the item script key itself, I think its the first one but I can't remember. what I mean:
// item script
ClothingItemExtraOption = ABCDEF,
ContextMenu_ABCDEF = "See how the names are linked implicitly?",
Oh and the same goes for the item name translation too like:
module MyMod
{
item MyItem
{
DisplayName = ABCDEF,
}
}
IGUI_EN = {
IGUI_MyMod_ABCDEF = "Implicit relations between stuff for everyone!",
}
sorry I'm so all over the place, but another reason to use module YourModule is so you don't have to prefix items with your mod name because it will already be prefixed similarly to how vanilla items are prefixed. like item is basically MyModule.MyItem and for vanilla module is Base. Everyone seems to like just shoving all their items and recipes in Base module, but then how do you decide which is vanilla game and which is your mod? (From a technical standpoint, not user)
obj:getWaterAmount()
I usually pair it with other checks like so:
if obj:hasWater() and obj:isTaintedWater() == false then
-- do stuff
end
You can see the IsoObject's Java methods here https://www.projectzomboid.com/modding/zombie/iso/IsoObject.html
Oh lord. This makes so much sense... and now I have the potential for a hundred or so manual edits. YIKES.
Thank you for the clear cut explanation!
Hi guys.
If I want a certain part of a mod to be installed manually. Will it suffice to put it in a folder with a different name that isn't part of the usual mod structure?
I just don't want this specific folder from the mod to be isntalled by the game when you activate it
If any of this is code or interacts with code via loaded files then install it in the /Zomboid/Lua/ directory as cached files may be accessed there.
Unless this is a patch of some sort.
(Something I do a lot of)
nah, its just a script
I wanted to tweak some recipes added by antoher mod, but it's not working so I gotta let subscribers know that this part must be installed manually by replacing files
Good evening guys, I need a little help
I made this code where when executing crafting
crafting clothing loses insulation
However, when equipping it, the game gives an error, (but it still has zero insulation)
However, when re-entering the save, the original clothing data returned, what do I need to add for it to save?
wondering if theres a way to make it choose from multiple .wavs so that the death sound is random
I don't normally do coding or anything I just make maps but it would be nice to not listen to the same sound everytime I kill a character
is there an event that fires when a player takes damage from a zombie? It seems OnPlayerGetDamage only fires when bleeding/infections/etc and not when the zombie actually hits
no
don't question why the zombie game doesn't have events for basic actions relating to zombies
oh if only this was a C# game and moddable with Harmony
I'm trying to avoid character death, or at least catch it before they die. Hooking into OnPlayerDeath is too late as it already wipes a bunch of character info. Hooking into OnPlayerUpdate or OnPlayerGetDamage is don't work as they come too early before the damage is applied so I can't really restore health in time
can anyone confirm my theory
does
IsoZombie:setNoTeeth(true)
means it will not cause bite damages ?
you should intercept the function that triggers the sound then play your function that plays random sound
setVariable("ZombieEatingStarted", true)
Hello there dear friends and zombies. Is there any up to date vehicle modding tutorial? The only I can find are from 4-6 years ago.
@worthy pawn
If you use visual studio code, you can select multiple lines in one spot by holding alt and click a spot and drag downwards ๐
Oh and I cooked a little regex replace for your translations if needed. It will only replace translation keys that do NOT have 2 underscores (there's no way to tell what is a module name and what isn't)
^(\s*)([^\W_]+)_([^\W_]+)(\s*=\s*".*",\s*)$
and replace it's matches with:
$1$2_YourModuleName_$3$4
but i'd recommend using alt click drag thing instead of this regex
or middle mouse button works the same I think
Depends what you want to do to vehicles. If you just want to add your own, the best teacher is the game itself! You can find vehicle stuff defined in the game here: \media\scripts\vehicles\*
Some of the models for these vehicles can be found here: \media\models_X\vehicles
Cool, I'll just check existing models, will then replace with my own and edit the code
where in the lua or java code does MoodleType.Dead get applied when dead?
oh my bad, I didn't realize it'd be under the IsoObject, I was expecting an object like the lights x3
MoodleType.Dead gets checked when Moodle.Update() is called. All moodles are applied to a player when the player is created, but they just have the levels set to 0 initially.
MoodleType.Dead will change in level in Moodle.Update() when the Moodle class parent (IsoPlayer usually) is dead.
The game's Java code (I changed the var name to make it easier to understand) in Moodle.Update() is:
if (this.Type == MoodleType.Dead) {
level = 0;
if (this.Parent.isDead()) {
level = 4;
if (!this.Parent.getBodyDamage().IsFakeInfected() && this.Parent.getBodyDamage().getInfectionLevel() >= 0.001F) {
level = 0;
}
}
if (level != this.getLevel()) {
this.SetLevel(level);
shouldUpdate = true;
}
}
So, been a minute since I look at java, and the fact it's looking at 2 languages isn't helping my understanding xD
How would I- or, can I- link into and monitor when an error happens?
I wanna make a quick thing that I can open when not in debug mode, that grabs any lua errors.
Unless ya can open console outside of booting the game in debug mode already?
(Note: mine would be just to monitor, no input to run code)
Errors I'm looking for are just the ones that trigger the red box in the bottom right.
Mine would listen to errors, but otherwise would only display stuff specifically sent to the "console"
ah thanks, didn't realize all moodles were added and it was just the levels that determined visibility
Look at %UserProfile%\Zomboid\console.txt, it is what stdout is outputted to. It includes errors too, you can just search for ERROR or more specifically, logException or Exception thrown or Stack trace
anyone?
The console.txt is written as things happen.
-# If you want something like a "live" update while not in debug and not having to constantly manually reopen it, you could write a batch file which checks if the file exists and is locked and print the contents as they appear.
-# You could then filter by content of what you get for the errors.
-# It's a very very strange way to do so, but it can work. (Just not sure it's worth all the hassle there...)
Would probably just be simpler and easier to use a mod like errorMagnifier from Chuck:
https://steamcommunity.com/workshop/filedetails/?id=2896041179
Atleast if I do understand the question correctly in the first place 
There is a program I use called klogg that live updates files like log files. It's super helpful and I actually found out about it because someone else here posted a screenshot with it on their desktop.
Is there a Lua method to just set a patch on a given inventory item clothing article? I see that the clothing class has:
addPatchโ(IsoGameCharacter gameCharacter, BloodBodyPartType bloodBodyPartType, InventoryItem inventoryItem)
But I'm struggling to understand why I would need a character? I just want to set Arm, to leather patched, with X bite/scratch defence etc
you can open the console #mod_development message
You don't need to change %username% as it's an environment variable that represents the currently logged in user (you)
echo %username% in cmd ๐
addPatch takes in a IsoGameCharacter (can be IsoPlayer too) so that it can get the player's tailoring level which changes the condition loss per hole. And also, the character is needed to sync clothing update with server (see SyncClothingPacket)
If you are calling this on client (doesn't matter if so) then you can just pass getPlayer() to the first param.
heh literally just found this while going ot make a new non-steam game with the launcher options xD
im not really a coder snd on top of that definitely not javascript so whats wrong here besides everything
Is this AI generated lol
just stole some random code off google tbh
I dont code
Scripts in pz are not javascript, they are ZedScript which is some weird amalgamation of a scripting language
could i literally just list multiple different clips and it would choose from them
You should look at how the game does it in pzinstall\media\scripts\sounds_player.txt
hi guys, im new to modding pz, i dont know much about coding and modeling, recently i make this mod and dont know what wrong with it, the gun is invisible in the game, can some one help me ?
Your mod has a space in it's id, I've never seen that before ๐ฎ
I haven't uploaded it to steam yet, I just made it this evening
this is what im thinking
You need to define the model in a model script https://pzwiki.net/wiki/Scripts_guide/Model_Script_Guide
They are the exact same, they will just override each other. I am assuming you are trying to replace PlayerDied sound in the vanilla game?
I know you can play sounds randomly from Lua but I don't know from this
yeah replacing the default im gonna see what happens although I wouldnt be doubted it just plays both
or neither
what im gonna test
Made some simple code as an easier test, since I don't need the custom console thing anymore xD
Run it from cheat menu's lua editor and it sets all items in range to be really high water amount.
local range = 3
local squares = {}
local sqr = getPlayer():getSquare()
local cell = getWorld():getCell()--:getGridSquare()
local oX,oY,oZ = sqr:getX(),sqr:getY(),sqr:getZ()
for x = oX-range,oX+range do
for y = oY-range,oY+range do
table.insert(squares,cell:getGridSquare(x,y,oZ))
end
end
local tbl = {}
for _,sq in pairs(squares) do
if sq == nil then return false; end
local sqObjs = sq:getObjects();
local sqSize = sqObjs:size();
for i = sqSize-1, 0, -1 do -- enumerate square objects and pack them into a table
local obj = sqObjs:get(i);
table.insert(tbl, obj)
end
end
for _,obj in pairs(tbl) do
if(obj:getWaterMax()>0)then
local oldAmount = obj:getWaterAmount()
obj:setWaterAmount(10000000)
print("setting object "..obj:getObjectName() .. " from "..oldAmount.." to ".. obj:getWaterAmount().." water.")
end
end```
mp3 file isn't supported by the game, only ogg and wav
crying in zedscript
I have an idea
but first remove the spaces from your file names and convert them to ogg
ya could do _ no? I normally do for everything xD
yes
is this right
should be yeah. I think another param is like worldobject but not sure if its required or not
it doesn't mind the last item having a ,?
it is needed
for zed script, all statements' lines must end with a comma
oh I could make a simple mod maybe- add a context menu option and then it runs that code, but instead of player position, it's mouse position-
uh- now how do I add stuff to the context menu xD
changed the actual files aswell ofc
btw citrus is your sound a music??
doesn't matter much I think but there's just diff functions for playing music and sound so I've never tested the difference
yeah
But anyway, in your sound script, you can do this to disable the vanilla death sound (is always played from Java code no matter what):
module Base {
sound PlayerDied {
category = Player,
clip {
}
}
}
or if that doesn't work:
module Base {
sound PlayerDied {
category = Player,
clip {
event = Game/GameOver,
volume = 0.0,
}
}
}
and then in a lua file in your_mod\media\lua\client\your_mod.lua have
local Events = Events
local SoundManager = SoundManager
local ZombRand = ZombRand
--- @type Callback_OnPlayerDeath
local function on_death(player)
local files = { "Barracuda.wav", "Everything_She_Wants.wav" }
local file = ZombRand(1, #files)
SoundManager.instance:playMusic(files[file])
end
Events.OnPlayerDeath.Add(on_death)
i test it and its not working, definitely a problem with the model
Did you export it with the correct settings? I am not sure if not doing so makes the model invisible but I've never done model stuff much.
what is correct settings? i just learn blender for a few day
not the same thing but when I made a silly pack for friends this is what it looked like and both mp3 and wav worked but those were shorter files
ill try yours instead
I am not sure, maybe #modeling could help? All I know is that the gun's barrel must be pointing Z+
okey. thank u for ur help
If what you did worked before then you could probably do the same, I thought the game didn't support mp3
yeah what mp3 files not supported ;-; (I won't question it, if it somehow worked then so be it)
trust me the sound of pluh def worked
got me killed a few times
rn im just trying to remember how to put the mod into zomboid I have some other ones so im just gonna put it in the same place and hope it works lol last time I made a mod it was a small map like a year ago
You can simplify it to
local range = 3
local player = getPlayer()
local player_sq = player:getSquare()
local cell = getCell()
local x, y, z = player_sq:getX(), player_sq:getY(), player_sq:getZ()
local squares = {}
for i = x - range, x + range do
for j = y - range, y + range do
squares[#squares + 1] = cell:getGridSquare(i, j, z)
end
end
local tbl = {}
for i = 1, #squares do
local sq = squares[i]
if sq == nil then return false end
local objs = sq:getObjects()
local sz = objs:size()
for j = sz - 1, 0, -1 do
local obj = objs:get(j)
tbl[#tbl + 1] = obj
end
end
for i = 1, #tbl do
local obj = tbl[i]
if (obj:getWaterMax() > 0) then
local old = obj:getWaterAmount()
obj:setWaterAmount(10000000)
end
end
it is more lines, but is much faster than previously
some optimisations to note:
- using local variables as much as possible (you already do this well :D)
- looping through tables using i and size of table instead of
ipairsandpairsas these two iterators are very slow - instead of using table.insert, manually insert by indexing size + 1, table.insert is very slow
pretty much it
@grizzled fulcrum its not subtle but it works and I tested it, works with both songs so it does choose between them
idk why you cant hear the clip but trust
the more you know
I assume it works with mp3 too but maybe longer files wont work and who knows what happens when you add more then 2
but the rest of my day is now adding songs to random death
only thing is I wish I could fade them in slowly lmao
you could do that manually using audacity or literally any audio software
yea thats what im gonna end up doing
I was talking about a function but I doubt the halfbreed java has it
simple work around
use death sounds from other games like dark souls or minecraft
Is clickedSquare where ever the context menu was clicked at?
function RCHT_WorldContextMenu(player, context, worldobjects, test)
--local playerObj = getSpecificPlayer(player)
local pipingOption = context:addOption("Creative refill", worldobjects, RCHT_RefillWater)
end
Events.OnFillWorldObjectContextMenu.Add(RCHT_WorldContextMenu)
(I copied the add option line from another mod x3)
Basically, I heard that this would be called, currently, no matter where ya clicked. I only want it if ya click on a world tile.
Everywhere you click is technically clicking on world tiles
so- how would I only do it if directly on a world tile? not inventory or something
I assume you want it to only add the option if they click on a water source?
no, creative refill will get all water holding items in range of the clicked square, and set their water.
Oh, I could make it so it's in range of the square, but to start it ya need to click on a water storage item-
Well, still, how to get the object/square under the cursor? :P
oh, the example thing I saw was "OnFillInventory" not world object
By water holding items you mean IsoObjects or WorldItems?
IsoObjects
But the fact they are using invenotry clears up the fact they are saying "It'll happen everywhere" x3
err
hard to explain, but was confused
now makes sense
this is tricky
If you want to loop through tiles every click, you wouldn't want to do it when clicking anywhere because that would create unneeded lag
like you mentioned, I think the best bet is if they click on a tile with an object that already holds water
ye, though, how to do that now x3
well you already cooked up a prototype ^^^
Nah, to check if there's a valid object below the cursor-
but i would change it actually
for _, worldObj in ipairs(worldobjects) do
if instanceof(worldObj, 'IsoLightSwitch') then
something like this? (Code snippet from building menu)
yep
ah ok
but once you have the obj break out of the loop
nop
hmm- ipairs? or can I do what ya suggested before, here?
doo not
number loop not good in this case?
yes
Hey everyone, asking here too in case, anyone got the contacts of Spoon who made this mod ?
https://steamcommunity.com/sharedfiles/filedetails/?id=2970858855&searchtext=Immersive+Hunting
no it is good
Huh?
does anyone know/could help me make a right click ui?
I want to make a mod on "train metalworking" like the "train carpentry" mod.
Context menu ?
yeah ๐ญ im new to modding I dont know too much
right click and the thing that opens is a context menu.
yes
do ```lua
local water = nil
for i = 1, #worldobjects do
local obj = worldobjects[i]
if instanceof(obj, "SomeWaterObj") or obj:hasWater() then
water = obj
break
end
end
Not just for PZ, but for anything.
Like it ya select text in discord and right click it, it has "copy" "cut" etc
sorry typing on phone so its a challenge
wait, is hasWater true if at 0 water?
Ye, that was why before I was checking for max amount
but you get the point
Does anyone know how to make a context menu?
its the same as ipairs contextually, but much faster than calling ipairs func
I'd help but I'm learning myself too ๐
Lmfao
depends what you want
ok, now to redo the code from before and combine my edited code with yours xD
Do you want to add an option to a menu? Is it just for clothing, or is it more complex? etc
Literally just a context menu with the words "train metalworing" when right clicking on a piece of metal.
is the metal and item or an object?
An item
I mod the game more than play it so I am not familiar with all the different items
So you need to add an event that gets called when the player right clicks an item in their inventory. I will show how to do this but I'm on my phone so it's going to take a bit longer to write out
you mean world item?
If thats what it is
ok that's pretty similar tho
Lmfao I need to get a mod folder
I dont even have one yet
What I mean. Is start the MODS folder
if I exit out of a save with the mod loaded, to the main menu where mod isn't loaded, and then re-enter the save, will it update the mod files ๐ค
(Retorical, but I am trying it rn)
ok I'm going type it on my computer when I get back, because mobile is pain
aoqia
if I were to send a .zip file would you be able to tell me if my directory is messed up?
Ive only made 2 mods so far so I barely even know how to get the directory right ๐ญ
the folder should be called models_x not model_x and you should be able to reference it using the path *after* that and without the extension (e.g. if your model is media/models_x/weapons/firearm/FalloutShotgun.fbx, you should write mesh = weapons/firearm/FalloutShotgun )
๐ฎ I completely flew over that I didn't even read it properly
hmm- it's quite laggy to open context menu now- is this just a coincidince or is it my for loop-
I don't know
also ratchet turns out hasWater is just the equivalent of
return this.getWaterAmount() > 0;
``` anyway
probably your loop, I can optimise it a bit, give me as ec
I have been watching Fear the Walking Dead recently and I just happen to really love season one where there Zombie Apcolopyse is only getting started and we get to witness the fall of Los Angeles as it slowly drifts into chaos. It seems that I'm not alone in this either as many people enjoy watching films and shows where they showcase societal collapse.
With that being said and with regards to Build 42 coming with NPCs, do you think a mod could ever exist where NPCs could be added to the game with scripted scenarios? Such as NPC store workers and people walking around Louisville going about their day?
I would personally call it, "The Last Fourth of July" or something like that. Where the game starts on July 4th and as you begin the game, society hasn't fallen yet.. All you hear is radio transmisions and rumors around Knox County in scripted dialogue from NPC encounters and then on July 6th the infection begins to really take hold on the entire district.
Would a mod like this be at all possible?
A mod that already exists that gives off a similar vibe is the Expanded Helicopter Events mod. It gives the game a great intro feel where there is still military and civilian presense taking place while sort of in the background. https://steamcommunity.com/sharedfiles/filedetails/?id=2458631365
probably? we don't really have any special knowledge on what a feature that's still likely several years out is going to be like
I think it's hard to say because we don't know what b42 has in store for us yet
So a guy can dream? ๐
pretty much
This happens to be one of the few games that can allow for such a simulation. I can't name any particular games in the survival genre that have zombies and have a world that allows you to enter every building and decorate and customize as much as this one.
But I feel the developers should consider expanding the tools we can access to build out these worlds.
We already have RP servers that totally negate the zombie stuff and serve as Sim City life RPs...
how do you change the name of a item
@analog breach btw for your lua script
Of course discord uploaded my message too, just delete the first two lines lol and the last line
this is for the context menu?
I understand like 1/5 of what im seeing
I don't usually just write code for people like this, but basically the things you need to add yourself as homework is
yeah I really appreciate it
You need to change Base.MetalObject (search for it) to the item name
There's some example translations (search for YourMod) that you can use as a baseline of how to add translation
You need to put what ever you want in your_function, that function will get called when the player clicks on the option
would I have to add that for multiple items?
add what
this script will handle all the items you right click, but where I put the check for Base.MetalObject you need to change that to whatever items you want to check
so like if obj:getType() == "Base.SomeItem" or obj:getType() == "Base.AnotherItem" then
I don't know how many metal items there are so you're probably going to have to put a couple there
also if you don't know lua, probably want to do a quick crash course here https://www.lua.org/pil/1.html
Shit I forgot about that
The whole obj:gettype
I forgot everything is categorized
also here's my general copy pasta advice
#mod_development message
oh and also change the second param name of your_function from player_idx to player because I forgot I just pass the player object directly
that is something I've always questioned, which is faster? Passing player_idx and then calling getSpecificPlayer(idx) every time or just passing player object?
the latter
hey albion, is Candle manually maintained if you know? or does jab have a script for it
it's generated by a big scary java program he wrote
oh my god its in the readme am I blind the answer is YES
I swear I read it up and down like 4 times
wait no im just stupid, he didn't open source it
because I was wondering why there are exposed classes that aren't listed in Candle, so when I try to get type information it does not work
I've only come across the "primitive" classes like Integer, Double, Float, Void (although void is completely pointless to expose lol)
I will search through all of them really quick to see what ones are and aren't and give a full list
it seems his compiler checks Integer, but doesn't generate typings
unless this is intended
there is an oddity with kahlua where even lua primitives have a metatable which i don't think we can represent, but accessing them as classes should be fine
