Member
Join Date: Sep 2008
Posts: 48
|
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] thanks! Last edited by Dastir; July 18th, 2009 at 01:59 PM. |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
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) Code:
if (field[fChosen].chosen.tagis[CastArmor.Heavy] <> 0) then done 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 |
#2 |
Member
Join Date: Sep 2008
Posts: 48
|
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.
|
#3 |
Member
Join Date: Sep 2008
Posts: 48
|
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! |
#4 |
|
|