Action Resources - osirisOfGit/BG3_Absolutes_Laboratory GitHub Wiki

Action Resources Mutator

Dependency On: (Sub)Classes || Transient: False (Unless the game is restarted, then True) || Additive: Yes - Resources will be merged together into one pool, with later mutators overwriting earlier ones if the same resource is configured


Action Resources Overview

This mutator has two sections, to cover both the General and Class-Specific use-cases. This mutator doesn't really have any randomness associated to it, as even a single extra resource has major implications for balancing - as such, users have complete control over the amounts given.

This mutator currently doesn't account for what resources the entity currently has - for example, adding 3 level-2 spell slots to an entity with 3 slots already will result in them having 6. I may change this in the future, depending on feedback.

General resources apply to every entity, but will be overwritten by class-specific resources designated below it. Class-specific resources check the Classes component on the entity, hence the dependency on (Sub)Classes mutator - this isn't tied to Spell Lists are classes already sort of are, and this is more intended for thematic resource allocation, like giving Bards Bardic Inspiration, Paladins Lay On Hands charges, etc.

Implementation Details

  • This is pretty much the only mutator I wanted to ensure worked between reloads, as the enemy regaining spell slots for example would be extremely impactful if a combat encounter was reloaded. To account for this, I dynamically create new a Status for each entity that is affected by this Mutator, using the Boosts property to add the new resource - this way, the Boosts are backed by a concrete Stat loaded on the server and the game persists the change.
    • This works until the game is exited, as dynamically created Stats only exist in the SE bank and aren't actually backed by a Stat file in the game, so they need to be recreated every game launch, but since ModVars and Entities are available per-save, and a save isn't loaded on Game startup, Lab doesn't know what Stats to recreate before the save is loaded. This causes the resources to reset to their original values on the first Save load, before being boosted again by Lab.
      • I can solve this by using a local file to track what stats are created, but I'd rather avoid that if possible - I'm not sure how big of a deal this behavior will be given its super narrow conditions. Feedback needed.

Demo

bg3_dx11_v4XzSiOsII.mp4

Sample Logs

[DEBUG] (S) ==== Starting mutator Action Resources (priority 8) ====
[DEBUG] (S) Class Bard is present on the entity - adding resources
[DEBUG] (S) Not adding resource Attunement to the boosts as the final amount is 0.0
[DEBUG] (S) Final boosts are ActionResource(BardicInspiration,8,0);ActionResource(Movement,4,0);ActionResource(SpellSlot,5,2);
[DEBUG] (S) Updating Resource Stat ABSOLUTES_LAB_RESOURCE_BOOST_e96976c7bac0
[DEBUG] (S) ==== Finished mutator Action Resources in 0ms ====
⚠️ **GitHub.com Fallback** ⚠️