Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - D&D 5th Edition SRD (http://forums.wolflair.com/forumdisplay.php?f=89)
-   -   Disabling Spells (http://forums.wolflair.com/showthread.php?t=65118)

Fenris447 November 18th, 2020 01:03 PM

Disabling Spells
 
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.

RavenX November 18th, 2020 01: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.

Fenris447 November 18th, 2020 01: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.

dungeonguru November 18th, 2020 04: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.

Fenris447 November 19th, 2020 05:39 AM

Any ideas why the foreach isn't working?

dungeonguru November 19th, 2020 08: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.

Fenris447 November 19th, 2020 09: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.

RavenX November 19th, 2020 01:53 PM

Quote:

Originally Posted by Fenris447 (Post 291968)
Any ideas why the foreach isn't working?

9 times out of 10, it's because your priority and timing are incorrect.

ShadowChemosh November 19th, 2020 02:06 PM

Quote:

Originally Posted by Fenris447 (Post 291974)
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.

Fenris447 November 20th, 2020 07: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.


All times are GMT -8. The time now is 03:22 PM.

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