Project Zomboid

Project Zomboid

Braven's NPC Framework
Braven  [developer] 22 Nov, 2023 @ 6:03pm
Properties, Modules, Dialogue, etc.
In case you want to do some digging before you subscribe to the mod, or you are reading a guide, here's a list with brief explanations of all the properties, modules, dialogue types etc. the framework includes.

Modules
These are entire systems that you can subscribe and unsubscribe your NPC to, and will automatically manage their behavior based on the properties defined which are tied to each system:
  • MyLittleSave - Saves the Inventory of an NPC in a custom stash.
  • MyLittleMovement - Handles NPC movement.
  • MyLittleEmotions - Handles NPC reactions to emotes.
  • MyLittleDoorManager - Handles NPC closing doors automatically.
  • MyLittleSpeech - Handles NPC speech.
  • MyLittleCombat - Handle NPC combat.
  • MyLittleNameDisplay - Display NPC name as a tag.
  • MyLittleHealth - Handles custom NPC health properties.

Properties
These are passed into the BB_NPCFramework.CreateNPC() function, and define the behavior of your NPCs. ALL of them are optional, and have default settings:
  • isFemale (Boolean) - Is the NPC female?
  • firstName (String) - NPC name.
  • lastName (String) - NPC surname.
  • outfitName (String) - A fixed outfit for the NPC.
  • hairStyle (String - The NPC's hairstyle.
  • hairR,G,B (Number) - The color of the NPC's hair.
  • skinColorIndex (Number) - Index of the NPC's skin color.
  • spawnSq (IsoGridSquare) - The square in which the NPC spawns.
  • faceObj (IsoCharacter) - A character for the NPC to look at when it spawns.
  • target (IsoCharacter) - The character the NPC will follow at first.
  • infiniteAmmo (Boolean) - If true, the NPC won't use ammo at all.
  • resupplyAmmo (Boolean) - If true, the NPC will get ammo when they run out.
  • ignoreBites (Boolean) - If true, the NPC will be invulnerable to bites.
  • isTough (Boolean) - If true, the NPC will be harder to damage.
  • fasterHealing (Boolean) - If true, the NPC will heal from wounds much faster.
  • regenHealth (Boolean) - If true, the NPC will regenerate health over time.
  • canFlee (Boolean) - If false, the NPC won't flee from enemies.
  • aimSpeedMultiplier (Number) - Multiply the speed at which the NPC aims at targets (Ranged only).
  • fleeDistance (Number) - How many squares the NPC will move away from enemies.
  • combatStance (String) - "Offensive" or "Defensive".
  • dialogueStringPrefix (String) - The prefix of the IG-UI dialogues of the NPC.
  • speechSfx (String) - A sound effect to play whenever the NPC talks.
  • speechColor (Table) - { R = ?, G = ?, B = ? }

Dialogue Types
There are various dialogue types that will be automatically triggered by various modules and be handled through MyLittleSpeech. Below is a list of all of the types, and their index.

To make your NPC compatible, create a IG_UI_EN.txt file in lua\shared\translate\EN, and respective languages.
Example: IGUI_OpEclipse_Specter_Acknowledge_1 = "Acknowledged, over and out."

  • Attack - 1 to 5
  • Trading - 1 to 5
  • Equip_Weapon - 1 to 3
  • Equip_Clothing - 1 to 3
  • CombatMode_Offensive - 1 to 3
  • CombatMode_Defensive - 1 to 3
  • Traveling_Day - 1 to 5
  • Traveling_Night - 1 to 5
  • Vehicle_Enter - 1 to 4
  • Vehicle_Exit - 1 to 4
  • Acknowledge - 1 to 5
  • NoAmmo - 1