Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Pathfinder Roleplaying Game (http://forums.wolflair.com/forumdisplay.php?f=62)
-   -   Suggested Wealth for Level [Help] (http://forums.wolflair.com/showthread.php?t=67287)

Arkadious July 30th, 2022 02:03 PM

Suggested Wealth for Level [Help]
 
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.

https://i.imgur.com/7dMZnyH.png

https://i.imgur.com/j5BnPgI.png

Arkadious July 30th, 2022 04:02 PM

1 Attachment(s)
I've attached the file I'm working on (the one that goes in ProgramData).

Arkadious July 30th, 2022 05:59 PM

I can see that the Wealth by Level mechanic (mechWealth) references some arrays that have been labeled as such:

Code:

mechGrGear
mechGrLim
mechGrMagi
mechGrNPC
mechGrPC
mechGrProt
mechGrWeap

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.

ploturo July 30th, 2022 08: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.

Arkadious July 31st, 2022 12:39 AM

I'm able to alter some numbers that are used for levels using these bits of code:

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 August 2nd, 2022 12: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.

ploturo August 3rd, 2022 10: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.

ploturo August 3rd, 2022 08: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.

Mathias August 3rd, 2022 11:01 PM

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.

Arkadious August 6th, 2022 04: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.

Code:


      ~ 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.?]
      nexteach

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

      iX = 0
      while (iX < nClasses)
        iX += 1
        perform hero.assign[Classes.S2Gestalt]
      loop

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?

ploturo August 6th, 2022 06:48 PM

Pulling tags copies them to the current pick (the one running the script) from whatever other pick/container you've have navigated to as part of the pull command.

Pushing tags copies them from the current pick to whatever other pick/container you've navigated to as part of the push command.

We don't actually need the foreach to pull tags from all the picks on the hero, since they have all already been added to the hero container at the timing we are interested in.

One minor issue is that the class helper will already have one class tag for your Gestalt class on it already, so that has to be taken into account to make sure the number of tags doesn't get screwed up.

This code assumes (pretty safely, I hope?) that there will always be at least one Classes.S2Gestalt tag on the hero, because I'm assuming the helper wouldn't be loaded if there are no levels of its class.

Pre-levels:4999
Code:


    ~ if there is only one class tag on the hero, we don't need to do anything
    doneif (hero.tagcount[Classes.?] <= 1)
   
    ~ attempt to calculate the actual level of the character
    var nClasses as number
    var nGestalt as number
    nClasses = hero.tagcount[Classes.?]
    nGestalt = hero.tagcount[Classes.S2Gestalt]
    nClasses = nClasses - (nGestalt * 2)

    ~ our minimum level is the number of gestalt class tags added, even if
    ~  the player hasn't chosen which classes to use for gestalt levels
    nClasses = maximum(nClasses, nGestalt)

    ~ delete the existing Classes.S2Gestalt tag on this helper to avoid extra tag
    perform delete[Classes.S2Gestalt]

    ~ copy all the existing Classes.? tags from the hero to this helper
    ~  and then delete those tags from the hero
    perform hero.pulltags[Classes.?]
    perform hero.delete[Classes.?]

    ~ add the correct number of temporary class tags back to the hero
    var iX as number
    iX = 0
    while (iX < nClasses)
        iX += 1
        perform hero.assign[Classes.S2Gestalt]
    loop

Pre-levels:5001
Code:


    ~ if only one class tag on this helper, we don't need to copy anything back
    doneif (tagcount[Classes.?] <= 1)
   
    ~ delete the temporary class tags we added to the hero at Pre-levels:4999
    perform hero.delete[Classes.?]
   
    ~ copy the tags on this helper back to the hero and delete them from here
    perform hero.pushtags[Classes.?]
    perform delete[Classes.?]
   
    ~ add back the original class tag that is supposed to be on this helper
    perform assign[Classes.S2Gestalt]

You could add the timing requirement that the 4999 script needs to run before "Component Totals: Eval Script #40" and the 5001 needs to run after it, just to document why the timings were selected for anyone else working on the code later.

Arkadious August 7th, 2022 02:23 AM

That code works great. I made a couple of tiny changes for what I wanted but yeah, thanks heaps! :) It's kinda frustrating how close it looked like I was to solving this myself and just not knowing what I was doing wrong.

Pre-levels, 4999
Code:


      ~ 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 nHitDice as number
      var nClasses as number
      var nGestalt as number
      var iX as number

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

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

      iX = 0
      while (iX < nClasses)
        iX += 1
        perform hero.assign[Classes.S2Gestalt]
      loop

Pre-levels 5001
Code:


      ~ 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
      perform hero.delete[Classes.?]
      perform hero.pushtags[Classes.?]
      perform delete[Classes.?]

Really I should just stop here for now. Maybe once I get better at Hero Lab programming I'll try to fix the issue with the incorrect level showing for the mouseinfo section.

Thanks for the help everyone. I really do appreciate it.


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

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