• 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

Increase all caster levels by 1

nuku

Well-known member
So I went directly to Magical Knack, being close to what I want.

doneif (tagis[Helper.FtDisable] <> 0)

if (field[usrChosen1].ischosen <> 0) then
~our caster level for the chosen class is at +2, to a maximum of the number of Hit Dice we have
field[usrChosen1].chosen.field[cCasterLev].value = minimum(field[usrChosen1].chosen.field[cCasterLev].value + 2, hero.tagcount[Hero.HitDice])
endif

That's what it has, and it makes sense enough, but how do I make it boost all classes you may have that have a caster level by 1? I haven't yet tangled with for/while/etc. loops in this language, and I get to figure out what tags are involved, which promises to be super fun!

Any help appreciated. I've made great progress today, so thank you in advance.
 
You will need to use a foreach loop to find all the classes and increase there caster level. If you search these forums for the word "Foreach" you will find plenty of examples.

THIS one by Aaron looks like it will be really close as it goes after Casters and the Class Helper Picks which is what stores the caster level.
 
You will need to use a foreach loop to find all the classes and increase there caster level. If you search these forums for the word "Foreach" you will find plenty of examples.

THIS one by Aaron looks like it will be really close as it goes after Casters and the Class Helper Picks which is what stores the caster level.

Alright, grabbed that and tried to twist it to my ends:

~ Go through all casting classes.
foreach pick in hero from BaseClHelp where "CasterSrc.?"
~ transition through the attribute linkage, is it higher than our current
~ variable? If so, set the variable to this and set the focus to the linked
~ attribute.
if (eachpick.linkage[cCasterlev].field[aModBonus].value < hero.tagcount[Hero.HitDice]) then
perform eachpick.linkage[cCasterlev].setfocus
eachpick.linkage[cCasterlev].field[aModBonus].value = eachpick.linkage[cCasterlev].field[aModBonus].value + 1

~ Otherwise, do nothing, we'll check the next class
else
~ Nothing
endif
nexteach

Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'evalrule' script for Thing 'trDiliCast' (Eval Rule '#1') on line 6
-> Non-existent linkage 'cCasterlev' used by script
 
So field[usrChosen1].chosen is the same thing as eachpick. With that can you see whats wrong with your script?

Basically eachpick is pointing to a specific Pick similar to saying "hero.childfound[cHelpWiz]" to transition to the Wizard Class Helper Pick.
 
So I tweaked it, and got a new error that leaves me even more baffled:
Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'evalrule' script for Thing 'trDiliCast' (Eval Rule '#1') on line 6
-> Reference to undeclared variable: 'eachpick'

Edit:
~ Go through all casting classes.
foreach pick in hero from BaseClHelp where "CasterSrc.?"
~ transition through the attribute linkage, is it higher than our current
~ variable? If so, set the variable to this and set the focus to the linked
~ attribute.
if (eachpick.cCasterlev < hero.tagcount[Hero.HitDice]) then
perform eachpick.linkage[cCasterlev].setfocus
eachpick.linkage[cCasterlev].field[aModBonus].value = eachpick.linkage[cCasterlev].field[aModBonus].value + 1

~ Otherwise, do nothing, we'll check the next class
else
~ Nothing
endif
nexteach
 
This one is line 6:
Code:
if (eachpick.cCasterlev < hero.tagcount[Hero.HitDice]) then

Does the original need to put anything around cCasterLev in order to tell Hero Lab what cCasterLev is and how to deal with it? Did you leave any of that out in this line of code?
 
Anything in this line from your original post that suggests how to tell Hero Lab what cCasterLev is and how to deal with it?

Code:
field[usrChosen1].chosen.field[cCasterLev].value
 
if (eachpick.field[cCasterlev].value < hero.tagcount[Hero.HitDice]) then

Error:
Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'eval' script for Thing 'trDiliCast' (Eval Script '#1') on line 6
-> Non-existent field 'cCasterlev' used by script
 
Capitalization counts! Look at what you've really entered as the Id of that field, and compare it to the capitalization of that field in that first post.
 
uh oh. It works, but it increases even if that pushes over your hit dice.

~ Go through all casting classes.
foreach pick in hero from BaseClHelp where "CasterSrc.?"
~ transition through the attribute linkage, is it higher than our current
~ variable? If so, set the variable to this and set the focus to the linked
~ attribute.
if (eachpick.field[cCasterLev].value < hero.tagcount[Hero.HitDice]) then
eachpick.field[cCasterLev].value = eachpick.field[cCasterLev].value + 1

~ Otherwise, do nothing, we'll check the next class
else
~ Nothing
endif
nexteach
 
Back
Top