Project Zomboid

Project Zomboid

Dynamic SandboxVars
30 Comments
JJman Mar 24, 2023 @ 2:52pm 
Does this mod still work?
pillow May 29, 2020 @ 6:01am 
Not sure if you still maintain this. I used this to learn how to modify sandbox settings. Your implementation is a little tough for users. You may be able to allow them to simply create a preset with a specific name for the "From" and "To" variables. Here's how I did it in one of my mods :

local options= {}
if getSandboxPresets():indexOf("pillow") == nil then
SandboxVars = require "Sandbox/Apocalypse"
else options = getSandboxOptions():loadPresetFile("pillow");
end
JREALMZ Dec 28, 2019 @ 8:17pm 
it still works on v41?
JREALMZ Nov 25, 2018 @ 1:50pm 
thank you, i dont know project zomboid modding very well
Morry  [author] Nov 25, 2018 @ 10:32am 
As stated above you can find all names of sandboxVars in a sandboxvars.lua in the USERNAME/Zomboid/Server folder. If you can't find the car sandbox vars, then I don't know where to find them. It's been over a year since I've modded Zomboid.
JREALMZ Nov 22, 2018 @ 11:43am 
How do you configure the mod so the general state, gas, and amount of the vehicles you encounter decreases over time?
M700N Aug 2, 2018 @ 2:03am 
Okay thanks anyway Morry
Morry  [author] Aug 1, 2018 @ 11:10am 
The mod can't do such things unfortunately. It can only do one rule for each sandbox setting, adding more just overwrites the setting.

You could try to change the ini mid-game, OnDusk triggers the updating of sandboxvars.

Or do not use any rule for it and instead use a cheat mod with a lua interpreter to the ElecShut vars by hand. You'll probably have to call getSandboxOptions():updateFromLua(). But I'm not really sure anymore, it's been almost a year since I've modded Zomboid.
M700N Jul 31, 2018 @ 5:21am 
@Morry Can you allow this to work for Power Outages? For example;

sandbox ElecShut 7 1 2
sandbox ElecShutModifier 900 -1 2
sandbox ElecShut 1 7 4
sandbox ElecShutModifier -1 900 4
sandbox ElecShut 7 1 6
sandbox ElecShutModifier 900 -1 6
sandbox ElecShut 1 7 8
sandbox ElecShutModifier -1 900 8

So in this example the electricity would cut off after 2 days, then switch back on after 4, then off again after 6 and then back on again after 8 days.
JREALMZ Jan 2, 2018 @ 6:55pm 
how do you decrase the chance of meta events over time?
neurogue Dec 4, 2017 @ 5:19pm 
Can I change the hunger value with this mod? I mean reduce the amount of food it requires me to eat a lot every in-game day.
Morry  [author] Nov 6, 2017 @ 6:00am 
That'd require a whole rewrite and would result in even less user friendly ini shenanigans. I'm not going to do that. You can pretty much achieve that yourself by updating sandbox variables by hand with the lua interpreter of cheat mod, when you feel like something should happen more/less often now.
Ziggylata Nov 6, 2017 @ 2:26am 
Actually, I meant chosing a start date for events, for example, helicopter events not happening at the start and gradually being more common up until a point where they die back down again. Things like that.
Morry  [author] Nov 5, 2017 @ 6:06am 
When the [Amount of Days] has passed the [End Value] is reached, values between the start value and end value are linearly interpolated, if there are values between them to begin with.

I'm not sure what you mean. The [Amount of Days] already counts from the start date. Do you mean deciding every value for a specific date? (passedDays, value) tuples or something?
Ziggylata Nov 5, 2017 @ 3:27am 
Can you make it so changes happen at certian dates? For example, it waits until 30 days in?
Morry  [author] Nov 5, 2017 @ 2:23am 
yes that place.
Ziggylata Nov 4, 2017 @ 1:28pm 
So the .ini is placed in the zomboid folder where your user is and not in the steamapps?
Like this: http://puu.sh/yeM5O/99d8998901.png
DungeonSlasher Oct 28, 2017 @ 3:31pm 
Understandable.
Morry  [author] Oct 28, 2017 @ 3:21pm 
It only affects spawning, so it's not going to remove anything that has already been spawned.
DungeonSlasher Oct 28, 2017 @ 3:05pm 
Will this affect things in my safehouse? How can I prevent the mod from removing stuff from my shelves?
ddraigcymraeg Oct 26, 2017 @ 12:26pm 
This is really cool. Thanks.
Morry  [author] Oct 14, 2017 @ 10:35am 
Loot should now decrease more gradually, but it's still connected to the sandbox options. I might later make a simpler version of this mod that will only focus on loot but allow more precise control on how it decreases and how much.
cocoayoc Oct 10, 2017 @ 9:42pm 
i was going to use this but writing the rules was too confusing
EPOC16 Oct 10, 2017 @ 8:40am 
This looks like something that may be interesting on the New dawn server... I am going to have to look into this deeper and see if it will be a good fit.
Morry  [author] Oct 5, 2017 @ 11:09am 
@Toyun, currently it just switches between sandbox settings over time. Most sandbox variables can only have integer values, so there can't be a gradual change (e.g. zombie speed). So at the moment, unless the difference between the start and end value is larger than 1, you're not going to get any 'inbetweening' and it's just going to switch when the amount of days pass.

That being said, loot drop rate isn't completely determined by sandbox variables. I might be able to make that decrease more gradually. I'm going to look into that.
Akimbo Swords Oct 5, 2017 @ 8:20am 
Nice mod, I will be sure to try it on my next playthrough.
Toyun Oct 5, 2017 @ 7:29am 
Does the changes come gradually or only when the "amount of days"-value has been reached?
DustyDinklemen Oct 4, 2017 @ 10:18pm 
Like the first one. Decrease loot spawn over a month. Makes it super more in-depth and I guess more realistic. Sad how community does more important fixes/changes to the game rather than the devs.
Morry  [author] Oct 1, 2017 @ 3:36am 
Yes you should also download the ini, without it the mod does nothing.
AbacateVito Sep 30, 2017 @ 6:34pm 
Ok, so I should subscribe to the mod AND also download the .ini thing?