Member
Join Date: Aug 2014
Posts: 44
|
Does a feat can modify racial trait bonus?
Hello, I have the following, for my custom race (Kaiyigiss) Custom Racial trait : Kaiyigiss Damage Resistance : (5/slashing). Custom Feat : Ironbark. Damage Resistance (5/slashing) becomes (constitution modifier/-) Is there an example of that somewhere? Thx Last edited by peterphonic; September 17th, 2014 at 09:53 AM. |
#1 |
Member
Join Date: Aug 2014
Posts: 44
|
I did the following to add DR/- with the constitution modifier
Code:
~ If we're disabled, do nothing doneif (tagis[Helper.FtDisable] <> 0) field[abValue].value += #attrbonus[aCON] #applyresist[xDamRd,field[abValue].value] I tried this Code:
#deleteresit[xDamRds] Code:
#removeresit[xDamRds] Somebody have an example how to remove or disable a special ability from a feat? Thank you! |
#2 |
Senior Member
Join Date: Jul 2012
Posts: 416
|
I believe all damage resists exists all the time on all characters. You cannot 'remove' the damage resist, you instead need to modify it's value (setting it to zero). The problem with this, though, is that there may very well be something else on the character that is granting DR/Slashing, and you would end up wiping that out as well. It is likely best, if you have a racial trait, and a racial feat that AFFECTS that trait, to have it do just that, instead of each manipulating the values. Instead of script in each, simply script something like the following in the racial trait (I have not tested this):
Code:
~ If we're disabled, do nothing doneif (tagis[Helper.FtDisable] <> 0) ~ Apply the proper DR, depending on presence of the IronBark feat. if (#hasfeat[fIronBark]) then field[abValue].value = #attrbonus[aCON] #applyresist[xDamRd,field[abValue].value] else field[abValue].value = 5 #applyresist[xDamRds,field[abValue].value] endif |
#3 |
Member
Join Date: Aug 2014
Posts: 44
|
Thx fuzzy. Works like a charm. I actually did that :
Code:
~ If we're disabled, do nothing doneif (tagis[Helper.SpcDisable] <> 0) ~ Apply the proper DR, depending on presence of the IronBark feat. if (#hasfeat[fIronbaKai] <> 0 ) then field[abValue].value = #attrbonus[aCON] #applyresist[xDamRd,field[abValue].value] else field[abValue].value = 5 #applyresist[xDamRdS,field[abValue].value] endif So, I am really progressing with scripting, but I am still a little bit confused between field and tag. I know that I need to do somethig like this to change the text : Code:
field[abSumm].text = "Damage Reduction (" & signed(#attrbonus[aCON]) & "/-)" Thanks for your help! |
#4 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
Think of tags as post-it notes placed on the item - they're there to remind you that something has a certain property, or does not fall within a certain category.
Fields store data that's not a simple yes-no - they store numbers like the final adjusted modifier for an attribute, or they store bits of text like the text that will be placed in the summary. That last line of code won't actually work. #attrbonus[aCON] is a math operation, and you can't have a math operation inside a text operation. You'll need to do the math operation first, store it in a variable, then use the variable in your text operation: Code:
var conbonus as number conbonus = #attrbonus[aCON] field[abSumm].text = "Damage Reduction (" & signed(conbonus) & "/-)" |
#5 |
Member
Join Date: Aug 2014
Posts: 44
|
Thx for your explanation Mathias.
For the abSumm field, it still not showing like I want though. It is alway showing the default summary text, when I do a mouse over the question mark (background tab). The following is what I did : Code:
~ If we're disabled, do nothing doneif (tagis[Helper.SpcDisable] <> 0) ~ Apply the proper DR, depending on presence of the IronBark feat. if (#hasfeat[fIronbaKai] <> 0 ) then field[abValue].value = #attrbonus[aCON] #applyresist[xDamRd,field[abValue].value] var conbonus as number conbonus = #attrbonus[aCON] field[abSumm].text = "Damage Reduction (" & signed(conbonus) & "/-)" else field[abValue].value = 5 #applyresist[xDamRdS,field[abValue].value] field[abSumm].text = "Damage Reduction (5/Slashing)" endif My question is, what is the magic of field[abSumm].text? How the software knows that I want to change the text of "Kaiyigiss Damage Recution"? Is it because the script is stored under raKaiDamRe? Thank you |
#6 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
Is it showing the correct text on the Special tab?
Also, phase & priority of that script? Check out this article on what the dots mean: http://forums.wolflair.com/showthread.php?t=21663 That explains how to move around through the data in Hero Lab. The code "field[abSumm].text" doesn't move anywhere else before transitioning to a field - that's why it alters the abSumm field on itself. |
#7 |
Member
Join Date: Aug 2014
Posts: 44
|
Ohhh, my bad. Just realized that CustDesc was the field that I had to modify.
The following is working like a charm : Code:
~ If we're disabled, do nothing doneif (tagis[Helper.SpcDisable] <> 0) ~ Apply the proper DR, depending on presence of the IronBark feat. if (#hasfeat[fIronbaKai] <> 0 ) then field[abValue].value = #attrbonus[aCON] #applyresist[xDamRd,field[abValue].value] var conbonus as number conbonus = hero.child[aCON].field[aBonus].value field[CustDesc].text = "{i}Damage Reduction (" & signed(conbonus) & "/-){/i}\n\nYou have Damage Reduction against all attacks." else field[abValue].value = 5 #applyresist[xDamRdS,field[abValue].value] field[CustDesc].text = "{i}Damage Reduction (5/Slashing){/i}\n\nYou have Damage Reduction against all attacks except Slashing" endif Code:
field[CustDesc].text = "{i}Damage Reduction (" & signed(conbonus) & "/-){/i}\n\nYou have Damage Reduction against all attacks." I looked string formatting, and I did not see anything to do such operations. Thx again for your patience! |
#8 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
signed() means display the number as a signed number - with a + if it's >= 0, or with a - if it's < 0.
So, just using conbonus by itself, not signed(conbonus) will display it without the +. |
#9 |
|
|