Senior Member
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265
|
I've just entered the Greater Resiliency feat from the Complete Warrior this Eval Script for checking for Damage reduction works up to the point where it adds +1 to the Damage reduction
Code:
~ Check for Damage Reductiion as a Class or Innate Ability hero.childfound[cBbnDR].field[hTotal].value += 2 hero.childfound[cPfPTaDam1].field[hTotal].value += 2 hero.childfound[cDwDDR1].field[hTotal].value += 2 ~ We passed, so add +1 to our total Damage Reduction. hero.child[xDamRd].field[hTotal].value = hero.child[xDamRd].field[hTotal].value + hero.child[xDamRd].field[hTotal].value + 1 done hero.child[cBbnDR].field[hTotal].value = hero.child[cBbnDR].field[hTotal].value + hero.child[xDamRd].field[hTotal].value + 1 done hero.child[cPfPTaDam1].field[hTotal].value = hero.child[cPfPTaDam1].field[hTotal].value + hero.child[xDamRd].field[hTotal].value + 1 done hero.child[cDwDDR1].field[hTotal].value = hero.child[cDwDDR1].field[hTotal].value + hero.child[xDamRd].field[hTotal].value + 1 done Code:
Damage Reduction ability required. @valid = pickexists[cBbnDR] + pickexists[cPfPTaDam1] + pickexists[cDwDDR1] Last edited by bodrin; February 21st, 2009 at 07:09 AM. |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,215
|
Actually, damage reduction is the xDamRd pick. All the class specials that grant damage reduction do so by bootstrapping xDamRd, then setting its field[Value].value
hTotal is charges, BTW. First, when looking for a class special or a special like Damage Reduction that hides itself when Value = 0, try putting this in an expr-req: hero.childfound[xDamRd].tagis[Helper.ShowSpec] <> 0 (Expr-reqs were added in v3, and they simplify the process of adding the majority of pre-reqs) The ShowSpec is added to a class ability/special once it's visible. For example, @valid = pickexists[cBbnDR] will succeed for a 1st level Barbarian, hero.childfound[xDamRd].tagis[Helper.ShowSpec] <> 0 will succeed only once the barbarian is L7+. Increasing damage reduction is an interesting problem, though. The majority of things that grant damage reduction don't stack with each other, to they add damage reduction with this sort of statement (from Barbarian): hero.child[xDamRd].field[Value].value = maximum(hero.child[xDamRd].field[Value].value, bonus) (the script already calculated the variable bonus from the barbarian level) What you have to do if you're adding +1 DR that does stack, is get your timing right so that your bonus is added after everything else adds the base DR values, but before the xDamRD pick runs the script that modifies the name to say "Damage Reduction 1/-" - drawing the # from whatever its field[Valeu].value is at that time. xDamRd's script runs at Final, 10000, so try putting your script at Final, 9000. All you should need is: hero.childfound[xDamRd].field[Value].value += 1 |
#2 |
Senior Member
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265
|
Thanks for the help Mgehl, the script works but it has a quirk.
This Exp-Req does indeed show an error message about damage reduction, however once the DR +1 is added by an illegal acquirement of the feat it disappears because the Damage Reduction script is fulfilled, Greater Resiliency is valid at this point but it shouldn't be. hero.childfound[xDamRd].tagis[Helper.ShowSpec] <> 0 will succeed only once the barbarian is L7+ How do I check and stop the feat from adding the Dr +1 if the character isn't a first level barbarian or a Dwarven Defender or any other class that doesn't have a Damage Reduction Class or Innate ability! If I still keep this script in too it produces two damage reduction error messages. @valid = pickexists[cBbnDR] + pickexists[cPfPTaDam1] + pickexists[cDwDDR1] |
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,215
|
Consider it from the other angle - "my DM says I can take this feat to give me DR 1/- even though I don't get DR from another source" - a user had to intentionally select a feat, so I'd give them the benefit of the doubt, and not bother checking for the pre-reqs inside the script.
Handling the fact that the feat satisfies its own pre-req - don't bother with something that complex if you're just trying to get a book entered for use. For completeness, here's what I've got (go back to a pre-req for this): if (@ispick <> 0) then @valid = hero.childfound[xDamRd].tagis[Helper.ShowSpec] elseif (hero.childfounc[xDamRd].field[Value].value >=2) then @valid = 1 end Walking through that: First, ask whether we're a pick (if we're still in the feat selection dialog) - if so, all we need is that the xDamRd special is out there, and displayed (which means it has a positive value). Otherwise, we ask whether xDamRd's value is greater than the +1 this feat is adding, if so, we're good. If it doesn't meet either of those, the if...elseif...end will complete, and the pre-req will complete, leaving @valid = 0, which is what it always starts a pre-req script set to. P.S. I haven't tested that or looked up references, I may have gotten reversed on whether you need @ispick = 0 or @ispick <> 0. |
#4 |
Senior Member
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265
|
Mgehl you genius, The script provided by your good self works a treat with a few modifications.
Eval script final phase 9000 Code:
hero.childfound[xDamRd].field[Value].value += 1 Code:
hero.childfound[xDamRd].tagis[Helper.ShowSpec] <> 0 Code:
if (@ispick <> 0) then @valid = hero.childfound[xDamRd].tagis[Helper.ShowSpec] elseif (hero.childfound[xDamRd].field[Value].value >=0) then @valid = 1 endif The feat adds the +1 so a first level barbarian would benefit from taking this feat straight away and benefit at 7th level and so forth! Last edited by bodrin; February 22nd, 2009 at 09:38 AM. Reason: Final pahse timing correction |
#5 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,215
|
Reading through the feat, a 1st level barbarian doesn't fulfill the pre-req. You don't fulfill a pre-req if the ability is something your class will get eventually, you only fulfill it once your class grants the ability. I suggested leaving out the check for fulfilling the pre-req within the script because DMs are free to override that for their campaigns.
|
#6 |
Senior Member
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265
|
Quote:
I, however think that just having the ability to gain the DR later fulfills the criteria of the feat even at first level but can understand the reasoning behind not allowing the feat until the Damage reduction is active at certain class levels! |
|
#7 |
|
|