Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game

Notices

Reply
 
Thread Tools Display Modes
Stormwarden
Member
 
Join Date: Jun 2010
Posts: 33

Old June 12th, 2010, 03:36 PM
Hi folks. First let me say that I'm loving Hero Lab. I'm just now looking around the forums and trying to figure out all that I can do with this application.

Second, I'm wondering if there's a way currently to do partial bab and saving throw bonuses in HL?

For instance, if you have a Clr 1/Mk 1, if you add the 0 bab that each class gets the character would of course have a bab of 0. Partial bab says that a Clr 1 and Mnk 1 really have a 3/4 bab, so adding them would give the character a 1.5, rounded down to +1 bab.

Similar concept can be applied to saving throw bonuses as well.
Stormwarden is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 12,781

Old June 14th, 2010, 09:02 AM
This is do-able, but I'm afraid it's going to be very complex to implement (time consuming and with fiddly math, rather than difficult). I'm afraid we want to get an update for HL out soon, and I'm behind where I should be, so I won't have the time to work out the full script for a few days. In the meantime, I'll give a quick outline of the steps and code involved. Maybe one of your fellow users can run with that and tell you how to write the actual script. If not I'll do so late this week or early next week.

This will all go in an Eval Script on a Mechanic.

Start by checking if the character has racial HD:

Code:
if (hero.tagis[Hero.RacialHD] <> 0) then
if that's true, find the race and set your focus to it:

Code:
 
perform hero.findchild[BaseRace].setfocus
doneif (state.isfocus = 0)
Then, you can look up the racial HD (field[rHDFinal].value), and look up the tags that determine the attack and save progressions. From those, you can calculate what remainders would be left over in the progressions, and store those in variables.


Next, search through all the classes on the hero:

Code:
 
foreach pick in hero from Class
And for each class, like the race, you'll retrieve the class level and the tags that determine the progressions, and add any remainders you find there to the same variables.

Once that's all done, you can round off the variables, and add the results to the attack and saves.
Mathias is offline   #2 Reply With Quote
Stormwarden
Member
 
Join Date: Jun 2010
Posts: 33

Old June 16th, 2010, 05:29 AM
Awesome, thanks Mathias. I'm learning my way around the editor still. I'll take a crack at it at some point, after I've gotten all the other stuff for my players set up (custom traits, etc).
Stormwarden is offline   #3 Reply With Quote
Flappi
Junior Member
 
Join Date: Jun 2010
Posts: 26

Old June 27th, 2010, 09:39 AM
Quote:
Originally Posted by Mathias View Post
Then, you can look up the racial HD (field[rHDFinal].value), and look up the tags that determine the attack and save progressions.
I'm trying to implement this, but I can't find how to determine if the progression is high, medium or low.
Flappi is offline   #4 Reply With Quote
Flappi
Junior Member
 
Join Date: Jun 2010
Posts: 26

Old June 28th, 2010, 05:16 AM
I have implemented the script; I think it's OK:

They all go in mechanics, in the post-levels phase (we need to do this after the levels phase, and the post-levels (user) is too late). The script for BAB:
Code:
var dummybab as number
var nHD as number
dummybab=0

if (hero.tagis[Hero.RacialHD] <> 0) then
  perform hero.findchild[BaseRace].setfocus
  nHD=focus.field[rHDFinal].value
~  debug "nHD: " & nHD
  if (focus.tagis[cAttack.Medium] <> 0) then
    dummybab=dummybab+0.75*nHD-int(0.75*nHD)
  elseif (focus.tagis[cAttack.Poor] <> 0) then
    dummybab=dummybab+0.5*nHD-int(0.5*nHD)
    endif
  perform state.clearfocus
~  debug "race dummybab: " & dummybab
  endif

foreach pick in hero from Class
~  debug "id: " & eachpick.idstring
  perform eachpick.setfocus
  nHD=focus.field[cTotalLev].value
