Home Creators Posts Import Register Favorites Logout
haven't archived this post yet. have a subscription? use the importer!

Downloads

  • Dataview - Query TTRPG Statblocks.md

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

Comments

CJ the wise

Is there a way to modify the search so that instead of searching by name it searches by monster type or CR? I've been messing around with it and unable to figure out how to get it to search for something other than the monster name.