FG Spreadshirt Swag
Page 1 of 3 123 Last
  1. #1

    5E Extension - Chat Effects & NPC Variables

    Forge Page:
    https://forge.fantasygrounds.com/shop/items/741/view

    Description:
    This D&D 5E extension does a few unique yet semi-related things. It parses effects outputted to chat from any source and converts them into a draggable effect. It also parses effects in NPC text blocks and adds them to the relevant Combat Tracker field. And finally, it allows math and variables to be used within NPC spells, traits, and actions.

    (As a small aside, this extension also automatically fixes NPC's Mage Armor spell to give the correct amount of AC, instead of always just giving a +3 bonus to AC regardless of the creature's current AC and DEX as it does in the base 5E ruleset)

    Effect Parsing:
    This extension parses effects outputted to chat from any source and converts them into a draggable effect. The most common uses would be through a table output or /roll 0 {message} or /die 0 {message} chat commands.



    This also works for table results that are outputted to chat, NPC spell/action entries in the Combat Tracker, and more.


    (A table result being parsed into a draggable effect)

    Syntax:
    The syntax is a little bit custom. All effects are prefaced with "[EFFECT]" followed by whatever effects you want using the regular effect syntax. Each effect must end with a semicolon (even the final effect). After the final effect, the following tags can be provided to alter the default behaviour (words surrounded by <> need to be replaced and # is any number. Do not include the <WORD> or # in the actual effect)

    Tags:
    "[D: # <UNIT>]" - sets the duration of the effect and optionally the units of duration (min, hour, day. Defaults to rounds).
    "[UNITS: <UNIT>]" - sets units of duration (min, hour, day) if for some reason you don't want to do so in the duration tag.
    "[ROLL]" or "[ACTION]" or "[SINGLE] or [DUSE] (BCE only)" - sets the action expiry.
    "[ATS] or [DTS] or [RTS] or [AS] or [DS] or [RS] or [AE] or [DE], or [RE], or [SAS] or [SDS] or [SRS] or [SAE] or [SDE], or [SRE]" - sets the BCE change state (BCE only).

    Non-functional tags:
    The following tags are implemented, but due to how Fantasy grounds handles untargetted effects, do nothing since their values are cleared on untargetted drops (which all from-chat effects are).
    "[T: <TARGET>]" - Sets the targeting.
    "[by <SOURCE>]" - Sets the source of the effect.
    "[INIT: #]" - Sets the initiative order to expire the effect on.

    All of these tags can only be provided for the whole [EFFECT] tag, meaning it isn't possible to define duration for individual effects within the effect text. Additionally, only one [EFFECT] tag can be defined per text box. The space after the colons are optional.

    Examples:
    [EFFECT] Stunned;
    [EFFECT] RESIST: all; ADVATK; [D: 5 mins]
    [EFFECT] DMG: 2d6 fire [D: 1] [ROLL]
    Limitations:
    This currently does not work for direct-to-chat messages, something must output a message to chat for it to parse effects within it. Using /roll 0 {message} or /die 0 {message} are the simplest ways to do this.

    ---

    NPC Action Effect Parsing:
    In addition to parsing effects in chat, this extension also parses effects in NPC stat block actions and spells. If a spell or action does not give you a draggable effect on the NPC record or CT entry, you can simply add an [EFFECT] tag to the bottom of that action and not only will it be highlighted and draggable, but it will also show up in that action's entry on the Combat Tracker.

    You must use the Combat Tracker effect syntax for effects in the Combat Tracker. This means doing something like this "[EFFECT] AC: 5; (D:3 MIN)" to set the duration and "[EFFECT] AC: 5; (A:ROLL)" to set the expiry, as the above tags are ignored in the Combat Tracker (no space after the colon on these CT-specific tags, and they are positioned before the final semicolon of the last effect)


    (A custom weapon effect in a NPC action being parsed to the Combat Tracker)

    MATH tag:
    In NPC records and effects, you can also use a new tag [MATH:] which will parse simple mathematical equations inside the tag, like [MATH: 4+6]. It also supports some mathematical functions like floor(), ceil(), abs(), log(), min(), max(), sin() and others. This tag uses LuaXP to parse these math equations, so go checkout the github for more information: https://github.com/toggledbits/luaxp.

    Note: If the final value of a math operation is a non-whole number, fantasy grounds will treat it as a 0, so it's best to round down the numbers (specifically CR) using floor() inside the MATH tag.

    Variables:
    There is also support for certain variables of creatures. Adding any of these variables anywhere in an NPC action or in any effect will replace the variable with the creature's corresponding stat. The available variables are as follows:

    [AC] - The creature's Armor Class.
    [HP] - The creature's maximum Hit Points.
    [CURHP] - The creature's current Hit Points.
    [CR] or [LVL] - The creature's Challenge Rating (converted to decimal form) or total level if it's a player. Both variables do the same thing regardless of PC or NPC.
    [PRF] - The creature's Proficiency Bonus.
    [STR], [DEX], [CON], [INT], [WIS], or [CHA] - The creature's ability modifier for the specified ability. Works with extensions that add new abilities.

    These variables do not update in real-time and require the NPC record to be closed and reopened to reflect any changes to the base stat, or for the effect to be re-applied if the variable is inside an effect.


    (Variables being used inside an effect. Notice how the effect has different values when applied to different creatures. If this effect was applied from a PC character sheet, it would always use the player's stats instead of the target's.)

    Examples:
    This example is a weapon attack that adds the NPC's proficiency bonus to the attack roll, and rolls a number of d6 damage dice equal to the NPC's Challenge Rating with it's Dexterity modifier added to the damage.

    For this particular NPC, the game treats this action as if it instead says "Melee Weapon Attack:+3 to hit, reach 5 ft., one target. Hit: 5d6 + 2 slashing damage." since the creature's CR is 5, Proficiency bonus is +3, and Dexterity modifier is +2.

    This example is a breath weapon that adds five times the NPC's proficiency bonus to the DC of the Dexterity saving throw, and rolls a number of d6 damage dice equal to half the NPC's Challenge Rating rounded down, with it's Proficiency Bonus added to the damage.

    For this particular NPC, the game treats this action as if it instead says "Each creature in that area must make a DC 15 Dexterity saving throw, taking 2d6 + 3 fire damage on a failed save." since the creature's CR is 5 and its Proficiency bonus is +3.

    ---

    New Effect: REDUCE (Undo Damage/Heal extension only)
    The REDUCE: x effect will reduce the last damage you took by x after you apply the effect. This can be used for things like Stone's Endurance to reduce the last damage you took when applying the effect by 1d12 (i.e. REDUCE: 1d12). The effect is automatically removed after applying it.

    Limitations:
    The text-highlighting when hovering over draggable text is not always the correct size, and ends up underlapping or overlapping other text when used with variables and the MATH tag.
    MATH tags with variables inside them do not work as expected when used in a PC's power/spell effects on the abilities tab of their character sheet; it applies variables based on the target's stats, not the caster's.

    Compatibility:
    This extension should be fully compatible with almost any extension. Unless another extension modifies PowerManager.parseNPCPower (which this extension overrides).

    Changelog:
    - Updated to v1.1.2
    -- More bug fixes related to BCE integration.
    - Updated to v1.1.1
    -- Bug fixes related to BCE integration.
    - Updated to v1.1.0
    -- Many bug fixes. Added support for BCE extension (Thanks rhagelstrom), Added support for Undo Damage/Heal extension.
    - Updated to v1.0.7
    -- Updated Mage Armor effect to use new tag format.
    - Updated to v1.0.6
    -- Hidden table rolls will now be parsed for effects.
    - Hotfix to v1.0.5.1
    -- Nil chat message text will no longer throw an error.
    - Updated to v1.0.5
    -- NPCs can now have multiple EFFECT tags per line.
    - Updated to v1.0.4
    -- Added CURHP variable.
    - Hotfix v1.0.3.1
    -- Fixed issue with duration units.
    - Updated to v1.0.3
    -- All variables now work inside PC character sheets. The variables use the player's stats instead of the recipients', as per default FGU effect tag behavior.
    - Updated to v1.0.2
    -- Changed variable syntax to better match FGU player effect tags.
    - Updated to v1.0.1
    -- Added support for variables and math in effects.
    Attached Files Attached Files
    Last edited by GEONE; August 11th, 2023 at 08:04. Reason: Updated to 1.1.2

  2. #2
    Updated to v1.0.3
    - All variables now work inside PC character sheets. The variables use the player's stats instead of the recipients', as per default FGU effect tag behavior.

  3. #3
    Updated to v1.0.4
    - Added CURHP variable. Removed chat debug.

  4. #4
    Updated to v1.0.5
    - NPCs can now have multiple [EFFECT] tags per line.


  5. #5
    Is there any way to use the MATH function to cause an attack to deal double damage (not just double dice like a normal crit)?

    My current workaround is to give the target a VULN: all effect before processing damage.

  6. #6
    Quote Originally Posted by mattvictim View Post
    Is there any way to use the MATH function to cause an attack to deal double damage (not just double dice like a normal crit)?

    My current workaround is to give the target a VULN: all effect before processing damage.
    MATH seems like it would be able to cause the attack to do something like double strength as a damage bonus, rather than modifying the result after the roll. However, the Blissful Ignorance extension provides the DMGMULT effect to multiply the bearer's damage totals.
    My Forge creations: https://forge.fantasygrounds.com/crafter/9/view-profile
    My GitHub: https://github.com/MeAndUnique
    Buy me a coffee: https://ko-fi.com/meandunique
    Discord: MeAndUnique#6805

  7. #7
    Thank you so much. That's exactly what I'm looking for (and already have it). There are so many great extensions out there... it's hard to remember which does what sometimes.

  8. #8
    Hi there! I'm getting an error with this extension. The error is thrown when I try to advance the initiative with the "next actor" button. It doesn't seem to break the game otherwise. I use many other extensions and haven't tested this with a fresh campaign. When I turn this extension off and run all the other ones the error does not appear when advancing the initiative.

    Thanks very much for making this!
    Screen Shot 2022-09-20 at 10.34.51 PM.png

  9. #9
    Quote Originally Posted by charmov View Post
    Hi there! I'm getting an error with this extension. The error is thrown when I try to advance the initiative with the "next actor" button. It doesn't seem to break the game otherwise. I use many other extensions and haven't tested this with a fresh campaign. When I turn this extension off and run all the other ones the error does not appear when advancing the initiative.

    Thanks very much for making this!
    Screen Shot 2022-09-20 at 10.34.51 PM.png
    Thanks for the report. One of those extensions must be outputting a chat message with no text whenever a new turn starts. I've added a nil check to rMessage.text for this extension, so it should no longer be an issue.

  10. #10
    Quote Originally Posted by GEONE View Post
    Thanks for the report. One of those extensions must be outputting a chat message with no text whenever a new turn starts. I've added a nil check to rMessage.text for this extension, so it should no longer be an issue.
    Yup, just tested with your update. Error message gone! thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in