Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Ecneconni
Junior Member
 
Join Date: Apr 2012
Location: Ohio
Posts: 15
Send a message via MSN to Ecneconni

Old September 5th, 2017, 10:18 AM
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?
Ecneconni is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old September 5th, 2017, 10:21 AM
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.
Mathias is offline   #2 Reply With Quote
Ecneconni
Junior Member
 
Join Date: Apr 2012
Location: Ohio
Posts: 15
Send a message via MSN to Ecneconni

Old September 5th, 2017, 10:26 AM
And now you know. I've been staring at it way to long. Thanks Mathias.
Ecneconni is offline   #3 Reply With Quote
Ecneconni
Junior Member
 
Join Date: Apr 2012
Location: Ohio
Posts: 15
Send a message via MSN to Ecneconni

Old September 5th, 2017, 10:34 AM
So... I changed it to "greater than or equal to" and now it shows nothing regardless of the tag count.
Ecneconni is offline   #4 Reply With Quote
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old September 5th, 2017, 11:31 AM
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
The else branch runs the risk of wiping out all copies of the tag assigned before, if any particular copy of the pick goes down that branch.
Aaron is offline   #5 Reply With Quote
Quintain
Senior Member
 
Join Date: Feb 2012
Posts: 546

Old September 5th, 2017, 11:56 AM
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)
Quintain is offline   #6 Reply With Quote
Ecneconni
Junior Member
 
Join Date: Apr 2012
Location: Ohio
Posts: 15
Send a message via MSN to Ecneconni

Old September 5th, 2017, 12:00 PM
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!
Ecneconni is offline   #7 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 06:39 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.