Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - D&D 5th Edition SRD

Notices

Reply
 
Thread Tools Display Modes
Fenris447
Senior Member
 
Join Date: Sep 2017
Posts: 357

Old November 18th, 2020, 02:03 PM
How would I go about disabling a spell? The new Order of Scribes has a feature that temporarily removes spells from your spellbook for 1d6 long rests. I have everything figured out for how to do this, except for two problems:


1. I have a foreach loop that should look at each spell in the hero with a particular thingid, but for some reason it's only finding copy of the spell in the spellbook, not the pick in the Wizard's prepared spells.

Code:
foreach pick in hero from BaseSpell where "thingid.(spellID here)"
perform eachpick.assign[Helper.Disable]
nexteach
For whatever reason, this is only finding and assigning the tag to the copy of the spell in the spellbook, and not doing the same to the spell in the Wizard's list of prepared spells. I think "from BaseSpell" is extraneous here, but removing it doesn't help. What am I missing?

2. The Helper.Disable tag does nothing to spells, so it's just a placeholder in the code above. I tried Hide.Spell, but that also didn't do anything. Once I figure out my problem with the foreach, is there any tag I can add/delete or field I can change in the spell to make it clear that the Wizard can't use it until it comes back? Worst case I'll just add sNameMod that says "Forgotten" or whatever, but I'd prefer something to make it go red.

Feel free to stop by the Lone Wolf Development Subreddit, for discussion of any and all LWD products and community efforts!
Fenris447 is offline   #1 Reply With Quote
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,599

Old November 18th, 2020, 02:10 PM
I'd try doing it with a focus instead so its doing it on a specific spell chosen from a drop down menu. Also you need to make sure you have the right timing on the scripting. Hide.Spell will not do it. You might have to try deleting the sClass tag for the class to make it not show up in the list of spells you can prepare.

RavenX

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #2 Reply With Quote
Fenris447
Senior Member
 
Join Date: Sep 2017
Posts: 357

Old November 18th, 2020, 02:30 PM
I already have a dropdown to actually pull the spell from the spellbook. I can directly add an sNameMod (or do whatever else I need) to the spellbook pick of the spell. The foreach I'm using is actually using a string for the expression, which is the thingid that I've pulled from the chosen (spellbook) spell.

What I need to do is also find and manipulate the copy of that spell that's in the prepared list, which is a separate pick of that spell.

Feel free to stop by the Lone Wolf Development Subreddit, for discussion of any and all LWD products and community efforts!
Fenris447 is offline   #3 Reply With Quote
dungeonguru
Senior Member
 
Join Date: May 2016
Posts: 591

Old November 18th, 2020, 05:37 PM
The spell in the spellbook will have a tag: Spellbook.cHelpWiz
The prepared spell will have a tag: Helper.Memorized

You might want to find the one with Helper.Memorized and remove the Helper tag. That should remove it from the Prepared list.
dungeonguru is offline   #4 Reply With Quote
Fenris447
Senior Member
 
Join Date: Sep 2017
Posts: 357

Old November 19th, 2020, 06:39 AM
Any ideas why the foreach isn't working?

Feel free to stop by the Lone Wolf Development Subreddit, for discussion of any and all LWD products and community efforts!
Fenris447 is offline   #5 Reply With Quote
dungeonguru
Senior Member
 
Join Date: May 2016
Posts: 591

Old November 19th, 2020, 09:10 AM
Here's and example of how I might set up the foreach.

Code:
var searchexpr as string
searchexpr = "thingid.(spellID) & Helper.Memorized"

foreach pick in hero from BaseSpell where searchexpr
eachpick.delete[Helper.Memorized]
nexteach
I use a variable since it's easier for me to parse or manipulate the string later if I need to.

The problem is probably with timing since both copies of the spell are picks that are assigned through different portals that probably run really close together in timing, the trick is to pick the right time. I don't know when they kick off but it might be worth digging into the timing report of a "live" character with a spellbook.

I'm going to suggest another path after thinking about how the rule as written is phrased. How hard would it be to use your spell selection to "disable" to instead throw a validation error - something like: "You must not have the spell (SPELLNAME) memorized if you have it chosen in (ABILITYNAME)."

Kinda like the Acolyte of Nature ability on the Nature Cleric Domain throws an error if you don't have the cantrip you choose memorized.
dungeonguru is offline   #6 Reply With Quote
Fenris447
Senior Member
 
Join Date: Sep 2017
Posts: 357

Old November 19th, 2020, 10:45 AM
I'd LOVE to have it throw an error. That would be preferable over what I'm trying to do. But I have no idea how to generate validation errors (outside of some light experience with pre-requisites). Any resources you could point me to there? I'll take a look at the Acolyte of Nature, of course.

Feel free to stop by the Lone Wolf Development Subreddit, for discussion of any and all LWD products and community efforts!

Last edited by Fenris447; November 19th, 2020 at 11:12 AM.
Fenris447 is offline   #7 Reply With Quote
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,599

Old November 19th, 2020, 02:53 PM
Quote:
Originally Posted by Fenris447 View Post
Any ideas why the foreach isn't working?
9 times out of 10, it's because your priority and timing are incorrect.

RavenX

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #8 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,728

Old November 19th, 2020, 03:06 PM
Quote:
Originally Posted by Fenris447 View Post
I'd LOVE to have it throw an error. That would be preferable over what I'm trying to do. But I have no idea how to generate validation errors (outside of some light experience with pre-requisites). Any resources you could point me to there? I'll take a look at the Acolyte of Nature, of course.
I would add debug lines to 100% verify that the foreach loop is not working:

Code:
foreach pick in hero from BaseSpell where "thingid.(spellID here)"
debug eachpick.idstring
perform eachpick.assign[Helper.Disable]
nexteach
Then go to "Develop->Floating Info Windows->Show Debug Output". Then you will actually see which Picks its finding.

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.
ShadowChemosh is offline   #9 Reply With Quote
Fenris447
Senior Member
 
Join Date: Sep 2017
Posts: 357

Old November 20th, 2020, 08:10 AM
Yeah I know it was at least finding the spellbook version of the spell, as I could see the tags were being pushed to it. The debug will need to check for more than just the id string, since they'd be the same for the same spell. I can also have the debug push me something like the memorized tag, if present, to see if I'm actually getting the memorized version.

Is there any way to determine when in the timing a pick goes live? To see when that memorized spell is actually considered present on the hero? I would have assumed it's live the moment it's picked, before the timings even start. But that must not be the case here. Because the foreach is based on the thingid, it should pull in every version of that spell on there. But it's not.

Feel free to stop by the Lone Wolf Development Subreddit, for discussion of any and all LWD products and community efforts!
Fenris447 is offline   #10 Reply With Quote
Reply

Thread Tools
Display Modes

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 11:06 PM.


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