Dataview - Return list of TTRPG Statblock Monsters (Patreon)
Downloads
Missing 1 full-res photo, 1 file, as this post has not yet been imported.
Content
This is a simple snippet of code that is super handy. Throw it into a note and it will return a list of monsters from the TTRPG Statblock JSON file. I use this to search for monsters than I might want to use in an encounter.
For example: I have lots of Kobold options but knowing which one I want to use can be a bit of a pain so I use this to create a list and then go shopping for my encounter.
Required Plugins
- Dataview
- TTRPG Statblocks / Initiative Tracker
Code Snippet - See attached for proper formatting
```dataviewjs
const monstersAsDvArray = dv.array(Array.from(window.bestiary.values())).filter(m => m.name).where(m => m.name.toLowerCase().contains('kobold'))
dv.table(["Name", "HP", "AC", "CR"], monstersAsDvArray.map((monster) => [monster.name, monster.hp, monster.ac, monster.cr]))
```
Replace the underscored 'kobold' with any name you wish to return.
Note: The monsters name needs to be all in underscores.
Files
Previews only