Senior Member
Join Date: Jul 2014
Posts: 412
|
An ability I am trying to rescript since I thought I had it right but is not as complete as I would have like so here is the deal this ability needs to have a bonus cap to allowable damage and must only allow for Light weapons, Bolas, Shurikens, and if selected the Exotic Weapon from the exotic weapon proficiency feat as the Style that can be chosen is for Exotic Weapon style.
Quote:
Last edited by DeltaMasterMind; December 28th, 2016 at 06:31 AM. |
|
#1 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Lets break the script down:
Code:
~only run the rest for the first copy doneif (tagis[Helper.FirstCopy] = 0) ~ If we're not shown, just get out now doneif (tagis[Helper.ShowSpec] = 0) Here is a better way but this does not help with the main issue yet. Code:
~ If we're not shown, just get out now doneif (tagis[Helper.ShowSpec] <> 1) ~ if we've been disabled, get out now doneif (tagis[Helper.SpcDisable] <> 0) ~only run the rest for the first copy doneif (tagis[Helper.FirstCopy] = 0) Code:
~ Generate our damage limit field[abValue2].value = field[xAllLev].value field[abValue3].value = hero.child[aWIS].field[aModBonus].value ~ Generate our Bonus Limit field[abValue].value = minimum(field[abValue3].value, field[abValue2].value) Code:
~ Generate our Damage Bonus max value. field[abValue].value += minimum(hero.child[aWIS].field[aModBonus].value, field[xAllLev].value) Code:
~ Generate our summary field[abSumm].text = "+" & field[abValue].value & " to hit, +" & field[abValue].value & " to damage." & hero.childfound[fcSAElves].field[abValue].value & " minutes to regain use of deadly focus." Code:
~ Generate our summary field[abSumm].text = signed(field[abValue].value) & " to hit, " & signed(field[abValue].value) & " to damage." & hero.childfound[fcSAElves].field[abValue].value & " minutes to regain use of deadly focus." Next Part: Code:
if (field[abilActive].value <> 0) then foreach pick in hero from BaseWep where "wClass.Light | IsWeapon.wBolas | IsWeapon.wShuriken" hero.child[Damage].field[Bonus].value += field[abValue].value hero.child[Attack].field[Bonus].value += field[abValue].value nexteach endif The above needs to be changed to ONLY give the attack/damage bonus to the weapon we found in the foreach loop: Code:
~ If we are not active get out now! doneif (field[abilActive].value = 0) ~ Loop through all light, bolas and shuriken weapons on the charcter foreach pick in hero from BaseWep where "wClass.Light | IsWeapon.wBolas | IsWeapon.wShuriken" ~ Give a bonus to only the weapon we are looping on eachpick.field[Bonus].value += field[abValue].value nexteach Code:
~ If we're not shown, just get out now doneif (tagis[Helper.ShowSpec] <> 1) ~ if we've been disabled, get out now doneif (tagis[Helper.SpcDisable] <> 0) ~ Only run the rest for the first copy doneif (tagis[Helper.FirstCopy] = 0) ~ Generate our Damage Bonus max value. field[abValue].value += minimum(hero.child[aWIS].field[aModBonus].value, field[xAllLev].value) ~ Generate our summary field[abSumm].text = signed(field[abValue].value) & " to hit, " & signed(field[abValue].value) & " to damage." & hero.childfound[fcSAElves].field[abValue].value & " minutes to regain use of deadly focus." ~ If we are not active get out now! doneif (field[abilActive].value = 0) ~ Loop through all light, bolas and shuriken weapons on the charcter foreach pick in hero from BaseWep where "wClass.Light | IsWeapon.wBolas | IsWeapon.wShuriken" ~ Give a bonus to only the weapon we are looping on eachpick.field[Bonus].value += field[abValue].value nexteach 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. |
#2 |
Senior Member
Join Date: Jul 2014
Posts: 412
|
You know before I saw this post it hit me that I wasn't using eachpick and was instead doing bonuses for all picks on hero. I realized this when I was taking a piss. xD
I am very grateful Shadow thank you and I went ahead and cleaned up my script manually so I get used to doing it that way. Much appreciated! This alone fixes alot of the problems I ran into today. |
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
ShadowChemosh - The Helper.SpcDisable test is redundant in almost all cases, as long as you've got the Helper.ShowSpec test. Helper.ShowSpec is not asssigned if Helper.SpcDisable is present, so the only times you also need to test for Helper.SpcDisable is when you know the Helper.SpcDisable will be assigned after the normal test for its presence.
|
#4 |
Senior Member
Join Date: Oct 2011
Posts: 6,793
|
Mathias and I differ on the necessity of SpcDisable tests. We've argued it multiple times and neither of us seem willing to budge.
|
#5 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
I had several responses here I have reworded about this so happy I am not the only one not 100% for this idea of not having SpcDisable. Logically I understand and agree 100% with Mathias in that its a "redundant" check.
My main issue is something I drill in my programmers at work which is "Maintenance". At some point someone besides the original coder is going to be reading and changing your code and it should be easy to read. This means I argue allot for being "verbose" in comments and variable names. Making sure we are obvious to the next coder. In this case by having Helper.SpcDisable check we are 100% clear to the next coder (either new or experienced) in what is happening. No "behind the scenes" knowledge is required to be known. In my case as a outside person I don't have to worry about the "timing" of the behind the scenes code being changed. When I am doing code reviews of the community stuff its easy to make sure we are correct regardless of the scripts timing. For my very specific case I program in almost a dozen languages and multiple data bases. Trying to keep all these "little" differences straight is not fun. Anything I can do to reduce that need to "memorize" a hidden feature is a plus in my book especially when adding it does not hurt anything. 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. |
#6 |
Senior Member
Join Date: Jul 2014
Posts: 412
|
Hey I just wanted to post to see if anything with this script seems like a bad idea considering how bonuses get added:
Quote:
|
|
#7 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Quote:
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 |
|
|