let current = dv.current();let title = current.name || current.file.name;// --- CONFIGURATION ---// Set to your silhouette image path or filename (e.g., "npc-images/silhouette.webp" or "silhouette.webp").// If the file doesn't exist or is set to "", it will gracefully display the text message below.let fallbackImage = "npc-images/silhouette.webp"; // ---------------------// 1. Gather all potential names (Title, quoted nicknames, and Obsidian Aliases)let rawNames = [title];// Extract quoted nickname if present in title (e.g., Wulfric "The Bear" -> The Bear)let matchNick = title.match(/"([^"]+)"/);if (matchNick && matchNick) { rawNames.push(matchNick);}// Safely pull aliases from Obsidian Frontmatter/Propertieslet rawAliases = current.file?.aliases || current.aliases || [];if (typeof rawAliases === "string") { rawNames.push(rawAliases);} else if (rawAliases && typeof rawAliases[Symbol.iterator] === "function") { for (let a of rawAliases) { if (a && typeof a === "string") rawNames.push(a); }}// 2. Build sanitized search terms (ensures terms are >= 2 chars to avoid matching "_" or empty strings)let searchTerms = new Set();for (let name of rawNames) { if (!name || typeof name !== "string") continue; let lower = name.toLowerCase().trim().replace(/["']/g, ""); let slug = lower.replace(/[\s-]+/g, "_").replace(/^_+|_+\$/g, ""); if (lower.length >= 2) searchTerms.add(lower); if (slug.length >= 2) searchTerms.add(slug);}// 3. Search npc-images for matching character fileslet matches = app.vault.getFiles().filter(f => { let pathLower = f.path.toLowerCase(); if (!pathLower.includes("npc-images")) return false; // Exclude the fallback image from character search if (fallbackImage && pathLower.includes(fallbackImage.toLowerCase())) return false; let imgName = f.name.toLowerCase(); return Array.from(searchTerms).some(term => term && imgName.includes(term));});// 4. Prioritize files with "avatar" in the name, otherwise take first matchlet match = matches.find(f => f.name.toLowerCase().includes("avatar")) || (matches.length > 0 ? matches : null);// 5. Render artwork, fallback image, or clean text messageif (match) { dv.paragraph(`![[${match.path}|cover]]`);} else { // Flexible fallback image lookup (works with filename, full path, or partial match) let fallbackFile = null; if (fallbackImage && fallbackImage.trim() !== "") { let cleanFB = fallbackImage.toLowerCase().trim(); fallbackFile = app.vault.getFiles().find(f => f.path.toLowerCase() === cleanFB || f.path.toLowerCase().includes(cleanFB) || f.name.toLowerCase().includes(cleanFB) ); } if (fallbackFile) { dv.paragraph(`![[${fallbackFile.path}|cover]]`); } else { dv.paragraph(`*No artwork generated yet for ${title}*`); }}
// 5. Render artwork or fallback
if (match) {
dv.paragraph(![[${match.path}|cover]]);
} else {
let fallbackFile = fallbackImage ? app.vault.getAbstractFileByPath(fallbackImage) : null;
if (fallbackFile) {
dv.paragraph(![[${fallbackFile.path}|cover]]);
} else {
dv.paragraph(*No artwork generated yet for ${title}*);
}
}
- **Mannerisms:**
Recent Activity
This section displays every time this entity is mentioned in session summaries.
Athelstan and Wulfric Skullsmasher entered the town of Dun to rest during their travels. Whilst there they learned that there had been recent disturbances in town due to rumours of both vampires and vampire hunters. Athelstan and Wulfric spoke with Vincent, an alleged wealthy merchant’s son, who was staying within the Horned Chicken Tavern. Wulfric took a dislike to Vincent due to his condescending attitude regarding Wulfric’s intelligence.
The town guards asked Athelstan and Wulfric to accompany them to the Custodian’s estate. There they met Custodian Layton Graylock who offered them a contract. Graylock requested that they deal with the vampire hunters who were overzealous and causing his people trouble. Graylock advised that he did not wish to deal with them himself overtly due to the hunters having some form of connection to powerful figures in Estwatch. Graylock advised that he wished them to simply be gone but would not frown at any methods used. Graylock also admitted that there was a vampire within the town and that he would be contract them both to deal with this vampire also.
Athelstan and Wulfric accepted and confronted the vampire hunters within their makeshift base of operations. The hunters were within the basement of an abandoned temple devoted to the Seven Divines, long since abandoned since Aldovia ceased worshipping them. Athelstan and Wulfric found the hunters (Borel, Rosalyn, and Alathar) unrelenting and the situation devolved to violence with the hunters dying.
Athelstan and Wulfric tracked the vampire subterranean lair down and discovered that Vincent was the vampire in question. Vincent was ready for Athelstan and Wulfric and, using necromancy, slaughtered an entire family upon them confronting him. This raised several incorporeal undead who forced Athelstan and Wulfric to retreat for a brief time. Athelstan and Wulfric returned, now more knowledgeable of the threat, and defeated Vincent, and his minions.
Vincent, upon his body being destroyed, became mist and returned to his resting place which was hidden within a collapsed section of the lair. Wulfric immediately began digging through the rock and earth and in only a couple of hours had found Vincent’s recuperating body.
Athelstan and Wulfric staked Vincent in his resting place with Wulfric putting a book into his unconscious mouth. Wulfric commented that he had promised Vincent that he would make him eat his own book.