• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

How-To: Add a bonus to all save DC's

Dackad

New member
Hi, first time poster, long time reader here.

I'm trying to create a template in the editor and one of its special abilities adds a +2 bonus to each special ability (including spell-like abilities) that the creature has. I've managed to mine some code from other things in the editor, but I can't get my code to work. Right now, it just doesn't do anything.

Here's what I have so far:

Code:
[Phase=Final Phase; Priority=10000; Index=1]
foreach pick in hero from RaceAbil where "(component.Ability & fieldval:abDC <> 0) | (component.BaseSpell & Helper.SpellLike & (sSave.Fort? | sSave.Ref? | sSave.Will?))"

       eachpick.field[abDC].value += 2

nexteach
I'm not sure if eachpick works in that way or if it's something else in my code. I tried using the #dc macro, but it didn't recognize eachpick and it gave me an error so I'm not sure what else to try here.

Thanks
 
#1: You're restricting this to RaceAbil - that means you're leaving out all class abilities, spell-like abilities built from spells, and generic abilities.

#2: Timing: Your expression requires that abDC already be finished calculating, so that it's non-zero, but then you want to add more to abDC, which has to happen before abDC's final value is calculated.
 
My quick idea is your way to late in timing by using Final. Adding bonus should be pre-levels or post-levels at the latest. Trying changing your timing to pre-levels and see what it does.
 
Also, you need to fork your addition within the foreach. Spells store their DCs in the sDC field, while abilities store it in abDC. Adding to the wrong field will throw errors. I'd do something like:

Code:
[Phase=Final Phase; Priority=11000; Index=1]
     foreach pick in hero where "(component.Ability & fieldval:abDC <> 0) | (component.BaseSpell & Helper.SpellLike & (sSave.Fort? | sSave.Ref? | sSave.Will?))"
       if (eachpick.tagis[component.Ability] <> 0)
         eachpick.field[abDC].value += 2
       elseif (eachpick.tagis[component.BaseSpell] <> 0)
         eachpick.field[sDC].value += 2
         endif
       nexteach
 
Code:
[Phase=Final Phase; Priority=11000; Index=1]
     foreach pick in hero where "(component.Ability & fieldval:abDC <> 0) | (component.BaseSpell & Helper.SpellLike & (sSave.Fort? | sSave.Ref? | sSave.Will?))"
       if (eachpick.tagis[component.Ability] <> 0)
         eachpick.field[abDC].value += 1
       elseif (eachpick.tagis[component.BaseSpell] <> 0)
         eachpick.field[sDC].value += 1
         endif
       nexteach

Should this still be a valid script after 7+ years? I'm trying to achieve a similar effect (+1 instead of +2 to all spell-like abilities and spell save DCs) as a feat (fArcAdept), but I get the following error message:

Syntax error in 'eval' script for Thing 'fArcAdept' (Eval Script '#1') on line 2
-> Invalid use of reserved word 'if' in script
 
Code:
[Phase=Final Phase; Priority=11000; Index=1]
     foreach pick in hero where "(component.Ability & fieldval:abDC <> 0) | (component.BaseSpell & Helper.SpellLike & (sSave.Fort? | sSave.Ref? | sSave.Will?))"
       if (eachpick.tagis[component.Ability] <> 0) [COLOR="Red"]then[/COLOR]
         eachpick.field[abDC].value += 1
       elseif (eachpick.tagis[component.BaseSpell] <> 0) [COLOR="Red"]then[/COLOR]
         eachpick.field[sDC].value += 1
         endif
       nexteach

Should this still be a valid script after 7+ years? I'm trying to achieve a similar effect (+1 instead of +2 to all spell-like abilities and spell save DCs) as a feat (fArcAdept), but I get the following error message:

Syntax error in 'eval' script for Thing 'fArcAdept' (Eval Script '#1') on line 2
-> Invalid use of reserved word 'if' in script
I've run into this a lot working with my own datasets. You just need to add a then on the end of the if and elseif lines. (I've added them in the lines above if just want to paste...
 
Back
Top