~  debug "nlevel: " & nHD
  if (focus.tagis[cAttack.Medium] <> 0) then
    dummybab=dummybab+0.75*nHD-int(0.75*nHD)
  elseif (focus.tagis[cAttack.Poor] <> 0) then
    dummybab=dummybab+0.5*nHD-int(0.5*nHD)
    endif
  perform state.clearfocus
~  debug "dummybab: " & dummybab
  nexteach

~debug "int dummybab: " & int(dummybab)
~debug "BAB: " & hero.child[Attack].field[tAtkBase].value

hero.child[Attack].field[tAtkBase].value = hero.child[Attack].field[tAtkBase].value + int(dummybab)
It's a little bit more complicated for save (since the prc don't use the same values in Pathfinder, and we also need to count the +2 bonus for a good save once and only once):
Code:
var dummyfort as number
var fldumm as number
var gsvcount as number
var gsvflag as number
var nHD as number
dummyfort=0
gsvcount=0
gsvflag=0

if (hero.tagis[Hero.RacialHD] <> 0) then
  perform hero.findchild[BaseRace].setfocus
  nHD=focus.field[rHDFinal].value
~  debug "nHD: " & nHD
  if (focus.tagis[SaveGood.svFort] <> 0) then
    dummyfort=dummyfort+0.5*nHD-int(0.5*nHD)
    gsvcount=gsvcount+1
  else
    dummyfort=dummyfort+nHD/3-int(nHD/3)
    endif
  perform state.clearfocus
~  debug "race dummyfort: " & dummyfort
  endif

foreach pick in hero from Class
~  debug "id: " & eachpick.idstring
  perform eachpick.setfocus
  nHD=focus.field[cTotalLev].value
~  debug "nlevel: " & nHD
  if (focus.tagis[ClassType.Prestige] = 0) then
    if (focus.tagis[cFort.Good] <> 0) then
      dummyfort=dummyfort+0.5*nHD-int(0.5*nHD)
      gsvcount=gsvcount+1
    else
      dummyfort=dummyfort+nHD/3-int(nHD/3)
      endif
  else
    if (focus.tagis[cFort.Good] <> 0) then
      gsvflag=1
      dummyfort=dummyfort+0.5*nHD-int(0.5*nHD+0.5+0.01)
    else
      dummyfort=dummyfort+nHD/3-int(nHD/3+1/3+0.01)
      endif
    endif
  perform state.clearfocus
~  debug "dummyfort: " & dummyfort
~  debug "gsvcount: " & gsvcount
  nexteach

~debug "int dummyfort: " & int(dummyfort)
~debug "svFortBase: " & hero.child[svFort].field[svBase].value

~floor(dummyfort)
if (dummyfort >= 0) then
  fldumm=int(dummyfort+0.01)
else
  fldumm=int(dummyfort+0.01)-1
  endif
~debug "fldumm (fort): " & fldumm & dummyfort

hero.child[svFort].field[svBase].value = hero.child[svFort].field[svBase].value + fldumm

if (gsvcount > 1) then
  ~+2 bonus for good save only once
  hero.child[svFort].field[svBase].value = hero.child[svFort].field[svBase].value -2*(gsvcount-1)
  endif

if (gsvcount=0) then
  if (gsvflag=1) then
    ~in this case only a prc gives a good save, we need to add the +2 bonus
    hero.child[svFort].field[svBase].value = hero.child[svFort].field[svBase].value +2
    endif
  endif
