• 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

usrCandid selection based on skill attribute

AndrewD2

Well-known member
Working on an ability that allows you to select an INT or CHA skill and gain a bonus to it. Figured that'd be easy enough, but then I realized that unless the skill has a SkillOver.? tag it doesn't actually tell you what skill it's based on in the tags, only through linkage[skillattr]. Is there a way to write a candidate expression for this using tags or do I need to foreach through the skills and make a list and apply that to the usrCandid1 field?

Thanks
Andrew
 
Yeah that's what I thought, just having a little trouble getting it worked out, almost done ... looks like just one stupid "|" extra showing up.
 
I got it to work if anyone is interested in looping through the skills like this sometime I did

Code:
var skills as string
var x as number
         
x = 0
         
foreach pick in hero from BaseSkill
   ~ Check Skill Override
   if (eachpick.tagis[SkillOver.aCHA] + eachpick.tagis[SkillOver.aINT] <> 0) then
      if (x <> 0) then
         skills &= "|"
      endif
      skills &= eachpick.tagids[thingid.?,"|"]
      x += 1
   endif
 
   ~ If it has a normal linkage to Charisma it also qualifies.
   if (eachpick.islinkage[skillattr] <> 0) then
      if (eachpick.linkage[skillattr].tagis[thingid.aCHA] + eachpick.linkage[skillattr].tagis[thingid.aINT] <> 0) then
         if (x <> 0) then
            skills &= "|"
         endif
         skills &= eachpick.tagids[thingid.?,"|"]
         x += 1
      endif
   endif
   
 
nexteach
               
field[usrCandid1].text = "component.BaseSkill & (" & skills & ")"

If anyone's got better ideas I'm open for them.
 
If you're going to offer it as an example, let's condense things:

Code:
foreach pick in hero from BaseSkill
  ~ Check Skill Override
  if (eachpick.tagexpr[SkillOver.aCHA | SkillOver.aINT] <> 0) then
    field[usrCandid1].text = splice(field[usrCandid1].text,"thingid." & eachpick.idstring,"|")
  ~ If it has a normal linkage to Charisma it also qualifies.
  elseif (eachpick.islinkage[skillattr] <> 0) then
    if (eachpick.linkage[skillattr].tagexpr[thingid.aCHA | thingid.aINT] <> 0) then
      field[usrCandid1].text = splice(field[usrCandid1].text,"thingid." & eachpick.idstring,"|")
      endif
    endif
  nexteach

if (field[usrCandid1].isempty =  0) then
  field[usrCandid1].text = "component.BaseSkill & "(" & field[usrCandid1].text & ")"
else
  field[usrCandid1].text = "component.BaseSkill"
  endif
 
Last edited:
Thanks Mathias, I've not used splice and tagexpr before I shall add them to my repertoire I love how condense that is.

Oh and shouldn't forget the timing, I'm running at Post-Levels/10,000
 
Also Mathias I don't know if you want to edit your code, but you're missing an endif before the nexteach in the first section.
 
Back
Top