View Single Post
UnitedWeStand
Junior Member
 
Join Date: Nov 2013
Posts: 5

Old November 17th, 2013, 04:20 PM
Nevermind, I actually managed to figure out how to make it work. Since the original sorting method that existed a couple years ago seems to have been phased out the easiest way was to have it handle the list in the order it started at, descending. Once decided on that it was a fairly simple matter of adjusting the way the bonus was calculated and moving code bits around (also deleted some unnecessarily confusing parts)

So no guarantees that this will work with ALL weapon training archetypes but as long as you have a Weapon Training Custom Ability set as secondary for whatever archetype you're working with this code should work if you set cHelpMag to cHelp[Class] of whatever you're using.

(for anyone that cares, here's the code I got to work)
Code:
~build up a tag expression to identify all weapon training abilities for
      ~this class
      var expr as string
      ~Change cHelpMag to be the class
      expr = "wFtrGroup.? & CustTaken.cHelpMag & Helper.Secondary"
      ~first, make sure we have any weapon training abilities for this class.
      ~If we don't, there's nothing to do here.
      doneif (hero.haschild[BaseCustSp,expr] = 0)
      ~the best bonus available to all weapon training abilities is 1 at 5th level,
      ~+1 per 4 levels after that. If we don't have a bonus, we're done.
      var bonus as number
      ~ Set to the number of secondary Abilities actually taken
      bonus = hero.child[cHelpMag].field[cUsedSp2nd].value
      var tagbonus as number
      ~if no weapon training selected, done
      doneif (bonus = 0)
      ~go through all of our weapon training abilities in descending order, giving a decreasing bonus to each.
      foreach pick in hero from BaseCustSp where expr
        ~set the bonus for this ability

        eachpick.field[abValue].value = bonus + 1 - eachpick.field[xIndex].value

        tagbonus = eachpick.field[abValue].value
        ~forward the weapon group tag we're assigned to the class a number of
        ~times equal to the bonus we're receiving
        if (eachpick.field[abValue].value >= 1) then
          var i as number
          var wepexpr as string
          var bonustag as string
          wepexpr = eachpick.tagids[wFtrGroup.?," | "]
          bonustag = eachpick.tagids[TrainBonus.?, ""]
          foreach pick in hero from BaseWep where wepexpr
            for i = 1 to tagbonus
              perform eachpick.assignstr[bonustag]
              next
            nexteach
          endif
        nexteach

Last edited by UnitedWeStand; November 17th, 2013 at 04:22 PM.
UnitedWeStand is offline   #49 Reply With Quote