Junior Member
Join Date: May 2010
Posts: 25
|
I am trying to create a feat, Shield Ward.
It will add the Hero's Shield AC bonus (including magic) to his Touch AC and his CMD. Here is the script I have to far, but it Herolab doesn't seem to like it much. ~find all our shields foreach pick in hero from BaseArmor where "EquipType.Shield" var bonus as number ~if it's equipped if (eachpick.field[gIsEquip].value <> 0) then bonus = eachpick.field[tACShield].value eachpick.field[tACTouch].value += bonus endif nexteach It compiles it without a complaint, but it does not adjust the Touch AC of the character. Then there is figuring out how to add it to the CMD..... And when it is used on a character with a Magic Shield, Herolabs complains bitterly that the 'attempt to access field "TACShield" that does not exist for thing "IMagArmor"' BenT1 |
#1 |
Junior Member
Join Date: May 2010
Posts: 25
|
By the way, the Weapon talent of the Fighter's does transfer now, Thanks!!
BenT1 |
#2 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
So you where pretty close actually, but a few problems. The AC field on shields is actually arAC not tACShield. Then you where trying to modify the touch AC on the shield by using eachpick.field[tACTouch].value. What you really wanted to do was modify the Touch AC of the hero. So you needed hero.child[ArmorClass].field[tACTouch].value.
You didn't say what your timing was for the script, but some playing around shows that Post-Attributes 10,000 seems to work the best for Magic and nonmagic shields. Here is the final working script. Code:
~Post-attributes 10,000 var bonus as number ~find all our shields foreach pick in hero from BaseArmor where "EquipType.Shield" ~if it's equipped if (eachpick.field[gIsEquip].value <> 0) then bonus = eachpick.field[arAC].value hero.child[ArmorClass].field[tACTouch].value += bonus endif nexteach Check out the CMB/CMD for weapons thread where I am doing stuff with CMB/CMD and Mathias answers a bunch of questions on it. Plus their are some example scripts you should be able to use as a base. Hope that helps. Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. |
#3 |
Junior Member
Join Date: May 2010
Posts: 25
|
Thanks for the help ShadowC, I appreciate it. I just moved the timing to Final/10000 so it would also pick up the Enhancement bonus of the shield.
BenT1 |
#4 |
Junior Member
Join Date: May 2010
Posts: 25
|
This is a script where I am trying to count the number of 'Draconic' feats a character has and use the number to determine the abilities granted by the feat. Timing is set at Final/10001. The var bonus is returning a 1, even though the character has 4 'Draconic' feats. I used the example from the help file to create the tagcount[fCategory.Draconic]
var bonus as number ~ Count our Draconic feats- How many do I have? bonus = tagcount[fCategory.Draconic] #skillbonus[skPercep] += bonus ~ gain low light vision field[livename].text = "Lowlight Vision" & " Bonus" & bonus ~ Improve our darkvision if necessary if (bonus >= 3) then hero.child[raDarkVis].field[abValue].value = maximum(hero.child[raDarkVis].field[abValue].value,60) endif if (bonus >= 4) then hero.child[rBlindsen].field[abValue].value = maximum(hero.child[rBlindsen].field[abValue].value,20) endif |
#5 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
If you use tagcount[fCategory.Draconic], you're counting the number of fCategory.Draconic tags on the thing where the script is running - so just that feat.
hero.tagcount[fCategory.Draconic] will get you the total number of tags on the character. |
#6 |
Junior Member
Join Date: May 2010
Posts: 25
|
Ok, that does return the proper value for the var bonus. But it is not adding to the #skillbonus[skPercep] += bonus is not adding it correctly to the Perception skill. It is still only adding 1, even though it is returning a value of 4. And my If statements are returning errors, 'extra characters on end of line'. I originally tried to assign the racial ability 'raLowLight', but that did not work.... I know it can be done, just can't find an example of it.
BenT1 |
#7 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Quote:
Try this. Code:
~ Improve our darkvision if necessary if (bonus >= 3) then hero.child[raDarkVis].field[abValue].value = maximum(hero.child[raDarkVis].field[abValue].value,60) endif if (bonus >= 4) then hero.child[rBlindsen].field[abValue].value = maximum(hero.child[rBlindsen].field[abValue].value,20) endif Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. |
|
#8 |
Junior Member
Join Date: May 2010
Posts: 25
|
Yes, it was a cut and paste. Thanks for the format info.
But, how does one check and assign a racial ability using a script? The editor complains about trying to access a non-live child pick for raDarkVis and raBlindsen. BenT1 Last edited by BenT1; May 28th, 2010 at 08:24 PM. |
#9 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Quote:
So for example if I wanted to apply Silver DR to a creature I first would have to bootstrap on xDamRdSil (Damage Reduction, Silver) so that it would have the Thing to apply against. Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. |
|
#10 |
|
|