• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Spell Swap Eval Script

TheNewProgrammer

Active member
Hi all, back on the spell swapping project I found an eval script for Divine soul sorcerer for 5e that sort of works

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
final Phase - Priority: 21000

doneif (tagis[Helper.ShowSpec] = 0)

~these vars will hold the tag expressions for spells and cantrips
~ needed to pull cleric spells into the list as well as sorceror

var spell as string
var known as string

spell = replace(spell, "sClass.cHelpHel", "( sClass.cHelpClr )", 1)
spell = replace(spell, "(sClassNot.cHelpHel)", "( sClassNot.cHelpClr )", 1)

known = replace(known, "sClass.cHelpHel", "( sClass.cHelpClr )", 1)
known = replace(known, "(sClassNot.cHelpHel)", "( sClassNot.cHelpClr )", 1)

~ debug "Spell: " & spell
~ debug "Known Spells: " & known

~finally, we replace the expressions with the new ones

hero.childfound[cHelpHel].field[sClass].text = spell
hero.childfound[cHelpHel].field[cSpellExpr].text = known
hero.childfound[cHelpHel].field[cSplBkExpr].text = known
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The way I understand it, it takes the class spell list, replaces it with the new list, and then overwrites the old list
Line 20 has an error. the old one was "hero.childfound[cHelpSor].field[cSpKnoExpr].text = spell" but cSpKnoExpr was not recognized, so I replaced it with Class because that is what stores the class spell list, but that does not work either. Anyone know how to make this work?
 
thanks, I feel like this is closer, but it still didn't work. The field cSpellExpr is already being modified in the second to last line of the script, but I tried changing the timing to your suggested time, but it did not work either. Testing with the original shows that the third to last line is the one that changes which spells can be chosen, so I think I need to fix that. Any other advice or perhaps do you know where these fields are stored so I can look at them? I tried the dev menus and couldn't find anything.
 
It's hard to know what to do without seeing what exactly is happening. When you say it doesn't work, does that mean it's not updating the text field or that it isn't providing the right collection of spells? Also, if all you want to do is change which spells a class has access to, have you tried deleting the existing sClass tag, and adding the new one?
 
Thanks for replying, I've been working on this problem for a while and it has been discouraging. I have been trying to make an archetype that replaces a class's spell list with another.
The current script doesn't replace the choosable spells like I want it to. When I look at the user file directly I can see the sClass tag, but I've never seen an example for what I am trying to do other than the Divine Soul Sorcerer. Any advice on how to delete the sClass tag and add the new one? That method sounds right, but I don't know how to do it. Thanks!
 
Thanks for replying, I've been working on this problem for a while and it has been discouraging. I have been trying to make an archetype that replaces a class's spell list with another.
The current script doesn't replace the choosable spells like I want it to. When I look at the user file directly I can see the sClass tag, but I've never seen an example for what I am trying to do other than the Divine Soul Sorcerer. Any advice on how to delete the sClass tag and add the new one? That method sounds right, but I don't know how to do it. Thanks!

Deleting and assigning tags is quite simple. I created an adjustment to test it, and used this script:

Post-Levels/5000
Code:
perform hero.childfound[cHelpSor].delete[sClass.cHelpSor]
perform hero.childfound[cHelpSor].assign[sClass.cHelpClr]

It's important to run your script before Post-Levels/10000, which is when the cSpellExpr field is generated. My test appears to have worked. Obviously, you'll want to replace the cHelpSor with cHelpHel.
 
Deleting and assigning tags is quite simple. I created an adjustment to test it, and used this script:

Post-Levels/5000
Code:
perform hero.childfound[cHelpSor].delete[sClass.cHelpSor]
perform hero.childfound[cHelpSor].assign[sClass.cHelpClr]

It's important to run your script before Post-Levels/10000, which is when the cSpellExpr field is generated. My test appears to have worked. Obviously, you'll want to replace the cHelpSor with cHelpHel.
Thanks! this worked. Excited to see this working after 6 months
 
Back
Top