PDA

View Full Version : How to code the Hex spell



Trogdor_007
October 3rd, 2018, 04:47
I sat down and decided to get the Hex spell working properly. In its vanilla form, the Hex spell gives you a damage buff, but not much else. With these modifications, the spell will check your target to see if you actually hexed them and apply the appropriate disadvantage on ability checks. I hope that this helps people keep track of the enemy that they hex. It also uses the concentration tag to make sure that the concentration rules are adhered to.

To use the code:

1) Apply the first effect to yourself
2) Apply one of the next 6 effects to your Hex target
3) Attack

Overview of the Code:

24807

Self Target Hex Code:

24808

Code for Disadvantage on Ability Checks:

24809

Just modify the ability score for each separate effect. The ability score must be in lower case letters.

Zacchaeus
October 3rd, 2018, 11:02
Welcome to the forums Trogdar.

You need to limit the Hex spell's damage to just melee and ranged attacks; since you don't get any additional damage if you are casting a spell on the target for example. So you would need IFT: CUSTOM(hexed), 1d6 necrotic, melee, ranged.

Trogdor_007
October 3rd, 2018, 14:35
Zacchaeus,

I had to double check the wording on the Hex spell. For the extra 1d6 necrotic damage to the hexed target it specifies "whenever you hit it with an attack". Wouldn't this encompass everything from direct attack roll spells like Eldritch Blast to save or take damage spells like Fireball? Even on the save for half damage spells you are still hitting your target with an attack. Did they errata the Hex spell to specify that you do not get the extra damage on spell attacks?

Uraence
October 3rd, 2018, 14:38
The Hex spell states "whenever you hit it with an attack." It doesn't specify the attack type.

Zacchaeus
October 3rd, 2018, 15:48
If you hit something that does not require an attack roll (such as any spell which just requires the creature to make a saving throw) then it isn't an attack. So hitting something with a sword or a bow or a spell such as Fire Bolt is an attack. However casting a Fireball is not an attack.

An attack requires you to make an attack roll; so the Hex spell only delivers the extra damage if you make an attack roll.

LordEntrails
October 3rd, 2018, 17:50
Does FG recognize such spells (firebolt et al) as "ranged" attack types?

Trogdor_007
October 3rd, 2018, 18:31
Zacchaeus,

I agree that at a glance RAW, things require an attack roll to be an attack. However, spells like Fireball, Cone of Cold, Magic Missile, and Burning Hands are still attacks. The spell section in the PHB gets a little grey in this area. It outlines spell attack rolls and spell saves and a means to determine if the spell takes affect. There may not be a "to hit" roll with Fireball; however, the target is still hit by the spell and damage follows.

The key aspect is the spell taking affect. With a melee or ranged attack you either hit or miss. Either the attack affects the target or it doesn't. With a direct spell attack roll you either hit or miss. With a spell save, the target either passes or fails the check. To me, it is the same thing.

I would argue that any spell that deals damage to a target is an attack. This would validate the conditions for applying the additional Hex damage to spells that require a save.

I think this is progressing towards a discussion on RAW vs RAI. Has anyone seen a post by the WotC crew on this issue?

Zacchaeus
October 3rd, 2018, 19:37
Page 194 of the PHB says 'If there's ever any question about whether something you're doing counts as an attack, the rule is simple: if you're making an attack roll, you're making an attack.' A fireball does not make an attack roll wheras a spell where you must roll to hit is.

https://www.sageadvice.eu/2015/08/15/hex-atttack-roll/

However it's your game. Your rules.

Trogdor_007
October 3rd, 2018, 20:10
I can't really argue with the developers of the game.

I am trying to get a blend between the rules and the interface (Fantasy Grounds). Code is very precise and rigid. Is there a way to improve the coding of the Hex spell to differentiate between damage resulting from an attack roll and damage from a save or ability check?

If Fantasy Grounds currently does not differentiate, then for the sake of simplicity and automation, I would push for all damaging spells to get the bonus 1d6. Alternatively, the effect could be ended for the damage roll and reapplied afterwards for the odd time the damage wouldn't apply.

Zacchaeus
October 3rd, 2018, 21:18
Use the effect that I posted in post#2 above. The damage from the Hex spell will only apply if it is done from a melee or ranged attack. So it will work just fine if a roll is made to attack but it won’t fire if a spell which only requires a save is cast.

BruceDM
October 3rd, 2018, 21:19
Zacch's solution of adding , melee, ranged will work for that, as any spell that is doesn't have an attack roll associated with it has no attack range tag (i.e. melee or ranged)

Trogdor_007
October 3rd, 2018, 21:25
Awesome. I will test it out later tonight.

