View Single Post
SeeleyOne
Senior Member
 
Join Date: Nov 2009
Posts: 891

Old June 2nd, 2015, 07:14 AM
I just came up with an even more efficient code for enforcing Novice and character creation and for enforcing the Rank while choosing Advances.

It can also be used with an alternate XP table. All that you have to do (as far as Rank is concerned) is change the value of xpPerRank in this code and you are done. You would possibly have to alter the number of Advances in a different Eval script.

I spread out the code a bit so that it is easier for us to read.

Phase: Final
Priority: 5010

Code:
    var endRank as number
    var xpPerRank as number
    var advPerRank as number
    var advCount as number
    var xp as number
    var xpRank as number
    var rankCount as number
    var endRank as number

    xpPerRank = 20
    advPerRank = xpPerRank / 5
    advCount = 0
    xp = hero.child[resXP].field[resMax].value
    xpRank = xpPerRank
    rankCount = 0
    endRank = 0

   ~ Check for spent Advances
   foreach pick in hero from Advance sortas _CompSeq_
      advCount += eachpick.field[advCost].value
   nexteach

   ~ Determine Rank based on current Advance
   ~ Seasoned
   rankCount = advPerRank -1
   if (advCount >= rankCount) then
      if (xp >= xpRank) then
          endRank = 1
      endif
   endif

   ~ Veteran
   rankCount = rankCount + advPerRank
   xpRank = xpRank + xpPerRank
   if (advCount >= rankCount) then
      if (xp >= xpRank) then
          endRank = 2
      endif
   endif

   ~ Heroic
   rankCount = rankCount + advPerRank
   xpRank = xpRank + xpPerRank
   if (advCount >= rankCount) then
      if (xp >= xpRank) then
          endRank = 3
      endif
   endif

   ~ Legendary
   rankCount = rankCount + advPerRank
   xpRank = xpRank + xpPerRank
   if (advCount >= rankCount) then
      if (xp >= xpRank) then
          endRank = 4
      endif
   endif

   ~ Apply the Rank
   herofield[acRank].value = endRank

Evil wins because good rolls poorly .... or the players are not paying enough attention to the game.
SeeleyOne is offline   #14 Reply With Quote