View Single Post
wynlyndd
Member
 
Join Date: Nov 2014
Posts: 90

Old February 16th, 2020, 03:32 PM
Okay, thinking about how to add the expanded spell list for the UA Class Variants, I tried to use ExtendThing which was less than ideal. I decided to see how other options did it.

Enter the Stone Magic Sorcerous Origin from UA. It adds a bunch of non-sorcerer spells.

So following its lead I added this code:
Code:
<document signature="Hero Lab Data">
  <thing id="cElmSpSCM" name="Elemental Spell" description="When you cast a spell that deals a type of damage from the following list, you can spend 1 sorcery point to change that damage type to one of the other listed types: acid, cold, fire, lightning, thunder. If a wild sorc, roll d20. If 5 or below, determine dmg type randomly. If affected by Tides of Chaos, always randomly determine dmg type." compset="CustomSpec" summary="Spend 1 sorc. pt.: Choose dmg type from 5 elements." uniqueness="unique">
    <usesource source="p5eSorUACVAP"/>
	<tag group="Helper" tag="Secondary" name="Secondary" abbrev="Secondary"/>
    <tag group="SpecSource" tag="cHelpSor" name="Sorcerer" abbrev="Sorcerer"/>
    <tag group="abAction" tag="Free" name="Free" abbrev="Free"/>
    <tag group="abCategory" tag="SorMetamag" name="Sorcerer Metamagic Ability" abbrev="Sorcerer Metamagic Ability"/>
    <tag group="abDuration" tag="Instant" name="Instantaneous" abbrev="inst"/>
    <tag group="abRange" tag="Personal" name="Personal" abbrev="pers"/>
	<bootstrap thing="cUAExSpLt">
      <autotag group="ClSpecWhen" tag="1"/>
    </bootstrap>
    </thing>

	<thing id="cUAExSpLt" name="Expanded Spell List" description="You must otherwise obey all the restrictions for selecting the spell, and it becomes a sorcerer spell for you.\n\n" compset="ClSpecial">
    <usesource source="p5eSorUACVAP"/>
	<eval phase="Final" priority="21000"><![CDATA[doneif (tagis[Helper.ShowSpec] = 0)
doneif (tagis[Helper.Disable] <> 0)

~these vars will hold the tag expressions for spells and cantrips

var cantrip as string
var spell as string
var known as string 
var first as string
var second as string
var third as string
var fourth as string
var sixth as string
var eigth as string
var ninth as string


~ fetch spell expressions
spell = hero.childfound[cHelpSor].field[cSpKnoExpr].text 
known = hero.childfound[cHelpSor].field[cSpellExpr].text 


~ these receive the extra spells for each circle
cantrip = " | thingid.sp5CXGEPrS "
first = " | thingid.spGrease | thingid.spProtGoEv "
second = " | thingid.spFlamBlad | thingid.spFlamSphe "
third = " | thingid.spVampTouc "
fourth = " | thingid.spFireShie "
sixth = " | thingid.spFlesSton "
eigth = " | thingid.spDemiplan "
ninth = " | thingid.spForesigh "

hero.childfound[cHelpSor].field[cCnKnoExpr].text &= cantrip
spell &= cantrip

if (#levelcount[Sorcerer] >= 1) then
  spell &= first
  known &= first
  if (#levelcount[Sorcerer] >= 3) then
    spell &= second
    known &= second
    if (#levelcount[Sorcerer] >= 5) then
      spell &= third
      known &= third
      if (#levelcount[Sorcerer] >= 7) then
        spell &= fourth
        known &= fourth
  		if (#levelcount[Sorcerer] >= 11) then
		  spell &= sixth
		  known &= sixth
        endif		  
      endif
    endif
  endif
endif
if (#levelcount[Sorcerer] >= 15) then
  spell &= eigth
  known &= eigth
  if (#levelcount[Sorcerer] >= 17) then
    spell &= ninth
	known &= ninth
	endif
endif

hero.childfound[cHelpSor].field[cSpKnoExpr].text = spell
hero.childfound[cHelpSor].field[cSpellExpr].text = known
hero.childfound[cHelpSor].field[cSplBkExpr].text = known]]></eval>
    </thing>

  </document>
Which worked! It added Grease, Flame Blade, FlameShield, VampricTouch, Fire Shield, and Flesh to Stone, Demiplane, and Foresight to the Sorcerer's spell list. And it is toggleable via Configure Hero.

There appears to be a limit to nested if statements, so that's why the last two spell levels are checked in a separate if statement.

But I think I have it!!!!

Last edited by wynlyndd; February 16th, 2020 at 04:47 PM. Reason: solved it
wynlyndd is offline   #1 Reply With Quote