Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - D&D 5th Edition SRD
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
dungeonguru
Senior Member
 
Join Date: May 2016
Posts: 608

Old August 3rd, 2017, 02:49 PM


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 commented out code in bold is where I try to add the RaceSpell and Usage tags. In a normal creature, these are autotags, the question is can you assign autotags or am I just assigning these tags wrong. I get an "Unspecified Error in parsing... " so my guess is I'm close.

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.
dungeonguru is offline   #1 Reply With Quote
dungeonguru
Senior Member
 
Join Date: May 2016
Posts: 608

Old August 4th, 2017, 05:14 AM
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
dungeonguru is offline   #2 Reply With Quote
dungeonguru
Senior Member
 
Join Date: May 2016
Posts: 608

Old August 4th, 2017, 07:04 AM
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
A problem I'm having is that in order to get the racial spell selection on the Race tab, it has to run in First, but any Modifiers to Charisma beyond the base race modifers are ignored (like if someone wants to adjust the dragon's charisma up a point or two with any method). This is because the timing is too early. However, trying to split the code up doesn't seem to work either, if I move the code for total number of spells to a Post-Attribute segment the code in First fails to fire off and render the selection screen.
dungeonguru is offline   #3 Reply With Quote
Reply


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 03:08 AM.


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