Trogdor_007
October 4th, 2018, 02:36
Something isn't registering correctly. This is what I currently have for the self targeted effect:

IFT: CUSTOM(Hex); DMG: 1d6 ranged, melee, necrotic; (C)

So far, it correctly applies the necrotic damage with melee and ranged weapons to a target with the hex applied to it. It will not add the damage to Eldritch Blast though.

Zacchaeus
October 4th, 2018, 02:41
You may need a second line for the Eldritch Blast with just the necrotic damage; I.e without the melee, range modifiers. I can’t test right now but I have a feeling that range only covers non spell ranged attacks.

Trogdor_007
October 4th, 2018, 02:54
That is unfortunate. I was hoping to have the Hex spell fully automated.

I guess I could add a second damage option to Eldritch Blast. Something like the Ice Knife spell. You just have to remember to click the one with 1d10 force + 1d6 necrotic when you are targeting your Hex target. That way, if you score a crit, the dice will double automatically.

24818

lostsanityreturned
October 4th, 2018, 02:55
The two easiest options are as follows

A) create attacks for all of your attack roll based spells (in the weapon section)
B) set the self applied effect (the IFT) to have a 1 round duration or to expire after the next action. The user will need to remember to click it each time they make an attack, but I don't find it that hard to track (rogues do it with sneak attack frequently)

Also, if you haven't already remember to add (C) to both effects so concentration is in play. (I add it to the self applied effect as well just so it clears if the player ever fails their concentration check)

Trenloe
October 4th, 2018, 06:17
You may need a second line for the Eldritch Blast with just the necrotic damage; I.e without the melee, range modifiers. I can’t test right now but I have a feeling that range only covers non spell ranged attacks.
Your feeling is correct. Spell damage rolls do not have the range tagged to them.

The [ranged] effect descriptor is matched against the details the the [DAMAGE] text reported in chat: [DAMAGE (M)] for melee and [DAMAGE (R)] for ranged - based off the range icon set for the weapon entry.

For spells the damage roll will always say [MELEE] - i.e. no range descriptor. Even though there might be an attack action in the same spell, the damage action doesn't read that attack action to determine range.

Zacchaeus
October 4th, 2018, 11:15
That is unfortunate. I was hoping to have the Hex spell fully automated.

I guess I could add a second damage option to Eldritch Blast. Something like the Ice Knife spell. You just have to remember to click the one with 1d10 force + 1d6 necrotic when you are targeting your Hex target. That way, if you score a crit, the dice will double automatically.

You don't need to be as specific as that since there are a lot of possible spells with a ranged attack. All you need is a second line in your Hex Spell DMG: 1d6, necrotic with an expiration of on next action. The Player will need to apply that effect to their character before rolling damage if they are casting an appropriate spell.

Trogdor_007
October 4th, 2018, 17:09
Ohhhh ok. Something like the code for a Sneak Attack. That is less complicated than re-coding each spell.

I feel a bit like Homer Simpson sailing across the Springfield gorge. Everything looked good, but the code fell short by just a bit. At least multiple solutions are hashed out.

Is there a proper forum for posting up code for abilities/feats/powers? I poked through the listings and nothing caught my eye. I am still getting the hang of the syntax for the FG code, but I do have some aptitude with coding. I went Mech. Eng. rather than Elec. Eng. but it was a close call. Right now I am trying to translate the syntax on the WiKi to the actual code written. The square brackets are throwing me for a loop. That is why I post pictures of the written functional code.

Zacchaeus
October 4th, 2018, 20:20
This series of videos might help (https://www.youtube.com/playlist?list=PLvtWYj3HpGj5yzVugpCeoUzxtJ0i906QG).

Ltbadger
March 25th, 2020, 02:21
That sir was genius

Thank you very much for all the questions you have answered these last few days.

Hopefully now I have seen you video the Hex will no longer VEX [me]

Varatta
January 5th, 2021, 01:55
You don't need to be as specific as that since there are a lot of possible spells with a ranged attack. All you need is a second line in your Hex Spell DMG: 1d6, necrotic with an expiration of on next action. The Player will need to apply that effect to their character before rolling damage if they are casting an appropriate spell.

So it sounds like there is no way to automate Hex damage at this stage appropriate to the various attack circumstances without having to click a button each time the player attacks? Would it be simpler (but basically the same) just to add a 1d6 necrotic damage attack to the sheet and when appropriate they just add that damage roll?

Zacchaeus
January 5th, 2021, 10:38
So it sounds like there is no way to automate Hex damage at this stage appropriate to the various attack circumstances without having to click a button each time the player attacks? Would it be simpler (but basically the same) just to add a 1d6 necrotic damage attack to the sheet and when appropriate they just add that damage roll?

Yes.