Register

Dorman Lakely's NPC Generator

An Add-on Module for Foundry Virtual Tabletop

Author: Dorman Lakely Project Source Foundry Versions 11+ (Verified 13) Last Updated 1 hour, 24 minutes ago

This package contains art, text, or software code produced using generative AI.

Claude AI assisted in the generation of the code and compiling tests. BUT I am a senior typescript developer and very much ensured good code quality and performance.

⚔ Dorman Lakely's NPC Generator

Version: 1.2.1

A powerful FoundryVTT module for generating complete D&D 5e NPCs with AI-powered names, biographies, and portraits.

✨ Features

  • Generate complete D&D 5e NPCs with full stat blocks
  • AI-powered name generation with cultural flavor support
  • AI-generated biographies with personality and physical descriptions
  • AI-generated character portraits using DALL-E
  • 36 playable and monstrous humanoid species
  • 12 D&D 5e classes with appropriate features and skills
  • Challenge Rating from 0 to 30 with accurate stat scaling
  • Multi-select personality traits system
  • Configurable AI creativity/randomness settings
  • Works with or without AI features

⚠ Important: API Key Required for AI Features

You must provide your own OpenAI API key to use AI features.

This module does NOT include an API key. AI features (name generation, biographies, portraits) will only work if you:

  1. Create an OpenAI account at https://platform.openai.com
  2. Generate an API key from the API Keys section
  3. Add credits to your OpenAI account (pay-as-you-go)
  4. Configure the API key in this module's settings

You will be charged by OpenAI based on your usage. See pricing information below.

⚙ Configuration

Step 1: Install the Module

1 In FoundryVTT, go to Add-on Modules and install Dorman Lakely's NPC Generator
2 Enable the module in your world settings

Step 2: Get an OpenAI API Key (Optional - for AI Features)

2 Sign up or log in to your OpenAI account
3 Click "Create new secret key"
4 Copy the key (it looks like: sk-proj-...)
5 Add credits to your OpenAI account in the Billing section

Step 3: Configure Module Settings

1 In FoundryVTT, go to Settings → Configure Settings → Module Settings
2 Find Dorman Lakely's NPC Generator
3 Configure the following settings:

AI Integration Settings

  • Enable AI Features: Toggle AI-powered generation on/off
  • OpenAI API Key: Paste your API key here (WARNING: Visible to all GMs)
  • OpenAI Model: Choose your preferred model:
    • GPT-4o Mini (Default) - Fast and affordable ($0.0001-0.0006 per NPC)
    • GPT-4o - Better quality ($0.0025-0.01 per NPC)
    • GPT-4 Turbo - Legacy model ($0.01-0.03 per NPC)
  • Portrait Art Style: Choose the visual style for AI-generated portraits:
    • Fantasy Painting (Default)
    • Fantasy Realistic
    • Fantasy Painterly
    • Digital Art
    • Anime Style
    • Pencil Sketch

AI Creativity Settings

  • Name Generation Randomness: 0.0-2.0 (default: 1.0)
    • Lower values = more consistent, predictable names
    • Higher values = more varied, creative names
  • Biography Generation Randomness: 0.0-2.0 (default: 0.8)
    • Lower values = more formulaic biographies
    • Higher values = more unique, creative biographies
  • Portrait Prompt Randomness: 0.0-2.0 (default: 0.9)
    • Affects the creativity of the prompt sent to DALL-E

💰 OpenAI Pricing Information

IMPORTANT: You pay OpenAI directly based on your usage. This module developer receives NO payment from your OpenAI usage.

Text Generation Pricing (Names & Biographies)

Model Typical Cost Per NPC Quality
GPT-4o Mini (Default) $0.0001 - $0.0006 Good - Fast
GPT-4o $0.0025 - $0.01 Better - Slower
GPT-4 Turbo $0.01 - $0.03 Legacy

Image Generation Pricing (Portraits)

Model Size Quality Cost Per Image
DALL-E 3 (Default) 1024x1024 Standard $0.04
1024x1024 HD $0.08
DALL-E 2 1024x1024 Standard $0.02
512x512 Standard $0.018

Cost Examples

  • Generate 10 NPCs with names and bios (GPT-4o Mini): ~$0.01
  • Generate 10 NPC portraits (DALL-E 3, Standard): $0.40
  • Generate 100 complete NPCs with portraits: ~$4.10

Note: These are estimates. Actual costs may vary based on complexity and randomness settings.

📖 Usage Instructions

Opening the NPC Generator

1 Click the Actors Directory tab (character icon on the left sidebar)
2 Click the "Generate NPC" button at the top of the Actors list

Basic NPC Generation

1 Folder (Optional): Choose a folder to organize your NPC, or leave blank
2 Campaign Flavor (Optional): Select a setting/theme (e.g., "Viking", "Forgotten Realms", "Steampunk")
3 Species: Choose from 36 options including:
  • Common PC races: Human, Elf, Dwarf, Halfling, Gnome, etc.
  • Exotic races: Aarakocra, Genasi, Kenku, Tabaxi, Triton, etc.
  • Monstrous humanoids: Goblin, Orc, Kobold, Lizardfolk, etc.
