Senior Member
Join Date: May 2016
Posts: 608
|
So, I've been playing with a "Spellcasting Dragon" template over the last couple of days and I've made some progress, but I keep banging into a few things I can't seem to find any notes on. Bootstrapping the Innate Spellcasting (xInnatSpel) for the Innate spellcasting text to get autogenerated. Heres the code at First/10000 that allows you to pick 1st level spells on the race tab when you have a dragon loaded with this template: Code:
perform hero.assign[Hero.Caster] perform hero.assign[sClass.cHelpSor] ~ perform hero.assign[Helper.WarlocCast] <- not needed.. perform hero.assign[CasterSrc.Arcane] perform hero.assign[CasterType.SpontKnow] perform hero.assign[SplAttr.aCHA] ~ for a test just allow 1st level sorcerer spells, will need to be 1/3 the CR for max spell level hero.findchild[BaseRace].field[rSpExLst].text = "sClass.cHelpSor & sLevel.1" ~ make the label show up as Dragon Innate Spells hero.findchild[BaseRace].field[rSpExLstNm].text = "Dragon Innate Spells" ~ the below line is returning a string for some reason, hardcoding to 1 for now but this needs to be the Charisma modifier for number of spells ~ hero.findchild[BaseRace].field[rSpExAllw].value = hero.child[aCHA].field[aModBonus].value hero.findchild[BaseRace].field[rSpExAllw].value = 1 ~ add the atwill and 1/day foreach pick in hero from BaseSpell ~ assign tags ~ eachpick.assign[Helper.RaceSpell] ~ eachpick.assign[Usage.Day] eachpick.field[trkMax].value = 1 nexteach The result of the above code allows a dragon to choose 1 spell from the 1st level sorcerer list and on the spells tab it shows the spell (example Fog Cloud) as: Fog Cloud (1) and the tracker with 1 usage. So right now I'm stuck on the /day and racial tags. Last edited by dungeonguru; August 4th, 2017 at 07:10 AM. |
#1 |
Senior Member
Join Date: May 2016
Posts: 608
|
OK, had to pick through Magic Initiate.
For some reason the eachpick assigns are syntactically different and my tired brain wasn't working, correct format is: Code:
~ add 1/day foreach pick in hero from BaseSpell ~ assign tags perform eachpick.assign[Helper.RaceSpell] perform eachpick.assign[Usage.Day] perform eachpick.assign[Helper.SpellLike] ~ perform eachpick.assign[Usage.LongRest] eachpick.field[trkMax].value = 1 nexteach |
#2 |
Senior Member
Join Date: May 2016
Posts: 608
|
OK, fixed most of my script.
I have the following that works for most case scenarios: Timing First/10000 Code:
~ Calculate 1/3 the CR, always round down. var tempCR as number tempCR = round(hero.findchild[BaseRace].field[rCR].value/3, 0, -1) ~ Drop out if the dragon can't cast 1st level spells. doneif (tempCR < 1) ~ make the spell tabs show up perform hero.assign[Hero.Caster] ~ Dragons are normally arcane sorcerer types, so giving the basics perform hero.assign[sClass.cHelpSor] perform hero.assign[CasterSrc.Arcane] perform hero.assign[CasterType.SpontKnow] perform hero.assign[SplAttr.aCHA] ~ if 1/3 the CR is greater than 1 then add to the end of the Spell List Levels var foo as number var tempstr as string foo = 1 tempstr = "sClass.cHelpSor" while (foo <= tempCR) ~ if first time through loop, make sure to add & if (foo = 1) then tempstr &= " & (sLevel." & foo else tempstr &= " | sLevel." & foo endif foo += 1 loop tempstr &= ")" hero.findchild[BaseRace].field[rSpExLst].text = tempstr ~ make the label show up as Dragon Innate Spells under Race Tab hero.findchild[BaseRace].field[rSpExLstNm].text = "Dragon Innate Spells" ~ Now to get the Modifiers on CHA to grant total number of spells. ~ Problem here is that the Final Attribute Modifier is not available. ~ So manually round down the racial start modifiers as workaround. var foo2 as number foo2 = round(hero.child[aCHA].field[aStartMod].value/2,0,-1) hero.findchild[BaseRace].field[rSpExAllw].value = foo2 ~ add 1/day foreach pick in hero from BaseSpell ~ assign tags perform eachpick.assign[Helper.RaceSpell] perform eachpick.assign[Usage.Day] perform eachpick.assign[Helper.SpellLike] eachpick.field[trkMax].value = 1 nexteach |
#3 |
|
|