Junior Member
|
So try as I might, I can't get this script to function the way I want it to.
It is supposed to work in conjunction between two class abilities. One being "Infernal Constitution" for which I have created a custom tag called "Custom.InfernlCon". The other ability is "Reservoir" which the class gains every level. There are 20 unique id's for this ability. It's done this way, because I am using the custom array-based menu as a way to activate the ability. If it's set to usrIndex 1, it grants access to the classes special, and adds the user tag "Custom.InfernlCon" The scripts I used are as follows: For Reservoir: Script 1 Phase: Pre-levels Priority: 10000 ~ If we're disabled, do nothing doneif (tagis[Helper.FtDisable] <> 0) if (hero.child[cvktReserv].field[usrIndex].value <> 0) then hero.childfound[cHelpVKT].field[cGiveSpec].value += 1 endif ~ If we're disabled, do nothing doneif (tagis[Helper.FtDisable] <> 0) if (hero.child[cvktReserv].field[usrIndex].value <> 0) then perform assign[Custom.InfernlCon] else perform delete[Custom.InfernlCon] endif ---- This is the same script for every copy of this ability. ---- For Infernal Constitution: Script 1 Phase: Attributes Priority 100 ~ If we're disabled, do nothing doneif (tagis[Helper.FtDisable] <> 0) ~ We will grant the hero a constitution of +1 for every three ~ tags "Custom.InfernalCon" found for a max of +7. if (hero.tagcount[Custom.InfernlCon] <= 21) then hero.child[aCON].field[Bonus].value += 7 elseif (hero.tagcount[Custom.InfernlCon] <= 18) then hero.child[aCON].field[Bonus].value += 6 elseif (hero.tagcount[Custom.InfernlCon] <= 15) then hero.child[aCON].field[Bonus].value += 5 elseif (hero.tagcount[Custom.InfernlCon] <= 12) then hero.child[aCON].field[Bonus].value += 4 elseif (hero.tagcount[Custom.InfernlCon] <= 9) then hero.child[aCON].field[Bonus].value += 3 elseif (hero.tagcount[Custom.InfernlCon] <= 6) then hero.child[aCON].field[Bonus].value += 2 elseif (hero.tagcount[Custom.InfernlCon] <= 3) then hero.child[aCON].field[Bonus].value += 1 else hero.child[aCON].field[Bonus].value += 0 endif ------------------------- Using the Debug Mode I have found that the tag does propagate and is removed when I switch Reservoir on and off. However, the bonus +7 appears on the constitution ability score regardless of the tag's presence or not. Would someone be able to point out a flaw if they see it, or have encountered this issue before? |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
In your elseif, you're using "less than or equal to", so as soon as it enters the elseif, the tagcount is <= 21, so the very first test passes, and the bonus is set to 7.
|
#2 |
Junior Member
|
And now you know. I've been staring at it way to long. Thanks Mathias.
|
#3 |
Junior Member
|
So... I changed it to "greater than or equal to" and now it shows nothing regardless of the tag count.
|
#4 |
Senior Member
Join Date: Oct 2011
Posts: 6,793
|
Your 2nd script is trying to count the number of custom tags on the hero. Your First script is assigning them to the initial context (which is the pick running the script), instead of the hero context. I am also concerned with the following:
Code:
if (hero.child[cvktReserv].field[usrIndex].value <> 0) then perform assign[Custom.InfernlCon] else perform delete[Custom.InfernlCon] endif |
#5 |
Senior Member
Join Date: Feb 2012
Posts: 546
|
Try reversing the order of your tests.
if (hero.tagcount[Custom.InfernlCon] <= 3) then hero.child[aCON].field[Bonus].value += 1 elseif (hero.tagcount[Custom.InfernlCon] <= 6) then hero.child[aCON].field[Bonus].value += 2 elseif (hero.tagcount[Custom.InfernlCon] <= 9) then hero.child[aCON].field[Bonus].value += 3 elseif (hero.tagcount[Custom.InfernlCon] <= 12) then hero.child[aCON].field[Bonus].value += 4 elseif (hero.tagcount[Custom.InfernlCon] <= 15) then hero.child[aCON].field[Bonus].value += 5 elseif (hero.tagcount[Custom.InfernlCon] <= 18) then hero.child[aCON].field[Bonus].value += 6 elseif (hero.tagcount[Custom.InfernlCon] <= 21) then hero.child[aCON].field[Bonus].value += 7 endif or you could do some math: ~ Set initial bonus to zero var bonus as number hero.child[aCON].field[Bonus].value += round(hero.tagcount[Custom.InfernlCon]/3,0,0) (I may have syntax issues with the round function) |
#6 |
Junior Member
|
Thank you Aaron, that fixed it.
I removed the else script, and changed the first one to: perform hero.assign and that fixed it. I also simplified my Infernal Con script to hero.child[aCON].field[Bonus].value += round(hero.tagcount[Custom.InfernlCon]/3,0,-1) and that seems to work nicely. Also thank you Quintin, I had already simplified it when you made the suggestion, but I'm thankful for your input nontheless. Last edited by Ecneconni; September 5th, 2017 at 12:07 PM. Reason: Add a thank you! |
#7 |
|
|