One thing I think we wanted in NWN1-ALFA, but never really had, was a no-drop token or method of nullifying casting and class abilities for faithless/fallen/etc divine casters.
Though mostly these would be for DMs to apply when RP conditions called for it, it's come to my attention that NWN2/MotB have no enforcement whatsoever for the "metal armor" rules for druids- so we could script such a system to block casting and class abilities for the duration of wearing the metal armor, plus 24 game-hours afterwards.
What's the best way to accomplish this? For now I could use the SetModuleOverrideSpellScriptFinished(); trick out of a function called from the spellhook, though that would mean the following:
1. All the spells would show up normal (and appear castable)
2. Spells would be tracked and restored by resting/praying as normal
3. Once cast, the animations will still fire, and potentially some of the spell VFX
4. After the time expires, uncast spells from memory would still be useable.
Now, the spells won't have any effect when they actually finish casting, but as you can imagine, it's not quite the same as just blanking out their spell memory, which might be preferable from an in-character perspective. I'm not sure how we'd go about blanking out spell memory by class though, since our current spelltracking implementation only tracks spells cast, not spells known- so we'd have to somehow add all a PC's spells from the class in question to the spelltrack DB- not sure how we could query them to add offhand.
Interested both in ideas for implementation, and in opinions on whether the spellhook/spell failure method with the limitations above would be worth coding for the near-term.
Spell / Class ability nullification: ideas?
Moderators: ALFA Administrators, Staff - Technical
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
Re: Spell / Class ability nullification: ideas?
I'm not sure that you'd need to get into spelltracking to clear out a fallen caster's memory. You could probably just make a loop that cleared divine spells as part of the OnClientEnter and OnRest scripts. It'd probably be stupidly monotanous to get just the divine spells, being that checking a 2da in a loop would make some crashes.AcadiusLost wrote:I'm not sure how we'd go about blanking out spell memory by class though.
You might be able to clear out cleric slots by just firing off DecrementSpellUses repeatedly on healing spells, and see if the engine counts that as a spontaneous casting. Not very helpful on the paladin/ranger/druid front, I know, (unless NWN2 lets druids spontaneously cast summons?) but it's a thought.
It may also be a possibility to put in a scripted spellhooking thing, like you've suggested here, that nullifies the spell effects, writes to the logs, and tells the player that they're fallen in the eyes of their deities. (maybe a popup text that says any VFX shown is OOC? It's not overly crisp and tidy, to be sure, but I'd think that players of fallen divine spellcasters would know that they're fallen and that they shouldn't be trying to use divine spells in the first place.)
- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
Re: Spell / Class ability nullification: ideas?
You can find a working example of this in the original spell tracking code in the SVN repository, AL. If you need help locating it, just let me know.Zelknolf wrote:You could probably just make a loop that cleared divine spells as part of the OnClientEnter and OnRest scripts. It'd probably be stupidly monotanous to get just the divine spells, being that checking a 2da in a loop would make some crashes.
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
Cipher: do I read you correctly to mean that working out, composing and adding a lengthy spelltrack record for each "nullified" PC (in effect, decrementing their remaining spell uses to zero), is your recommendation here?
The simple alternative is just having the spells result in no effect, via the spellhook (like failed scrolls, without mishap checks).
If it's simple to build up the string from potentially available (but as yet un-cast) spells, I'd appreciate a link to the section you're referring to, especially if it's buried in the orphaned code from our prior spelltracking implementation (when we were tracking spells available, instead of spells used).
Oh, and Zelknolf: the thoughts are appreciated, though we've got everything tied into SQL tables currently, and the resting and entry events are already pretty tangled up with existing systems, so probably best to work via what we've got already built in rather than working around it with a custom decrementing. Druids do have spont. casting for summons in NWN2, but as you said, isn't a universal solution- doesn't help with rangers or paladins, and thanks to Spirit Shamans and Favored souls, we also have to consider faithless/out-of-favor handling for natural spontaneous casters, as well heh. Spellhook already tests all spells cast to work out whether they're off a potion or scroll, and processes them through those sytems as well as spelltracking normally, so it'd be an easy place to exert control, just not an elegant one from the IC perspective (caster still plays the animations, draws the AOO's, etc- just no meaningful spell effects).
The simple alternative is just having the spells result in no effect, via the spellhook (like failed scrolls, without mishap checks).
If it's simple to build up the string from potentially available (but as yet un-cast) spells, I'd appreciate a link to the section you're referring to, especially if it's buried in the orphaned code from our prior spelltracking implementation (when we were tracking spells available, instead of spells used).
Oh, and Zelknolf: the thoughts are appreciated, though we've got everything tied into SQL tables currently, and the resting and entry events are already pretty tangled up with existing systems, so probably best to work via what we've got already built in rather than working around it with a custom decrementing. Druids do have spont. casting for summons in NWN2, but as you said, isn't a universal solution- doesn't help with rangers or paladins, and thanks to Spirit Shamans and Favored souls, we also have to consider faithless/out-of-favor handling for natural spontaneous casters, as well heh. Spellhook already tests all spells cast to work out whether they're off a potion or scroll, and processes them through those sytems as well as spelltracking normally, so it'd be an easy place to exert control, just not an elegant one from the IC perspective (caster still plays the animations, draws the AOO's, etc- just no meaningful spell effects).
- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
Yes. You'll obviously need to prevent prayer from subsequently restoring those spells for the faithless (could be a simple check against the player's deity field in the prayer code) and from getting new spells on level up. The latter will be more challenging.AcadiusLost wrote:Cipher: do I read you correctly to mean that working out, composing and adding a lengthy spelltrack record for each "nullified" PC (in effect, decrementing their remaining spell uses to zero), is your recommendation here?
What I was pointing you to is a working example of how you might loop through all spells in order to construct the spell use logs. The tracking system can then just take over naturally and nullify spell uses at the proper times.
Since there is no way to query the engine and retrieve a list of the spells a player has memorized, the work around is to loop through all the spells (or just the relevant divine spells) and decrement spell uses where uses > 0. Now bear in mind that this implementation did not work for spell tracking on clerics because their spontaneous casting ability muddled the results of GetHasSpell(), which returns the number of spell uses remaining for a given spell. But this number is always equal to or greater than the number of actual spell uses, so for the purposes of nullifying spell uses for the faithless, it should work fine.
I like this implementation from an IC perspective but it will require that we update the code whenever spell lists are modified.
Take a look at the code snippet starting on line 133 of rev 267 of acr_spelltrack_i in the repository:
http://alfa-bmf.svn.sourceforge.net/vie ... iew=markup
The goal is to perform a loop similar to that in ACR_RemoveSpellUses() above to construct a spell use log for the player in the manner that we track spells currently. If you'd prefer that I code up this interface for you, just let me know. It'll just need to be invoked from the right places (wherever you deduce that a player is faithless, on level ups, etc).
This is a fine alternative as well, but as you pointed out, just not as immersive.The simple alternative is just having the spells result in no effect, via the spellhook (like failed scrolls, without mishap checks).
- Brokenbone
- Chosen of Forumamus, God of Forums
- Posts: 5771
- Joined: Mon May 16, 2005 1:07 am
- Location: London, Ontario, Canada
I still don't own NWN2, and don't quite know how the scripting works, so forgive any potentially ignorant suggestions.
If you're thinking of a "token" to drop on "fallen/disfavored" religious type PCs, I wonder if the relatively new "Protection from Alignment" spell scripts (currently in the ahp_3.0_2da.hak for NWN1) could provide any inspiration. There's a relatively simple check, which at first was plain alignment based for clerics / druids, but later, based against a deity list, which could stop the spellcasting dead in its tracks. That is, you do "blow" an instance of "Protection from Evil" (as an example), but rather than the spell taking effect, you get a little server message of "You do not have the ability to cast good descriptor spells."
Any "if" condition I am sure, at least in NWN1, could check things other than deity fields, alignments, etc. That is, if the script was asked to check for a "Fallenwidget", it could snuff out the spell and send the PC a server message like "You are out of favor with <Deity>." Hell, if you felt like tracking abuse, you could put in a log stamp for any fizzled spell attempts.
If there's interest, see scripts in the latest ahp_3.0_2da.hak such as "nw_s0_prgood.nss", nw_s0_previl.nss", etc.
This isn't a decrement-making system, it just squanders spells one might try to cast... take it for what it's worth, if scripts like this are even "portable" over to NWN2. Hope it's of aid.
*re: immersiveness of a fizzle... since I see it mentioned just above my post. Sending a server message about needing to seek atonement or whatever seems a one-size-fits-all reminder, could be a good fit here.
If you're thinking of a "token" to drop on "fallen/disfavored" religious type PCs, I wonder if the relatively new "Protection from Alignment" spell scripts (currently in the ahp_3.0_2da.hak for NWN1) could provide any inspiration. There's a relatively simple check, which at first was plain alignment based for clerics / druids, but later, based against a deity list, which could stop the spellcasting dead in its tracks. That is, you do "blow" an instance of "Protection from Evil" (as an example), but rather than the spell taking effect, you get a little server message of "You do not have the ability to cast good descriptor spells."
Any "if" condition I am sure, at least in NWN1, could check things other than deity fields, alignments, etc. That is, if the script was asked to check for a "Fallenwidget", it could snuff out the spell and send the PC a server message like "You are out of favor with <Deity>." Hell, if you felt like tracking abuse, you could put in a log stamp for any fizzled spell attempts.
If there's interest, see scripts in the latest ahp_3.0_2da.hak such as "nw_s0_prgood.nss", nw_s0_previl.nss", etc.
This isn't a decrement-making system, it just squanders spells one might try to cast... take it for what it's worth, if scripts like this are even "portable" over to NWN2. Hope it's of aid.
*re: immersiveness of a fizzle... since I see it mentioned just above my post. Sending a server message about needing to seek atonement or whatever seems a one-size-fits-all reminder, could be a good fit here.
ALFA NWN2 PCs: Rhaggot of the Bruised-Eye, and Bamshogbo
ALFA NWN1 PC: Jacobim Foxmantle
ALFA NWN1 Dead PC: Jon Shieldjack
DMA Staff
ALFA NWN1 PC: Jacobim Foxmantle
ALFA NWN1 Dead PC: Jon Shieldjack
DMA Staff
I think this was Acadius' first suggestion, to just go into the spellhooking and add something like if(GetHasItem("fallen_divine_caster") && GetLastSpellCastClass() == CLASS_TYPE_<whatever>) {code to abort the spell here -- either returning false or SetExecutedScriptReturnValue(0) ... I think. NWN2 might have that rigged a little differently} -- this is all the protection from alignment spells do, except their little if structure shows up right after the spellhooking.Brokenbone wrote:If you're thinking of a "token" to drop on "fallen/disfavored" religious type PCs, I wonder if the relatively new "Protection from Alignment" spell scripts (currently in the ahp_3.0_2da.hak for NWN1) could provide any inspiration. There's a relatively simple check, which at first was plain alignment based for clerics / druids, but later, based against a deity list, which could stop the spellcasting dead in its tracks. That is, you do "blow" an instance of "Protection from Evil" (as an example), but rather than the spell taking effect, you get a little server message of "You do not have the ability to cast good descriptor spells."
- Brokenbone
- Chosen of Forumamus, God of Forums
- Posts: 5771
- Joined: Mon May 16, 2005 1:07 am
- Location: London, Ontario, Canada
Heh... I'm weak on terminology I guess, but big on recycling.
ALFA NWN2 PCs: Rhaggot of the Bruised-Eye, and Bamshogbo
ALFA NWN1 PC: Jacobim Foxmantle
ALFA NWN1 Dead PC: Jon Shieldjack
DMA Staff
ALFA NWN1 PC: Jacobim Foxmantle
ALFA NWN1 Dead PC: Jon Shieldjack
DMA Staff
- PensivesWetness
- Frost Giant
- Posts: 702
- Joined: Thu Oct 28, 2004 4:25 am
- Location: Cleveland, Ohio (where? whut? dude...)
Uh, when i play SP, when a Ranger wears something other than Padded/Leather/Studded (Not sure about Hide), he losses his particular class skills/modes... even Chain shirts, regardless of material used prevent this (So much for Chainshirt fests)Brokenbone wrote:Heh... I'm weak on terminology I guess, but big on recycling.
maybe you could look at the loops/dohickies on those scripts for use on Druids?
<Gebb> ok, what does it mean to be "huggled"? <spidroth_esq> Something terrible. <Squamatus> buggered <Dran> sodomised <Squamatus> by an acorn on a stick <tresca> LOL <Gebb> that didn't help <alynn>