Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - d20 System
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Dastir
Member
 
Join Date: Sep 2008
Posts: 48

Old July 18th, 2009, 01:55 PM
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 by Dastir; July 18th, 2009 at 01:59 PM.
Dastir is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old July 18th, 2009, 08:17 PM
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
Mathias is online now   #2 Reply With Quote
Dastir
Member
 
Join Date: Sep 2008
Posts: 48

Old July 18th, 2009, 09:56 PM
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.
Dastir is offline   #3 Reply With Quote
Dastir
Member
 
Join Date: Sep 2008
Posts: 48

Old July 19th, 2009, 05:02 AM
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!
Dastir is offline   #4 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 01:58 PM.


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