Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - d20 System (http://forums.wolflair.com/forumdisplay.php?f=46)
-   -   Eval Script for Charges based on Stat Modifier (http://forums.wolflair.com/showthread.php?t=49918)

mirtos July 7th, 2014 03:55 PM

Eval Script for Charges based on Stat Modifier
 
Im trying to create a "rage-like" ability that follows pathfinders basis of rounds/day vs the times/day, and base it on con modifier. thats the problem im having.

Code:

~ Available when not lawful - otherwise we don't meet requirements
      var result as number
      if (hero.tagis[Alignment.Lawful] <> 0) then
        result = assign[Helper.SpcDisable]
              endif

      ~ If we're enraged, apply the stat modifiers for that
      var level as number
      level = field[xTotalLev].value
     

      var attrbonus as number
      var savebonus as number
      if (level >= 20) then
        attrbonus = 8
        savebonus = 4
      elseif (level >= 11) then
        attrbonus = 6
        savebonus = 3
      else
        attrbonus = 4
        savebonus = 2
        endif
      if (field[hIsOn1].value <> 0) then
        hero.child[aSTR].field[Bonus].value += attrbonus
        hero.child[aCON].field[Bonus].value += attrbonus
        hero.child[aDEX].field[Bonus].value += attrbonus
        #applybonus[BonMorale, hero.child[vWill], savebonus]
        endif

      ~ Set up our text fields
      field[CustDesc].text = "Focus your aggression, giving you +" & attrbonus & " Str, Dex +" & attrbonus & " Con, +" & savebonus & " to Will saves and -2 to Armor Class. Many skills and abilities cannot be used while the character is enraged.{br}{br}Rage lasts for 3 rounds + Con bonus."
      if (level < 17) then
        field[CustDesc].text = field[CustDesc].text & " At the end of the fury, the Viking becomes fatigued (-2 Str, -2 Dex, can't charge or run) for the rest of the encounter."
        endif
      field[xSumm].text = "+" & attrbonus & " Str, Dex, +" & attrbonus & " Con, +" & savebonus & " to Will saves, -2 to AC when enraged."

      ~ If we're exhausted, apply the stat modifiers for that (we don't get
      ~ exhausted after level 17)
      if (level < 17) then
        field[hName2].text = "Exhausted"
        if (field[hIsOn2].value <> 0) then
          hero.child[aSTR].field[Penalty].value = hero.child[aSTR].field[Penalty].value - 2
          hero.child[aDEX].field[Penalty].value = hero.child[aDEX].field[Penalty].value - 2
          endif
        endif

      ~ We can Fury based on our constitution + level rounds per day
      ~ times per day.
      var total as number
      total = 2 + (level * 2) + hero.child[aCON].field[Bonus].value
     
      field[hTotal].value += total
      field[livename].text = "Fury (" & total & "rounds/day)"

The section thats not working right:
Code:

      total = 2 + (level * 2) + hero.child[aCON].field[Bonus].value
Its ignoring the con bonus. Also, id like it to to be based on "real con bonus" vs "temporary con bonus".

Thoughts and help would be useful.

Thanks!

Sendric July 7th, 2014 07:45 PM

Quote:

Originally Posted by mirtos (Post 186978)
Im trying to create a "rage-like" ability that follows pathfinders basis of rounds/day vs the times/day, and base it on con modifier. thats the problem im having.
.
.
.
The section thats not working right:
Code:

      total = 2 + (level * 2) + hero.child[aCON].field[Bonus].value
Its ignoring the con bonus. Also, id like it to to be based on "real con bonus" vs "temporary con bonus".

Thoughts and help would be useful.

Thanks!

If you haven't gotten an answer by tomorrow morning, I'll take a look at this when I get in front of HL. First though, when are running this script? If it's ignoring the CON bonus, it could simply be running too early. If the timing is ok, you could try breaking that line up into two parts. For example:

Code:

      total = (level * 2)
      total += 2 + hero.child[aCON].field[Bonus].value

If that works then its something to do with the structure of the equation.

PS. "perform" has replaced the need for a variable. For example:

Code:

      var result as number
      if (hero.tagis[Alignment.Lawful] <> 0) then
        result = assign[Helper.SpcDisable]
              endif

can instead be done as:

Code:

      if (hero.tagis[Alignment.Lawful] <> 0) then
        perform assign[Helper.SpcDisable]
      endif


mirtos July 8th, 2014 04:37 AM

I had it previously as two lines. No difference. I'll check the timing tonight when I get home.

Sendric July 8th, 2014 06:14 AM

Alright. I took a look at this. First off, looks like you took the script from the Barbarian Rage which runs post-levels/10000. That's too early to determine your CON bonus. However, if you move the whole script to post-attributes then nothing else works. So, I recommend you move that last piece to a new script.

Second, you want to use the field "aBonus" instead of "Bonus". The former is your CON bonus before modifiers, while the latter is used for untyped bonuses to your CON score.

Post-Attributes/15000
Code:

      ~ We can Fury based on our constitution + level rounds per day
      ~ times per day.
      var total as number
      total = 2 + (field[xTotalLev].value * 2) + hero.child[aCON].field[aBonus].value
     
      field[hTotal].value += total
      field[livename].text = "Fury (" & total & " rounds/day)"

PS. If you right-click on your CON score and select "Show Debug Fields" you can see how the fields change when you are enraged. This tells you which field you want to use for this purpose.

mirtos July 8th, 2014 06:18 AM

Thanks. Especially for the Show the Debug fields hint. I always forget about that.


All times are GMT -8. The time now is 02:06 AM.

Powered by vBulletin® - Copyright ©2000 - 2020, vBulletin Solutions, Inc.
wolflair.com copyright 1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.