Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game


Thread Tools Display Modes
Lord Magus
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 461

Old May 22nd, 2023, 06:19 AM
An adjustment I created has a chooser from 6 abilities called "affinities"
Choosing 1 of those has a variety of effects, including changing the caster level on spells that I have already tagged (using a sSchool user-defined tag) as linked to said affinity.

I can't find a reference or an example to learn how to do the following:

Extract (pull?) a tag (Affinity.?) from the affinity thing that has been chosen, define a corresponding sSchool.? tag (push?) and then insert this sSchool.? tag in a foreach loop that selects the relevant spells to modify the caster level. In particular, I don't have a clue for the last step (inserting the tag).

Any pointers or examples to help me here? This whole tag extraction and manipulation thing has really been what has been holding me back on a number of scripting projects for this campaign... Thanks!
Lord Magus is offline   #1 Reply With Quote
Join Date: May 2021
Posts: 84

Old May 26th, 2023, 02:52 PM
It would look something like this (standard disclaimers like untested, typed in browser, etc...):

~ finished if nothing is chosen yet in the menu
doneif (field[your_field].ischosen = 0)

~ get affinity tag list from chosen item stored in menu field
var candid as string
candid = field[your_field].chosen.tagids[Affinity.?,"|"]

debug "tag(s) matching Affinity.? are: " & candid

~ finished if no Affinity.? tags were found
doneif (empty(candid) <> 0)

~ switch the tag group to sSchool
candid = replace(candid, "Affinity.", "sSchool.", 0)

debug "updated tag(s) are: " & candid

~ iterate through any picks in the hero container which match
foreach pick in hero from BaseSpell where candid
     eachpick.field[value_to_change].value += 2 

If spells need to match all tags (if there are multiple Affinity.? tags) and not just any one tag, you should change "|" to "&" in the tagids[] call above.

You can modify the tag expression (the string stored as candid) to exclude other stuff as needed, for example if the ability shouldn't affect spells cast by items:
candid = "!Helper.ItemSpell & (" & candid & ")"
ploturo is offline   #2 Reply With Quote
Lord Magus
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 461

Old May 28th, 2023, 01:32 PM
Well, that has been extremely helpful! Thank you!
Lord Magus is offline   #3 Reply With Quote

Thread Tools
Display Modes

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 09:32 PM.

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