• 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

CL of specific spells...

ShadowChemosh

Well-known member
I was going back to older .user files and updating them with the latest changes to HL. Things like using BonTrait for traits and such. A trait from Tadlor Echoes of Glory is Precocious Spellcaster. Here is the benefit: Select one cantrip and one 1st-level spell; when you cast these spells, they function at one caster level higher than your actual caster level.

I thought great I will update it to the use the new field[sCL] that was added. I am running into some errors though trying to use this.

I have a custom expression "component.BaseSpell&sLevel.0" so a single cantrip can be picked.

Here is one of the scripts I tried.
Code:
~Pre-levels 5,000
      ~set our focus to the selected pick
      call fTargetFoc
      doneif (state.isfocus = 0)
      focus.field[sCL].value += 1

Here is the error message I get when I choose Acid Splash for a Sorcerer that did have Acid Splash added under the Sorcerer tab.
Attempt to access pick information or behaviors for read-only thing 'spAcidSpl0'
Location: Procedure 'fTargetFoc' near line 6


So I know another way to pick up a chosen field so I tried that next. Here is that script:
Code:
~Pre-levels 5,000
if (field[usrChosen1].ischosen <> 0) then
   field[usrChosen1].chosen.field[sCL].value += 1
endif
And here is its error message:
Attempt to assign field value with no pick context.

What I am missing or doing wrong when trying to use this new field[sCL]. I also tried just setting the Acid Splash spell using its ThingId and that worked correctly. I then tried to find an existing thing like (Gifted Adept) which does basically the same thing, but it as of yet has no scripts.

Any help would be much appreciated.
 
In the editor for the feat, go to the Item selection section, and change "Restrict First List To..." to "Picks on Hero".

You can't modify a field unless you are modifying a thing on the hero. If you leave that blank or select "All Things", you are selecting all the spells that are available to all characters, but what you're selecting isn't actually present on the character.
 
That was the issue. Thank you!

Another question. With the above change if I use a list to display first level spells the list only shows the one selected/known by the hero. Which is fine. The question is for 0 level spells it shows everything, but does not cause any errors.

So for a cleric can see Arcane spells(ie Acid Splash) and things like Detect Magic shows up 3 times. How come their is a difference between 0 and level 1 spells?

Thanks
 
In order to give Wizards and Witches all the 0-level spells in their spellbooks, those 0-level spells are actually present on all characters. On a blank character, in the develop menu, select floating info windows...show selection tags, and then find a few of those spells. You'll see that they have Spellbook.cHelpWiz or Spellbook.cHelpWit. So, !Spellbook.? will restrict those from being shown.

Unfortunately, that restricts the feat to spells that a wizard/witch has memorized, but you have the same problem for a cleric, too.

There may be a better solution for Clerics/Wizards.

Switch the "Restrict First List to..." back to "Things".

Now, in your script, you'll retrieve the Id of the thing that was chosen, and use it to find the corresponding picks:

Code:
doneif field[usrChosen1].ischosen = 0
 
var searchexpr as string
 
searchexpr = (!Spellbook.? & !Helper.SpellLike & " & field[usrChosen1].chosen.tagids[thingid.?,"|"] & ")"
 
foreach pick in hero from BaseSpell where searchexpr
  eachpick.field[sCL].value += 1
  nexteach

This does mean that if a multiclasses character has the same spell from more than one source, it'll alter the CL of both. I don't know if that's correct or not. (I have prevented it from finding spells in spellbooks and spell-like abilities)

Oh, and since it's looking for two different spells, you can integrate those into a single script, to save processing time (using only one foreach instead of two):

Code:
doneif field[usrChosen1].ischosen = 0
doneif field[usrChosen2].ischosen = 0
 
var searchexpr as string
 
searchexpr = !Spellbook.? & !Helper.SpellLike & ((" & field[usrChosen1].chosen.tagids[thingid.?,"|"] & ") | ( " & field[usrChosen2].chosen.tagids[thingid.?,"|"]  & "))"
 
debug searchexpr
 
foreach pick in hero from BaseSpell where searchexpr
  eachpick.field[sCL].value += 1
  nexteach

Hopefully I got that right - you'll want to delete the debug once you've verified that it's constructing things correctly.
 
Awesome thank you. I am putting this script in my keepers as that is a really cool way to do the foreach as I didn't know I could actually dynamically build a string to search for. That opens up some interesting possibilities.

Their was just a couple really small changes I had to make to the script to get it to work. So here is that final version to help out any future readers.

Code:
~Pre-levels 5,000
doneif (field[usrChosen1].ischosen = 0)
doneif (field[usrChosen2].ischosen = 0)
 
var searchexpr as string
 
searchexpr = "!Spellbook.? & !Helper.SpellLike & ((" & field[usrChosen1].chosen.tagids[thingid.?,"|"] & ") | ( " & field[usrChosen2].chosen.tagids[thingid.?,"|"]  & "))"
 
~debug searchexpr
 
foreach pick in hero from BaseSpell where searchexpr
  eachpick.field[sCL].value += 1
  nexteach
 
Back
Top