Project Zomboid

Project Zomboid

Braven's Camouflage
This topic has been locked
Braven  [developer] 27 May, 2023 @ 4:02am
Why the zeds are a bit buggy
The Problems
I know some people will ask, so here it goes. Sometimes, the zeds just stand there looking at the Player without doing anything. I have experienced this on singleplayer though I believe if two players are together they won't do that, instead moving on to whoever is NOT camouflaged.

Additionally, the zombies of course will still follow camouflaged players around and attempt to attack them, though they will never be able to. Why is that?

The Answers
All of that comes to the part of the code I've written that prevents zombies from attacking the Player. There are various methods of doing this, but they are all flawed. I've chosen the one I think is the least problematic.

Make the Player a ghost
In previous builds this used to work, as it just made the player invisible to the zombies. Recently, it also just... muted the player. For no reason. So you don't make sounds at all. Also apparently you are actually invisible to other players while in multiplayer too, so this was discarded.

Make the player temporarily a ghost
Ok what if we make it real quick? WELL. That would require a TON of logic being calculated in real-time, for every nearby zombie. No bueno. Also, there would always be exceptional situations where it wouldn't work at all, leading to people dying on my watch.

Prevent zombie from targeting the player
Cannot be done through code. There is simply no vanilla function for this, and we cannot directly alter it as modders.

The solution
The solution was to mess with the zombie AI just enough that they cannot harm the player, but is still completely functional, allowing the mod to work perfectly on multiplayer. This comes with the side effect of zombies following the player around, which can easily be solved by the player just... going away. As they should.
Last edited by Braven; 27 May, 2023 @ 4:03am