Mastering FoundryVTT Rule Elements: Dice, Logic & Detachment
Hey there, fellow FoundryVTT enthusiasts and creative GMs! Ever found yourself wrestling with the platform's incredible Rule Elements, only to hit a wall when trying to craft truly dynamic and persistent custom effects? You're definitely not alone, and today we're diving deep into some game-changing feature requests that could revolutionize how we build custom content, especially for systems like Pathfinder 2e. We're talking about bringing math and logic operations directly into dice formulas within Rule Elements and, perhaps even more crucially, introducing a 'detach' option for onDeleteActions when dealing with inMemoryOnly effects. Imagine the possibilities, guys: no more rigid, one-size-fits-all effects, no more frustratingly fleeting conditions that vanish when they really shouldn't. The current limitations, particularly when trying to set up nuanced effects like Persistent Fire damage based on an effect's badge value, can really cramp a GM's style, leaving us unable to create the rich, reactive worlds we envision. This discussion isn't just about minor tweaks; it's about unlocking a whole new level of customization and automation, making our virtual tabletops even more immersive and less reliant on manual workarounds. We'll explore why these enhancements are so critical, how they'd work, and the incredible impact they'd have on your campaigns, freeing up your mental bandwidth to focus on storytelling rather than system mechanics. Let's dig in and see how we can push the boundaries of what FoundryVTT Rule Elements can do!
The Frustration of Current Rule Element Limitations
Why Dynamic Dice Formulas Matter
When we talk about FoundryVTT Rule Elements, their power lies in their ability to automate complex game mechanics, but current implementations often hit a ceiling when effects demand truly dynamic dice formulas and conditional logic. Take for instance, a custom effect that grants Persistent Fire damage based on the badge value of another active effect. In our current environment, while we can reference data.badges.value in some contexts, directly embedding mathematical operations or conditional logic within a dice formula – something like [[floor(@actor.data.badges.value / 2)]]d6 or [[(@actor.data.badges.value > 5 ? 2d6 : 1d6)]] – is simply not supported. This fundamental limitation means we're often stuck with static values or overly complex workarounds using multiple rule elements, each with its own specific predicate, just to achieve what a single, intelligently designed dice formula could accomplish. This is a huge roadblock for GMs and content creators looking to implement nuanced scaling effects, where damage, healing, or other numerical outcomes depend on a sliding scale or specific thresholds of a character's current state, a spell's power, or an item's charge. Without these advanced dice formula capabilities, the flexibility of the GrantItem RE or other Rule Elements is severely curtailed, preventing us from creating truly reactive and adaptive game mechanics that respond organically to the evolving game state. We're left with a system that's incredibly powerful but rigid in key areas, forcing us to choose between simplified effects or an unmanageable web of conditional rule elements that are difficult to maintain and debug. This is where the core of our frustration lies: the desire to push FoundryVTT's automation further, but being held back by the inability to perform basic calculations and logical checks right where they're needed most – within the very dice rolls that define so much of our gameplay.
The Persistent Damage Dilemma
Let's zero in on a particularly vexing issue that many GMs and content creators have encountered: the persistent damage dilemma, especially when trying to manage effects like Persistent Fire damage that originate from an inMemoryOnly Rule Element. The crux of the problem arises when an effect, such as one granting Persistent Fire damage based on a badge value, is configured to be inMemoryOnly. While inMemoryOnly is fantastic for temporary, dynamic effects that shouldn't clutter the actor's sheet permanently, its tight coupling with onDeleteActions means that when the source Rule Element changes its conditions (e.g., the badge value is lowered or the effect simply expires), the associated persistent damage condition or other granted item is immediately and automatically removed. Imagine, guys, you've got a cool custom spell that applies a lingering burn, scaling with the spell's power. If that power is represented by a badge value on the spell's effect, and the spell's duration ends or its power diminishes, the persistent burn should remain for its own duration, independent of the original trigger's status. Yet, under the current FoundryVTT framework, the persistent damage vanishes alongside the original effect that granted it, even if the intention was for it to persist. This creates an immersion-breaking disconnect and forces GMs into tedious manual tracking or convoluted system-agnostic macros to re-apply conditions that should have simply detached from their source. We need a mechanism, perhaps an onDeleteActions: { detach: true } property, that explicitly tells the system: