Lone Wolf Development Forums  

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


Thread Tools Display Modes
Junior Member
Join Date: Mar 2021
Location: New Zealand
Posts: 18

Old July 30th, 2022, 03:03 PM
Does anyone know the name / priority of the script that calculates the player's level and determines how much wealth the player should have for it?

From what I can tell without finding it, the script calculates a PCs/NPCs level by looking at the number of class tags they have, but without knowing the name of the script or the variable it saves the number to, I'm kinda stuck.

For context, I'm using an edited version of the gestalt addon. I have 9 "classes" added (3 gestalt, 3 of class 1, 3 of class 2) in the correct order, but since only the gestalt classes should calculate towards the wealth limit I need to edit the calculated number.

What I've done is commented out a part of the code that "clears all the class tags and then adds an equivalent number of gestalt class tags". When you select a class using the gestalt class picker, another part has been commented out that pulls the class tags from the picker. The result is a hero calculated to have the same number of levels as the original gestalt addon, that correctly calculates level for all fields such as pre-requisites, skills, ability score increases, feats, etc., and works for characters above level 20.

The downside is that it incorrectly calculates the amount of levels they have for the purposes of calculating wealth as shown in both picture below.

Last edited by Arkadious; July 30th, 2022 at 05:03 PM. Reason: Clarification
Arkadious is offline   #1 Reply With Quote
Junior Member
Join Date: Mar 2021
Location: New Zealand
Posts: 18

Old July 30th, 2022, 05:02 PM
I've attached the file I'm working on (the one that goes in ProgramData).
Attached Files
File Type: email PFRPG_Gestalt_Class.user (29.5 KB, 1 views)

Last edited by Arkadious; July 30th, 2022 at 05:12 PM.
Arkadious is offline   #2 Reply With Quote
Junior Member
Join Date: Mar 2021
Location: New Zealand
Posts: 18

Old July 30th, 2022, 06:59 PM
I can see that the Wealth by Level mechanic (mechWealth) references some arrays that have been labeled as such:

If I actually check the mechWealth entry, there is very little to work from. I assume then that there must be another script that calculates the number of class tags and looks at the specific location of an array and use the value stored at that location to decide how much wealth that character gets?

Any help would be appreciated.
Arkadious is offline   #3 Reply With Quote
Join Date: May 2021
Posts: 79

Old July 30th, 2022, 09:03 PM
If you have some time to poke around, I would suggest using the editor to go through the code of any procedures that seem relevant. (Basically you make a new copy of the procedure, and then can read through the code on the new copy.)

There is quite a bit of code exposed there, and even though you can't change those procedures directly, you can sometimes figure out what changes or tags you can use to get the effect you want.

At a quick glance, the ClassList procedure seems to have some stuff relevant to level adjustments and whether or not classes are counted.

edit: There is also a filterable Task List available from the Debug:FloatingInfoWindows: menu... Filtering with "total level" which seems to indicate a calculate script on the hero's tTotLevel field happens at Post-levels 10000.

Last edited by ploturo; July 30th, 2022 at 09:31 PM.
ploturo is offline   #4 Reply With Quote
Junior Member
Join Date: Mar 2021
Location: New Zealand
Posts: 18

Old July 31st, 2022, 01:39 AM
I'm able to alter some numbers that are used for levels using these bits of code:

      field[cLevelAdj].value += -2
      herofield[tPlanLvl].value += -2
      herofield[tLastLevel].value += -2
      herofield[tLevel].value += -2
      herofield[tEqvGrLev].value += -2
What these do is alter what level HeroLab thinks my character is and what the level their last level was.

By altering tLevel, I am also altering tTotLevel and I've got these values in a script in Class Level Id cS2Gestalt so every time you add a Gestalt level, it reduces those values by 2.

Looking the values using the debug tools, the values are correctly set, and the final values are what they are supposed to be, but the Suggested Wealth is still calculating (Gestalt * 2) levels too high.

I checked the ClassList procedure, but it was responsible for the numbering and ordering of the classes in the classes tab for a character. It did do some calculations for cLevelAdj, tPlanLvl, and tLastLevel, but nothing in there that references the Wealth by Level mechanic.
Arkadious is offline   #5 Reply With Quote
Junior Member
Join Date: Mar 2021
Location: New Zealand
Posts: 18

Old August 2nd, 2022, 01:29 AM
I think I might've found a lead involving the gear item gMoney, but if I try to find gMoney in the editor, while I can find the id using a search item function I can't actually find an entry for it.
Is it too fundamental or something, so Hero Lab doesn't let you edit it?

I think I'm going around in circles at this point.

Last edited by Arkadious; August 2nd, 2022 at 03:53 AM.
Arkadious is offline   #6 Reply With Quote
Join Date: May 2021
Posts: 79

Old August 3rd, 2022, 11:45 AM
Things like gMoney, or the Totals "Hero (Totals)" thing, can be accessed in the editor if you create an editthing entry for the compset they are created from (Purse and Actor, respectively). You would need to create/edit a datafile as a text/xml file to add an editthing.

Unfortunately, there is rarely any useful info that can be found in those kind of entries, since basically all of the relevant scripts and information were added at the component level that make up the compset the things are derived from, and not as part of each thing.

For example, Acrobatics and Bluff are things that can be edited in the Skill tab of the editor, but most of the scripts that are run for each skill are actually part of the BaseSkill component in the Skill compset and aren't visible in the editor. Only scripts that are specific to a certain skill, like the bonus to fighting defensively granted by Acrobatics, would be visible in the editor for each thing.

Last edited by ploturo; August 3rd, 2022 at 11:47 AM.
ploturo is offline   #7 Reply With Quote
Join Date: May 2021
Posts: 79

Old August 3rd, 2022, 09:08 PM
It looks like the level and amount of starting gold are being calculated based on the number of Classes.? tags present at Pre-levels:5000, in a script on the Totals component called "Component Totals: Eval Script #40".

They are stored in herofield[tEqvGrLev].value and herofield[tSCROver].value, if you want to calculate them yourself and set them at Pre-levels:5001.

Or you can bootstrap another helper to the Gestalt cHelp thing, with an eval script at Pre-levels:4999 to pull all the Classes.? tags and then delete them from the hero and replace them with the correct number of Classes.? tags, and then a second script at Pre-levels:5001 to delete the temporary Classes.? tags and push the previous tags back to the hero.

The mouseinfo for the total gear value also uses the count of the Classes.? tags to determine the character level and wealth, but unfortunately it does it outside of the normal evaluation loop and doesn't have a stored value anywhere to change.

Technically, you could fix that by deleting all the Classes.? tags and replacing them with the correct number of tags again at Render:9999999... But theoretically it would also break any code that counts class tags to evaluate pre-reqs when a user is adding new feats/etc, since that happens outside the normal evaluation loop too.

Last edited by ploturo; August 3rd, 2022 at 09:10 PM.
ploturo is offline   #8 Reply With Quote
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,076

Old August 4th, 2022, 12:01 AM
In the editor, on the Mechanics tab, make a copy of "Wealth by Level Mechanics". Then, in "Overrides...", select "Wealth by Level Mechanics". Unfortunately, there's not an editor control set up for the relevant array yet, and the editor doesn't give you access to arrays, except through editor controls, but you should be able to edit the XML on the item you've created, and edit the relevant arrays.
Mathias is offline   #9 Reply With Quote
Junior Member
Join Date: Mar 2021
Location: New Zealand
Posts: 18

Old August 6th, 2022, 05:04 PM
I think your way of deleting tags, inserting some temporary tags before wealth calculations, and then reinserting the correct tags afterwards is probably the best method.

I don't have much experience with bootscraps, foreach picks and helpers, so is this follow below what you mean? The idea with this script to use the foreach pick to grab every class tag, pull them, delete our current class tags, and then assign an equal number of temporary Gestalt class tags to determine our level.

      ~ If we are under level 3 don't do anything as we will cause errors
      ~ Once we have three classes then we can modify it down to two.
      doneif (hero.tagcount[Classes.?] < 3)

      ~ Test to see if this does anything useful
      var nClasses as number
      var nGestalt as number
      var iX as number

      nClasses = hero.tagcount[Classes.?]
      nGestalt = hero.tagcount[Classes.S2Gestalt]
      nClasses = nClasses - (nGestalt * 2)

      foreach pick in hero
        perform eachpick.pulltags[Classes.?]

      ~perform hero.pulltags[Classes.?]
      perform hero.delete[Classes.?]

      iX = 0
      while (iX < nClasses)
        iX += 1
        perform hero.assign[Classes.S2Gestalt]
The plan is for the next script at Pre-levels 5001 to clear our temporary class tags, and then push the tags we pulled in the previous script.

I assume there are ways to push pulled variables from other scripts or am I overcomplicating this?
Arkadious is offline   #10 Reply With Quote

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 06:44 PM.

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