Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
I am working on an alternate magic system, in which characters have some ability in 6 magic affinities (the 4 elements, light and darkness) to a variable degree. Each of the 6 affinities is linked to one of the basic attributes. The character puts ranks in those affinities, and bonuses can also be applied; the total score is no greater than the character total level. I have coded these as Custom Abilities linked to a configurable.
Thus, an 8th character with Air affinity 2 ranks + bonus 2 has a total Air level of 4, and if he has Dark 6 ranks + bonus 3 his Dark level would still be 8. Of course, I have run into problems... |
#1 |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
One of the other abilities a character can have is a large short-term stat buff from those affinities; when the ability is used, you get a bonus to any stat for which you have at least 2 ranks in the corresponding affinity, the bonus being one-half the total level (rank + bonus) of the affinity (yes, crazy at high levels).
I am trying to code the buff without using a series of if/then statements. A foreach loop iterating through the affinities seems appropriate, but I can’t get it to work so far. Post-Levels 50100 (...) Code:
foreach pick in hero where "abCategory.AMSAffin & Helper.FirstCopy" var AffAttr as string var AttBon as number AffAttr = "hero.child[" & eachpick.field[abText].text &"]" AttBon = round(eachpick.field[abValue3].value/2,0,-1) #enhancementbonus[AffAttr, AttBon] nexteach the field [abValue3] holds the total level for each affinity (and is calculated at post levels 50000) The error message: Hero Lab was forced to stop compilation after the following errors were detected: Syntax error in 'eval' script for Thing 'cAMSElAug' (Eval Script '#2') on line 15 -> Unspecified error parsing script Line 15 is the bonus macro 1) Is the problem the use of variables such in the macro? At least for the number, it usually works. Is there a problem with the string variable? 2) Any advice on how to optimize this script? I can't seem to find a way to travel to the attribute linked to the affinity without reconstructing it through the above string. Tags? Thanks! Last edited by Lord Magus; December 17th, 2021 at 06:42 PM. |
#2 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
I don't understand what AffAttr even trying to do? Looking up a text field on a pick to get the Id of something?
Variables are not at all allowed to be used to generate Ids to target something. If the individual abilities know which ability score they target, why aren't they each running this script, applying just their own bonus? Last edited by Mathias; December 18th, 2021 at 09:52 AM. |
#3 |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
Quote:
2) That answers that part , thanks! Quote:
To illustrate, a character with Fire 6 and Water 4 gets a +3 to CHA and +2 to CON, but not to the other stats; another with Light 10 and Air 3 gets +5 to WIS and +1 to DEX. EDIT: Maybe having the ability have no script, but scripts on the affinities looks for that ability being activated do the trick? Last edited by Lord Magus; December 18th, 2021 at 05:07 PM. Reason: Maybe I figured it out! |
||
#4 |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
|
#5 |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
Now trying to code for a "generic" item that can improve one of the wearer's affinities. I want to use a dropdown selector to allow the player to choose which item slot the item occupies.
Selection: Magic Item Slots Restriction: None First-500 Code:
~ We establish the item slot ~ If we're not equipped, get out now doneif (field[gIsEquip].value = 0) ~ If slot not chosen, get out now doneif (field[usrChosen2].ischosen = 0) perform field[usrChosen2].chosen.pulltags[Hero.?] perform pushtags[Hero.?] |
#6 |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
Progressing, using the Ornament (gear item) script as guide
Candidate expression for usrChosen2: component.ItemSlot & !Helper.Cyberware & !thingid.isEqpArmor & !thingid.isEqpPFRun & !thingid.isEqpS2Les (usrChosen1 is for targeting the affinity improved by the item) Pre-Levels - 9000 Code:
~ We establish the item slot ~ If we're not equipped, get out now doneif (field[gIsEquip].value = 0) ~ If slot not chosen, get out now doneif (field[usrChosen2].ischosen = 0) perform field[usrChosen2].chosen.pulltags[ExtraSlot.?,Hero] perform forward[Hero.?] How can I keep the item from competing with itself for slot use??? Last edited by Lord Magus; January 4th, 2022 at 07:56 AM. |
#7 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
You're pulling an ExtraSlot tag, then forwarding a Hero tag? Shouldn't those be the same tag group?
|
#8 |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
I am still at the "copying similar things found elsewhere" stage, not necessarily fully understanding what I'm doing...
I lifted from the Ornament gear thing, which is the only thing I found which allows the user to set the item's equipment slot. This is from LoneWolf! Code:
(...) doneif (field[usrChosen1].ischosen = 0) perform field[usrChosen1].chosen.pulltags[ExtraSlot.?,Hero] perform forward[Hero.?] EDIT / UPDATE: "Ornament" is from a Lone Wolf file, but may be 3rd party as it is not sourced and I can't even locate it on d20pfsrd... Will try to use one of ShadowChemosh's adjustments that looks more promising. Last edited by Lord Magus; January 5th, 2022 at 06:49 AM. Reason: Turtle-paced progress |
#9 |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
Finally got it to work! ShadowChemosh's adjustment used to change an item slot gave me everything I needed!
|
#10 |
|
|