Player Resource Consortium

Neverwinter Nights => Builders => Topic started by: barna10 on February 14, 2012, 07:52:31 PM

Title: Craft system
Post by: barna10 on February 14, 2012, 07:52:31 PM
I am attempting to alter the craft system (arbitrary) to give more options while still avoiding TMIs.  I wrote some functions into prc_craft, but they don't seem to work.  It appears as if some other function (probably from one of the includes) is setting a limit that I can't change.  Specifically I am trying to increase the number of feats available for bonus feats.

Does anyone know where to start looking?  Also, where is the code for PRCGetFileEnd function?

or where the const NUM_MAX_FEAT_SUBTYPES is used?

Title: Re: Craft system
Post by: barna10 on February 15, 2012, 03:13:29 AM
Figured it out!

I'm going to attempt to add more feats to the list and then I'll post the files.
Title: Re: Craft system
Post by: barna10 on February 15, 2012, 04:37:59 AM
Ok, got feats working AND corrected an error that prevented adding spells using arbitrary crafting (always getting a TMI error)

For now, all you get is Bioware spells.  Fix was in the code, but the error prevented it from working ("irp_spells" constant reference should have been capitalized).

Enjoy.  My first NWN coding!
Title: Re: Craft system
Post by: barna10 on February 15, 2012, 08:02:08 PM
I have tweaked the fix as much possible to provide as many spells as possible (about twice as many as my first attempt).  Some, but not all, of the PRC spells are enabled.

 If playing on a server, I could tweak it to allow ALL spells, but it will require a separate prc_craft.ncs. 

On that, is there a way for the system to detect if it is running in multi-player mode or not?  I could incorporate an if statement to have it enable all spells automatically when playing on a server.

 If you downloaded the previous file, this one supersedes the previous one.
Title: Re: Craft system
Post by: xwarren on February 16, 2012, 02:01:51 AM
On that, is there a way for the system to detect if it is running in multi-player mode or not?  I could incorporate an if statement to have it enable all spells automatically when playing on a server.
I use GetPCPublicCDKey() for that - in single player mode (with default parameters) it returns blank string.
Title: Re: Craft system
Post by: barna10 on February 16, 2012, 03:18:01 AM
good to know, I will try that
Title: Re: Craft system
Post by: xwarren on February 17, 2012, 07:36:04 AM
I've integrated your fix with PRC sources. :)
Thank you!
Title: Re: Craft system
Post by: barna10 on February 17, 2012, 11:05:32 PM
No problem.  I'm glad I could finally give something back.
Title: Re: Craft system
Post by: barna10 on February 20, 2012, 03:53:31 AM
I cleaned up the code a bit.  Also, I noticed some code uses "IPRP_SPELLS", others use "iprp_spells".  I added support for both.  Now both arbitrary and non-arbitrary crafting work. 

However, non-arbitrary crafting requires the PC to have the spell memorized.  I haven't figured out how to tie-in the Warlock's UMD check for this, but I'll keep working on it so Warlock's can create scrolls and potions without using arbitrary crafting.
Title: Re: Craft system
Post by: xwarren on February 20, 2012, 05:25:17 AM
I cleaned up the code a bit.  Also, I noticed some code uses "IPRP_SPELLS", others use "iprp_spells".  I added support for both.  Now both arbitrary and non-arbitrary crafting work. 

However, non-arbitrary crafting requires the PC to have the spell memorized.  I haven't figured out how to tie-in the Warlock's UMD check for this, but I'll keep working on it so Warlock's can create scrolls and potions without using arbitrary crafting.
Good point with iprp_spells case, though it's only needed for string comparision in PopulateList() function (Get2daCache always uses lowercased file names).

Thanks for fixing this. I've updated my copy of SVN repository.