==================================
THIS CODE IS NO LONGER SUPPORTED
==================================
Spell Points System v1.1
==========================
This system modifies the default 'spells per day' magic system used by NWN2 into a 'spell points' magic system. Each of the 7 spell casters (not including Warlocks b/c they have unlimited spells per day) is assigned a spell point amount based on their caster levels. Each time a caster casts a spell, spell points are subtracted from the casters available spell points. Once the caster has exhausted all of his spell points for the day he is unable to cast any more spells.
Change Log
============
- v1.1
Added a custom gui window that displays the current number of spell points for the selected character. More code clean up.
- v1.051
Integrated the systme with Even AI v.07357. More code clean up.
- v1.05
Added support for custom spell point items. Items with tag ending in _spsxx (where xx is a number from 0 to 99) will add that amount of spell points to the caster. For example a ring with a tag ring_sps25 will add 25 spell points to the character.
- v1.04
Got the world map transitions to work. Got the spell points to work when the caster is contolled by the AI. Got the spell point bonuses to work at the correct level. Got the ability bonus to get the correct bonus based on the current caster level.
- v1.03
Reworked the entry points for the system. Uses ExecuteScript at the rest/cast/equip/unequip events. This should make it easier to incorporate it anywhere you like. Gives casters bonus spell points based on their ability modifier up to the level of spells they can cast. Renamed and reorganized the files and functions to be easier to read and manage.
- v1.02
Did more clean up of the UDM code. Figured out how to do the OnEquip and OnUnequip checks.
- v1.01
Moved the restore spell points functionality from the onrest script into the my_inc_spellpoints to make it easier to add the spell points system to other modules. Cleaned up the UMD script sections a bit. Figured out why the onrest script that Even uses actually works in the OC, Duh.
The spell point restore is not working for me. It seems I have to rest after I enter every single zone to have any spell points. _________________________ NWN2 Voting Standards - Tattoo it on your forehead. 10 - A Masterpiece, Genuinely Groundbreaking 9 - Outstanding, a Must Have 8 - Excellent, Recommended to Anyone 7 - Very Good, Deserves a Look 6 - Good, Qualified Recommendation 5 - Fair, Solid yet Unremarkable 4 - Some Merit, Requires Improvements 3 - Poor Execution, Potential Unrealized 2 - Very Little Appeal 1 - Not Recommended to Anyone
Posted by sdawm1 at 2007-01-1119:16:16
Let there be much singing and dancing! I think I got everything working! - Spell Points restore with the World Map transitions (tough nut to crack). - Spell Points should still work even if the AI is controlling the character (not enemy casters though, they work normally). - Bonus Spell Points based on the ability modifier are done correctly (not all at once like I was doing). - Slots per day caster do not get bonus Spell Points from items (only Bards and Sorcerers get bonus spell points). I have set the system up so it can be activated on a class by class basis. Just set the HasInfiniteSpell column in classes.2da to 1 for any of the seven caster classes and they will use spell points. Leave it set at 0 and they will use the standard spells per day system. This means that you can have some classes use spell points and others use spells per day in at the same time. To change the spell point amount given to each character, just modify the sps_.2da files. There are three of them and they are easy enough to understand. If you want to make changes to how the system works, you will only need to modify the sps_inc_spellpoints and recompile the other 4 sps_ files. All of the logic is in the sps_inc_spellpoints. No other file would need to be recompiled. The other files are just wrappers and interfaces. This allows for very easy upgrade once installed. I was forced to recomplie all of the spell scripts from the game. I did not change any of them. I just recompiled them. If you us a custom version of any spell (or any custom spells) you will need to recompile the spell(s) with the x2_inc_spellhook that I have included in the zip file. All of the game files that have been modified only have on line added to them. ExecuteScript("sps_script", oTarget); Or something like that. If you need to add this to any other events or custom scripts, that is all you have to add. Easy enough.
Posted by sdawm1 at 2007-01-1020:22:34
I have figured out what causes the AI to skip the UMD check. That would be good news except for the fact that the problem is in the spellhook itself. Having said that, I have figured out how to make it work... but I would have to change the spellhook and that means recompling all the spell scripts. I would not have to change any of the spells I would just need to recompile them. And that is exactly what I didn't want to do, but that is the only way to make this thing work for AI controlled characters. So, I guess that is what I will do.
Posted by Lord_Ernie at on01/10/07
I'm sorry to hear about the issues you're having... I figured it would have something to do with AI functionality, but as I'm not an expert on any area of NWN (the furthest I've gotten is some modification of existing mods), so I fear I won't be of much help to you. If you ever come round to fixing the problem, I'd still be interested. :) As it stands, though, the system is still very much useful to PW's who'd like to use it. A nice piece of work. I'll rate it 9 as it stands :).
Posted by sdawm1 at 2007-01-1008:06:55
lerathel - So, you would want to mix the spell slots per day with the spell points per day? Well, making the spell points per day only work if the InfiniteSpells column in the classes.2da would be easy enough (I think). Then you could actually make it work for some classes and not others. For example, Clerics could use spell slots per day and wizards use spell points per day. As for just letting the players choose... I am not sure what would happen in a multiplayer game if the players had two different classes.2da. If one Wizard had InfiniteSpells set to 0 (no) and another wizard had it set to 1 (yes). IIRC, the 2da files are resolved at the client. If that is true, then it could work. I will attempt to test that and let you know.
Posted by lerathel at 2007-01-1003:50:24
At last ! I alway used the spell point system in DD second edition the rule was in optionnal book, and the system exist for 3.5 too, again in an optionnal book, I would like to add this to my persistent world but the player need to be able to choose between standar system and this one, could you do this ? like choosing a feat to use this sytem ? thank you I cant wait to try it :)
Posted by sdawm1 at 2007-01-0920:28:59
Well, I have been working on this thing for a good bit of time and here is what I know... Lord_Ernie, I have figured out why Amie, Sand or whoever can cast spells all day long. It seems like the AI does not do the spellhook check, more specifically the UMD check. I am doing everything through the UMD as to not have to touch the spells themselves and they are just skipping that part. That means that as long as you have the caster selected (anyone) it will do what it is supposed to do, but once you select another character the AI takes over and it stops working right. Aaagghhh! There were a couple of other things too, but I have corrected them. Of course I have no idea how to fix that at the moment. I have been looking though the AI code and it is making my brain hurt. I will have to try to get in touch with someone that understands how the AI works and see if there is even a way to do what I am attempting. I know Even has made an AI for NWN2 (I happen it use it and like it very much) so I will see if he has any time to assit me. I have managed to fix the ability bonus issue. No more level 1 sun elf wizards with 17 spell points. The get the correct amount now. And as you increase in level you get the correct bonus from a high ability score. For kicks I even put in a bit more feedback to let you know what was happening. Basically, this would have work well in NWN since you could only ever control the PC. But since NWN2 lets you control your companions, it kind of... well... I guess it sucks. I suppose it would work in NWN2 if you didn't use companions, but that is kind of lame... Unless you were dueling or playing a mod with no controlable companions. Lanessar, I take your point about the items granting extra spell points and extra slots. Making that adjustment is easily done. That would mean that only Bards and Sorcerers would get extra spell points. All the other caster classes would get extra spell slots. That makes a lot of sense to me and I think I will go ahead and make that change... or perhaps make it an option. As far as tweaking it... by all means do. With this latest version (1.03) and despite the above limitations, I think it is a decent framework for a more advanced and robust system. I have completely redone how game events can access the system. It should be really easy to add this (or something derived from it) into another mod or PW. And since I switched to using 'ExecuteScript("sps_onrest", OBJECT_SELF)' in the all the events I should be able to make updates without having to recompile any other files. Anyway... I am still looking at getting this thing working correctly for companions. I will make the change for slot based casters asap. And I am still looking into the world map transition issue. It is just a matter of finding the correct place to drop the ExecutScript command. It may take a few days, as my real life does not seem to understand the importance getting this issue corrected.
Posted by Lanessar at on01/16/07
On the spell points matter, I do suggest doing a variable on the item which sets bonus spell points (or at least offering that variation). Here's why: Wizards and other slot-based casters (not sorcerers) use those slots in this system for additional spells. This expands their repertoire of spells. Spell points grant further use of existing spells. Those are two different and quite powerful abilities. To grant both to a wizard without any seperation will create a bit of an imbalance. Here's the example: A wizard (level 8) with 36 spell points finds an item with a bonus level 4 spell slot. This then gives him an additional spell to memorize for level 4 (say, ice storm on top of stoneskin) and another four spell points for a total of 40. The sorcerer gains... four spell points, for a total of ~60. He does not gain an additional "spell" to use with this system. If you seperate it out, it creates a much more balanced and robust system. I suppose I can just modify your work to achieve what I want to do, though. I just wanted to bring up that you've created a totally alternate spell casting system, quite powerful, for persistent worlds and the like. _________________________ Lan's Placeable Groups v1.5
Posted by Lord_Ernie at on01/10/07
You're welcome. :) I'm sorry I can't help with fixing this, but looking into the details of NWN coding is unfortunately beyond my schedule at the moment. Anyway, as said before, if you do find what's wrong, this definitely is an interesting system.
Posted by sdawm1 at 2007-01-0812:14:25
I know I tested that very case... I must have messed something up when I was cleaning up the code. (Mental Note: Do regression testing.) Thanks for the help.
10 - A Masterpiece, Genuinely Groundbreaking 9 - Outstanding, a Must Have 8 - Excellent, Recommended to Anyone 7 - Very Good, Deserves a Look 6 - Good, Qualified Recommendation 5 - Fair, Solid yet Unremarkable 4 - Some Merit, Requires Improvements 3 - Poor Execution, Potential Unrealized 2 - Very Little Appeal 1 - Not Recommended to Anyone