A class is made up of "TWO" pieces or Things. The Class Helper and the Class. The Class Helper only exists "ONE" time no matter the level of the character. Where a Class Pick exists each time you select the class on the Basics tab. So a 5th level wizard has ONE Pick named cHelpWiz and 5 picks named cWizard (so 6 total picks on the hero).
When I get home I can get you the correct component name for class helpers. But to find it yourself add 1 level of wizard to your a blank character. Go to the develop menu and look at the "tags" and look for "cHelpWiz". If you look at the "tags" you can see the components and one is named "Class Helper". Its BaseClHelp in Pathfinder/5e and I thought that naming convention came from d20.
My next question in all this is do you need to run super early in script timing? Otherwise class level and racial hit dice are all tags on the "hero" you can simply count.
Code:
var classlevel as number
classlevel = hero.tagcount[Classes.?]
If you run at like Post-Level/10000 the above script will tell you the total of ALL classes on the hero. Which is all that #totallevelcount[] macro is doing.
If you are needing to run "super" early like First/10000 or earlier then and only then would you need to do a foreach loop to try and count classes. This is because the "Classes.?" tags have not yet been forwarded to the hero. Even then I am thinking that the Class Helpers have the total class level already done and you only need to total the couple class helper Picks not the "Class" components on the character.
In example the character has 5 levels of Wizard and 1 of Rogue. Your foreach loop and find cHelpWiz with a class level of 5 and cHelpRog has a class level of 1. Boom now you know you have 6 total levels.
Quote:
Originally Posted by Nightfox
The other question is what order do foreach loops approach data?
|
Foreach loops are not SQL and you can not do an "order by". In other words you will get the "Picks" back in a random order that will very often change when executed. If you have 6 picks A,B,C,D,E,F on a character and do
Code:
foreach pick in hero from LETTERS
You could one time get back F,E,D,C,B,A and next run get A,B,C,F,E,D.