Hello, Readers!

So I recently learned thanks to the below video that my Druid ( which, in 5e, has its spell selection function like a Clerics does ) can swap out his spells every time he takes a long rest if he chooses. As I've chosen a chaotic good character, and I used RNG to generate the character otherwise, I figured it'd be a fun experiment to try choosing his spells randomly each rest! I even thought to myself, "You know, I probably could whip up a script to do this for me!"

How many spells does my cleric know?

I then forgot about this -- or so I thought. As it turns out, my brain didn't. And as I was dozing off, my brain suddenly went on high alert, showing me a completed framework, a program flow, to solve the issue I had dismissed earlier. And just would not let me go to sleep until I coded it. So, I present to you...

Clarjon1's D&D 5e Druid Spell Slot Generator Script!

5eDruidSpellSlotGenerator.pl

This would also work for rolling up wizards and clerics, just need to swap out the spells, and disable the Druid specific "Circle" bits ( or leave the character level var set to 0! ). A future iteration will likely clean up how things work to reduce code reuse, using dynamic variable names...

But it works well, and the first session with spells spat out by this script was a lot of fun! Below is the output of the first playsession's spells for my level 3 druid:

Cantrips:
---------
Produce Flame
Guidance
Poison Spray
=========
Level 1 Spells:
---------------
Cure Wounds
Faerie Fire
Detect Poison and Disease
Entangle
=========
Level 2 Spells:
---------------
Circle of the Swamp: Acid Arrow
Circle of the Swamp: Darkness
Moonbeam
Moonbeam
=========
Level 3 Spells:
---------------
=========
Level 4 Spells:
---------------
=========
Level 5 Spells:
---------------
=========
Level 6 Spells:
---------------
=========
Level 7 Spells:
---------------
=========
Level 8 Spells:
---------------
=========
Level 9 Spells:
---------------

There will be some more cleanup done for sure, things like "Don't output some stuff if the relevant var == 0" for example... but hey, for some code scratched out in the middle of the night¸borne from the rambling mind as it drifts off to sleep...

Next Post Previous Post