#mod_development
1 messages · Page 75 of 1
Not sure what dropdown menu you mean
How were you able to manually override them, like specifically say when it’s going to go out?
On my game it would say Electricity Shutoff: 0-30 days
Other options are 0-2 months, 0-6 months, etc…
And that’s it, I’m not able to manually manage them.
Really? I don't think I've modded this... I wonder if your game needs an update? Or my game... doesn't need whatever update you got?
So under Sandbox > World > Electricity Shutoff, you see a dropdown?
I know you probably just said that but I am doing a sanity check
To make sure I actually understand you
Sort of mind boggling
Yes, when I go into my settings on Sandbox for a singleplayer world, I get the drop down menu that says 0-30 days, etc…
Ohhhhhhhhh
Is it only available setting for Multiplayer servers or something?
My screenshot is Multiplayer
Ah
That's so fuckin weird they do it differently
And the opposite of smart
Whatever that is
Idr
Check on a singleplayer
But the opposite of smart
Ik
I am actually getting sucked into a game now... but you can check Host settings under Multiplayer to confirm what I'm guessing here
I’m on my bed waiting to sleep, ‘cause I gotta wake up at 4:00
haha word
Wouldn't be the weirdest thing I've seen in this game
Besides, my computer is in my backpack for the trip, so…
Lot of very questionable organizational decisions were made in programming PZ
Where can we put suggestions like these?
Well first you take off your pants...
Yeah… shame, honestly.
Okay
I mean they have a suggestions forum, I made a suggestion there once... 3 months later my suggestion is a mod I made and they haven't added my request
I wouldn’t mind it if this was a mod
Singleplayer be able to select WHEN the water goes out.
Kind of annoying it’s an option only for MP.
I might be able to find a way but I'm not sure. I would have to inspect that table and how its data gets used.
In the meantime, you could always host multiplayer... nobody can join if you don't invite them
And nobody sees your server if it isn't added by IP to their list (or public dedicated).
True, but I can escape death whenever I want, and I know my ass is gonna want to, so…
Wdym by escape death whenever you want?
God mode
Ahhhhhhhhhhhhh
Become Invisible
Lmao
Not invincible but I mean if you can't activate a context menu before they eat you, you probably couldn't activate God mode in time either.
I've got a few TV-Shows that I thought were pretty fun to make, took me ages back then, though.. here's an example episode:
[img=music] ... CRAZY ... [img=music]
[img=music] ... CARL ... [img=music]
The one-stop chop-shop!
Welcome back to Crazy Carl! Your one and only mechanic TV show!
Today we'll be talking about how to swap your headlights!
First, find your trusty screwdriver! I call mine.. Trusted screwdriver.
*Beer Can Opening*
Next, pop the hood and simply screw each bulb till they are out, simple!
*Screwdriver Sounds*
Now.. screw in the new ones, or old, doesn't matter, this is a demonstration!
But, remember, only do this once per day on the same car, everything else would be silly!
You can also change the battery and radio with the very same screwdriver
Doing so will channel your inner mechanic in no time!
But you don't have to stop here, oh no.
Just go to your neighbor and do it again on his car! HAHA!
Next time we'll look into changing your tires!
[img=music] ... CRAZY ... [img=music]
[img=music] ... CARL ... [img=music]
I was playing around with Chatgpt though, and asked it to come up with an episode based on a few examples, and it came up with this.
[img=music] ... CRAZY ... [img=music]
[img=music] ... CARL ... [img=music]
The one-stop chop-shop!
Welcome back to Crazy Carl! Your one and only mechanic TV show!
Today we'll be talking about how to fix a car that's making strange noises.
First things first, grab a wrench, a hammer, and some duct tape.
Hammering and Wrenching Sounds
If the car is making a grinding noise, simply hit it with the hammer until the noise stops.
If it's making a squealing noise, wrap some duct tape around the offending part.
And voila, problem solved!
But wait, there's more! If your car is completely broken down, simply push it off a cliff and buy a new one.
It's the Crazy Carl way!
Next time, we'll be talking about how to give your car a stylish paint job using a can of spray paint and a lawnmower.
[img=music] ... CRAZY ... [img=music]
[img=music] ... CARL ... [img=music]
.. scary, but funny. Thought i'd share.
But yeah, a Water and Electricity shutoff setting for SP as a mod or official would be greay
I’ve gotten good at it
Then you would also get good at activating teleport via context menu 😉
It's literally a right-click away at all times
True
Not saying you can't activate God mode fast... just saying, however fast you can be, you can probably activate Jumper faster.
Single player you can only custom sandbox once
If u play local host then you would have had the ability to do so
Imean anytime ubcan configure it
Jumper lets you save TP locations by name and category to your context menu for quickly teleporting all over the map
@gaunt cargo
FYI
Wdym?
You can also bring buddies if you ever do decide to play online
@thick karma wanna play
True
?
@ancient grail Yes but I am about to play DKO with a friend for awhile.
A mod for SP like that would still be fine. Anyway, Happy New Year and goodnight!
I made a thing
Theres a button that says host
If u do that then u would have a locally hosted server
That will let u configure sandbox anytime. For sp u cant
What is it
I see what you mean, I see
Sure let me know
That’s wholesome
button for the debug tool set
got side tracked again cause of skill recovery journal
but I finished this guy - thought he came out great
it does , it looks awsome
useful for the community mod youre doing too
anyways... anyone know which lua file contains the vehicle spawn
imean the auto world spawn thing
Hello, I want to create a poster mod, but I don't know what to do with the .pack and .tiles files, I don't understand English much so I couldn't find a guide, if you could help me I would be very grateful.
I want to create something similar to this mod https://steamcommunity.com/sharedfiles/filedetails/?id=2401339485&searchtext=posters
okay, thanks.
Are there any mods to remove the poison symbol on food? I notice there is a sandbox option for water but nothing else
question... i know noobish but maybe can help me understand overall what makes the most sense. if function is global, it would make sense for me to just use that global function instead of creating a local function that does the exact same thing, right?
or will it still be faster or more efficient to just use a local function anyways pretty much no matter what
Based on your design, use the global one. It isn't more or less efficient performance-wise.
I'd avoid poisoning the global table when planning code.
yea someone gave me the ole proper etiquette on not using globals or overwriting
but as long as i require another script. i can utilize that local function, correct?
sorry for such basic question also. this is my last 🙂
local will be isolated to a visibility scope.
oh
You can reference by requiring either the file or the table it is inside via module require assignment.
you can bring globals to the local space
(Is trying to push people in here towards using modules)
modules are the way
skill issue for lack of better term
i see lol im familiar with it in the workplace 😛
damn so fast of responses. thank you again
PIpeWrench operates entirely on modules.
working on making a craftable lightsiwtch tile for my first real mod 🙂
i looked at it but became overwhelmed as a newer person to coding
i saw you chatting about it last week or so and was interested. but once i have the basics down of a few languages i should be able to absorb the typescript thing
Don't worry: I'm a broken record here.
lololl
Not many people know that they have that option. 🙂
damn this error has hands
Anyone familiar with Star's fix view XP mod - 'When you see "+75%", that actually means "x4" i.e. "+300%".' What does he mean by this?
where is star anyways . his no longer active here
it's in reference to xp being gained at 25% by default
25%+75% = 100%, which is 4x the default... it's a dreadfully misleading part of the ui
ah - but his UI displays ... 'x 6.64' which I think is incorrectmore confusing?
6.64 get's displayed for 1.66 or 3+ starting skill (125% I think on the vanilla UI)
1.66/.25 = 6.64
Idk maybe I'm tired - been getting comments all day with people doing math lol
Numbers. Lots of them.
Hey @sour island Want to see some simple rain FX API I rewrote recently?
When using set/getHunger(), would something like
player:setHunger(player:getHunger() + 0.5)
make the player hungrier, or less hungry?
It's a drag-n-drop mod.
No. I render this entirely from scratch in realtime.
😮
My demo shows the full rotation of it.
It's a particle emitter technically..
It has settings like spread, angle (radians), color, alpha, drawing box, etc.
I can toss it in here if you want to check it out. 🙂
Does anyone know the mod where you can upgrade backpacks, in the crafting menu you have an option to craft water slot, weapon slot, bedroll slot
I'm thinking of expanding on it to include polygon bounds and modularity so people can write their own physics.
I used to have it but forgot the name of it after I reset my subscribed
Noirs attachments
Thanks
np
I know it wasn't authenticZ or attach weapons to back
@sour island
Knew**
It's funny to see it working with particles live with PZ running.
but anyone know the answer to this? all the stat and bodydamage values are goofy 😭
Because I am not sure if hunger is keeping track of how hungry the character is, or if it is how full they are, by default -
stat by default is set to public float hunger = 0.0F;
Huh.. They're playing Daft Punk in the Starbucks I'm at.
I need to take a look and see if I can exploit some methods in the Texture class with ISUI render code.
smdh @sour island being so damn active updating his mods making me have to restart my server
||thank you for the updates :D||
Np, say, did you have a bug where the character kept saying 'nothing to add' over and over?
Tbh I almost never die so..
Haha
Maybe my reload script could be useful.
It's more for server-exclusive content buuuuut yeah.
GIV
It has that side-effect / feature.
It's a dynamic loader that handles server-side scripts which can be a part of a mod's code.
Scripts.
Those exist.
People here will know em. I don't.
I'm not familiar
When I get a Workshop item popular again, I'm going to schedule updates to be at a very specific time a week.
chuck, i just updated the container unlock and turned it into time action. it wasnt that hard after all. all this time i was afraid of metatables
where?
i think i might have seen that but i guess it confused me even more that time lol
I don't see it appear on workshop - either way timed actions aren't that hard to work with
hahahahahaha
So today in JS I just wrote local var = .. and didn't notice.
Yesterday morning I typed this instead of self in Lua.
Do it at like 1am est, that way it’s early enough that European server admins aren’t up yet but late enough that North American server admins are going to sleep 👹
I'd like to know the sweet spot time to do it.
It'd be nice to have a conformity on that time.
We all know how ugly servers get when updates happen at random times.
Are there any errors that wouldn't produce an error message? like on the java side or something like that?
ooooh wassat?
fixing up AUD
made the modData tool have a submenu instead
added cars + more descriptive option names
and does it show vehicluar mod data?
should
I can test if need be?
yeah, there's usually a couple on every square
sure I can throw it on the repo
obviously, heavily WIP
for now I'm leaving the debug tools as a sub mod
My plan is to refactor the way buttons are handled for the tools to make adding more easier
how did you make the context appear first on top before the rest of the default ones
@thick karma he knows how to make it appear on top
media/lua/client/ISUI/ISContextMenu.lua has all of them
this is exactly what i did too.. i used the getType as part of the context name
?
you can also give an index or use the prefill events
and add suboptions
giving an index is a bit naive though unless you're grabbing it from something
Just realized I don't have bodies showing up
yep getType()
probably need to add a 'if else' option
that'd return their object type in terms of wall/floor etc
or their sprite's type
to check if another mod is active?
okay so how do i check if 10yl is loaded?
you use it's modID and getactiveMods
if getActivatedMods():contains('ModId') then is the most simple way to do this
Yes, my example was part of my 'load these other mods first' thing
Use what he wrote instead
Mod ID: 10YL_ALL
Mod ID: 10YL_HIGH
Mod ID: 10YL_LOW
Mod ID: 10YL_MAPS
Mod ID: 10YL_MEDIUM
Mod ID: 10YL_VH
You'll need to do all of them
here are the mod ids so you would have to or or or or
that's a pain lol
if getActivatedMods():contains('10YL_ALL') then print('skizot is king of 10 yrs later all') end
elseif getActivatedMods():contains('10YL_HIGH') then print('skizot is king of 10 yrs later high') end
might just be faster to use a table and a loop at that point
Omg this is clutch info ty Chuck
yep
bodies are apart of a gridsquare's getMovingObjects right?
yes
getStaticMovingObjects
elseif self.itemType:isSelected(2) then
for i=0, sq:getStaticMovingObjects():size()-1 do
if instanceof(sq:getStaticMovingObjects():get(i), "IsoDeadBody") then
local item = sq:getStaticMovingObjects():get(i)
table.insert(itemBuffer, { it = item, square = sq })
end
end
end
if not body and v:getSquare() and v:getSquare():getDeadBody() then
body = v:getSquare():getDeadBody();
end
if instanceof(v, "IsoDeadBody") then
body = v;
end
weird
?
but why wont it return body iny first place
WHAT THE SHIT. why so damned many?!
Always pays to have the option
ugh. but adding 10yl to my mower is rough
i DO Plan to make a version of the mower that is a push mower.
one day in the FAR FAR future.
Anyone know if it is possible to modify the speed of reading?
Come on, @faint jewel, we NEED to reality sim some mroe
sigh.
Other than that- Currently struggling to find out if I can change the players movement speed, combat speed, general speeds of timed action completion, stuff like that
I have found variables in the java that seem to change some of those things, but none of which are very clearly defined :(
you can hijack timed actions easily as it's in Lua
Word, I figured as much. Just wasnt certain, I havent looked into the timed actions aspect much. Still working on the other variables
Just make sure you overwrite properly
if you plan to touch reading, be ready for incompatibilities with a million different mods you've never heard of before
CDDA hardoverwrites vanilla functions
added it it my 'please stop' list
require "TimedActions/ISReadABook"
local crossRefMods = {
["CatsWalkWhileReadMod"]="ReadFasterWhenSitting",
["CatsReadMod"]="ReadFasterWhenSitting",
["CatsReadMod(slower)"]="ReadFasterWhenSitting",
["SnakeUtilsPack"]="tooltip",
["nicocokoSpeedReading"]="TimedActions/NSRReadABook",
["CDDAReading"]="TimedActions/ISReadABook",
}
local loadedModIDs = {}
local activeModIDs = getActivatedMods()
for i=1, activeModIDs:size() do
local modID = activeModIDs:get(i-1)
if crossRefMods[modID] and not loadedModIDs[modID] then
require (crossRefMods[modID])
loadedModIDs[modID] = true
end
end
yeah- I just wasnt sure if there was any sort of core variable I could interact with
my mod actually worked with cdda except that it also *removes* functions and one of mine called one of the vanilla ones
it removes parts of the timed action?
yeah, a couple functions related to the xp boost and stuff
they aren't needed anymore of course but that was an annoying one
local function 10ylRunning()
if getActivatedMods():contains('10YL_HIGH') then
print('10YL_HIGH is enabled.')
return true;
elseif getActivatedMods():contains('10YL_MEDIUM') then
print('10YL_MEDIUM is enabled.')
return true;
elseif getActivatedMods():contains('10YL_LOW') then
print('10YL_LOW is enabled.')
return true;
else
return false;
end
end
``` that should do it for a boolean check right?
function name can't start with a number
local function bIs10YLActive()
local activeMods = getActivatedMods()
return activeMods:contains('10YL_HIGH') or activeMods:contains('10YL_MEDIUM') or activeMods():contains('10YL_LOW') or false
end
you little code monkies you.
you could also for loop
return autobreaks (?)
local function bIs10YLActive()
local activeMods = getActivatedMods()
local modIDs = {"10YL_HIGH","10YL_MEDIUM","10YL_LOW"}
for _,mod in pairs(modIDs) do
if activeMods:contains(mod) then
return true
end
end
return false
end
I prefer keeping stuff in lists so I can change it more easily later
yeah that's how i'd do it
just writing out a bunch of ors/an if tree can be kind of fatiguing
Hey ! No just High, Medium or low ^^
Hey Dane, long time no see!
I gave versions rather than the sandbox options because there were some problems with the servers, the sandbox options were only taken into account on a cell or I don't know what weird operation it was
Hey ! Happy new year 😄
the version with 10YL_Maps is to activate the maps 10 years later with unique buildings, more trees etc because I did not randomly generate the trees as with the overlays, I did the mapping by hand thanks on the reverse of the card by Alree
The 10YL_vehicles version allows to have a 100% spawnrate for vehicles creating traffic jams and the angle of the vehicles is random
local modDataContextClasses ={
["IsoDeadBody"] = function(object) return object:getOutfitName() end,
["IsoPlayer"] = function(object) return object:getUsername(true) end,
["IsoZombie"] = function(object) return object:getOutfitName() end,
["BaseVehicle"] = function(object) return object:getScript():getName() end,
}
local function fillModDataContextMenu(array,contextMenu)
for i=0,array:size()-1 do
local object = array:get(i)
local optionAdded = false
for type,func in pairs(modDataContextClasses) do
if instanceof(object, type) then
local optionName = func(object)
if optionName then optionName = ": "..optionName end
contextMenu:addOption(type..(optionName or ""), object, showModData)
optionAdded = true
end
end
if not optionAdded then contextMenu:addOption(tostring(object:getClass()), object, showModData) end
end
end
tried a new technique
ooh that's clever
a little wasteful as StaticMoving vs Moving don't overlap but I hate copy pasting
damn, that SHOULD work.
if GrassBush:getProperties() and GrassBush:getProperties():Is(IsoFlagType.canBeCut) then
--print("Bush!")
square:transmitRemoveItemFromSquare(GrassBush)
if not GrassBush:getModData().soundbreak then
GrassBush:getModData().soundbreak = 1
vehicle:playSound("VehicleHitTree")
Blade:setCondition(BladeHealth - HitDmg)
end
end
``` this is my normal method.
it's because it's not reading it as enabled.
Anyone know if the variables in defines.lua (the ZomboidGlobals) are updated onTick?
so i've made that mower that will end the world!
Can anyone help me please? I have a model of a gun and a sound for it, I need to change the default m4 to the one I chose
You can use a lua file to swap the model and sound of the base m4 to yours
Is it that simple? Thank you so much
Need it for my new video
Is it a grass cutter?
updating my mower to work with 10yl
fixed it. yay!
the mower will now mow 10yl grass

i's been the biggest ask for the mower.
where do I find models files in the game folder?
lawn mower simulator with 10yl is so soothing.
option MFTEOTWC.stackQuantity
{
type = integer,
min = 10,
max = 25,
default = 5,
page = MFTEOTWC,
translation = MFTEOTWC_stackQuantity,
}```
does anyone see anything wrong with this?
for some reason having this sandbox setting in my mod causes a crash to desktop when loading lua but im staring at it and cant figure out what might be wrong with it
the implementation of it also looks just fine as far as i can tell; i have it implemented literally identically to two other perfectly functional implementations of the same setting and code for exactly the same purpose
but its just this specific one that is breaking and i cannot find a fucking difference
for instance
local currentItemList = {}
for i=1,#itemList do
currentItemList[i] = itemList[i]
end
for i = 1,1 * SandboxVars.MFTEOTWC.stackQuantity do -- change the second number to how many you want
local chosenItem = table.remove(currentItemList, ZombRand(#currentItemList)+1)
player:getInventory():AddItem(chosenItem)
end
end```
```Recipe.OnCreate.ItemStackVinyl = function(items, result, player)
local currentItemList = {}
for i=1,#itemList do
currentItemList[i] = itemList[i]
end
for i = 1,1 * SandboxVars.MFTEOTWC.stackQuantity do -- change the second number to how many you want
local chosenItem = table.remove(currentItemList, ZombRand(#currentItemList)+1)
player:getInventory():AddItem(chosenItem)
end
end```
here's where it's implemented
local currentItemList = {}
for i=1,#itemList do
currentItemList[i] = itemList[i]
end
for i = 1,1 * SandboxVars.MFTEOTWC.cacheQuantity do -- change the second number to how many you want
local chosenItem = table.remove(currentItemList, ZombRand(#currentItemList)+1)
player:getInventory():AddItem(chosenItem)
end
end```
and here's an identical, functioning version that works just fine
maybe a non-unicode character snuck in
i copied the entire thing directly from the functioning ones
except for typing in the few characters required to change it from cache to stack in the sandbox settings and in here
and i dont see a space where a non-unicode character could be there
{
type = integer,
min = 5,
max = 100,
default = 50,
page = MFTEOTWC,
translation = MFTEOTWC_cacheQuantity,
}```
heres the functioning sandbox option as well
... oh mygod.
no i did not.
i see what it is. ive been looking at text all day nonstop and i didnt even see
min = 10,
max = 25,
default = 5,
there is. a problem here.
im the dumbest person on earth
So- does anyone know if the rates of certain effects are changed by the length of a day?
that's very vague!
yeah
LMFAO
And shit... Is there an easy way to set that as a multiplier for some stuff?
Like- I am setting effects to happen on every minute to tweak player stats, but I want to make sure that the values still work for different game speeds
Yes. albion knows.
I calculated the rates using the global definitions for the rates, but I think they run on tick... So without knowing the relative speed of the game, I can only check them based on a set value of game time length
Given that the stats aren't even normalized the same way... my suspicion is that it probably depends on the stat
But idk
--[[
Stat max values:
Hunger = 0-1
- Defaults to 0.0
- Base = Increases @ 0.03 / min irl
- Exercise = Increases @ 0.07 / min irl
Thirst = 0-1
- Defaults to 0.0
- Reduced @ 0.0288 / min irl
Endurance = 0-1
- Defaults to 1.0
- Running = Decreases @ 0.1872 / min irl
- Sprinting = Decreases @ 1.638 / min irl
- 'Immobile' = Increases @ 0.1116 / min irl
Fatigue = 0-1
- Increases @ 0.1242
Stress = 0-1
- Defaults to 0.0
- Decreases @ 0.108 / min irl
Boredom = 0-100
- Defaults to 0.0
- Increases @ 3.6 / min irl
- Decreases @ 138.6 / min irl
Unhappiness = 0-100
- Defaults to 0.0
- Increases @ 1.8 / min irl
Temperature = 30.0 C - 41.0 C
]]--
3,600 ticks / minute. So assuming a 2 hour length of day these are the rates
😭
java seems to usually use this:
... * GameTime.instance.getMultiplier() * GameTime.instance.getDeltaMinutesPerDay()
So they multiply x by (multiplier * irl mins per day) ?
Damn. Where do you see that? So I can check out the implementation
Just found these
Lmfao
thank you project zomboid
i've been endlessly curious about why that second one exists
im having trouble joining my friend
we have all the same mods
but when i try to join it says mod (mod template not installed) even though we have mod template
Can I add parameters to the functions in my lua events?
Like- If the function I am calling can take a variable, could I do event.---.add.exampleFunction(x)?
opt a) event.---.Add(function()myfunction(var)end)?
opt b) local var; event.---.Add(myfunction)?
I usually keep anything I'll need in a local var and check that in the function. You can't remove the function if you add it like in opt a.
I see what you mean
I basically just want to have the ability to negate my function lol. That way I can have the same function run to do the opposite effect
But its all good, I know a way around it i think
I would just do the whole function inside if possible.
event.someevent.Add(function() print("do the whole function here") end)
bruh. i still need to be taught lol.
there is fuckery involved on a level that is scary.
i would LOVE for an ingame or WYSIWYG ui editor.
Hello does the server folder replicate the code for other users i'm having issues with players not seeing the same zed type with cdda mod
the original author put the code inside shared folder.
wow, every time I realise there's more info to be found in this guide
thank you
Any luck setting these? I tried...
getGameTime():setNight(0)
getGameTime():setNightTint(0)
OnTick and OnPostUIDraw and got nothin, despite tracking the variables increasing from 0 to 1 as night reaches its darkest.
what is this for?
btw, changing climate controls works best from admin settings, SP seems bugged or something
Hallucinogenic effects
Real-time modification of perceptions of the player that contradict server reality.
Brandon is working on a drug mod of sorts.
@fast galleon
ah, you probably don't want climate controls then, but something like the search effects
I looked at that as well... He is aware of that option but for reasons I haven't requested he still seems interested in night strength management, which I am assuming from context is related to the same goals he's been pursuing.
Tbh I am also interested in night strength management separately
I would like to greatly reduce darkness at night as part of a mod
Without any weird nightvision effect
I would also like to be able to reduce darkness of locations that are out of line-of-sight (but visited before).
I second that, would be nice to have white nights in summer
Yeah I have dumped some hours already trying to find something
There are a couple things in ClimateManager that very slightly let me adjust darkness levels but I can't seem to access the key that primarily determines just how dark things get overall at night
And I have no idea where to find the code that darkens the unseen.
this.setExposed(ClimateMoon.class);
ClimateMoon you think??
Weird name...
I noticed it but didn't think it sounded right
Will read it more closely
Javadoc Project Zomboid Modding API declaration: package: zombie.iso.weather, class: ClimateMoon
Not sure about that
I would imagine it's what's affecting night strength
Seems to explicitly control phases of the moon
May influence night strength but it's not the primary thing
Very small class
This is what I've been exploring with very minor successes: https://zomboid-javadoc.com/41.65/zombie/iso/weather/ClimateManager.html
Javadoc Project Zomboid Modding API declaration: package: zombie.iso.weather, class: ClimateManager
But so many options, some accessed uniquely
taking time to try things
Ye fenris did a great job. The guide Helped build the mod community
seems like night is multiplied by moon phase
and affecting night is easier than the moon
the RenderSettings seems to be per player, it's where I saw the multiply. gotta go
- I guess it's all about the climate, so test with climate debug tools as mentioned earlier.
parameters are passed when the event is triggered
when you add a function to an event you are simply registering it to run when triggered
all the parameters passed on the trigger will go to that function
Am I not understanding how require works in .lua?
I have a file MutiesDiary.lua in lua/client/ and another file MutieDiaryExperienceTracking.lua in the same directory.
I use require "MutiesDiary" at the top of the second file, but it somehow doesn't get respected, and ends up loading MutiesDiaryExperienceTracking first. 😦
if the require fails, it prints a message in logs. Since they are both in client and not in a subdirectory you should focus on spelling.
MutieDiaryExperienceTracker loads before MutiesDiary because of the s after Mutie
Wait I just noticed you wrote it two ways
Which way is it? Muties or MutieDiary?
P sure MutieDiary would load before MutiesAnthing fwiw so a subtle difference could explain it
MutiesDiary, every time, it's not the spelling. I just seem to have a bug in MutiesDiary.
Is it directly in /client/ or is there a folder after?
Require needs to include folders after client/server/shared/
It's directly in client.
I have a bug in MutiesDiary, unrelated to require.
And fixed, I had a trailing ; after a function name and that caused issues. Woopsie.
I wish Lua syntax errors automatically opened the debug ui D:
when i set a recipe to NeedToBeLearn:true people without reading the recipe still have access too it
I have a question folks. Is it possible to make spawn points exclusive to a trait? I'm running my own server and next season I want to have 3 groups of Settlers, Raiders and Nomads. Each of them will have a custom Faction HQ (I will create a custom map for this) and I want people to be only able to spawn there if they have the appropiate Settler/Raider/Nomad trait selected
I also want these traits to unlock custom clothing in the character creation and give an experience boost to certain skills (but no skill points only the boost). I know you can do this with occupations but is it also possible with traits?
Would that be like getDawn() ?
Would I need to somehow store that info it gets to use it in the rest of my code so it can be the reference point for the triggering of the effect?
nvm. i just wasnt putting a , at the end of the line
getClimateManager():getSeason():getDawn()
I use it like that, since it's from season I think it's good probably to update it once a day if you don't want to get the value every time
I'll have to make a third-party patch to the Night Combat XP mod that does this.
hm, wonder how often I should update this too. All it does is change an icon in the UI.
Could set it to the every 10 minutes event?
hey does anyone here do commissions for clothing mods?
what are you after?
If this is possible I would also like to know how hard/ time intensive it is (I work in IT so I have coding experience and I worked in media design before so I can create my own artworks). If its very time intensive I would like to commission this if someone is interested
I'd say medium, it's not as easy adding an extra script and not something new.
Isn't there already mods designed around professions? Can't imagine the jump is that hard.
has anybody made any mods re. radio stations, ie. adding new stations to frequencies, changing transcripts, etc?
Do you know one I could take a look at?
Then I'll do it myself I guess

Hi, does anyone know if the API offers any persistent, globally unique ID for a player at the server side? I've tried getPlayerNum() and getOnlineID() but they appear to return values that aren't unique amongst the players (i.e. two players can have the same value).
There's steamID but if you mean unique to the specific character (as in per life) you can assign a modData value for reference
Thank you - Whilst I do have the steam ID, currently I have to get this from the client side using getCurrentUserSteamID(), so I'd be completely trusting the client with providing this value accurately... more challenging is that the Steam ID is too long for the LUA number type, so it loses precision (which means two players could have the same value, if the Steam IDs were similar up to around the last 3 digits).
The value doesn't need to be per life though, just per user.
My first mod. https://steamcommunity.com/sharedfiles/filedetails/?id=2911373802
Code: https://github.com/pangolp/itemsAwards
Thanks @bronze yoke for the help / advice.
then use the username
two players cant have the same because well its a server account
Yeah, if username is the only thing that's confidently unique, I'll base it around this - I was looking for a numeric type as the table I'm keeping state in for each player is numerically indexed (and needs to be for some of the later functions that work on it to operate correctly), but I can create a map from username to my own persistent index and use this - was just wondering if anything was already provided that behaved like this save re-inventing the wheel / duplicating functionality if it's already there.
weird and youre probably not taking advantage of tables but you could use sqlid
Is this the ID from the player database? I was just looking into how I might read from that (Something like https://zomboid-javadoc.com/41.78/zombie/network/DBResult.html ?), if you happened to have a pointer on how to get that, it would be very useful!
Javadoc Project Zomboid Modding API declaration: package: zombie.network, class: DBResult
you shouldnt need to use the db and dont think that class is exposed to lua
why isnt username enough?
what exacly are you trying to achieve?
The table I'm updating requires a unique index for each player - later behaviour requires that the index is numeric. If username is the only value that behaves like this (persistent and unique to a player), I'll map a map between username and index value, was just hoping the server had a unique numeric value for each player to hand.
i.e. PlayerNum / OnlineID felt like they might be this but they didn't seem to actually be unique amongst the players when testing.
playernum is for splitscreen
Aha that's really useful to know, ty
The LUA table is later converted into XML - the XML processor determines the tag structure based on the key type, so if it's not numeric, it will use the actual key name in the XML tag, which is undesirable. I could rewrite the XML processor, but it works really well otherwise so I'd prefer not to add a workaround there, but preserve the numeric keys upstream in the player data.
This is what I'm currently thinking - basically just store a map of usernames to indexes that I assign myself.
then just use moddata or global moddata and give em your own serialcode
I've not yet used moddata, but assume it is somewhere I can attach persistent values/data to players and/or other objects?
sqlid is the kind of thing you're looking for
Any hints on how to access it? I've never been able to read properties off the java objects (always have to use a method call), I see sqlID on the IsoPlayer object.
So long as it's numeric, and doesn't get re-used amongst players, it'll do what I need.
you need to use reflection but someone mentioned it only works in debug mode
iirc setting only works in debug
im barely ever out of debug so not sure on the behavior
you can read but not write afaik
Read should be sufficient for what I need, though I've not performed reflection in this environment before, anyone have an idea how it's performed?
well then youre good getting the sqlid though i would still do a custom mapping for better performance
you have to go through all the fields until you find the one youre looking for
Oh yeah for sure - might as well dump it into modData after
I kind of wish the hardware information was more accessible as a means to create a hardwareID
mapping name to id is just faster than iterating through fields
also keep in mind modData attached to a player is local and does not get synced
How can you check if an item is stackable or not? I tried to call CanStack() but it breaks on that call
is there any reason to why this happens?
editing the file directory in file explorer to models_X/Vehicles/Vehicles_96CivicSi doesn't change much
@neon bronze
what is an example of stackable obj?
no name for model?
Like shells and such
But i looked into the java code and CanStack just always return false
ah, never added a vehicle myself
tried it before and i had the same problem
i think this is actually the solution to this
thank god you mentioned it or else i would've gone crazy
IT WORKSSS
seems like parts of old code
All inventory items can appear as a stack in inventory page.
*some clips have canstack=false in script though, which would set IsAimedFirearm to false? 🤔
Is there a way to specify the RGB of a tint-able piece of clothing in a zombie outfit in clothing.xml?
what does VERSION = 1, do in sandbox-optionx.txt btw?
let's the game know the version the script is for
stacking in the inventory is purely cosmetic
items themselves dont actually stack
in case they upgrade sandbox api
I've been reviewing https://pzwiki.net/wiki/Modding:Lua_Event to see if I can find an event that appears on the server side for when a player connects and disconnects - the events OnConnected / OnDisconnect don't seem to fire at the server side however. Are there any events that might do so?
Hi guys, sorry if I'm not allowed to ask this here, what do we do to see which lua events get triggered upon doing a certain action? Like, I'm trying to find out how to get an event when you open a container
I think you need ISOpenContainerTimedAction.lua, in \Steam\steamapps\common\ProjectZomboid\media\lua\client\TimedActions
unfortunately not
am I right in my understanding that
if player:HasTrait("HeartyAppitite") then
modData.StartingTraits.HeartyAppetite = true;
end
modData.StartingTraits.HeartyAppetite = modData.StartingTraits.HeartyAppetite or false;
would net same result as
modData.StartingTraits.HeartyAppetite = modData.StartingTraits.HeartyAppetite or player:HasTrait("HeartyAppitite");
should work, right?
I also have a pair of methods for getting values out of a class field if you want something ready-made.
function getClassFieldByName(obj, name)
for i = 0, getNumClassFields(obj) - 1 do
---@type Field
local field = getClassField(obj, i);
local fieldName = tostring(field);
if luautils.stringEnds(fieldName, "." .. name) then
return field;
end
end
return nil;
end
function getClassFieldValueByName(obj, name)
local field = getClassFieldByName(obj, name);
if field then
return getClassFieldVal(obj, field);
end
return nil;
end
Use like:
local wheel = getClassFieldValueByName(part, "wheel");
Assuming HasTrait returns true/false, yes.
Unless modData.StartingTraits.HeartyAppetite is true and HasTrait returns false.
The mini-mobs of zombies that have a survivor zombie with a military backpack in the center, is that survivor zombie's outfit selected in lua or is that done java side?
yes
Thanks
or simply
modData.StartingTraits.HeartyAppetite = player:hasTrait("HeartyAppetite")
nah, then if they dont have it anymore it'll switch state, i want to record the state onCharacterCreation
But if they dont have it anymore then they dont have it
yes but i need to know if they had it
Describing conditions on which you lose/gain traits in here would take a lot of text, so just check goolge sheets for details (link in mod workshop page description). Affected traits that can be gained/lost dynamically: High/Low Thirst, Light Eater/Hearty Appetite, Thick/Thin Skinned, Slow/Fast Healer.<br>IMPORTANT: if you pick any of these traits in character creation they will be permanent on your character, both negative and positive.
last line
🙂
May be a silly question, but did you check events to see if this is possible via that?
There's OnCharacterCreateStats and OnCreatePlayer which both sound promising.
i just initialize my modData OnCreatePlayer
So you could just do as Browser8 suggests there? Rather than re-setting every time 😉
it doesn't re-set
Are you trying to change weight? I know how to do that if u are
if there's already value\
it wouldn't work
No, I mean, if you're doing OnCreatePlayer, and that's only run once. Why bother with anything that might be complicated to read later? Just do the simple direct approach Browser8 suggests. The code is only executed once per player created, so your ModData will remain the same throughout the playthrough.
onCreatePlayer is ran every time player loads in
What ru trying to do
Now that explains it 😄
Traits are saved even so no need for that can just check if the player has it and do your thing if so
I already did what I need
My dud did u even read this

Yes if the player currently has it then he has it after a reconnect
...
The intent is to let the player keep experiencing effects even if the trait is lost through other means.
Im not following u but i think i may have the codes on one of my mod
Lemme grind it down for you
The problem has already been solved 
Yes
But I wanna explain why modData.StartingTraits.HeartyAppetite = player:hasTrait("HeartyAppetite") won't work
If I remove HeartyAppetite trait from player, next time he loads in, your line would say that modData.StartingTraits.HeartyAppetite = false. Would that be correct?
Indeed

If you want it to still work why did you remove it then
I don't need it to still work
I need to check if it's permanent or not
to see IF i can remove it
"IMPORTANT: if you pick any of these traits in character creation they will be permanent on your character, both negative and positive."
Actually, upon re-reading, you'll end up setting the modData.StartingTraits.HeartyAppetite value to true, even if the player originally didn't have it, as long as they currently have HeartyAppitite.
You're probably looking to do:
if modData.StartingTraits.HeartyAppetite == nil then
modData.StartingTraits.HeartyAppetite = player:HasTrait("HeartyAppitite");
end
it's same code as this line modData.StartingTraits.HeartyAppetite = modData.StartingTraits.HeartyAppetite or player:HasTrait("HeartyAppitite");
No.
That line of code will evaluate to false or player:HasTrait("HeartyAppitite") when player:HasTrait("HeartyAppitite") = false.
Which means you'll be setting it to HasTrait and walk right into the issue with Bowser's approach.
yes? If modData.StartingTraits.HeartyAppetite exists, leave it be. if it doesn't - set it to player:HasTrait("HeartyAppitite")
That's not what that means.
yes it is?
It means if modData.StartingTraits.HeartyAppetite evaluates to true, afaik, when working with booleans?
Or rather, you're working with booleans, so it'll be one large boolean expression rather than an assignment of either A or B.
You are still overwriting the variable
Just test it ingame then
I'd refer to section 3.3 of the Lua docs.
https://www.lua.org/pil/3.3.html
Here it states that
A useful Lua idiom is x = x or v, which is equivalent to
if not x then x = v end
Remove it
Which is not what you're looking for, since your x is a boolean.
You will have overwritten the initial value
i.e., it sets x to a default value v when x is not set (provided that x is not set to false).
literally
created char with fasthealer,
removed via debug
reloaded
what are you talking about guys

create without
dafuq
what is this bullshit man 
fuck me I hoped I won't have to do fucking 10 if statements in my moddata lua
thanks for heads up
@drifting stump @agile vigil

If incase you need to then make a checker function
U said you need to make multiple ifs statements
So u can just put it on a single function and jist call that function so u .... Ow ok

Anyone know how the skill recovery journal 100% works? I tried using it but I barely got my levels back and im a lil confused
@sour island
Wait is that the guy who made the mod?
Yes
Ye people dont much about mod authors i guess. So i bet puting authors name on the mod itself is the effective form of publicity/advertisment
only end user don't care, they just want play I think lol
He seems away right now, anybody else knowledgeable in the mod?
Its just been updated im not familiar with the changes .. what is it u want to ask
Well I had like level 7 axe or something, Wrote in the journal with 100% retention, and when I picked it back up after death I'm level 3. While transcribing the journal it also said that I only written like 240 xp in it.
Maybe I think its something that its not?
I thought it'd just give me most if not all the levels back
Yeah the old data is gone i think he revamp the journal go to the mod page he wrote stuff there im sure
I mean I think that that would indicate if I was close to level 8 that It would round down to 7
bc im not level 8 yet
Is this your server having problem with the thing? Just announce the mod got updated
Its a singleplayer
Ah well just run debug nd give yourselef the level
How do I do that?
I'm not sure how to get there is that a mod? Or
function PerkLevelup(player, perkType)
local perkLevel = player:getPerkLevel(perkType);
if perkLevel < 10 then
player:LevelPerk(perkType, false);
player:getXp():setXPToLevel(perkType, player:getPerkLevel(perkType));
SyncXp(player)
end
end
function getGodPerks()
for i = 0, 10 do
PerkLevelup(getPlayer(), Perks.Reloading);
PerkLevelup(getPlayer(), Perks.Aiming);
PerkLevelup(getPlayer(), Perks.Nimble);
PerkLevelup(getPlayer(), Perks.Sprinting);
PerkLevelup(getPlayer(), Perks.Sneak);
PerkLevelup(getPlayer(), Perks.Lightfoot);
PerkLevelup(getPlayer(), Perks.Maintenance);
PerkLevelup(getPlayer(), Perks.Blunt);
PerkLevelup(getPlayer(), Perks.LongBlade);
PerkLevelup(getPlayer(), Perks.SmallBlade);
PerkLevelup(getPlayer(), Perks.SmallBlunt);
PerkLevelup(getPlayer(), Perks.Axe);
PerkLevelup(getPlayer(), Perks.Spear);
PerkLevelup(getPlayer(), Perks.Electricity);
PerkLevelup(getPlayer(), Perks.MetalWelding);
PerkLevelup(getPlayer(), Perks.Mechanics);
PerkLevelup(getPlayer(), Perks.Woodwork);
PerkLevelup(getPlayer(), Perks.Tailoring);
PerkLevelup(getPlayer(), Perks.Doctor);
PerkLevelup(getPlayer(), Perks.Cooking);
PerkLevelup(getPlayer(), Perks.Farming);
PerkLevelup(getPlayer(), Perks.Fishing);
PerkLevelup(getPlayer(), Perks.Trapping);
PerkLevelup(getPlayer(), Perks.Fitness);
PerkLevelup(getPlayer(), Perks.Strength);
end
end
getGodPerks()
here paste this on debug
What is that?
Is my screen meant to look like this
oh wait
i think I got in the actual game
Just paste it on the debug then press enter
On the lua console
Press f11 i think
Theres a mod conflict on your setup maybe
Yes untick the checkbox on the top left ish
Damn left my cigarrete to type that code its gone when i came back 😂
I think yeah I got my levels back, but I feel like this is super cheaty and I wanna figure out the actual mod yk?
@sour island if you see this please read up real quick and lmk what u think
Thanks @ancient grail I gtg tho
Am I crazy or is item below simply nil?
-- walk to
if JoypadState.players[player+1] == nil and not playerObj:getVehicle() then
if test == true then return true; end
context:addOption(getText("ContextMenu_Walk_to"), worldobjects, ISWorldObjectContextMenu.onWalkTo, item, player);
end
From ISWorldObjectContextMenu.lua in createMenu.
Oh that's old actually - even before the last update all do was handled per point.
The update may require you to craft a new journal - and to use that new one and the old one, side by side until you die.
I wrote something to carry over the old method into the new - but people are also getting confused.
check out clearFetch
I probably need to redo the sandbox handling as non set variables are nil -- so I should've made it behave like the old style if nil not default 🧠
People also don't seem to be aware of bonus XP multipliers :/
Or read any changelogs
Oh hi! I just checked back. So @sour island I didn't exactly pick up what your saying sorry!
You're saying there was an update or something?
Any way to know x and y of ui?
ui.instance:getX() or ui.instance:getY()
what is ui.instance?
are there docs i can look at for lua support? im trying to grasp what everything is lol
Yes, the update ignores TV earned XP as well as boosted XP% from professions/traits
That may explain issues with less than expected results. Both can be toggled on with sandbox.
Where would I get the update? On the steam page? Bc I believe I redownloaded it earlier
Which then I just need to test the settings
his playing SP
he wont have access to sandbox
im trying to host with true music and all its required addons and my server gets stuck on "initializing"
without the mods the server starts fine
thanks\
I ended up simply passing the variable along as given even though I'm pretty sure it's always nil.
Sometimes big modpacks can take a pretty long time to initialize for the first time.
its like 10 mods
Mmmmm suspicious
is it because true music addons are like 300 megabytes each
DM me the 10 mods if you want that's not hard to test
I see that's possible
should i just wait it out? the max i waited was like 4 minutes
Possibly, yeah, it could take more than that if it's a ton of stuff to load, depending on PC
i have a really good pc
Not just pc, but also internet speeds and stuff. I’ve had similar issues on first time loads- I would also try opening a solo map first, then closing it and joining your server. Idk why but I have noticed that helps cut down on the timing of things since it preloads a lot of the files
From a playerObj how can you know the way the player is currently facing? I wan to know id a player is going upstair or downstair
Glytch u still here?
Anyone know if it’s possible to have traits locked to only be selectable for specific professions?
Like, say I took a profession like unemployed. I want to give the player the option to select a new trait, but ONLY for that profession
So it’s not tied intrinsically to the profession, but instead costs points as an additional player option
i think something like that was being worked on for profession framework?
Don't think you can do that directly, but you could add a "NotUnemployed" trait to every other profession and make that trait exclusive to your profession-limited one.
Though its a bit ugly in the UI, especially if you are adding a bunch of profession-limited traits to various professions.
Yeah, but it’s the opposite from what i see. Like- it makes specific traits not selectable for a profession. Which would work, but would mean I would need to account for every single profession separately 😭
And yeah, thought of that too. But that sounds pretty awful… goal would be to add like, subfields to professions. So players could specialize their stats
ya profession framework can do it, traits that are profession specific, or requiring additional prerequisite traits selected first. But experimental features not enabled by default, may include bugs
You can change sandbox with another mod 'change sandbox' by Star.
Hey, anyone familiar with The Workshop?
What's the name of the workbench you can make in the crafting menu to start using the thing?
Anyone know if theres a mod that lets alll the origins craft the bombs and noisemaker that engineer can make
Yo
yo
so that or deal
it only doesnt work if 2nd option is false?
or if it's boolean?
or what's the deal 😄
using or to make a default value?
that doesn't work if the first option (the existing value) is/can be false
oh
Might not be possible unless you can overwrite the vanilla code running the char creation . But that might be hardcoded
An idea on how u can do this i by skipping the charater creation or just remove whatver the choices the player took and just remove everything then create some sort of gui that simulates the char creation
Hacky tho
so 1st one can't be boolean
Ye or only needs to check 1 in order to do the function
How the hell does it know that it can be boolean though, when you create variable you don't specify that it's boolean, does it check the 2nd option and then goes like "oh ye it's boolean"?
if it's anything like the appearance screen you can mod it from lua, it's a massive pain though
Can you repost your code
it's nothing to do with it being boolean
modData.StartingTraits.LightEater = modData.StartingTraits.LightEater or player:HasTrait("LightEater");
or returns the first half if the first half evaluates to true, otherwise it returns the second half
Yeah and gui coding is hell time consuming
and false of course doesn't evaluate to true so it doesn't work

Put a
local on that to help with the length
I do that in code that works with those, I want them to be grouped nicely in my moddata lua
ignore mid part I haven't redone it yet 
in client/OptionsScreens/CharacterCreationProfession.lua the class CharacterCreationProfession has a method called isTraitExcluded that I'm guessing filters the list you could probably just override that
can you send the text editable code
do you want to swap out modData.StartingTraits for local var?
and/or sleep system
I'll do it myself in a bit, atm busy with writing up workshop text 🙂
Hi! Anyone know anything about coffee?
I added a new customMug (like the spiffo mug with another logo), so the empty item and a HotDrinkCustomMug version, these items work well. The problem is that I can't get the option to make the hot drink with a right click on the item. So I added a new evolvedrecipe for my mug but I have no recipe display.
I couldn't find a mod that used a new item in an existing recipe. Does anyone know how to point me in the right direction?
local sTrait = modData.StartingTraits
local st = {}
st[1] = "HearthyAppetite"
st[2] = "LightEater"
st[3] = "LowThirst"
st[4] = "SlowHealer"
for k, v in pairs(st) do
if pl:HasTrait(st[1]) == sTrait[st[1]] then
print(sTrait[st[1]])
end
end
something like this im sorry if it doesnt work im not really sure how to write it lol
but just to give an idea if it could
but this is just polishing it and maybe somewhere along the line it would be easier to code the next parts
but if your code already works then might aswell use that
but the idea is to store the "HearthyAppetite" string to be able to easily just put that string when you ask the if questions later
local sTrait = modData()['StartingTraits']
local st = {}
st[1] = "HearthyAppetite"
st[2] = "LightEater"
st[3] = "LowThirst"
st[4] = "SlowHealer"
for i = 0, #st -1 do
if sTrait == st[i] and pl:HasTrait(st[i]) then
--dostuff
break
end
end
maybe thats better?
Can anyone point me in a direction as to why my mod data won't initialize on the server side for this object? I know it's somewhat impossible without looking at the code, but a direction to look would be nice 😭
interesting
aLSO @sour island i'M NOT SURE IF THIS IS A GLITCH (caps) but I randomly got 3 extra skill levels aiming even though I didnt have it.. I don't really mind just odd
again im not ssure if it will work but what this does is you can add all the traits easily to the table if the server adds other traits
I have this on my server object definition.
self:initNew()
if SBioGasSystem.isValidModData(isoObject:getModData()) then
self:noise("Valid Data")
self:fromModData(isoObject:getModData())
end
self:saveData(true)
end```
```function SBioGas:saveData(transmit)
local isoObject = self:getIsoObject()
if not isoObject then return end
self:toModData(isoObject:getModData())
if transmit then
isoObject:transmitModData()
end
end```
if you run the code i gave you
it maxed out your stats
what is the purpose of the moddata
is it sprite/texture related
no, just values that need to be updated hourly.
or you can refer to maybe farmin related lua
function ISFillGrave:changeSprite(square)
for i=0,square:getSpecialObjects():size()-1 do
local grave = square:getSpecialObjects():get(i)
if grave:getName() == "EmptyGraves" then
grave:getModData()["filled"] = true
grave:transmitModData()
local split = luautils.split(grave:getSprite():getName(), "_")
local spriteName = "location_community_cemetary_01_" .. (split[5] + 8)
grave:setSpriteFromName(spriteName)
grave:transmitUpdatedSpriteToServer()
end
end
end
or maybe this? but remove the sprite part
function DebugContextMenu.setForceLockDoor(worldobjects, door, player)
if not door:getModData().CustomLock then
door:getModData().CustomLock = true
else
door:getModData().CustomLock = false
end
door:transmitModData()
end
heres another one
i think this onens better suited
transmitCompleteItemToServer
could also be this one .. ihavent tried what your doing but this what i seeon the vanilla
aight, thanks for the examples, I'll stare at it some more until it works haha
Hey guys, I got a question. If I am broadcasting a message to the chatbox, is there a way to make it in a local range rather than globally to the server?
yell
wait is that something utilized in processSayMessage or am I using the wrong function?
No sorry lol, I should've specified more.
Ty, this was driving me insane hopefully this is it
Hrm. I'll stare at it, because right now I have it like processSayMessage("Sorry, you can't do that unless you're an admin!") if a command is entered but maybe I'm approaching this wrong
Oh, nevermind. I'm just dumb, it's just a large range and not global.
Thank you for the help, I might try to refactor this with this though.
If I am putting functions in a table, can I add parameters to the functions? Or do they have to be listed without ()
they have to be listed without ()
if you use () you're not passing a reference to the function, you're calling it and passing the return value
https://imgur.com/KclKdOT due to the demand of checking various vehicles to test the functions i actually made a function to help me
there is not, at present, i will add it to the list of stuff to do when i next revisit the mod to fix some other stuff.
What your guyses opinion on advanced trajectory
cool thank you for the respond
wait, so when I call the function, I call the table with something like drugData.sideEffect()
Do you know what will happen if I put something inside of that ()?
it was pass that as an argument
What do you mean?
like drugData.sideEffect(false) passes false as the first argument
a function is a function, it doesn't matter how exactly you're accessing it
Ye - see my last snippet
Like, it will pass that to the function that is in the table?
yeah
oh, hell yeah
You can use the key to access a function that is a value
And pass arguments to it just fine
Helps cut down on copy pasting as you can manipulate the key using [""]
beautiful! I am trying to find a way to use a single identifier, so it will know the specific function to call based
Like- I am tying the category of the drug in its table to various different variables. So that will make the whole thing really straightforward
if x then just checks to see if a variable exists, right?
Exists and not false
so like, this:
if drugData.baseEffects then
drugData.baseEffects(drugMultiplier)
return
end
Would check to see if that table instance exists, then run the function
x~=nil if you need false to pass
Yep but drugData is modData?
You can't store a function in modData afaik - and probably shouldn't
local x = item:getModData().DrugID
local drugData = DrugInfo:getDrugInfo(x)
Nah, I have a lua table. So, I put the name of the table instance in the modData of the item
Ah ok 👍
The funciton I am currently using takes the drug category and the reference for the table info from my main function as seen above. Idea is that I can run this function with just the category of drug or with the specific info from the item. This would let me run the function both tied to my OnEat function trigger, as well as independently using just the Drugs Category.
local function DrugsInPlayerSystem(drugCat, drugData)
The reason I am running the above if statement is basically just to see if this exists, if not, it will run the basic function defined by the category. But I would prefer to not reference multiple tables if I dont need to, so that is my fallback option
Is there a way to edit the queue join time? AKA not process 1 user every 30s and shortening that time itself? Is there somewhere to reference that?
@ancient grail smthing like this?
local function checkStartingTrait(startingTraits, player, trait)
if startingTraits[trait] == nil then
startingTraits.HeartyAppetite = player:HasTrait(trait);
end
end
local function createModData(playerIndex, player)
-- stuff here
checkStartingTrait(startingTraits, player, "HeartyAppitite")
end
```?
oh forgot return
oh wait its not needed
ow wow nice
there
es somethign like that is better
huh
cuz I refuse to have variables with typos in my code
ye but your are referring to the vanilla syntax so
ye but
no, look
kidding
if I pass checkStartingTrait(startingTraits, player, "HeartyAppitite")
it'll create startingTraits.HeartyAppitite
Appitite

Good grammar
as I said before
spellcheck is new feature

anyone knows how deactivate an entire lua file
without overwritting it
cuz its already an overwrite of something
its overwritting the vanilla stuff so id like todisable it so i can overwrite the vanilla
overwrite wars
anyone know a mod similar to skill recovery journal mod?
the mod is currently not working, the author is working on hotfixes rn
wow chuck is really in demand
the mod actually works idk why people think otherwise read the description iguess it will explain alot
Nah Chuck actually updated it and broke some stuff from the looks of it
i know it works, ive been using it for a while
If what your checking for is defined at startup, you can just return . For example, I have this at the top of a file in one of my mods:
if getActivatedMods():contains('ClothingActionsRM') then return end
Just literally at the top of the file outside of all functions. Will just return and stop processing the file if true.
no cuz this will just prevent my lua to run
cuz its asking if this mod is active and iknoow it is cuz i required it
then return so meaning my lua wont run
i tried overwritting the file already but mine gets loaded first so it overwrittes mine
Oh, you're attempting to disable a lua file in another mod or something? You can just try to override it later. As in, if it does it on initial mod load, you do it OnGameBoot. If they do it OnGameBoot, you do it OnGameStart. etc
Can anyone help me please? I have a model of a gun and a sound for it, I need to change the default m4 to the one I chose
and the only problem now for me is he replaced the ISInventoryTransferAction:isValid()
i weant to revert it to vanilla
you need to make script txt file
add the sound
module Base {
sound ATMCash { category = Improvised, clip { file = media/sound/ATM_sfx.ogg, } }
}
like that
or just make it base
Ok, looking at that mod it overrides the function when mods are loaded. So you could just do:
local ISInventoryTransferAction_isValid = ISInventoryTransferAction.isValid
function ISInventoryTransferAction:isValid()
...Put the vanilla code here...
end
end)```
Since that mod gets to it first and overrides the table, not sure how else to restore that than override again later and just restore the vanilla code.
you could override his file, but load order can be a pain with that
copy the script fiole of the vanilla but change some stuff
hope this works
you could make sure your file loads first, save the original function, require his file, then reset the function to the one you saved
I use this in mods I have published. Sometimes its the only way to ensure compat....
then you'd only overwrite his mod and no others
it wont work like this i think
cuz self trigger function should have the names right
i thinkl
syntax error
function ISInventoryTransferAction:isValid()
ISInventoryTransferAction_copy()
end
function ISInventoryTransferAction_copy()
--paste vanilla func
end
this could work i think
I'm not sure I follow. The syntax is correct, you are just overwriting the isValid method on the ISInventoryTransferAction table on Game Start instead of when Lua files are read
i was thinking like this:
local old_isValid = ISInventoryTransferAction.isValid
require 'other_file.lua'
ISInventoryTransferAction.isValid = old_isValid
your mod has to load first though
i rarely see stuff that calls a function within a function u sure this will work
cuz its hightlighted red on my ide
function() function ISInventoryTransferAction:isValid()
i know this works
ive seen it done but i dont think i can pull it off on this
Here is an example from a mod i have published using this method. works 100%
dafuq
The rest of my ISInventoryPage:update() function is then called after the base
i thought we were trying to undo what another mod has done?
ok my mod is pretty much done, just waiting for my mod image and gonna finish documentation and prob gonna release tomorrow 
depends if i'll get my mod picture today or not 
but it highlighted red on my end
waiting for fren to provide 
maybe you do have a syntax error in your code or its your ide. 🤷 only thing that matters is if the game thinks it works or not at the end of the day
local ISInventoryTransferAction_isValid = ISInventoryTransferAction.isValid
function ISInventoryTransferAction:isValid()
this is how chuck overwritten the thing
can i used your solution with that
yeah, as long as your mod runs first, that should work
and just have it ignore the lua and get the parts i needed from it by copying it
idk if that will work cuz i require it
meaning its gona run first always
like in the mod info
that doesn't affect load order
ill try again
wait you know what this might actually work
i just forgot to remove the last end function so it highlighted red earlier
Ah! I have to just stare at VSCode sometimes until I see issues. ha. It's not pretty, but should work for you
dude you are friken
ow man
you nailed it
omg!!!
i dont have to wait fopr chuck to wake up and clean the api,. he can just continue to fix the journal and i still required his mod
win win
thnx alot @dark wedge
i will never have doubts about what your saying ever! lol at first it didnt think it would work .,. but your method is better than how others overwrite things
where did you learn that
Through necessity. lol. Some modders don't run the underlying functions and just spin their own, which breaks the chain. Just overriding it later in the process makes it work.
No criticism there! I admit its necessary sometimes. Just have to work around it when it is a thing. Ha
damn you the man ! thnx alot you saved my butt im finally done with the thing
nice. and glad to help! i needed a break from staring at the disgusting monstrosity that is raw ".x" files. 
ow snap thats hard to deal with esp for me im not a fan of blender
autodesk maya cant handle x files
I love me some blender. but i'm stuck using that fragMOTION app for now. through a windows vm. ha. only old blender can handle .x files, and i couldn't get that to work. i used the vanilla animations as my base, so i have to use an application that reads those ".x"
its to the point where i just edit the raw files to copy animations because its faster. i hate it, but it works
Sounds like hardcore stuff
Trying my hand at using classes in Lua and I'm genuinely not sure what I'm doing wrong.
I've made a minimal class:
require "MutiesDiary"
---@class MutiesDiary.Player
MutiesDiary.Player = {};
MutiesDiary.Player.Type = "MutiesDiary.Player";
---@field player IsoPlayer | IsoGameCharacter | IsoObject
---@param self MutiesDiary.Player
---@return boolean
function MutiesDiary.Player:canRead(self)
return not self.player:getCharacterTraits():isIlliterate();
end
---@param player IsoPlayer
---@return MutiesDiary.Player
function MutiesDiary.Player:new(player)
local object = {};
setmetatable(object, self);
self.__index = self;
self.player = player;
return object;
end
And then I call it with
local player = MutiesDiary.Player:new(character);
if not player:canRead() then return false end
elsewhere, but despite the :new() method being run perfectly, and self working fine in there, as soon as I return object I end up with a blank table 
Oh, you don't put self in the argument list for your class functions 🙂
@faint jewel Do you know if trailers from W900 Semi-Truck mod need a special parking zone to be spawned in?
not that i know of?
While testing my map and various mods, I have never seen any trailers to be spawned anywhere hmmm.
usually you do obj.player=player
do you get errors on player:canRead() ?
oh, yeah I see what you mean. No you don't do that
you either do obj.func(self) or obj:func()
self.player goes to the class, not the new obj. So every time you would set it to the whole class
@agile vigil
I see.
did you check by the mall?
u do mistake in new
function MutiesDiary.Player:new(player)
local object = {};
setmetatable(object, self);
self.__index = self;
object.player = player;
return object;
end
assign values to new table not to self cuz self in new function still just a MutiesDiary.Player
Poltergeist already pointed this out a few hours ago 🙂
ah, yea, didn't check it fully, fine 👍


