View Single Post
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old August 12th, 2016, 09:23 AM
Alright, that trait doesn't bootstrap anything, it just shows itself on the SLA list, I think. If you're already using the second selector for an attribute, you may need to come up with something else for that. Need that selector for this plan of action.

The trickiest part is going to be figuring out when it should switch from showing itself vs. adding to the spell list of spells known. Here is how I would approach it.

Step 1, in an eval script on the trait pull all sClass tags on the chosen spell to the trait. Also pull the ClsAllowSp and ClsScAllSp tags.

Step 2, in the same eval script, use those tags to generate a tag expression (store it in a string variable), then do a foreach through all casting classes on the hero.

Step 3, inside the foreach set a field (maybe abValue) on the trait to 1 (a flag to indicate we should be expanding a spell list rather than showing ourselves), and build a second tag expression (stored in a different string variable) of all valid classes we find.

Step 4, check our flag from the previous step. If it is 0 then we found no valid classes and should show ourselves (so assign the tags which will make us show on the SLA list and in the tracked resources table). If it is 1 then use the tag expression we built in the previous step to set up our usrCandid2 field to select between valid classes.

Step 5, in a seperate eval script which runs later than the first, check our flag. If we've used the second selector to choose what class should get expanded, push the ClsAllowSp tag we pulled in Step 1 to the chosen class.

Step 6, in an eval rule check our flag. We're valid if the flag is set to 0. Otherwise, check the spells on this hero to see if the one chosen by selector 2 has been added. If it hasn't, generate a validation error message mentioning the name and prompting the user to add it to the selected class.
Aaron is offline   #7 Reply With Quote