#mod_development
1 messages ยท Page 217 of 1
I got mine to about 560ร560
Also it looks pretty good
Finally finished.
text, text color, text frequency, o snap. i wonder if you can trigger emotes
Ok that's kinda neat
Me want
Oo, I might play with that. But your character has to be able to emote while moving.
I'll also need to check if you're doing anything, if you're just idle or moving then maybe.
Anyway, where do you guys get your Workshop ID?
i just recently got sick (the 80% heavy cold) for the first time today, and the player was coughing and breathing heavy, and moving his arms all around, as i was playing and doing stuff.
submit it to the steam workshop to get one generated?
How do I make a text bold?
[b] like this [/b]
So it's just HTML?
it's html like
Now that I've completed my state of decay re-texture
And my Knox Plague re-texture
I'll make a retexture of the JOY plague from the Amazing world of Gumball
I'll probably end up doing a full change of every damage texture as well
Like I didn't with the Knox Plague re-texture
I'll make all the wounds on the zombies leak rainbow blood
And change their general look to the rainbow drool
With large eyes
Reason: Bad word usage
Honestly I've had my eye on this for awhile because I know nobody is going to do it
And I think it will be extremely fun
It's a fun mod idea.
I only recently discovered I can change the wound textures as well
And now I'll never been satisfied with my textures until I do a full wound re-texture based on what I'm making
And honestly doing the wounds is even more fun than doing the zombies themselves
How would you add these images? Is it after you publish the mod that you can customize it in the workshop instead of workshop.txt?
yeah
I just figured this out to
There is a thing in the workshop
That let's you
Once you have the thing uploaded this will be on the workshop page
Figured.
Do you think this mod is Realistic?
I might add that tag to the mod.
I'd say so
Though I myself probably say something more along the lines of
"Fuck I'm bleeding out"
Though I feel more variety of messages
Could make it pretty fun and even immersive
More is more better
After all
ImBleeding.bleedingTexts = {
[BLEEDING_SEVERITY.minor] = {
"The bleeding is minimal, but I must tend to it.",
"The wound is minor, but I should address it soon.",
"I'm bleeding a little...",
"Ow! It kind of stings! I'm bleeding a little bit."
},
[BLEEDING_SEVERITY.moderate] = {
"The bleeding is moderate, but I must tend to it.",
"The bleeding is moderate, but manageable.",
"I must apply pressure to stop this moderate bleeding...",
"Although moderate, I must staunch the bleeding soon...",
"Though moderate, I must find a way to stop this bleeding..."
},
[BLEEDING_SEVERITY.severe] = {
"I CAN'T AFFORD TO LOSE ANY MORE BLOOD!!!",
"I'M LOSING A LOT OF BLOOD!!!",
"I FEAR I WON'T SURVIVE THIS IF THE BLEEDING DOESN'T STOP!!!",
"THE BLEEDING IS CRITical, and i'm growing weaker...",
"THE WOUND IS SEVERE, I MIGHT DIE SOON IF I DON'T ADDRESS THIS QUICKLY!!!",
"I'M LOSING BLOOD RAPIDLY, I NEED HELP!!",
"I'M BLEEDING SEVERELY!"
}
}
```These are the texts for now.
Oooo
I like it
Alot of different text based on the severity
I imagine this would work with something like getText("prefix"..ZombRand(number)) for translations.
Oh, good idea.
Where would I put the texts?
I guess IGUI, like the read action does.
Oh, ok.
I'm not sure though, could other languages add more text variety?
Like for example:
The EN minor's texts contain five sentences while the CH minor's texts contain ten sentences and so on.
Since the one I'm thinking right now is like this:
ImBleeding.bleedingTexts = {
[BLEEDING_SEVERITY.minor] = {
getText(),
getText(),
getText(),
}
}
Which would be a fixed number of texts. Unless there's a function for that.
hm, you could get the translations and remove duplicate and empty variations.
How do I get the translations?
using getText or the relevant function for that file.
No, I mean, is there like a getTexts or something that returns a list of well.. texts.
I don't think they support dynamic texts like that, you would probably need a custom solution.
local function myLocalFunction --local
function myFunction -- not local. global?
Yes, that is a global function.
Is there a way to read files using the game's code? Or do I have to use native Lua methods.
There are a few ways to read some files.
declaration: package: zombie.Lua, class: LuaManager, class: GlobalObject
How do I get the current language the user is using?
what for? translations are automatic. (if thats what you're trying to do)
I'm trying to make a custom file reader.
oh. for the 'not all languages have the same number of lines' thing. im bad at lua, buuuuuut i think you could just iterate through a list of strings
i did this for a couple projects, i think there's a method on Core that returns a language code?
looks like i used getCore():getOptionLanguageName()
What does it do?
that returns a language code like 'EN'
Awesome.
Is it possible to make your own directory in your mod? Like instead of putting everything in media/lua/client, I can put a utility file in say media/lua/utils and then get those files by doing require("utils/FileName")
Translator getLanguage returns a Language object, it checks the options that albion mentioned.
No, require would not work. But you can use loadstring after you read the file (not reccomended).
You could just read lines and use them instead.
I'll just put it in client then
Alright. So how am I going to do this?
- I need to get the language the player is currently using.
- With that language, I can do
io.open("{LANGUAGE}/{fileName}_{LANGUAGE}")to access the file I need to read. - After that I can do something like this:
fileName_LANGUAGE = {
fileName_type_name_01 = "Text 01",
fileName_type_name_02 = "Text 02",
fileName_type_name_03 = "Text 03",
fileName_type_name_04 = "Text 04",
fileName_type_name_05 = "Text 05",
}
```4. I need to create a function that checks if the variable has an index suffix (`_01`), if it does then keep going down until you reach a line without that index suffix.
If the variable has an index suffix then keep looping and then return a list, otherwise just return the text/value.
assuming it's in client you can use
local texts = require(string.format("fileName_%s",getCore():getOptionLanguageName()))
if not texts then
texts = require "defaults"
end
e.g. defaults file
return {
myTexts
}
It's fine.
what is
I'll just put it in client.
I used to do something very similar with my mod, Immersive Lore, and I used JSON for this. It might be good for you depending on what you're trying to do, but it was troublesome with translations, so I had to change the JSON solution to something else
I'll just use txt.
If you use this with a text file, instead of the above lua example then.
- ok
- no, use the function posted before
- ok
- save all valid suffixes and figure out the size of the variants?
What is "defaults"?
I'll just ignore that.
a preselected option adopted by a computer program or other mechanism when no alternative is specified by the user or programmer.
You can use the translation files for this purpose
I do something similar for conditional speech -- where I load up all the possible phrases using getTextOrNull
So the translations are independent of each-other
Then you can have the phrase pulled from the translated table of phrases using zombRand or whatnot
Huh, what?
Yeah, like I said, I have no idea how to get the length of the list.
Chinese minor texts could be 10 while English's is 5
That's where the getTextOrNull() comes into play
And my files for conditional speech don't have the same lengths either
I'm all ears.
Load all the phrases on game boot - and then add returned phrases to a collection -- getTextOrNull() will return null when that phrase is exhausted
https://steamcommunity.com/sharedfiles/filedetails/?id=2398253681 This is the mod I employ that technique
This is a cropped snippet:
local phraseSets = {}
phraseSets.Phrases = {}
--- snip
phraseSets.Phrases.Drunk = {}
phraseSets.Phrases.HasACold = {}
--- snip
function phraseSets.LoadFromTranslation()
for k,_ in pairs(phraseSets.Phrases) do
local phraseNum = 0
while phraseNum < 1000 do
phraseNum = phraseNum+1
local phraseID = "UI_Phrases_"..k..phraseNum
local foundPhrase = getTextOrNull(phraseID)
--[debug]] print("CND-SPEECH: phraseNum:"..phraseNum.." foundPhrase:"..foundPhrase)
if (foundPhrase) then
table.insert(phraseSets.Phrases[k], foundPhrase)
else
break
end
end
end
end
return phraseSets
This assumes you have a text file in the appropriate translation format -- it will start pulling phrases off the phraseSets.Phrases. table
--UI_Phrases_Drunk
UI_Config_Drunk = "Drunk",
UI_Phrases_Drunk1 = "feeling tipsy",
UI_Phrases_Drunk2 = "feeling good",
UI_Phrases_Drunk3 = "this is great",
UI_Phrases_Drunk4 = "that is the stuff",
UI_Phrases_Drunk5 = "that is the good stuff",
UI_Phrases_Drunk6 = "time to party",
UI_Phrases_Drunk7 = "I am wasted",
UI_Phrases_Drunk8 = "I could go for another",
UI_Phrases_Drunk9 = "I have no worries",
UI_Phrases_Drunk10 = "nothing can stop me now",
UI_Phrases_Drunk11 = "bring on the shots",
How can I improve my text? I am currently using setHaloNote but the text is too small sometimes.
I use say() - I would suggest the same for your case
actually I lied
I use addChatLine
player:addLineChatElement(text, return_color.r, return_color.g, return_color.b, UIFont.Dialogue, vol, "default", true, true, true, true, true, true)
I swapped to addChatLine for MP support
Actually, if your mod doesn't need to be shown/work like dialogue -- I would stick to haloText
Actually x2 - I don't see a way to use other fonts with halotext - so use Say()/addLine
You'd need to use a network command to make it work in MP - so that part is up to your preference -- you can read through conditional speech for that too
Anyone know what would cause this to happen with world models? Normals are fine on the model
local bleedingText = PhraseClass:getRandomPhraseBySeverity(bleedingSeverity)
local textTintMultipliers = {
[ImBleeding.SEVERITY.minor] = 1,
[ImBleeding.SEVERITY.moderate] = 3,
[ImBleeding.SEVERITY.severe] = 5
}
local textTint = (255 - (bloodLossRate * 55 * textTintMultipliers[bleedingSeverity])) / 255
textTint = math.min(textTint , 200 / 255)
local currentTime = getGameTime():getMinutesStamp()
if (ImBleeding._timeBeforeSayAgain <= currentTime) and (bloodLossRate > 0) then
-- playerObj:setHaloNote(bleedingText, 255, textTint, textTint, 300)
playerObj:Say(bleedingText, 1, textTint, textTint, UIFont.Dialogue, 0, "default")
ImBleeding._timeBeforeSayAgain = currentTime + ImBleeding.BLEEDING_SEVERITY_DELAYS[bleedingSeverity]
end
```Can't get this to work, the color is always green.
For Say() you'd need to change the "default" to "radio"
Perfect.
Going to update this tomorrow.
- Update poster/preview image.
- Text is now larger
- Added translation support
I may add multiplayer support but that's for when the mod gets popular enough.
Anyway, thanks, pro.
The game really needs documentation for its API, quite difficult to mod especially with variable names like baseRange, I never knew that was the volume.
That aside, I'm gonna go catch some dreams. Got work tomorrow.
base_menu = context:addOption("Upgrade Stove", worldobjects, upgradeStove(stove, context));
shouldnt this fire the function when i actually click the button? upgradeStove is called on populating the context menu like this
Just pass the function name without the args
Rn the result gets called instead of the function
Hopefully you learned something.
You are calling the function, that's why it fires. You need to pass the reference only and then add the other variables.
Looking around the codebase - would anyone know anecdotally if you can shoot vehicles? Does someone need to be sitting in one for it to work?
Which madman was rewriting vehicles to have better damage calculations?
I do not know for damages but for physics: https://steamcommunity.com/workshop/filedetails/?id=2909035179
I think it was @astral dune
But the reason I wasn't sure is because shooting at cars seems to be very very miss heavy
I assume it's cause my aiming is so low - can test that - but it feels weird to be so damn close and miss a car lol
cant seem to find much information on context menu stuff, is there a way to change the color of the button text?
It does suck when you are blasting zombies with a shotgun and mistaking hit the car you are using though... lol
That's a thing?
Trying to add something somewhat simple - but it's probably going to result in me rewriting how attacks are handled ๐ญ
the ability to shoot out someone's tires would be fantastic though ๐
Hi everybody. Does such a function addCorpseItem() exist?
Advanced Trajectory allows you to shoot and damage cars with bullets, I am not sure if that's modded or vanilla though since I never shoot cars in vanilla, I only did it for fun while playing around with AT.
Am I totally off in thinking that I can add a function to Events.OnObjectAdded from a server file, or when it fires? I am never seeing my test logging for any item, let alone when I find a generator on the map
I would be eternally grateful if anyone gets a chance to check out the code and point out my mistakes because I'm at the end of any ideas for troubleshooting this behavior: https://github.com/TheCrimsonKing92/pz-propane-generators
it doesn't matter if it's a server file, files execute the same wherever they are
Do you know anything about this particular event, or OnNewWithSprite? I'm not being creative, this code is copped basically straight from vanilla's MOGenerator.lua, but never do my modded generators appear.
hmmm, it might not still be used, i'd throw some prints into the vanilla file to see if it actually runs
this stuff is *usually* for global objects, there's a bunch of code for generator global objects but none of it is used, not sure if they previously did or something but generators don't use that system right now
Ack, I tried throwing one in vanilla and didn't see anything
That makes sense if it's crufty
from what i've read on your github it doesn't look like this is tied to global objects, but
what exactly are you trying to do?
I thought I could hook into when generators are created and placed on the map, to modify some of them to run on propane or be dual-fual generators between gas and propane
I've not made custom items before, so that seemed like a simple way to change behaviors around them without having to create new item scripts. But I'm willing if it's necessary, just haven't learned that lifecycle.
OnNewWithSprite is called when a tile with that sprite is loaded, it's probable that generators aren't usually created through that method
most generators are randomly generated so i imagine they just create the object directly for those
if there's a guaranteed spawn somewhere i'd expect that to go through this
Yeah, it's unclear at this point
How guaranteed? I use Rosewood for testing and usually find a generator in the school shed, though seemingly not always.
Maybe I haven't found a guaranteed spawn.
It also does not kick in when I add a generator from the Item List debug functionality.
if i'm interpreting correctly it'd have to be a 100% guaranteed, map-defined spawn
yeah, i've found the part of the java where they add the random generators and that wouldn't trigger this
Hm, does that point to a more reliable method?
not really, i can't see an easy way to catch it
i don't think you can even scan squares as they load as it happens after that, it fires OnSeeNewRoom but that's before it actually rolls for the generator
are the changes to the generator visible?
if the player wouldn't be able to tell, i don't think generators ever spawn on or anything so you can just change whatever you need when the player first interacts with it
Does anyone know how to edit a .pack file?
Seems some textures aren't contained within the Texture folder
But instead the TexturePack
Folder
Inside something called a .pack
why do you need to edit it?
I want to change blood textures
Though I mostly want to edit the wound marks on the health panel
you can overwrite images inside a pack without using one, i'm not even sure what the benefits to packing are
probably some loading or size optimisation
But how would I get the images out
oh, Project Zomboid Modding Tools on steam has a utility for extracting them
I also would think I need to repack it after as that's how they are in the game files
tilezed
you don't need to repack it, and if you did you would be overwriting every texture in the game
images in a pack still have an effective filepath and putting an image loose in that filepath in your mod will override it as normal
I honestly have no idea what that means
if you want to override textures/myimage.png you put your own file on that path in your mod right?
you can still do that for texture packs, the images inside them still have paths
you will still need to extract it with tilezed though
So would I just put it in the
texturepack folder same as the regular textures?
I've heard of that but cannot find it
download Project Zomboid Modding Tools, it should be in your steam library if you have zomboid
it's included in there
I have that downloaded
But it doesn't allow me to unpack the file
Hold up
It isn't installed
Odd
Would I just open the pack from within tilezed?
Yeah .pack files don't even appear inside tilezed
After figuring out how to open it in tilezed
I have no idea what a prefix is
I appreciate the look and suggestion. For this initial idea I haven't planned or created alternate sprites, simply modified behavior based on a generator type I roll for (though that's in the MOGenerator code not being used).
Some maps come with pre-existing generators, the main map usually spawns them randomly with the OnSeeNewRoom event. Immersive solar arrays spawns more custom generators the same way.
Some please tell me what the heck a prefix is
e.g. crafted_01_0 remove the _0?
?
I don't see any pack files that look like that
I'm trying to extract
UI.pack
go to view pack, hover over an image, what does it show you?
Moodle_Icon_Zombie
argh, you probably want to export separately then without any prefix
How would I?
I just spent about 3 hours of my existence trying to figure out how to open this thing
its been a while since I've touched it, but ya it was me. For the record, afaik, you can't shoot a car unless you're literally standing in a spot that allows you to interact with a door, hood, trunk, etc. So point blank
Yeah I noticed that
Don't really feel like spending that much effort on the process ๐
Someone else mentioned advtradjectory does it - I wonder how
dunno! the point of my mod was to build an event system to allow modders to tell what kind of damage the vehicle took (collision, off-road, zombie, weapon, etc), and alter, redirect or cancel it
worked good, the only challenge was high speed collisions between two vehicles. Didn't get the chance to properly test that, and moved on to other things. hopefully the next big release makes all that obsolete, but who knows
From previous comments it seems like Aiteron wanted to work on it
I think a vehicle refactoring is probably much farther down the line
could be, I begged them to fix the hardcoded override of the engine's horsepower on the java side and they said they would for 4.2, if they remember, lmao
Yeah that's another thing - alot of stuff in under exposed
I was going to try and mess with the hitList when people swing their weapons - but it's all unreachable ๐ฅน
So I'd need to recreate it in Lua
Several classes worth of stuff
ya, me too, when trying to event-ize people hitting cars with bats and such
You should check out the logging skill mod I wrote - figured out a way to find/grab the tree object being struck
Maybe it could help with hitting cars?
My issue is related to ranged weapons - which I don't even know if that'd work
hmm, ya, I vaguely remember doing a deep dive on that before I realized ranged weapons still only work point blank on vehicles. Didn't come up with much
so many possible board games to adapt in the game, can't miss that 
I like APIs and systems, feels nice to whip together a mod in a weekend since most of the hard work is done already
Well I give up
Can't figure out what the heck I'm supposed to do
Every guide I find does nothin
Yeah that's why I want to make a framework for my mod lol
Because then it would be sooo easy to add more zombie types outside of just The Last of Us
what's your issue ?
.pack files ?
Yeah
I've been trying to find out how to extract the files in it
But can't
no idea what that is sadly sry
Well that's unfortunate
I'll probably try again tomorrow
I've spent way too long just trying to open a file
Did you try like that?
Is output the location the files are brought?
I put in to directly into my mod template folder
no prefix; each tile is a separate image
I really still have no idea what a prefix is
Though I just need to know how to take the image out
I tried without the prefix
Still no luck
๐ชฆ
Is the prefix the name of the file maybe ?
I tried that
It didn't work either
Would have loved to help you but I've got no idea what those files are
I have no idea either
I'm starting to think nobody does
lmao
those are for maps ?
also I'm a bad example, I've been modding for 2 months now
They are the texturepack files
They contain all the moodles and icons
I wanted to redo the artwork for bites on the health panel to go with my mod for extra immersion
And do some new art for the zombie moodle just for fun
A prefix is something that starts at the beginning. For example: _var is prefixed with _, the opposite of this is called suffix which is at the end so it's var_ in that case.
The textures do look creepy, no idea how it looks in-game haha
i just Ctrl+F this discord for 'extract pack', lots of people struggling. here's one person who did it successfully:
though, he's extracting map tiles, not moodle sprites, etc.
not sure if this post is relevant. maybe?
I got them to look pretty good
Just going though every texture in the game to fully overhaul the zombies
Like the wounds, bites, and moodles
would make for some cool retextures
I'm sure that would interest @median prairie ๐
Right now it's nearly fully done with all the textures
Every body texture is done
Every skull texture
Every slash and almost every wound
skull textures ? The skeletons ?
What would be the prefix of the
Moodle_zombie_icon?
I need
It could literally be just M or Moodle. It just refers to a letter/word before the variable name.
I've redone the skull textures for all the zombies
So when they are damaged you don't see a fully intact skull
My zombies have a broken jaw so it make more sense for the jaw on the skull to always look broken
I'll try that
Thank you
I mean that's just the body texture ?
I know but in the body texture they have a torn jaw
But if one of the zombies has a half of their skull showing
Suddenly the jaw is back in place
It's simply for immersion with texture consistency
But I need it
half of their skull showing, that's in the base game ?
Yeah
There is a zombie damage where half, a bit, or the entire skull is showing
didn't even knew that
I noticed when I used the Lovecraft re-texture where the face of the zombies is a hole
But some of them had skulls over the texture meaning they suddenly had a fully intact skull
It bothered me so I made sure nobody had that problem with mine
hmm I see yeah
OK ok
It did give me something
Not the right thing but something extracted
Also if you want to make some eldrish horrors like Mystery did with its occult zombie mod, I'm making a framework to easily add zombie types 
Mystery made that mod?
Interesting
I still really need to figure out how they did this to make the eyeball zombies

Hello

Speak of the devil
You can hide parts of the zombies
I do want to remove that pesky nose of theirs
So if I'm not mistaken @median prairie you made your models clothings right like I did with my Bloater for my the last of us mod ?
Sounds rad!
Haven't looked deeply in your mod
Yup! Just clothing.
Used regular masking with clothing, nothing fancy.
exactly
You're not actually replacing the model of the zombies, you just trick the players by making the model a clothing
Then hide the body parts (if needed)
I've noticed all have used clothing
I just need to figure out how to do that
And how to make the rather simple eyeball head model
Fairly easy to do tbf once you got the hang of it
I can send you my (less than optimal) blender file of my Bloater if you want to have fun with it
You just link your model to the body parts of the player model
(the armature in Blender)
That could work
Then export the model in .fbx with the right settings and done
Figured out the issue with the alpha argument
Tho is it moving by itself ๐ ?
Ghosts
Chuck casually coming in the middle of a conversation showing his crazy board game stuff
No, the network code is not sound enough to do something that needs to be updated
Or alteast when I tried to make it server side the game kept trying to duplicate stuff cause it updates from clients lol
Well, I'm definitely missing a part of the conversation here lol
GameNight has issues with desync if the people have high ping
Right
If I make it possible for multiple people to mess with the ouija board it wouldn't really work
The biggest hurdle is that I want the objects in the world to move around
yeah that sounds like hell
If I kept it only UI I would probably have no issues
I still need find out why my key frames in blender seem to be broken
I have no idea what I'm doing
@sour island May I ask how you learned what a function does, did you have to read the source code most of the time? Also, any tips for a beginner PZ modder?
Check out how others do stuff, try to replicate some bits to understand how it works
That's how I learned it
Wanted to make an addon and reintroduce Monkey's work on The last of us enhanced experience bcs it was broken but by doing it my own way, made 2 different mods and now I'm fully rewriting it lol
then suffer for hours when some weird shit happens

Look into Umbrella and those kinds of tools
I already have Umbrella for linting. Used beautiful-java to decompile the source.
I use an older version (sort of) - which is de-compiled code + a lua library
Oh, yeah then you're off to a good start
And yeah, you kind of need the decompiled code
Still haven't even looked into that ngl
The issue I was having with the alpha for textures was cause the overload for draw texture isn't actually ever called from the UI in Lua - so I had to add one -- wouldn't have known without just looking at the decompiled code
Is it just me or some variables are just var1234 or string1234 instead of actual variable names. Is that like a side-effect from decompiling or is that how they wrote it?
It's a side effect lol
The online java doc does actually get filled occasionally with the correct names
TIS casually obfuscating their code
I wonder if a crafty person could tie those two together -- I would have assumed Umbrella/Candle to do this tbh
But scraping a website sounds like a pain
I don't really care how the decompiled code is written, I just need documentation for what a function does lol
well...
This is unofficial: https://zomboid-javadoc.com/
https://projectzomboid.com/modding/zombie/core/Core.html#getMpTextColor()
Isn't it this one?
declaration: package: zombie.core, class: Core
This is the official one which I think was updated: https://www.projectzomboid.com/modding/index.html
I think having the actual decompiled code is nicer - atleast with IntelliJ - I can jump to it to verify what's going on
And the nice thing about Java is it declares the variable's type - so you can kind of put 1 and 1 together to follow along
Is there an event for when a character is doing a TimedAction? I'm planning on making a single trait mod.
There are Lua functions for when timed actions occur - timed actions are actually Lua centered
Not trying to be too anal, but 'events' are something else - java sided methods that can be interacted with using Lua -- You'll see them around like Events.XYZ.Add(functionthinghere)
You can also overload/overwrite Lua functions - which is probably what you'd want for messing with timed actions
you cannot be fat and skinny at the same time, they are mutuallyExclusive.
If you gain weight, the game will -remove- skinny and -add- fat (for example)
if thats what youre asking.
Thanks.
I need help, I want the item to stay still every time I craft something, for this I use keep and OnCreate to execute dialogs every time the recess is created, the problem comes that with each crafting the object changes its position, and if I apply the command RemoveResultItem: true, it doesn't render the text I need
Code:
recipe Entregar billetera
{
Wallet,
keep Capitana,
Result:Money,
CanBeDoneFromFloor:true,
OnCreate:ComercioCapitana,
}
recipe Saludar a la Capitana
{
Capitana,
IsHidden:true,
Result:Capitana02,
CanBeDoneFromFloor:true,
OnCreate:SaludarCapi,
}
Code .Lua:
function SaludarCapi(items, result, player)
sayThis = ZombRand(5);
if sayThis == 0 then
player:Say("Buenas camarada!! que te trae por aqui??.");
elseif sayThis == 1 then
player:Say("B-buenas Armero~... espera quien eres?.");
elseif sayThis == 2 then
player:Say("Si si, trajiste lo que te pedi??.");
elseif sayThis == 3 then
player:Say("Hola!! que quieres??.");
elseif sayThis == 4 then
player:Say("Entonces le clave un tiro en la cabeza y.. mrda... que quieres tu??.");
end
end
Image1: before
Image2: after
Damn, this mod is going to be much more complicated than I expected.
it's planned
we'd have to actually hook up a decompiler but we already have all the data scraped for umbrella, i might try and get beautiful java to utilise it or something
definitely makes interpreting methods a bit easier
anyone using a decompile as a reference should remember there's no reason you can't edit the files, rename variables when you work out what they are and you'll be able to decipher the code much quicker
Couple teasers of a RP pose mod I'm making with some friends.
Music unrelated, just couldn't be bothered to mute my audio while testing.
yknow how theres debug mode with right clicking? like the ui box shows up with like the brush tool admin stuff like horde spawning etc?
How would one make a custom one of those
I'm actually role-playing as a priest right now
I need
I'd wager it is at least a month away, but be on the lookout. I'll try to lightly advertise it.
Planning on having at least 15-20 of various different poses in each category of lying, sitting, standing, and 'holding props'. Such as guns, bats, etc.
That is awesome
I've been looking for a comprehensive pose mod
So I'm happy to hear one is one the way
If you don't already have it, Fuu's roleplay poses is an excellent one, Fuu actually helped me with my work on this one and gave me their blessing to utilize some of their framework to make this one.
I am working to ensure they're compatible with one another as well. So between Fuu's and mine, hopefully will cover a lot of bases!
I've never seen it
I'll definitely give it a look thank you for informing me
I'll await to download your mod as soon as it comes out as well
I need all the poses
I made these
For my fellow State Of Decay lovers
Definitely my most simple re-texture out of the 3
But I feel people will enjoy it
can you send me a link to your retexture mod? if its public ofc lol looks very kewl
also again if anyone knows how to make my own debug UI menu thing like how they have how the ui box shows up with like the brush tool admin stuff like horde spawning etc or the more builds mod makes a tab for itself etc
How would one make a custom one of those would be very cool cause i cant seem to find any resources on how to do so online
I'll send it over
It is 100% public because the workshop needs more State of Decay content
ty mega chad
Probably a dumb question, but does music (and sound in general) play for all split-screen players?
Most of it would. Modded sound effects based on info about the object returned by "getPlayer()" or "getSpecificPlayer(0)" might trigger wrong, though both players would hear it when it did happen because they share audio.
Gonna have to go back to the drawing board on this. I hooked into OnSeeNewRoom and tried to scan over the objects in the squares of the room, but none of the objects appear to have truly loaded in at that point (getName() and getSpriteName() seem to always return nil).
Events.OnSeeNewRoom.Add(function(isoRoom)
log('OnSeeNewRoom triggered for a new room...');
log('Room name: ', isoRoom:getName());
local squares = isoRoom:getSquares()
local squareCount = squares:size()
for i = 0, squareCount - 1 do
local square = squares:get(i)
log('Looking at square with x: ' .. square:getX() .. ' and y: ' .. square:getY())
local objects = square:getObjects()
local objectCount = objects:size()
for o = 0, objectCount - 1 do
local object = objects:get(o)
log('Looking at an object on the square')
local name = object:getName() or 'N/A (Not Found)'
local spriteName = object:getSpriteName() or 'N/A (Not Found)'
log('Object name: ' .. name .. ', sprite name: ' .. spriteName)
if "appliances_misc_01_0" == object:getSpriteName() then
log('Found a generator!')
if isModded(object) then
log('Generator is modded!')
else
log('Generator is not modded')
end
end
end
end
end)
Unless someone knows of another event that's more applicable/fires after the objects all have their data, I'll probably have to do something more invasive (maybe an OnTick that checks conditions and sets things up to be resolved later, not sure).
This method just fills the log with junk
LOG : General , 1708351023674> [Propane Generators (PGGeneratorCreation.lua)]: Looking at an object on the square
LOG : General , 1708351023687> [Propane Generators (PGGeneratorCreation.lua)]: Object name: N/A (Not Found), sprite name: N/A (Not Found)
I mean, why do you write in the logs anyway ?
It wouldn't fill the log with junk without your log functions ?
This is for testing purposes
I need to hook into when generators are put into rooms so I can modify them
I don't get it, what's the issue with that then ?
Albion said they are spawned after the event, so you would need to do it next tick.
But, why not spawn new generators instead?
What's an efficient method for doing so? My previous mod was just a custom UI for doing searches, so I'm not familiar with item lifecycles or map world object placement
Efficient way to spawn a custom generator?
Spawn a custom world object once the map has generated, ideally with knowledge of where generators already exist
This mod and SteamPoweredGenerator both override the code in MOGenerator, which albion and I think doesn't run anymore, so I'm not sure if these mods are non-functional or that's just old cruft they don't need anymore.
Immersive solar arrays spawns new generators, regardless of vanilla generators. It has different chances for room types and sandbox scale.
MOGenerator should run when maps already have a generator, like Kingsmouth.
Ah okay, so it is relevant, just not for Rosewood where I've been testing
Just to make sure, does this also check items in the room?
Not really, it gets called with OnNewWithSprite when the generator sprite is used, with a direct reference to the object
ah, I thought he was using his Item Stories mod for this.
Not sure about Item Stories, but I am seeing some client-facing code, so I'll dig into that. Thanks for the interest and reference!
Events.OnPlayerMove.Add(checkSquaresForGenerator)
Would appreciate any love shoved on this: https://www.reddit.com/r/projectzomboid/comments/1auolub/game_night_mod_now_has_2_more_addons
<@&671452400221159444>
is there a way to add a variable to an item? was saving and passing isostove reference to check if it has been upgraded already, but realized they change every time you load the game so i need something more permanent
Moddata
thanks bud i really appreciate all the answers!
Hello! I have a mod whose role is to send a message to all players, but it seems to me that the playsound method doesn't do that.
Could someone advise me?
Here is an excerpt from my current code:
function SoundManager.playMySound(name)
print("Attempting to play the sound:", name) -- For debugging
local emitter = getWorld():getFreeEmitter()
if emitter then
emitter:playSound(name)
print("Sound played:", name) -- Confirmation that the sound has been played
else
print("Emitter not available") -- For debugging if the emitter is not available
end
end
When hooking into a function like ISVehicleMenu.onSleep, my 'copy' of the function doesn't overwrite the vanilla function, so it won't cause issues with other mods, correct? Or how exactly does hooking into a vanilla function to change a tooltip for example play with other mods that also hook into the same function?
Depends on how you do it. Wanna post the code? @sleek hull
You need client-server commands to tell people to play sounds at the same time (as far as I know).
`
local old_ISVehicleMenu_onSleep = ISVehicleMenu.onSleep
function ISVehicleMenu.onSleep(playerObj, vehicle)
if not vehicle:isStopped() then
playerObj:Say(getText("IGUI_PlayerText_CanNotSleepInMovingCar"))
return;
end
local playerNum = playerObj:getPlayerNum()
if findNearbyPillow() then
options.addPillowComfort = true
else
options.addPillowComfort = false
end
local pillowNearby = options.addPillowComfort and getText("Sandbox_ComfySleeping_Yes") or getText("Sandbox_ComfySleeping_No")
local currentComfort = getCurrentComfort()
local formattedString = getText("IGUI_ConfirmSleep") .. "\n\n" .. getText("Sandbox_ComfySleeping_Comfort") .. " " .. getComfortString(currentComfort) .. "\n\n" .. getText("Sandbox_ComfySleeping_PillowNearby") .. " " .. pillowNearby
local modal = ISModalDialog:new(0,0, 250, 150, formattedString, true, nil, ISVehicleMenu.onConfirmSleep, playerNum, playerNum, nil);
modal:initialise()
modal:addToUIManager()
if JoypadState.players[playerNum+1] then
setJoypadFocus(playerNum, modal)
end
end
`
As far as I figured and was told it was just a 'save a reference to the original function, then redeclare it with the modifications you need' type deal
Currently, the mod is functioning but only affects one player, and players in proximity to this player can hear it too. I believe this is simply a matter of utilizing the correct method.
Ahhh I was thinking of playClip... Idr who hears playSound. I thought it was similarly local.
What triggers SoundManager.playMySound(name)?
@coarse frost
This will not preserve original behavior.
Hello. Does anybody know where I can find the variable that determines clothing condition and the textures that add holes to clothing?
You have overwritten all original behavior.
It will not be compatible with other modifications of that function.
Is the entire purpose of your function replacing the text of the sleep modal?
Yes
Do you only want it to apply to the English version of said text?
No, the rest of my mod is currently in English/German/Italian/Simplified Chinese/Traditional Chinese and French
So I'd have to be able to replace it with a formatted string with getText() calls to get the respective translated text
Looking at the wiki, hookinh into the function is more or less saving a reference to the old function, redeclaring it, then calling the old function at the beginning of the one I've redeclared to keep the original behavior, yes?
I'm looking at
public abstract long playSound(String file,
boolean doWorldSound)
Deprecated.
and thinking it could be my solution
Where does options come from? Is it local to your file or something?
Yeah that's a close estimate, but here there may be an easier way.
It's just a table I have that holds sandbox options & some flags
This function is activated by another file at specified times, nothing too complex.
local SoundManager = require "SoundManager"
local TimeModule = require "TimeModule"
local lastTriggeredTime = nil -- Variable pour stocker l'heure de la derniรจre lecture
local function stringToTable(str)
local result = {}
for match in string.gmatch(str, "[^;]+") do
table.insert(result, match)
end
return result
end
local function manageRestartTimes()
local times = SandboxVars.AdvancedRestartAlerts.RestartTimes -- Assurez-vous que les horaires sont au format HH:MM pour correspondre au format de getCurrentTime
local timesTable = stringToTable(times)
local currentTime = TimeModule.getCurrentTime()
for _, scheduledTime in ipairs(timesTable) do
if TimeModule.isCurrentTimeEqualToSubtractedTime(scheduledTime, 10) and lastTriggeredTime ~= currentTime then
SoundManager.playMySound("Jingle_Chuck_10_min")
lastTriggeredTime = currentTime
elseif TimeModule.isCurrentTimeEqualToSubtractedTime(scheduledTime, 5) and lastTriggeredTime ~= currentTime then
SoundManager.playMySound("Jingle_Chuck_5_min")
lastTriggeredTime = currentTime
end
end
end
Events.EveryOneMinute.Add(manageRestartTimes)
damn did'nt see the deprecated
It may be audible to multiple people because this is running locally for all of them
Rather than transferring the sound over the server.
tyt
You could do something like this instead:
local ExampleModule = {}
ExampleModule.ModalDialog = {}
ExampleModule.ModalDialog.new = ISModalDialog.new
-- Do not add self below; it is implied by ":" between "ISModalDialog" and "new".
function ISModalDialog:new(x, y, width, height, text, yesno, target, onclick, playerIndex, ...)
if text == getText("IGUI_ConfirmSleep") then
-- Optional, but you would need this for splitscreen to work right:
local player = getSpecificPlayer(playerIndex)
-- Use player to find distance to nearby pillow; I'm guessing you used `getPlayer()` or something, which only gets player 0.
if findNearbyPillow(player) then
options.addPillowComfort = true
else
options.addPillowComfort = false
end
local pillowNearby = options.addPillowComfort and getText("Sandbox_ComfySleeping_Yes") or getText("Sandbox_ComfySleeping_No")
local currentComfort = getCurrentComfort()
text = getText("IGUI_ConfirmSleep") .. "\n\n" .. getText("Sandbox_ComfySleeping_Comfort") .. " " ..
getComfortString(currentComfort) .. "\n\n" .. getText("Sandbox_ComfySleeping_PillowNearby") .. " " .. pillowNearby
end
-- self below passed by : because Lua does that; very important to remember it.
local modal = ExampleModule.ModalDialog.new(self, x, y, width, height, text, yesno, target, onclick, playerIndex, ...)
return modal -- Very important.
end
return ExampleModule
Would decorate the modal call to replace the sleep text with what you want at that point of entry.
Can't easily intervene on ISVehicleMenu.onSleep in a highly compatible way because the value of getText("IGUI_ConfirmSleep") is used as a literal parameter in the middle of the function.
But you could catch it in ISModalDialog:new and no modal call that didn't have the translation of IGUI_ConfirmSleep would be affected.
hello friends, i am not sure if this is the right place to post this but i am searching for someone to commission a mod. if anyone has a better place to direct me or takes comissions please let me know โค๏ธ
I'm not sure where you would go to commission a mod tbh
It might be here I'm not sure though
shiny !
Hello, I am looking for help on one of my functions that I have made.
getPlayer():addHole(Torso_Upper, true)
I am trying to make a hole in the person's clothing of the Torso_Upper section of the body. When I use this function, a hole is created, however, it is in a random spot of clothing (ex. a hole is made in the pants, shoes, shirt, etc). Does anybody know a fix to this?
Does player:addHole() need a BodyPart object, or what's it's parameters?
Thank you, I'll take a look in a bit. Briefly looked at it but it seems simple enough!
addHole(BloodBodyPartType part, boolean allLayers)```
There are a few addHole functions but this is the one I am using
character:addHole(BloodBodyPartType.Hand_L);
Thank you
Might have luck here in Commissions and Requests:
https://discord.gg/j6bNYUkz
thank youuuuuuuuu
Spooky scary?
There is no way I just wasted 2 hours of my life because I had the letter "y" in the wrong spot
parthit:setHaveBullet(true, getPlayer():getPerkLevel(Perks.Doctor))
getPlayer():addHole(BloodBodyPartType.parthit, true)``` Okay so this is the code. It is meant to cause a person to be shot somewhere on their body and cause a rip in the clothing where they got shot
However, while the bullet does hit the person and the fabric does rip, they arent in the same location
BloodBodyPartType.parthit is null
parthit is a local variable, not a member of BloodBodyPartType
Thank you, didn't catch that. How would I make parthit register as a member of BloodBodyPartType?
Don't give up, @SubLight, I know you were in here September 2023 tying to add holes. You can do it! It looks like you're getting really close?
I was also trying, and read all of your posts to try and gain insight on how to do it
That's actually a really cool idea
Would make using a gun much more satisfying
Don't guns already do that ?
I know blade weapons will create more holes in zombie clothing
So wouldn't it also be the same thing against players and for guns maybe ?
Not really
It does degrade the clothing but it doesn't put dynamic holes in it
Even with bladed weapons it's not very accurate with were it puts the hole
dear modders, may i get some advice from thee?
function sayhi(player)
local player = getPlayer()
player:Say("complete")
end
function SecretMapCheck(playerID, context, items)
local player = getPlayer()
print(items)
print("Name of the clicked item",items[1].name)
if items[1].name == "Secret Treasure Map Pieces" then
readoption = context:addOption("Check the Map",sayhi,1)
else
return
end
Events.OnPreFillInventoryObjectContextMenu.Remove(SecretMapCheck)
end
Events.OnPreFillInventoryObjectContextMenu.Add(SecretMapCheck)```
So, i have this code inserted into my file. and tried to make the game character to say "Complete" when I click an option "Check the Map" which appears after right clicking an item called secret treasure map pieces
However, the option "Check the Map" appears but when I click on it.. the button does not do anything.
Myabe it's cuz i put the args. within the addoption () wrong
Could anyone help me to solve this question?
Mainly making it to update my current mod but could use it for that too
where can I find more information about getVariable?
The lua API just lists IAnimationVariableSlot
It's related to animsets
Trying to find the player's current animation. searching this discord for find animation, get animation, return animation, player animation, your post looked promising, where you recommended using getVariable to check for idle.
would the animset... include m_Name, m_AnimName, m_StringValue, or the filename, or something else?
or maybe it IS the XML, or perhaps inside of an XML, i'll look around in media\animsets
getVariable gets the status of a variable for a character
So you can 't get what animation the character is playing exactly
But because every animations are defined by a variable you can it's value and check if the conditions are right for the animation to play
is this variable a string? is it a filename? a condition?
Did you look at AnimSets ?
yeah i have a few opened up right now
well some variables are boolean, other strings
so I would use a variable found under m_Conditions, then. I'll try that out
is there any function i can use to get how many items a player has (like how much scrap electronics) preferably inventory + surroundings, or do i have to do it with loops?
Depends what you want
a variable is a condition
m_conditions is just one of those
idk what it defines
tried getCount() but it always returns 1 ๐
I think you're going to have to make a local variable, iterate through your inventory, and add to that var each time an item matches your specifications, sad.
yeah i went through that list of getters 5 times, but was worth a shot ๐ thanks!
Maybe I'm wrong, though. What is the item, maybe you can use getAllCategory() and then get the length of the ArrayList?
scrap electronics and aluminum
when going through the inventory with a loop they just show one by one so id say im stuck doing it this way
You're exploring custom models ? ๐
Also what's that from ?
The amazing world of gumball
Eventually
Rn I'm messing with textures
Still trying to learn how blender works
there isn't a player:getStats():getGodMode() or anything like that.
Maybe lua has a way of detecting if I'm in debug?
player:isGodMod()
you can check debug with isDebug()
no, wait, that's getDebug() ๐
isClient, isServer... getDebug 
In yesterdays mod,
I made an enum in the sandbox options, then passed that integer into a table, as an argument, and the table calls a unique function per sandbox enum. cool huh >.>
the beauty of lua
though, the 4 functions are global, as they reside in another lua file.
should I instead call 1 global function, which then splits into the 4 local functions...?
or use modules and never touch globals again...
if by module, you mean the 'requires', then creating a local var of the class, and then calling className.Function,
yeeeah i spent several hours trying to get it to work, and gave up ๐
I'm sure I could learn it, in lua, outside of PZ modding, then come back and get it working
that's fair
speaking of spending a few hours, I'm been trying to detect an item in inventory.
It seems like this would work, but something is wrong.
local itemFound = getPlayer():getInventory():FindAndReturn('Pen'); print("was the item found? " .. itemFound)
And then once I got that working, I was gonna hide it in my backpack, which I assume would cause FindAndReturn to come up empty handed, so then I'd try ContainsRecursive
nevermind, the FindAndReturn is suddenly working.........
@bright fog thanks for suggesting I check out AnimSets, it works perfect
local function playerReading()
--[[ TranscribeJournal.xml
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>TranscribeJournal</m_StringValue>
</m_Conditions>
--]]
local performingAction = getPlayer():getVariableString("PerformingAction")
if performingAction == "TranscribeJournal" then
return true
else
return false
end
end
skill recovery journal
๐
I'm quite sad that I can't figure out how to extract those textures
Because for this re-texture I was hoping to turn the bite marks rainbow
Does anyone know how to make a UI similar to this? I can't for the life of me figure out how to add an "admin menu" like this (trying to make a mod for custom admin commands and this seems like the best UI system for it but I cant find out how to do it lmao)
rip
I can at least change the damage to rainbow
So I can make the bites on the character look rainbow
And all the blood on the zombies
That's at least that
is there an easy way to wait in lua?
getPlayer():Say("message 1")
--wait, pause, sleep / coroutine ... 1 second later
getPlayer():Say("message 2")
I'm assuming this is NOT how the in-game radio broadcasts / VHS tapes work, but I might try looking there.
(or would a generic lua response from the internet work fine here, in zomboid lua?)
there is in fact
there is in lua, not in zomboid 
zomboid can't really do this because it runs mostly singlethreaded and the lua would hang the entire game, you need to use some kind of timer like the above
To find an item in your inventory, call FindAndReturn(string) and pass in a string, easy.
To find an item in your backpack, call containsRecursive(InventoryItem) and pass in an InventoryItem. but where do I get that InventoryItem?
Can I just... name it?
local desiredItem = somehowSpecifyInventoryItemByNameOrSomething
getPlayer():getInventory():ContainsRecursive(desiredItem)
getPlayer():getInventory():containsTypeRecurse("Base.Apple")
ah i was trying
local testItem = getPlayer():getInventory():getItemCountFromTypeRecurse('Weapon'); print (testItem )
adding the Base prefix resolved the issue, thank you again
apparently the crash handler managed to get itself into a loop
is adding modData to the player bad?
edit: also, good thing it only made 14? lol
it was a black screen that kept adding two errors every time i pressed f11, so i guess i pressed it 14 times
no, it's standard
After working non stop for about 5 hours I have completed and published the joy retexture
edit: workshop page needs in-game screenshot(s), same for SOD Black Fever !!
Oh dang
I forgot about that
I'll get screenshots for both of em
I will slow down on the re-textures for now
Just so that burnout doesn't destroy me
I'm tempted to look into map making because my state of decay obsession drives me to want to recreate Danforth
decided to reply to myself cuz i solved the problem. Im leaving this here so that other people who fall into the same problem can get help
i managed it to work by placing correct args. inside the method
variable = context:addOption("String", itemobjectRightClicked, Method, player)
I'm happy that you did that
I've had a few issues with figuring stuff out
And I see someone having the same problem
But instead of getting an answer the person just goes
"Nevermind"
Or "I fixed it"
Without ever saying how
hahah yea
Hello everybody! i'm trying to figure out how get "uncovered by clothes" BodyParts, i'm find some method that should return an arraylist BloodBodyPartType with zombie.inventory.types.Clothing.getCoveredParts(). but i don't understand how to call it, could somebody helpme with that?
send help im confused
string index too long?
search for getCoveredParts() method from common/media/lua folder of project zomboid
and reverse engineer it
and which line is producing the error? does it say?
Is there any documentation about methods, or the only one way is reverse engineering?
I dont know where i'd find out which line is making the error
Javadoc Project Zomboid Modding API declaration: package: zombie.inventory.types, class: Clothing
Thank you good man
But there is only name of methods
can you try print(_player) and see if that is producing 0 ???
if you want to know how they are used, then you would have to use Find from file function from tools like Note++
then see how they are used in the game
Ok, thanks
yes it is printing 0
can you also try putting a boolean after the _worldObject ?
you are passing _worldObject as the first argument to Test but the function expects a player
you are a madlad thank you
any idea on how I'd make a submenu as well?
local subMenu3 = ISContextMenu:getNew(context)
context:addSubMenu(submenu2, subMenu3)
local sizeKey = "Purchase a 20x20 Land"
local sizeKey2 = "Purchase a 40x40 Land"
local sizeKey3 = "Purchase a 50x50 Land"
subMenu3:addOption(getText(sizeKey), worldobjects, createSafeZone, square, playerss, 1)
subMenu3:addOption(getText(sizeKey2), worldobjects,createSafeZone2, square, playerss,1)
subMenu3:addOption(getText(sizeKey3), worldobjects,createSafeZone3, square, playerss,1)```
danke
Hey guys, is there a way to make a custom object (inventory item or instance ) without using the script.txt ?
for example, i know if i use```lua
local spray = InventoryItemFactory.CreateItem("Base.Plank")
it creates an instance of a plank object. However, If i change the "Base.Plank" to any random name that doesn't exist in item.txt script it will produce "nil"
is there a way to do like... inventoryItemfactory.new = function()
and give diff. attributes to it like... name, type, weight etc ??
you can, but items created this way cannot save
is there a way to have a table of saved ID's on the server/client? IE can I save an ID to a custom table that persists through logins and server restarts?
i found this i think ill figure it out but regardless im still gonna ask lol https://github.com/MrBounty/PZ-Mod---Doc/blob/main/How to use global modData.md
Contribute to MrBounty/PZ-Mod---Doc development by creating an account on GitHub.
How do you overwrite a vanilla function? I know about the:
local original_func = originalFunc
local function newFunc()
if condition then
...
else
originalFunc()
end
end
```But I don't quite understand the structure of the files in `TimedAction` folders.
There are .start .stop and .perform functions.
I want to modify the player's stats like Stress and Unhappiness when they finish a TimedAction.
start is when the action begins, stop is when the action is cancelled or otherwise ends before completion, and perform is when the action is completed successfully
you've got it there, but in most cases you run the copy of the original no matter what and just add more code before/after that call
rather than only running the original under a certain condition
So you do this?
local original_func = originalFunc
local function newFunc()
originalFunc()
-- your own code
end
oh cool, yea i don't need it to be permanant. It can be temporar until the game restarts. Is there any file which I can take a look at?
What is getModData? Is it for your own custom variables stored in a way where you can get them in any file without having to require a module?
think of modData as a info box of an obj.
in vanilla an item is obj. zombie is an obj, and a player is an obj.
modData saves any variables, tables, etc into itself
so if you do player:getModData(), it calls info box of the player
Well, can you make your own variables?
yes
OK, cool.
for example, data = getPlayer():getModData()
data.myowncustomvariable = "hello"
So I can do:
local playerObj = getPlayer()
local playerModData = playerObj:getModData()
local playerModData.customVariable = 0
yep
Awesome, I will use this for my trait mod.
it is a table
What is kahlua?
the java implementation of lua zomboid uses
everything is table in lua :(((
which makes it so confusing
especially when you want to do OOP
I think it makes it easier to remember the types. Lua has way lesser keywords than Python.
it's classic lua that objects are implemented by adding a table to a table
Ever heard of JSON?
of this
any file i could look at ?
i found it in a weird vanilla lua file wrapping this function but i don't think the file did anything interesting
i see thanks
what will be the main diff, with InventoryItemFactory.CreateItem("Base.Plank")???
doesn't that just instance an existing item? this creates a new Item script object, you can DoParam/use setters to set properties on it, and then use the factory to instance it
right, i realized itemfactory only instance existing item
but thought, if I change its name, values, and other properties, it can be used as (act as) new script item
like a work around method
unless you're using umbrella, yes
it can, but a few properties are only ever read directly from the script object
however those edited item instances would be able to save, these cannot
danke
when you say they cannot save, how temporary are they?
like until you restart a game?
restart, i think they were fine to be unloaded and loaded (e.g. left in a container and walk away)
oh.. i see ty
Can you overwrite vanilla functions like this?
yeah
What is sendClientCommand?
it's for client->server communication
it fires an event on the server with the module, command and args table passed to it
it's the only way for lua to network things
I see.
how would I run these commands from a client mod/custom function? Also does the string userAccessLevel mean the level the client running the command has or the access level to set? [RemoveAdminCommand and GrantAdminCommand]
nvm i think i found somethin
the userAccessLevel string is likely which set of rights you want to give. observer, gm, overseer, moderator, admin
ty
How does the Smoker trait give you stress overtime? I wanna make something similar.
am I able to SendCommandToServer even if I don't have the permissions? Or would I have to make a custom command? [I'm making a 'custom' admin]
i commonly use
setaccesslevel userName admin
...but ive never tried from within a custom function
from chat in game or from a function/mod?
chat, or into the dedicated server command prompt, only. never tried from a function
kk is there a way to make a custom command thats run on the server/console?
or rather a function that is run from the server so it always accepts it/completes it?
[I'm thinking if I send a "GrantAdmin" command from a player without admin it wont let it happen, and likewise a "RemoveAdmin" command from an admin to oneself might not work]
[[also for the record im doing this cause i have a server and i want to make custom admin tools for custom events lmao]]
I can't believe I have to read this to figure it out, but hey, at least it's readable even though I don't code in Java.
if (this.getParentChar().Traits.Smoker.isSet()){
this.getParentChar().setTimeSinceLastSmoke(this.getParentChar().getTimeSinceLastSmoke() + 1.0E-4F * GameTime.instance.getMultiplier());
if (this.getParentChar().getTimeSinceLastSmoke() > 1.0F) {
double double1 = Math.floor((double)(this.getParentChar().getTimeSinceLastSmoke() / 10.0F)) + 1.0;
if (double1 > 10.0) {
double1 = 10.0;
}
this.getParentChar().getStats().setStressFromCigarettes((float)((double)this.getParentChar().getStats().getStressFromCigarettes() + ZomboidGlobals.StressFromBiteOrScratch / 8.0 * double1 * (double)GameTime.instance.getMultiplier()));
}
}
lol the scientific notation
Hey quick question.
Why is it that mod-developers make one single mod with optional dependencies already installed?
Like when you have a mod to repair weapons and then put optional dependencies for everything that is popular and not vanilla.
There are also devs who upload one mod and then a separate one for the dependencies. Thats how I know it.
If anyone answers, i'm down to hear more technical stuff since I'm learning a IT job
it's just much less complicated for users and for maintenance to use only one mod
it depends on the mod but most of the time these optional dependencies aren't things anyone would want to disable so there isn't really any benefit at all to making them separate
and why not make it so it turns on and off automaticly, maybe enable / disable via sandbox
i thought that was assumed in the one mod solution, that's what i do
some content types can't easily be toggled though, there are a few reasons you might have to use multiple mod ids
okey thanks very much
Is the event OnGameStart triggered when you load/create a new save?
The icon is not showing?
Does anyone know how Events.EveryDays work? I try below but it isn't working. Even used the Events.EveryDay just to check if i have wrong syntax, but both doesn't work. Hourly is good though
local function DailyRewards()
print("Daily Rewards In Progress..")
end
end
local function HourlyRewards()
print("Hourly Rewards In Progress..")
end
end
Events.EveryHours.Add(HourlyRewards)
Events.EveryDays.Add(DailyRewards)
Events.EveryDay.Add(DailyRewards)
Triggered every day at midnight (in-game).
It says in the wiki it should occur every 12 midnight but the print logs is not popping up
wait do we have an IDE for PZ? ๐
Probably because you have two?
yeah i was trying the other one jsut in case of incorrect syntax because it isnt working
That doesn't exist. Remove that.
where is this? is this your IDE or somewhere?
or debug?
Visual Studio Code with Umbrella.
omg thank you
Can anyone explain why the icon is not showing?
might be the casing?
local gunnut = TraitFactory.addTrait("gunnut", getText("UI_trait_gunnut"), 6, getText("UI_trait_gunnutdesc"), false, false);
I have this sample from mine
No, my dumbass put /ui/Traits in /media/lua instead of /media ๐คฆโโ๏ธ
Can you put methods/functions into modData?
Kind of
I've stored functions in tables for my mod but it's not what you think
You link a function to a module then you call that function via a string key:
MyModule = {}
function MyModule.myfunction(variable)
-- do stuff
end
-- elsewhere
stringinmoddata = "myfunction"
MyModule[stringinmoddata](variable)
Store the stringinmoddata in ModData and call it the way I did above
Sry writing that on phone so taking ages
Oh, so it's MyModule[ModData.variable]()?
No sry forgot (variable)
Let me try my method one last time and I'll try yours.
I don't have the function you try to call so no idea if your thing is right
What is the variable parameter?
Anything you want
Put one or not if you have parameters for your function
If you don't have any it's just that:
MyModule = {}
function MyModule.myfunction()
-- do stuff
end
-- elsewhere
stringinmoddata = "myfunction"
MyModule[stringinmoddata]()
Can not this be rewriten like that ?
Class:method
-- ===
method(Class)
I have no idea, I'm experienced with Python.
I believe when you use methods you can write it like this
So would possibly still work idk
Like this?
playerModData.workaholic.setTimeSinceLastWork = setTimeSinceLastWork(...)
Question
is anyone familiar with using
luautils.walkAdj(PLAYER_OBJ, square) method??
for some reason when i execute that method, it stop during the move..
does it automatically get canceled if other methods like "print" or "getPlayer():Say("hi")" gets executed?
Hey everyone. Can someone provide me with a Lua method to play an audio file for all players on the server?
If I just wanted to make a mod that alters the charactercreationprofession lua, how would I do that? My friends on MP want to be able to get more traits than the hard 100 limit in config.
Hey, I haven't tested it myself, but
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/How to make a custom trait.md
I was just trying to alter the lua to give more points. I've done it for myself for SP before, but asking all the MP friends to change it seems silly when I could just set the server to run it. I just don't understand the mod format beyond "contents"
do I just put the folder tree of the file I'm altering under contents, with the same named file? I just want to replace "charactercreationprofession.lua" with an altered version. That's all.
you can add to a vanilla function without changing the original or straight up replace it yeah https://pzwiki.net/wiki/Lua_Functions
overriding the file wholesale causes a lot of compatibility issues but for personal use it's usually fine
When I edited it myself directly, there were no issues, so I assumed the same mod list would not cause an error for mp
Literally just trying to change the trait point count in that lua.
I'm trying to add an icon to my mod
But it doesn't seem to show up
I also found out how to unpack .pack files
By putting in the first word of the Icon as the Prefix
And changing it from spritesheet to single image
The zombie moodle isn't showing up either however
So to change it to the higher count, I would just put the Lua in the contents, with the same folder hierarchy as the originals?
yeah
So media->etc. Under contents, cool. I appreciate it. It's just for a small friend group.
the problem with file overrides is that if two mods override the same file only one of the overrides is going to work - for personal use you can easily ignore this
but start with the media folder, only incude the tree to the lua, and drop the altered lua in, and good?
oh you will need the mod structure with a mod.info and everything if you don't have that
I think that's the one thing I haven't added yet. Not sure how to structure that exactly, but I'll figure it out. That seems more straightforward
Contents/mods/MyMod/media/lua/client/TestFile.lua overrides media/lua/client/TestFile.lua
you can grab the example mod folder i think it has the correct structure
I unpacked the texture and changed it
I put it into a texturepacks folder
But the texture hasn't been changed after updating the mod
Do I need to re-pack the textures?
you can just put it in textures
texturepacks is for texture packs
internally the game treats them the same
went contents->mods->media, with mod.info in the mods folder, and it's saying "no mod info" Do I need to give the mod it's own folder like mods->TraitPointsYes->media?
Oh
I guess that makes sense
I'll give it a try
mod info should be in the folder with your mods name
It let me upload. Going to fire it up to test it now that I'm subscribed.
Thank you all so very much.
and why would this not execute? ive been stuck for like 30 minutes ๐ before the loop everything prints ok, size > 0 and all
local destContainerItems = self.destContainer:getItems();
print("items in oven: ", destContainerItems:size());
print(destContainerItems);
for i, item in ipairs(destContainerItems) do -- this never executes
print("item ", i, item:getFullType());
end
destContainerItems is not a table, you can't iterate through it with ipairs
this is the equivalent:```lua
for i = 0, destContainerItems:size()-1 do
local item = destContainerItems:get(i)
end
damn it thought that might be the case but the fact that it reacted to size made me stick to this
thank u
didnt think of trying this
well tables don't, they use # ๐
ahh ok thanks for clearing that out i wasnt sure when to use which
this is an array or?
in general, i would expect almost anything coming from a java method to be an arraylist like this
cool ill keep that in mind thanks a mil ๐
This doesn't seem to have worked
The Icon isn't showing up either
Don't think so, it queues the walk action without passing a test that allows it to complete early
<@&671452400221159444>
Did I just give myself a virus
Save me Marcin Kleczynski, you're my only hope
WHAT
My password is changed
Help
uh-oh
Contact support immediately
Fuck I am an idot
That is really bad UX
absolutely horrific addition
yes it's terrible, it's being plaguing Discord for a few weeks now
Worst thing they could have done
Ok I need help
Go change all your mail passwords
How
Go change your Discord password
Connect to your mail and go change the password
At least change that one
<@&671452400221159444> hey sry to ping again, could you please delete his messages ?
Before others fall for it
Which password was changed, Steam?
Steam
hmm i see... maybe i should use timed action que method instead of lua util
I keep forgetting you can report people now
I'm about to re-implement creating custom generators through the new method Poltergeist helped me uncover, I can't be having any of you losing your rights to try my new mod
I'm trying but it my email won't work
is there a way to make a custom command thats run on the server/console?
or rather a function that is run from the server so it always accepts it/completes it/has permission?
[I'm thinking if I send a "GrantAdmin" command from a player without admin it wont let it happen, and likewise a "RemoveAdmin" command from an admin to oneself might not work] (haven't tested yet, just thought it would be common sense that it wouldnt lol)
[[also for the record im doing this cause i have a server and i want to make custom admin tools for custom events lmao]]
I'm so fucking scared
get 2FA please/steam guard as well, its a life saver sometimes
i remember when CS2 came out it so far to date was and has been the only link I clicked where I actually logged in/got tricked (they made the youtube channel look like it was Valve somehow/that the video was being live streamed from valve) attempted login from Russia lmao 2FA ftw tho instantly was able to just unsign out of every possible location/system and then reset password n enable steamguard lol
I can't access my steam account anymore
It's not letting me use my email to change the password
Thanks for the spam reports
Not sure why there's been influx of them and they're not being picked up
Someone please help I can't lose this account
Do you have a phone number associated you could use? If it you keep having no luck with that form, I would look for a support phone number so you can get a human on the line.
Alright I'll try thank you
Always have 2FA
up
Also if you bought games you can use those to prove Steam it's your account
Sorry for pinging you from multiple months ago,
I'm looking to make a function that's run on the server/has authority that can be called from admin clients (IE have the admins send a message/command to the server, have the server execute that command)
Reason why im pinging is cause this looks like the only lead I can see (as im keyword searching through the entire channel) so I thought I'd ask if you knew how I could achieve such a feat. [I'm making a custom admin and I want to be able to call commands like you could from server console]
also similar to what doggy jvla said, if you have any used gift cards in person it can also be used to validate your claim (I recovered an account/disabled 2FA for my own account when I lost access to the phone because I had like 4 steam gift cards still lying around that i had used)
I have nothing
can i use ISTimedActionQueue to add my function to queue? (or execute it somehow when the queue is done)
ISTimedActionQueue.OnCompleted(TurnStoveOn); weirdly enough like this seems to work and also throw errors at the same time
I'm somehow back into my steam account
It's not letting access anything but I think the steam servers are down at the moment
yea they are
Ok good
I'll keep an eye out so I can get my account back when they come back up
Was that thing a virus or something?
Or did it just steal my account
ยฏ_(ใ)_/ยฏ
steam servers seem up to me
I think they just came back up
ah fair
Is there a general way to overwrite all TimedActions instead of overwriting them one by one?
Actually never mind since I'll choose which ones are modified but just in-case I need it in the future.
I would like to inform anyone here
Not to subscribe to any of the things posted until I can reclaim the account
Consider it compromised
I don't think viruses can go through steam workshop
Would be a minefield if it wasn't protected
At least one good news I guess ?
Oooo
At least there's that
I'm at least glad they can't infect others though my steam account
Imagine how hell it would be lmao
Yeah that would be chaos
Then my account would be nuked
well let's hope that doesn't happen at least
That link was so obviously a trap
That is probably one of the stupidest things I have ever done
tbf happens to anyone
Hi everyone, good evening, I needed a little help, I wanted to extract the image of this specific saw tile.
but I didn't find out how, I don't know if it's a different method.
but I even tried to search in the tile program, but supposedly where this saw was supposed to be located is invisible
(As in the second example image)
And I made a post recently about those scams on the Discord's reddit, there was that guy calling it darwinism for people falling for it
https://www.reddit.com/r/discordapp/comments/1avntuk/scam_issue_and_links_being_hidden_in_other_links/
I honestly just didn't think
I'm not the quickest when it comes to these things
And can get trapped without realizing
my modules are only working one way.
Snippet from JournalReminder.lua
JournalReminder = {}
local PlayerTimer = require ("PlayerTimer")
print("PlayerTimer should be a table... " .. type(PlayerTimer)) --prints "table"
PlayerTimer.DoSomethingImportant() -- works!! o snap
return JournalReminder
Snippet from PlayerTimer.lua
PlayerTimer = {}
local JournalReminder = require ("JournalReminder")
print("JournalReminder should be a table... " .. type(JournalReminder)) --prints "nil"
JournalReminder.MyFunction() --does not work
--ERROR: attempted index: MyFunction of non-table: null
--(This error was expected, because the type, as seen above, is not 'table')
return PlayerTimer
writing this out to try and rubber duck the answer
you don't have both of these requires at the same time right? you can't have circular dependencies
(also keep in mind that module tables should be local in their own file too or there isn't much point to using them)
If you have more than one radio, is there a way to send information to a server and back so that the exact one you are working on is the one you sent? Maybe a unique key shared by clients and server?
I'm confusing myself, let me double check the snippets above to see if I properly wrote them out here
Or basically a unique ID number given to objects in the game so that the server and clients know that is the same item?
@bronze yoke ok I made sure the snippet above properly reflects my 2 lua files, I had some labels reversed when I first posted the question to discord.
...are you saying the two files cannot require each other?
JournalReminder.lua can properly call the 'start timer' function on PlayerTimer.lua, nice!!
PlayerTimer currently has no way of telling JournalReminder that the timer has finished.
(unless I just make a global function, then we're good to go)
If PlayerTimer is not allowed to require JournalReminder as a module...
that would be strange, wouldn't it?
"module tables should be local in their own file too or there isn't much point to using them"
I don't actually understand this sentence at all, but I'm trying to do the right thing, and only use local functions
if file a requires file b, then file b must load before file a does (or more specifically before the require function can return)
if file a requires file b, and b requires a, both of them need to load before each other
I see, that's too bad.
(so instead of loading files alphabetically, it forces the 'required' lua files to go first)?
yeah, that's right
as for this, your files declare their module tables as PlayerTimer = {} - there's not as much point using modules if the table is global anyway, since you already have the table in the global namespace - usually the module table is local, returning it at the end of the file is what lets other files get it by requiring that file
the idea is that by using return/require, you never actually have to touch the global namespace at all, and can still communicate between files
man, the limitations of lua are really frustrating.
...and if I'm not mistaken, functions need to be written from the bottom of the document, moving upwards,
Can you think of a way for my timer to signal that it has finished?
solution 1: Just put all code into a single lua document
solution 2: use a global function, so that the timer, when finished, can notify the main script
solution 3: ??
What are the benefits of declaring your own variables in ModData?
they're attached to the object and they save and load with the save file
Ah, I see.
It's top-bottom.
Though you can declare functions below and use it above, I don't recommend it.
whenever you have a circular dependency it usually means either you need to split shared code into a third module, the two modules shouldn't be separate to begin with, or your code is tangled needlessly
I mean.. I could be wrong, but I'm pretty sure lua doesn't know "what is under it" at any given time.
local function myFunction()
AddOnePlusOne()
end
local function AddOnePlusOne()
print ("1 + 1 = 2")
end
I feel like this snippet would throw an error. lua doesn't know what AddOnePlusOne() is, because like... the file hasn't been read that far yet.
maybe im wrong tho. I know so very little about lua
i'm not sure exactly what your modules are doing but if you want a timer that calls a function when it ends, you could pass a callback function upon starting the timer
If you have linters, they will highlight the code below that is being used above.
this is correct, though it usually only applies to local variables
It works with methods but please don't do it with functions.
local variables (including functions) are compiled as part of the code itself, so it needs to exist when it's being compiled, whereas globals/table accesses (even in local tables) are looked up every time that code runs, so as long as the thing is there by the time the code runs it's fine
the code isn't tangled, and It just seems cleaner to separate out the timer logic. I'll look into what it is, and how to use a callback function, that sounds promising, maybe
whats linters ๐ฎ
you basically just pass a function reference to the timer, and then when the timer ends it calls that function
Extensions that helps with possible errors, auto-compelete, and typing annotations.
errrrrrr, "pass a function reference to the timer"
AFAIK I cannot do this, without a requires. I think im just missing something
or, wait, so when I call FunctionB, I can leave a reference to FunctionA somehow. Actually I think this makes sense
-- no idea what the structure of this module actually is, i'm guessing you keep active timers in a table or something? but this is a simplified example
PlayerTimer.callback = nil
function PlayerTimer.startTimer(time, callback)
PlayerTimer.callback = callback
-- etc
end
function PlayerTimer.timerFinished()
-- you can pass some arguments here too if you want
PlayerTimer.callback()
end
-- in the journal file
PlayerTimer.startTimer(5, JournalReminder.onTimerFinished)
remember that functions are just like any other variable
you can pass them around and do whatever you want with them
What is GameTime:getMultiplier()?
I've only used getGameTime():getGameTimeMinutesStamp()
it's a time delta
It takes the game speed into account?
don't remember, i have a table of the different multipliers and what exactly they take into account in this guide https://github.com/demiurgeQuantified/PZModdingGuides/blob/main/guides/GameTime.md
Reason: Bad word usage
Always double check the link you're clicking even if it is familiar.
Help please
Could anyone tell me why the "player" variable at line 40
produce error
because it's considered as nil??
if i change that player into getPlayer()
it works fine
I really gotta do that
Mind you this is the second time I've been swindled
hmm when i checked
not an actual IsoPlayer.
I want to download an anti-virus but even though I'm fairly certain the website is legit
I'm afraid to download anything right now
is considered as player
i don't know why
why in checkZombie(player,isoObject) the player info is passed to isoObject?
Why is it
Isoplayer
And not
Isaplayer
i guess it's short term of Indie stone object player
Will this work?
well done
now help me
XD
why at function checkZombie
it won't recieve player argment??
i mean the parameter
it's only recieving isoObject argument info
into Checkzombie function parameter
Can anyone help me understand where I'm going wrong with introducing the ground model for this weapon? When the lines that are marked with a "///" are introduced, only the ground version of the model will show up, but the held version will not. When the lines are removed, the standard model appears appropriately. Am I stupid?
Solved it!
For others who also have same question: The error was due to
local Option = context:addOption("Check the corpse",isoObject,CheckZombie,player);
in this method
it passes isoObject first then player next
so the function parameter need to be in the same order
function example(isoObject,player)
maybe if you ask those in modeling section , they might reply faster
Noted; figured it was a code issue over a direct model issue, but I'll try there too
function Workaholic.update()
-- sources/zombie/characters/BodyDamage/BodyDamage.java
local player = getPlayer()
if player:HasTrait("Workaholic") then
local playerModData = player:getModData()
WorkaholicModData.setTimeSinceLastWork(playerModData, WorkaholicModData.getTimeSinceLastWork(playerModData) + 0.0001 * getGameTime():getMultiplier())
if WorkaholicModData.getTimeSinceLastWork(playerModData) > 1 then
local timeSinceLastWork = math.floor(WorkaholicModData.getTimeSinceLastWork(playerModData) / 10) + 1
if timeSinceLastWork > 10 then
timeSinceLastWork = 10
end
local stress = WorkaholicModData.getStressFromWork(playerModData) + ZomboidGlobals.StressFromBiteOrScratch / 8.0 * timeSinceLastWork * getGameTime():getMultiplier()
WorkaholicModData.setStressFromWork(playerModData, stress)
end
print("stressFromWork: "..playerModData.stressFromWork)
print("timeSinceLastWork: "..playerModData.timeSinceLastWork)
end
end
Events.OnTick.Add(Workaholic.update)
```Guys, `stressFromWork` is not updating for some reason, it's so frustrating.
---@param modData table
---@param stress number
function WorkaholicModData.setStressFromWork(modData, stress)
modData.stressFromWork = PZMath.clamp(stress, 0, WorkaholicModData.getMaxStressFromWork())
end
It's always 0.
I don't know how this happened lol
It works when I restart the game and not just the Lua. WTF?
I'm looking to make a function that's run on the server/has authority.
Anyone know anything/any leads on that? I cant seem to find much of anything..
Help, how do you properly overwrite a function or inject a code into a function?
My bad, I guess it was overwriting the vanilla file because the name of my file is the same with the vanilla one.
Is there a better way to do this? It works sometimes, sometimes it doesn't. It's frustrating.
Is there supposed to be 2 models for ground and handheld ?
Are there any other ways to save data without using ModData? The thing I'm doing is really inconsistent.
Depends, do you want them to be persistent ?
Yes.
It's like stress from Smoker trait.
But the answer is yes you can store data with other ways, but making them persistent ? Not exactly
The only way to make data persistent is via moddata
What's your issue with it ?
Sometimes the ModData variable is not being touched while sometimes it does.
It is really frustrating.
wdym not being touched ? Are you sure you coded it to make you access it when you need ?
There's no such issues with moddata not responding or idk what
I'm using them alongside local data base that I need to reset every save launch
So persistent data base thx to moddata and non-persistent thx to local tables
Check the code.
local WorkaholicInit = {}
---@param playerIndex number
---@param player IsoPlayer
function WorkaholicInit.onCreatePlayer(playerIndex, player)
if player:getModData().stressFromWork == nil then
player:getModData().stressFromWork = 0
end
if player:getModData().timeSinceLastWork == nil then
player:getModData().timeSinceLastWork = 0
end
end
---@param player IsoPlayer
function WorkaholicInit.onPlayerUpdate(player)
if player:getModData().stressFromWork == nil then
player:getModData().stressFromWork = 0
end
if player:getModData().timeSinceLastWork == nil then
player:getModData().timeSinceLastWork = 0
end
end
Events.OnCreatePlayer.Add(WorkaholicInit.onCreatePlayer)
Events.OnPlayerUpdate.Add(WorkaholicInit.onPlayerUpdate)
```Here's the init code.
Explain where's the issue, will be way easier for me
IsoObject has a getModData method. IsoGridSquare has getModdata and it makes me want to weep.
I have no idea what the issue is. Sometimes when I restart the game and load the save, it works perfectly fine, but then when I quit the save and go to the main menu and then back then it stops working.
Did you use prints to check your moddata is not nil ?
I'm already checking them on initialization so I didn't see the point of doing a nil check.
Yeah well you never know
Guys
is there a table or something
that saves all the items that exists in the game??
It's not even nil.
Is math.random totally unavailable in favor of ZombRand?
I believe so yeah
No idea
I can use ZombRand for one of my purposes which needs to generate round integers to pick items from a table, but I need a random number in the distribution of [0, 1)
local function getRandom(table)
-- With input n, generates a random int from 1 to n inclusive
return table[math.random(#table)]
end
local function getWeightedRandom(probabilityTable)
-- [0, 1) generation range
local p = math.random()
local cumulativeProbability = 0
for hitRegion, probability in pairs(probabilityTable) do
cumulativeProbability = cumulativeProbability + probability
if p <= cumulativeProbability then
return hitRegion
end
end
end
Just divide the ZombRand.
Yeah
Obnoxious, but will do it
value = ZombRand(0,100)
value = value/100
This issue has been bugging me since yesterday.
I have no idea why it works sometimes.
Do you have a github repo perhaps so I can easily read it ?
Yes, you can view my code for ItemSearcher here (https://github.com/TheCrimsonKing92/pz-item-searcher/blob/master/media/lua/client/ItemSearchPanel.lua#L568-L589) where I cache all the items for later searching.
Bcs rn reading through Discord code boxes is fucking me up
I can post it on pastebin.
No
My point was to allow me to read it in VScode or something like that
Reading it through pastebin will not help me read it lol
thanks ill take a look !
Just download these files, can't be bothered in making a GitHub repo.