In the "Select From" option in the editor, select "Attributes" - that way the user can select the attribute this is based on.
Since this eval script is looking up final attribute values, we'll need to be in the Post-Attribute phase or later. Skills are handled relatively early in Poat-Attributes, so we'll need to be even earlier - Set the timing to Post-Attributes/5000.
Now, in the Eval script for that ability, start with the usual test:
Code:
~ If we're not shown, just get out now
doneif (tagis[Helper.ShowSpec] = 0)
Set up the bonus we're applying:
Code:
if (linkage[table].field[cTotalLev].value >= 10) then
field[abValue].value += 2
else
field[abValue].value += 1
endif
Next, identify the chosen attribute (and don't do any more if nothing's been chosen):
Code:
perform field[usrChosen1].chosen.setfocus
~if we haven't chosen anything yet, just get out now
doneif (state.isfocus = 0)
Now, so that it can be referenced easily, pull in the override tag from that attribute:
Code:
perform focus.pulltags[SkillOver.?]
Now, search through all the skills on the hero:
Code:
foreach pick in hero from BaseSkill
Now, find any skills that have an override tag (from various abilities that say "Skill X is now based on attribute Y instead of attribute Z), and compare the SkillOver tag we retrieved with the SkillOver tag on that skill.
Code:
if (eachpick.intersect[SkillOver,SkillOver] <> 0) then
eachpick.field[Bonus].value += field[abValue].value
If there isn't one of those, test for the regular link to the attribute:
Code:
elseif (eachpick.islinkage[skillattr] <> 0) then
if (eachpick.linkage[skillattr].intersect[SkillOver,SkillOver] <> 0) then
eachpick.field[Bonus].value += field[abValue].value
endif
endif
Note that the line:
Code:
eachpick.field[Bonus].value += field[abValue].value
should be replaced with the specific bonus type this is adding, if it's not adding a generic bonus - for example, here's a sacred bonus:
Code:
#applybonus[BonSacred, eachpick, field[abValue].value]
Here's all that assembled into a single place, with the proper close for the foreach:
Code:
~ If we're not shown, just get out now
doneif (tagis[Helper.ShowSpec] = 0)
if (linkage[table].field[cTotalLev].value >= 10) then
field[abValue].value += 2
else
field[abValue].value += 1
endif
perform field[usrChosen1].chosen.setfocus
~if we haven't chosen anything yet, just get out now
doneif (state.isfocus = 0)
perform focus.pulltags[SkillOver.?]
foreach pick in hero from BaseSkill
if (eachpick.intersect[SkillOver,SkillOver] <> 0) then
eachpick.field[Bonus].value += field[abValue].value
elseif (eachpick.islinkage[skillattr] <> 0) then
if (eachpick.linkage[skillattr].intersect[SkillOver,SkillOver] <> 0) then
eachpick.field[Bonus].value += field[abValue].value
endif
endif
nexteach