(it's essentially the same for Will and Ref save)


Now I'm looking for a way to activate/deactivate the mechanic...
Flappi is offline   #5 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 12,781

Old June 28th, 2010, 07:39 AM
Activation/Deactivation is a simple matter - In the sources option, which is the last thing on any editor entry, assign this mechanic to a new source (probably one in the house rules section) - that way the mechanic will only be active while the source is checked.

Thanks for working this through for me. I apologize that I wasn't able to get back to this.
Mathias is offline   #6 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 12,781

Old June 28th, 2010, 07:45 AM
In terms of the good saves, the prestige class's good save progression is not equal to the regular class's good save progression - 2.

Also, don't forget that the user might have taken more than one base class, so I don't think you can just give the +2 only once.
Mathias is offline   #7 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 12,781

Old June 28th, 2010, 07:46 AM
Sorry to hit you again, but once thing that may cut a bit of typing:

in Hero Lab, X = X + Y can be written as: X += Y

That means that:

hero.child[svFort].field[svBase].value = hero.child[svFort].field[svBase].value +2

can be written as:

hero.child[svFort].field[svBase].value += 2
Mathias is offline   #8 Reply With Quote
Flappi
Junior Member
 
Join Date: Jun 2010
Posts: 26

Old June 28th, 2010, 08:24 AM
Quote:
Originally Posted by Mathias View Post
In terms of the good saves, the prestige class's good save progression is not equal to the regular class's good save progression - 2.
If I don't mistake, the prc save bonus is:
good : floor ((prc_level+1)/2)
poor : floor ((prc_level+1)/3)
(in fact, it's just another way to round a non-integer result: Pathfinder don't round down for prc save).

Then, the difference between the prc save and the fractional save is:
good : 0.5*prc_level - int(0.5*prc_level+0.5)
poor : prc_level/3 - int(prc_level/3+1/3)

As a related note, sometime I add 0.01 inside the "int" functions. It's because it seems that for the computer, 1/3+1/3+1/3<1, and then int(1/3+1/3+1/3)=0. Therefore I add 0.01: int(1/3+1/3+1/3+0.01)=1. Since the minimum possible difference is 1/6 (the difference between 1/2 and 1/3), and that 0.01 is lower than 1/6, it shouldn't be a problem; but maybe there is a prettiest way. In the case of prc save, it's important at least for a poor save:
poor : prc_level/3 - int(prc_level/3+1/3+0.01)

Note that the result can be negative (eg for a good save and prc_level=1, or a poor save and prc_level=2); that why I create a floor function afterward (the floor function doesn't seems to be intrinsic).

Quote:
Also, don't forget that the user might have taken more than one base class, so I don't think you can just give the +2 only once.
that's the role of the variables gsvcount (good save counter) and gsvflag (good save flag)

gsvcount start at 0, and is increased by 1 each time a race or a base class has a good save; the counter isn't modified by prc.

gsvflag start at 0, and if the script find a prc with a good save, the flag becomes 1.

Then, at the end of the script:
* if gsvcount is 2 or more, we have too many +2 bonus from high save of base class: I remove the difference (2*(gsvcount-1)).
* if gsvcount is 0 and gsvflag is 1, there is no base class with high save (since gsvcount is 0), but one prc with good class. If you use the unearthed arcana rule, you should add 2 to the save, but it's debatable in Pathfinder (since the prc don't give the +2 bonus for high save, or even a +1 bonus: Pathfinder didn't intend to add a flat bonus to high save for prc), but I decided to add it.

I could do both with only one "if" statement (if (gsvcount>0) then remove 2*(gsvcount-1) (comment: it's 0 if gsvcount=1), elseif (gsvflag=1) (comment: in this case, we have gsvcount=0: no base class with high save) then add 2, endif). :/


Edit: as you see, I'm not a beginner in programing, but I'm a total beginner in XML and hero lab; probably there are some better way to do the same script.


Edit 2: the rule I wanted to script (to be sure we use the same):
* for each level of a class, add:
** 1/2 for a good save
** 1/3 for a poor save
* then, after each contribution of each class have been added, round down.
* if at least one class gives a good save (be it a base class or a prestige class), add +2 to the final base save.

Last edited by Flappi; June 28th, 2010 at 08:37 AM.
Flappi is offline   #9 Reply With Quote
Imper1um
Member
 
Join Date: Jun 2010
Posts: 40

Old June 28th, 2010, 08:39 AM
Is this a house rule?

I can't find anywhere in Pathfinder it says that this case even exists...+0+0 = 0. >.>
Imper1um is offline   #10 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 07:26 PM.


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