Senior Member
Join Date: Nov 2011
Location: South Riding, VA
Posts: 841
|
Is there an equivalent tag like BonusSplAt but for secondary spells?
I have a class that automatically gets specific secondary spells at specific levels. The spells are taken from a selected patron and I would like to just replace the BonusSplAt tag on the spells bootstrapped by the patron to one that automatically adds them onto the hero as a secondary spell. |
#1 |
Senior Member
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975
|
Not recalling which off the top of my head, but I think one of the advanced or occult classes does that. I think it's the Shaman from the ACG.
|
#2 |
Senior Member
Join Date: Nov 2011
Location: South Riding, VA
Posts: 841
|
Thanks I will check it out!
|
#3 |
Senior Member
Join Date: Nov 2011
Location: South Riding, VA
Posts: 841
|
Ok. I got is working... sort of.
Here is the code I have on my class helper to convert a patron's spells into secondary spells for the class Code:
~ We select a patron an gain its spells as bonus spells at particular ~ levels. We handle this similar to a shaman's bonus spells instead ~ of like a domain spell because we automatically get these spells ~ we need to get a list of our patron spells and modify when ~ we get them ~ We get our bonus spells as follows ~ Spell - Cultist - Witch ~ 1st level spell - 2nd level - 2nd level ~ 2nd level spell - 6th level - 4th level ~ 3rd level spell - 8th level - 6th level ~ 4th level spell - 10th level - 8th level ~ 5th level spell - 12th level - 10th level perform hero.findchild[Ability,"abCategory.WitPatron & CustTaken.cHelpCul"].setfocus doneif (state.isfocus = 0) perform focus.assign[SpecSource.cHelpCul] ~ now go through spells and modify for cultist use foreach pick in hero from BaseSpell ~ Is this bootstrapped by something? if (eachpick.isroot <> 0) then ~ Is that something a witch patron and selected by the cultist? if (eachpick.root.tagis[abCategory.WitPatron] * eachpick.root.tagis[CustTaken.cHelpCul] <> 0) then ~ modify the spell perform eachpick.delete[Spellbook.?] perform eachpick.tagreplace[SpellSort.?,SpellSort.cHelpCul] perform eachpick.tagreplace[SpellType.?,SpellType.cHelpCul] perform eachpick.assign[Helper.NoPrepCnt] perform eachpick.tagreplace[CasterType.?,CasterType.MemAll] ~ adjust Level we get bonus spells if (eachpick.tagvalue[sLevel.?] = 1) then perform eachpick.tagreplace[BonusSplAt.?,BonusSplAt.2] perform eachpick.assign[SecClsAllw.cHelpCul] perform eachpick.assign[SecSplType.cHelpCul] elseif (eachpick.tagvalue[sLevel.?] <= 5) then var newLvl as number newLvl = eachpick.tagvalue[BonusSplAt.?] + 2 perform eachpick.delete[BonusSplAt.?] perform eachpick.assignstr["BonusSplAt." & newLvl] ~ how for a bit of a kludge to make sure these show at the ~ correct level if (eachpick.tagis[sLevel.2] * tagexpr[fieldval:cTotalLev >= 6] <> 0) then perform eachpick.assign[SecClsAllw.cHelpCul] perform eachpick.assign[SecSplType.cHelpCul] elseif (eachpick.tagis[sLevel.3] * tagexpr[fieldval:cTotalLev >= 8] <> 0) then perform eachpick.assign[SecClsAllw.cHelpCul] perform eachpick.assign[SecSplType.cHelpCul] elseif (eachpick.tagis[sLevel.4] * tagexpr[fieldval:cTotalLev >= 10] <> 0) then perform eachpick.assign[SecClsAllw.cHelpCul] perform eachpick.assign[SecSplType.cHelpCul] elseif (eachpick.tagis[sLevel.5] * tagexpr[fieldval:cTotalLev >= 12] <> 0) then perform eachpick.assign[SecClsAllw.cHelpCul] perform eachpick.assign[SecSplType.cHelpCul] endif else perform eachpick.assign[Hide.Spell] endif endif endif nexteach Additionally, there is a small twist. At levels 2 and 3, before the class can normally get 1st levels spell at 4th level (well they get 0 so they can get bonus spells from high attributes), the class gets the level 1 patron spell. I cannot get this to show up at all since we do not have any normal spell slots available. In other words the class progression for 1st level spells is 1st level - none 2nd level - patron spell 3rd level - patron spell 4th level - 0 + patron spell 5th level - 1 + patron spell etc. Finally I think there might also be a conflict between the normally gained spells (which are in a spellbook) and the patron spells (which are gained like a shaman). The normally gained spells have the tag CasterType.MemBook, while the patron spells have the tag CasterType.MemAll. |
#4 |
Senior Member
Join Date: Nov 2011
Location: South Riding, VA
Posts: 841
|
Whew. Ok I got it working. Turns out I needed to manually adjust the cSecCur, cSecMax and cMemMax fields at certain levels for everything to work as it was supposed to.
Anyway here is the working code: This converts patron spells for use by my class Code:
Pre-Levels/50 ~ We select a patron an gain its spells as bonus spells at particular ~ levels. We handle this similar to a shaman's bonus spells instead ~ of like a domain spell because we automatically get these spells ~ we need to get a list of our patron spells and modify when ~ we get them ~ We get our bonus spells as follows ~ Spell - Cultist - Witch ~ 1st level spell - 2nd level - 2nd level ~ 2nd level spell - 6th level - 4th level ~ 3rd level spell - 8th level - 6th level ~ 4th level spell - 10th level - 8th level ~ 5th level spell - 12th level - 10th level ~ since we want to be done if we have not chosen a patron, but we ~ want to add a tag to the patron, just use findchild to find ~ our chosen patron and focus on it. If no focus, we get out. ~ Afterwards, clear the focus. perform hero.findchild[Ability,"abCategory.WitPatron & CustTaken.cHelpCul"].setfocus doneif (state.isfocus = 0) perform focus.assign[SpecSource.cHelpCul] perform state.clearfocus ~ now go through the patron spells and modify for cultist use foreach pick in hero from BaseSpell ~ Is the spell bootstrapped by something? if (eachpick.isroot <> 0) then ~ is it a witch patron that was selected by the cultist? ~ (note to self: + -> logical OR, * -> logical AND) if (eachpick.root.tagis[abCategory.WitPatron] * eachpick.root.tagis[CustTaken.cHelpCul] <> 0) then ~ modify the spell we are on perform eachpick.delete[Spellbook.?] perform eachpick.tagreplace[SpellSort.?,SpellSort.cHelpCul] perform eachpick.tagreplace[SpellType.?,SpellType.cHelpCul] perform eachpick.assign[Helper.NoPrepCnt] perform eachpick.tagreplace[CasterType.?,CasterType.MemAll] perform eachpick.assign[SecSplType.cHelpCul] perform eachpick.assign[SecClsAllw.cHelpCul] ~ adjust level we get the bonus spell if (eachpick.tagvalue[sLevel.?] = 1) then perform eachpick.tagreplace[BonusSplAt.?,BonusSplAt.2] perform eachpick.assign[SecClsAllw.cHelpCul] elseif (eachpick.tagvalue[sLevel.?] <= 5) then var newLvl as number newLvl = eachpick.tagvalue[BonusSplAt.?] + 2 perform eachpick.delete[BonusSplAt.?] perform eachpick.assignstr["BonusSplAt." & newLvl] else ~ if we are above 5th level spell, hide us perform eachpick.assign[Hide.Spell] endif endif endif nexteach have our patron spell at 2nd and 3rd level without primary spellcasting Code:
Final/500 ~ now we need to fix the array cSecCur for our cultist level ~ this is a kludge because the class looks to be counting all the ~ secondary spells when it shouldn't ~ doing this prevents HL from throwing errors of to many spells chosen ~ first remove anything higher than 5th level field[cSecCur].arrayvalue[6] += -1 field[cSecCur].arrayvalue[7] += -1 field[cSecCur].arrayvalue[8] += -1 field[cSecCur].arrayvalue[9] += -1 ~ now the rest is level based ~ at 12th we have access to our 5th level patron spell if (field[cTotalLev].value < 12) then field[cSecCur].arrayvalue[5] += -1 endif ~ at 10th we have access to our 4th level patron spell if (field[cTotalLev].value < 10) then field[cSecCur].arrayvalue[4] += -1 endif ~ at 8th we have access to our 3rd level patron spell if (field[cTotalLev].value < 8) then field[cSecCur].arrayvalue[3] += -1 endif ~ at 6th we have access to our 2nd level patron spell if (field[cTotalLev].value < 6) then field[cSecCur].arrayvalue[2] += -1 endif ~ below 4th level, but above 1st, we do not get any ~ primary spells, just our patron spells, so we zero the cMemMax field ~ this way we show our spellcasting tab (and on the statblock) ~ but only get the 1st level patron spell if (field[cTotalLev].value < 4) then var ii as number ii = 0 while (ii<= 9) field[cMemMax].arrayvalue[ii] = 0 ii+=1 loop endif ~ just make sure below 2nd we have no spellcasting at all from ~ secondary spells if (field[cTotalLev].value < 2) then field[cSecCur].arrayvalue[1] = 0 field[cSecMax].arrayvalue[1] = 0 endif |
#5 |
|
|