• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Wierd error

Charender

Member
I am trying to mage a class ability that calculates a spell pool for existing classes, then I am using a global mechanic that bootstraps the ability onto all classes. The problem is that I am getting an odd error.
Here is my code
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<document signature="Hero Lab Data">
  <thing id="cDivPool" name="Divine Casting Pool" description="This pool controls the amount of divine power you can use in a day." compset="ClSpecial" summary="You have a pool for casting divine spells.">
    <tag group="User" tag="Tracker" name="Tracker" abbrev="Tracker"/>
    <tag group="Usage" tag="Day"/>
    <eval phase="Final" priority="10000"><![CDATA[
      ~ If we're not shown, just get out now
      doneif (tagis[Helper.ShowSpec] = 0)

      var i as number
      i = 0
      foreach pick in hero where "CasterSrc.Divine"        
        debug "name "&eachpick.field[name].text
        debug "Caster Level "&eachpick.field[cCasterLev].value
        i += eachpick.field[cCastMax].arrayvalue[1] + eachpick.field[cMemMax].arrayvalue[1]
        i += 2 * (eachpick.field[cCastMax].arrayvalue[2] + eachpick.field[cMemMax].arrayvalue[2])
        i += 3 * (eachpick.field[cCastMax].arrayvalue[3] + eachpick.field[cMemMax].arrayvalue[3])
        i += 4 * (eachpick.field[cCastMax].arrayvalue[4] + eachpick.field[cMemMax].arrayvalue[4])
        i += 5 * (eachpick.field[cCastMax].arrayvalue[5] + eachpick.field[cMemMax].arrayvalue[5])
        i += 6 * (eachpick.field[cCastMax].arrayvalue[6] + eachpick.field[cMemMax].arrayvalue[6])
        i += 7 * (eachpick.field[cCastMax].arrayvalue[7] + eachpick.field[cMemMax].arrayvalue[7])
        i += 8 * (eachpick.field[cCastMax].arrayvalue[8] + eachpick.field[cMemMax].arrayvalue[8])
        i += 9 * (eachpick.field[cCastMax].arrayvalue[9] + eachpick.field[cMemMax].arrayvalue[9])
        debug "Divine Caster "&i 
        nexteach
        
      debug "Divine Caster Total "&i]]></eval>
    </thing>
  <thing id="mMagPool" name="Magic Pools" compset="Mechanics" uniqueness="useronce">
    <usesource source="srcShatt" parent="UserParent" name="Shattered Isles"/>
    <bootstrap thing="cDivPool"></bootstrap>
    </thing>
  </document>

I am getting an error "Attempt to access field 'cTotalLev' that does not exist for thing 'mMagPool' Location: 'field calculate' script for Field 'xTotalLev' near line 16

There are no scripts attached to mMagPool, so I am not sure why I am getting this error.
 
Class specials MUST be bootstrapped from a class, an archetype, or a custom ability - they need one of those specific connections in order to know which class they belong to (and class specials must belong to a specific class). Bootstrapping them from a mechanic means they try to look up the class level of the mechanic, which does not exist.

Can you make this a Racial Special, or an Ability, rather than a Class Special? If you just need the value, and don't need to display anything to the user, can you put the script on the mechanic?

So that you don't have to delete it from one tab and re-create it on another tab, you can edit the XML and change

Code:
compset="ClSpecial"

to

Code:
compset="RaceSpec"
or
Code:
compset="Ability"

then re-open this file in the editor.

If each pool is specific to a single class, so that a Cleric/Inquisitor has two separate pools, I'd recommend making an archetype for each of the classes that you need to change - all the archetypes will be nearly identical - all just bootstrapping the same class special. You just need to duplicate the first one you create and change the class it modifies.


Another potential problem:

Code:
foreach pick in hero where "CasterSrc.Divine"

Classes are not the only things in the character that have the CasterSrc.Divine tag, so you need to restrict your search to only looking through classes:

Code:
foreach pick in hero from Class where "CasterSrc.Divine"
 
Back
Top