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)
-   -   What is cClsIndex? (http://forums.wolflair.com/showthread.php?t=62504)

Illyahr April 27th, 2019 06:50 AM

What is cClsIndex?
 
As title. I have a cHelp bootstrapped to a template. It needed class abilities (and wouldn't recognize class abilities at level 0 as that would put the array at -1) so I had to bump cTotalLev by 1.

This gave it skill points based on Int mod, so I had to reduce those but I'm getting errors. I based the script on other scripts but I'm trying to figure out what each thing is so I can figure out where it's going wrong.

Kendall-DM April 28th, 2019 09:12 AM

The index is part of an array that indicates your progress in multiple classes.

The first class you enter at 1st level has an index of 0.

The second class you enter, regardless of what level you enter it is set to 1.

Etc.

Technical Stuff
It is just an internal index that HeroLab uses to keep track of classes on the hero, the index allows the crunchy bits to know which class in the class array it is referring to.

So, if you had a Rogue/Sorcerer that entered rogue at 1st level and sorcerer at some other level, the rogue's index is 0 and the sorcerer is 1. At some point in the crunchy bits of the code, it needs to know something about the class and class levels thereof it is referring to. So, the <someArray>[0] holds the value of the number of levels held by the rogue and the <someArray>[1] holds the value of the number of levels advanced by the sorcerer.

A 10,000 foot view of the thing. A helper class has this index, and since you bootstrapped the cHelpxxx, it probably has code referring to the cClsIndex field located within that cHelpxxx object.

Does that help any?

Illyahr April 28th, 2019 12:49 PM

It does. So templates come back as -1 then?

The main problem I'm getting is that I need to reduce the skill points to zero but it keeps coming back with an error trying to reduce tSkTotals to -1, but shouldn't be. It only does it sporadically, which makes it difficult to pin down.

Code:

Post-Attributes, 1000
var lev as number
var bon as number
var skl as number
lev = field[cTotalLev].value
bon = hero.child[aINT].field[aNormMod].value

if (bon < 1) then
  bon = 1
endif

skl = lev * bon

var index as number
index = field[cClsIndex].value
herofield[tSkTotals].arrayvalue[index] -= skl


Kendall-DM April 28th, 2019 01:55 PM

Ok, as I understand it, you are bootstrapping the cHelpxxx.

This doesn't mean the same thing as having a class level for the class.

You actually have to add that class, but since you are bootstrapping, there is no class added.

An index of -1 means there is no index (it's like being NULL, it doesn't exist as an index).

There is some class linkage that goes on internally in HeroLab, but that isn't happening here.

What exactly are you trying to do, I might be able to provide a better alternative than what you are attempting.

Illyahr April 28th, 2019 02:31 PM

Class abilities (how I'm adding the special abilities of being a god) can't be set at level 0 (comes back with an index of level -1, which confuses the system) so I boosted the cTotalLev to 1. I set BAB and saves to Poor, so it doesn't affect those calculations, and skill points to 0, but it still gives one level of skill points based on the hero's Intelligence modifier. I'm trying to negate this.

Bootstrapping a cHelpxxx to a template is tricky.

Kendall-DM April 28th, 2019 03:45 PM

Some script code can be used to modify and adjust various attributes and abilities of characters in HeroLab.

Other code and objects have internal code that acts upon it that is difficult, if not impossible, to modify and adjust.

Working with the cHelpxxx object, you may be working in the later territory.

Without more specific knowledge about what you actually want to happen, that's about all I can provide. Mind you, some class abilities themselves can be bootstrapped directly. Others require a bit of tag/script work to make that happen. The task you are attempting without using levels might be a monumental task. Having done tasks to change features of HeroLab that were monumental to accomplish, I don't envy you the task. In fact, there are a few I gave up on because they just couldn't be "fixed" the way I wanted (Alternate Form and Change Shape abilities come to mind).

I'll help if I can, but I think this involves alot more than just a few lines of code to enact.

NOTE: I also tried to create a 0-level commoner template without much success. I've got a semi-working model that had worked at one point, but I got hit with changes in HeroLab updates that broke it and I don't want to go through all the rigmarole just to get it working again. But that's another story.

Illyahr April 29th, 2019 01:49 PM

The thing is, I got almost all the code for it working. Everything works except I dont want it to provide skill points. This is literally the very last thing before it is ready for use.

Edit: Do you think the timing is wrong? The code I'm using is set to post-attributes so it can find the normal Intelligence modifier. You think the skill point total needs to be done before that? If so, it would explain why it isn't working.

Illyahr April 29th, 2019 05:19 PM

Figured out what was wrong. The system recognizes 'field[aNormMod].value' but doesn't know what it refers to and comes back with a value of 0. When I put that in for the equation, it comes back as "skl = 0" so reduces current skill points by 0. Changed aNormMod to aBonus got it to work, as long as the creature doesn't get an extra skill point each level.

Still working out how to account for that.

Edit: Figured a workaround. Once I put the rest of the deities in, Deities & Demigods will be done.

Kendall-DM April 29th, 2019 07:50 PM

Ah, the aNormMod. Decided to look at that myself, at one point that thing worked and now it does some weird stuff. Anyhow, the aNormMod really only applies to advancing your attribute bonuses at every 4th level. It is used in conjunction with the uINT thing that represents that advancement.

I've had a feat for the longest time called Smart that allowed a character to get a +1 to an attribute that worked just like the attribute advancement. Unfortunately, it stopped working at some point about 4 years ago and I've never been able to figure it out (been at it again this evening to no avail).

BUT, I did discover one of those special things with aNormMod where two scripts are running at the same timing and you may have to squeeze code between them.

Anyways, the aNormMod should be adding to the attributes, not adjusting the attribute bonus in a negative way (which is what it appears to be doing). That is, if you add that attribute through the uINT (+1 Intelligence selection at every 4 levels) it works fine, but adjusting it further in a script oddly treats it as a negative value and adjusts the skill points appropriately. That explains what is happening with my stuff, but the point at which it happens (PostAttributes 100) has two scripts that I can't get between.

Might be one of the many broken things in the d20 files that don't get fixed on a regular basis. Such is the fate of a defunct product that doesn't have a great influence on future development.


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

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