View Single Post
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