![]() |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 461
|
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! |
![]() |
![]() |
Member
Join Date: May 2021
Posts: 84
|
It would look something like this (standard disclaimers like untested, typed in browser, etc...):
Code:
~ 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 nexteach 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: Code:
candid = "!Helper.ItemSpell & (" & candid & ")" |
![]() |
![]() |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 461
|
Well, that has been extremely helpful! Thank you!
|
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|