4 Gender (Optional): Select Male, Female, Non-binary, or other options
5 Role: Choose the NPC's class (Barbarian, Fighter, Wizard, etc.)
6 Name: Enter manually or click the AI wand icon to generate
7 Alignment: Choose from standard D&D alignments
8 Challenge Rating: Use the slider to set CR (0 to 30)
9 Personality Traits: Click the dropdown to select multiple traits as pills
10 Biography (Optional): Write manually or click the AI wand icon to generate
11 Portrait (Optional): Browse for an image or click the AI wand icon to generate ($0.04 per image)
12 Token (Optional): Browse for a token image
13 Click "Create NPC"

What Gets Generated Automatically

The module automatically calculates and generates:

  • Ability Scores: Scaled to CR with role-based modifiers and species bonuses
  • Hit Points: Based on CR and Constitution modifier
  • Armor Class: Based on CR and equipment
  • Speed: Species-specific movement (walk, fly, swim, climb)
  • Skills: Class-appropriate proficiencies based on CR
  • Saving Throws: Class-appropriate proficiencies
  • Languages: Species-specific languages
  • Equipment: CR-appropriate weapons and armor for the class
  • Class Features: Level-appropriate features from compendiums
  • Spells: For spellcasting classes, appropriate spell levels
  • Currency: CR-based treasure

🎨 AI Features Guide

AI Name Generation

  • Click the wand icon next to the Name field
  • The AI considers: Role, Species, Gender, Campaign Flavor, Alignment
  • Names are culturally appropriate and fit the chosen flavor
  • Cost: Less than $0.001 per name

AI Biography Generation

  • Click the wand icon next to the Biography field
  • Generates exactly 2 paragraphs:
    • Paragraph 1: Background and personality (2 sentences)
    • Paragraph 2: Physical description including species-specific traits (1 sentence)
  • The AI considers: Name, Role, Species, Gender, Alignment, CR, Personality Traits, Campaign Flavor
  • Cost: $0.0001 - $0.0006 per biography (depending on model)

AI Portrait Generation

  • Click the wand icon next to the Portrait field
  • Uses DALL-E to create original character artwork
  • The AI considers: Name, Species, Role, Gender, Biography (physical description), Portrait Art Style
  • Images are saved to: DormanNPCGenImages/portraits/
  • Cost: $0.04 per image (DALL-E 3 Standard, 1024x1024)
  • Generation time: 15-30 seconds

Portrait Generation Notes

  • The module shows a cost estimate before generating
  • Generation may fail if the prompt violates OpenAI's content policy
  • Images are original creations - no copyrighted characters or IP
  • You can regenerate if you don't like the result (additional cost)

🛠 Working Without AI

You can use this module without AI features enabled:

  • Enter NPC names manually
  • Write biographies manually (or leave blank)
  • Use your own portrait images
  • All stat generation, skills, equipment, and features work normally

Simply leave "Enable AI Features" turned off in the module settings.

❓ Troubleshooting

AI Features Not Working

  • Verify "Enable AI Features" is turned on in module settings
  • Check that your OpenAI API key is entered correctly
  • Ensure you have credits in your OpenAI account
  • Check the browser console (F12) for error messages
  • Verify you're logged in as a GM (AI features are GM-only)

Portrait Generation Fails

  • OpenAI may reject prompts that violate content policy - try different descriptions
  • Check that Foundry has write permissions to the Data folder
  • Network errors: Wait a moment and try again
  • Rate limits: If you generate many portraits quickly, you may hit rate limits

High Costs

  • Portrait generation is the most expensive feature ($0.04 each)
  • Switch to GPT-4o Mini for text generation (10x cheaper than GPT-4 Turbo)
  • Lower randomness settings can slightly reduce token usage
  • Monitor your usage at https://platform.openai.com/usage

📋 Tips & Best Practices

  • Generate biographies before portraits - the physical description helps create better images
  • Use Campaign Flavor for more thematically appropriate names and descriptions
  • Select personality traits before generating biographies for more detailed characterization
  • Higher randomness settings (1.5-2.0) produce more unique results but may be less predictable
  • Lower randomness settings (0.3-0.7) produce more consistent, formulaic results
  • CR determines the power level - stats, HP, AC, and equipment scale automatically
  • Generated NPCs appear in the Actors directory and can be edited like any other actor
  • Save your favorite portraits as tokens for future use

📞 Support & Information

⚔ Happy NPC Generating! ⚔

This module is not affiliated with OpenAI or Wizards of the Coast.

Categories

Available Versions

  1. Version 1.2.3

    1 hour, 24 minutes ago
    Foundry Version 11+ (Verified 13) Manifest URL Read Notes
  2. Version 1.2.2

    23 hours, 26 minutes ago
    Foundry Version 11+ (Verified 13) Manifest URL Read Notes
  3. Version 1.2.1

    1 day ago
    Foundry Version 11+ (Verified 13) Manifest URL Read Notes