Project Zomboid

Project Zomboid

[B42/B41] Bandits NPC (v2)
Crew 30 Dec, 2024 @ 7:53pm
[Build 42 Issue] In the "BanditCreator.MakeFromWave(wave)" function, the "clan" Lua table is nil; bandits cannot spawn.
OS: Linux (Debian Bookworm)
PZ Version: 42.0.2
Mod(s): Bandits

I originally mentioned the issue of NPCs not spawning in the Day One forum, but I dug a little deeper and found the errors concerned this mod. The mods were reinstalled many times by now, so I'm confident it's not corruption.

Every time the Lua is reloaded (along with the mod's files), 16 errors crop up, each pointing to the 16 clan Lua files (I can share my console.txt on request).

In all of them, the offending line is:

BanditCreator.ClanMap = BanditCreator.GroupMap or {}


With the error being:

"Exception thrown java.lang.RuntimeException: attempted index: GroupMap of non-table: null at KahluaThread.tableget(KahluaThread.java:1667)."


Once I start a game and debug-spawn bandits, another error appears now concerning the file BanditCreator.lua:

"Exception thrown java.lang.RuntimeException: attempted index: id of non-table: null at KahluaThread.tableget(KahluaThread.java:1667)."


This same error also appears when NPCs spawn legitimately on Day One, so I'd imagine the issue still arises when bandits are scheduled to spawn.

Here, the error is thrown in the "BanditCreator.MakeFromWave(wave)" function, once the properties of the appropriate clan file are attempted to be assigned to a bandit. Specifically this line at first:

bandit.clan = clan.id


It should be noted that "clan" was initialized to "BanditCreator.GroupMap[wave.clanId]" and reports as "nil" in the PZ debugger.

These errors only appear for Build 42; otherwise, the mods work perfectly fine back on Build 41. I didn't notice any substantial difference between the code of the two versions, but I don't know Lua. Considering there doesn't seem to be any other posts on this particular issue, it's potentially the kind of scuffed Build 42 beta for Linux. However, you'd be the best to determine that.

Also, great mod! :steamthumbsup:

EDIT 1: the addition of having reinstalled the mods and some formatting
Last edited by Crew; 30 Dec, 2024 @ 7:57pm