PDA

View Full Version : CL of specific spells...


ShadowChemosh
June 20th, 2010, 09:37 AM
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.

~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:

~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.

Mathias
June 21st, 2010, 08:27 AM
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.

ShadowChemosh
June 22nd, 2010, 07:22 AM
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

Mathias
June 22nd, 2010, 10:00 AM
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:


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):


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.

ShadowChemosh
June 26th, 2010, 08:14 AM
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.


~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