• 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

Battle Caster feat

Dastir

Well-known member
I am trying to code the Battle Caster feat from COmplete Arcane and am not quite sure how to proceed.

I know how to detect iof a class has the ability to ignore spell failure from a specific class of armor, and I know how to adjust that for a specific class. The question I have is this:

How do I detect, regardless of class, the highest level of armor the character can wear and still ignore spell failure, and how can I, again regardless of class, increase that? I understand logically how to do it

Code:
[pseudocode]
if (hero has CastArmor.Heavy) then
   done
elseif (hero has CastArmor.Medium) then
   assign CastArmor.Heavy
elseif (hero has CastArmor.Light) then
   assign CastArmor.Medium
endif
[/pseudocode]

The thing I don't get is how to detect and assing these tags no matter what class they have. All the examples use childfound[classid]

thanks!
 
Last edited:
Remember to give full descriptions of what you're trying to enter does.

Battle caster requires the ability to ignore spell failure from a class of armor and increases the class of armor allowed.

Okay, pulling out my copy of Complete Arcane, I don't actually understand how they intended the feat to work. If you were a warmage 8 (ignores medium armor) / bard 1 (ignores light armor) / sorcerer 1 (doesn't ignore armor, do you go up to heavy / medium / none respectively? Or do you pick one class for each time you choose the feat?

First, note that you're looking at the hero to find the tags. That's actually incorrect, because the CastArmor tags stay on the Class Helper, and aren't forwarded to the hero (which is why my earlier example is processed correctly, with each class ignoring the right armor).

Okay, if you're supposed to select a class to improve, you'll use:

field[fChosen].chosen

in place of childfound[classid]

start by making sure the user chose something, and exit the script if they haven't (since this script will try to run as soon as they add the feat, before they've had a chance to select the class to apply it to):

Code:
doneif (field[fChosen].ischosen = 0)

now, check if they have heavy armor:
Code:
if (field[fChosen].chosen.tagis[CastArmor.Heavy] <> 0) then
  done

and, you already know how you're going to go about the rest.

Now, for the second option - if the feat was intended to improve all classes with the ability to ignore armor:

we're going to use a "foreach pick in hero" procedure, which searches everything attached to the character to find those things that match the tags you're looking for.

the search expression that will find what we want is:
"component.BaseClHelp & (CastArmor.Light | CastArmor.Medium)"

that will find class helpers (which is what we want to modify), that can ignore either light or medium armor (why bother checking for the ones that have heavy armor - those don't need to be modified)

Code:
foreach pick in hero where "component.BaseClHelp & (CastArmor.Light | CastArmor.Medium)"
 
  if (eachpick.tagis[CastArmor.Medium] <> 0) then
    eachpick.assign[CastArmor.Heavy]
  elseif (eachpick.tagis[CastArmor.Light] <> 0) then
    eachpick.assign[CastArmor.Medium]
    endif
 
  nexteach
 
Thanks! I suspect it is the second scenario, but I may do a bit of research on that. I will try this out and let you know what happens.
 
Worked perfectly with only one change. Had to call "perform" for the assign statements to keep the compiler from barfing on those lines.

Thanks for your help!
 
Back
Top