Project Zomboid

Project Zomboid

Generator Sound and Power Range
 This topic has been pinned, so it's probably important
ribs  [developer] 23 Aug @ 4:17am
How to lower generator sound and remove power range caps
The sound players hear from the generator is hardcoded in Java and isn’t the same as what zombies hear.
In sandbox settings, the generator’s vertical power range is capped at 15.

To change this, you need to decompile Java classes. I will not explain how to do that here.

However, you can download my compiled classes and check for yourself.
This is not completely safe and might break your game, so make sure you have a backup ready.
The files are safe because I made them. If your antivirus warns you, it is only because they are compiled files.

Easy way: download the compiled classes
Make sure to back up the ProjectZomboid\zombie folder in case something goes wrong.
Download the zip file from workupload DOT com /file/vgKGhcMCF7v
Extract and paste into the ProjectZomboid directory.

And that's it.

Hard way: editing the classes
To lower the generator sound level for the player:
Inside ProjectZomboid\zombie\iso\objects\IsoGenerator.class, method playGeneratorSound.
Add the following command to decrease the sound (1.0 is 100% of the volume, 0.2 is 20%):
v1.setVolumeAll(0.2f);

To remove the skyscraper basement/skyscraper cap:
Inside ProjectZomboid\zombie\iso\objects\IsoGenerator.class
Some methods that use the variable GeneratorVerticalPowerRange are capped, for example:
Math.min(8, this.getSquare().getZ() + GeneratorVerticalPowerRange);
This limits the generator’s vertical power range to a maximum of 8 floors

To remove the sandbox max vertical cap setting:
Open ProjectZomboid\zombie\SandboxOptions.class.
Increase the variable limit to the maximum possible (32):
this.GeneratorVerticalPowerRange = this.newIntegerOption("GeneratorVerticalPowerRange", 1, 32, 3);

And that's it.

Q&A

Which version are you using?
B42.11.0

Are these files stable?
Probably not, since they replace a main file. You can try to use them with newer versions, but there is a good chance things will break.

Why are you doing this then?
Because I can.

Do you plan to maintain this file?
It depends on whether I keep playing the game.

How can I edit Java classes?
I will not teach that here. It is better not to discuss it on this platform.

Is this safe for MP?
It is not even completely safe for SP 🤣. But you will probably be fine. It only changes the behavior I mentioned above.

Does changing a hard-coded implementation like this cause bugs?
Of course it can. I am just showing you the way. I did not have much time to make it completely fail-proof.
Last edited by ribs; 23 Aug @ 6:01pm