Note: You are not logged in.
Chat Effects & NPC Variables

by GEONE

FREE
5.00 Avg. rating

Forum Thread
Total Subscribers: 389


Description

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.

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 parenthesis need to be replaced and # is any number. Do not include the parenthesis 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)

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 an 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 (decimal form) or total level if it's a player. Both variables do the same regardless of PC or NPC.
[PRF] - The creature's Proficiency Bonus.
[STR], [DEX], [CON], [INT], [WIS], or [CHA] - The creature's ability modifier for that 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.

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.


 Scimitar                                                                                
Melee Weapon Attack: +[PRF] to hit, reach 5 ft., one target. 
Hit: [CR]d6 + [DEX] slashing 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.

 Fire Breath (Recharge 5-6)                                                
The dragon exhales fire in a 60-foot cone. Each creature in  
that area must make a DC [MATH: [PRF]*5] Dexterity saving  
throw, taking [MATH: floor([CR]/2)]d6 + [PRF] fire damage on
a failed save, or half as much damage on a successful one.  


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.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 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.



UUID 17ce31c2-18d3-11ed-8c52-0050562be458