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:
- Create an OpenAI account at https://platform.openai.com
- Generate an API key from the API Keys section
- Add credits to your OpenAI account (pay-as-you-go)
- 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
Step 2: Get an OpenAI API Key (Optional - for AI Features)
sk-proj-...)Step 3: Configure Module 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
Basic NPC Generation
- Common PC races: Human, Elf, Dwarf, Halfling, Gnome, etc.
- Exotic races: Aarakocra, Genasi, Kenku, Tabaxi, Triton, etc.
- Monstrous humanoids: Goblin, Orc, Kobold, Lizardfolk, etc.
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
- Module Version: 1.2.1
- Compatible with: FoundryVTT v11-13
- Required System: D&D 5e
- GitHub: Repository
- OpenAI Platform: https://platform.openai.com
⚔ Happy NPC Generating! ⚔
This module is not affiliated with OpenAI or Wizards of the Coast.