Player Resource Consortium

Neverwinter Nights => Help => Topic started by: Ophichius on October 13, 2011, 03:32:05 AM

Title: PRC 3.5 b2 and NWNX question.
Post by: Ophichius on October 13, 2011, 03:32:05 AM
I'm using the latest version of the PRC with NWNX2, trying to get the game to properly retain the Draconic Enlargement stat bonuses. Right now it treats them as temporary bonuses and erases them on rest/level up.

I was told that using NWNX would fix this, but it appears not to be the case. Am I missing a step, or is this not currently fixable?
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: xwarren on October 13, 2011, 03:54:27 AM
Usually this would require nwnx_funcs plugin installed, but iirc premanent stat modifications were not implemented for size changes.
I may be wrong though - check if other stat mods work for you (templates, class bonuses etc).
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: Ophichius on October 13, 2011, 06:12:34 AM
I forgot to add that I have nwnx_funcs installed. I just checked and it seems to be properly changing the stats for PnP Shifters. I'm willing to make the changes to the DD myself, but I haven't any idea where to start.

When you say 'class bonuses' which classes do you mean? The normal DD stat bonuses work for me, but they always have.
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: xwarren on October 13, 2011, 07:05:33 AM
Most of the nwnx_funcs modifications are applied in prc_nwnx_funcs.nss. This script applies ability changes to Warchief, Mighty Contender of Cord, Heartwarder, Acolyte of the Skin, Diamond Dragon... etc (see the script).

Temporary size bonuses you mentioned before are applied in prc_size.nss script (PRCGetCreatureSize() checks for draconic enlargement). I think you should start there ;)
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: Ophichius on October 18, 2011, 09:41:16 AM
Okay, had a poke around, raised about as many questions as I got answered.

Can I safely create new persistent local variables within the prc_size.nss script, or will I need to alter something elsewhere to make it work? Specifically will "SetPersistantLocalInt(oPC, "NWNX_Size<stat>", foo);" create the persistent local "NWNX_Size<stat>" or do I have to go about that some other way?

Am I correct in assuming that prc_size.nss handles the effects of the engorge spell, as well as DD size changes? (For that matter, what else touches prc_size.nss for determining stat changes?).

Are there any significant drawbacks to making the prc_size script attempt to use NWNX before failing over to the current method of operation?

Finally, what's the simplest way to check that NWNX is in use? If I'm reading inc_nwnx_funcs correctly, GetLocalInt(oModule, "PRC_NWNX_FUNCS"); should return nonzero if NWNX is running?
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: xwarren on October 18, 2011, 12:14:04 PM
Quote
Finally, what's the simplest way to check that NWNX is in use? If I'm reading inc_nwnx_funcs correctly, GetLocalInt(oModule, "PRC_NWNX_FUNCS"); should return nonzero if NWNX is running?
correct

Quote
Can I safely create new persistent local variables within the prc_size.nss script, or will I need to alter something elsewhere to make it work? Specifically will "SetPersistantLocalInt(oPC, "NWNX_Size<stat>", foo);" create the persistent local "NWNX_Size<stat>" or do I have to go about that some other way?
Yes, you can add new persistant locals this way. (I would use only one local though - the size for which bonuses were applied by nwnx - and allow the script to calculate the rest)

Quote
Am I correct in assuming that prc_size.nss handles the effects of the engorge spell, as well as DD size changes? (For that matter, what else touches prc_size.nss for determining stat changes?).
I haven't seen code for enlarge person in prc_size - imo it's OK - enlarge person is temporary magical bonus so it should be 'green'.
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: Ophichius on October 21, 2011, 06:41:51 PM
Finished coding up a version that I think works, but the darn thing won't compile! Every time I go to compile it with nwnsscomp it throws me errors about mostly unrelated files. Specifically, it's complaining about constants not being constants in prc_inc_nwscript and prc_inc_descrptr.

What am I missing here? I assume the nss files included with the PRC are identical to the ones used to compile the ncs files, in which case there's a way to kick the compiler in the teeth and force it to ignore errors.
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: xwarren on October 22, 2011, 01:00:13 AM
Finished coding up a version that I think works, but the darn thing won't compile! Every time I go to compile it with nwnsscomp it throws me errors about mostly unrelated files. Specifically, it's complaining about constants not being constants in prc_inc_nwscript and prc_inc_descrptr.

What am I missing here? I assume the nss files included with the PRC are identical to the ones used to compile the ncs files, in which case there's a way to kick the compiler in the teeth and force it to ignore errors.

Are you compiling with the latest soruces (3.5 beta 2)? Which compiler do you use?
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: Ophichius on October 22, 2011, 07:53:02 AM
Using the .nss files I extracted from the 3.5b2 haks, and the NwnNssComp 2.0 file from here: http://nwvault.ign.com/View.php?view=Other.Detail&id=708

The specific error I am getting is this:

prc_inc_nwscript.nss(63): Error: Non-constant value specified for constant "BIOWARE_INHIBIT"
prc_inc_descrptr.nss(57): Error: Non-constant value specified for constant "DESCRIPTOR_ELEMENTAL"

I haven't touched either of those files at all, so why it's throwing errors at me is a bit baffling. I did take a look at them, and the relevant lines are as follows:

// This line is here to prevent the bioware toolkit from
// throwing an exception over the number of constants in PRC
const int BIOWARE_INHIBIT = !!0;

//special
const int DESCRIPTOR_ELEMENTAL         = DESCRIPTOR_ACID | DESCRIPTOR_COLD | DESCRIPTOR_ELECTRICITY | DESCRIPTOR_FIRE | DESCRIPTOR_SONIC;
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: xwarren on October 22, 2011, 08:08:27 AM
Right, i'll have to update prc_inc_descrptr.nss.

The compiler you use seems to be an older version (Strat updated it in 2011!? - i don't think so) The version we use to compile PRC doesn't complain about errors in those scripts.

Try Advanced Script Compiler (http://nwvault.ign.com/View.php?view=NWN2PlugIns.Detail&id=99) - It's the most recent version of 'PRC Compiler' and i use it to compile most of my scripts (but i haven't updated our SVN repository with it yet).
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: Ophichius on October 22, 2011, 08:16:52 AM
Hmm, that squashed the complaints about constants being declared improperly, but I'm getting a new error. "unable to load nwscript.nss". Did a quick search and couldn't find that file at all. I think I may need some help in configuring my development environment properly. So far I've just dumped the contents of most of the PRC haks into a folder along with the compiler.
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: xwarren on October 22, 2011, 08:19:37 AM
The command line for Advanced Script Compiler is a bit different than for Nwnnsscomp
I use something like this:
NWNScriptCompiler.exe -1ogl -i "<path_to_include_files>" -n "<path_to_nwn_dir>" <script_name>
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: Ophichius on October 22, 2011, 08:26:56 AM
Excellent, that got it compiling. Will report in a few if it worked.

One minor bug this will introduce though, NWNX doesn't appear to have a way to alter dodge AC, just base AC. So any dodge bonuses from size changes will be rendered as base AC bonuses instead.
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: Ophichius on October 22, 2011, 09:02:32 AM
Half-success.

Stats change properly with size changes from enlarge person, reduce person, or DD levels. Unfortunately, they don't revert properly when the enlarge/reduce person spells wear off.
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: xwarren on October 22, 2011, 10:03:07 AM
I'll quote myself:
Quote
enlarge person is temporary magical bonus so it should be 'green'.
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: Ophichius on October 22, 2011, 10:47:24 AM
Yeah, thing is, I didn't touch enlarge person. It apparently -is- affected by the size change code. I'm not intricately familiar with the PRC subsystems, but it appears that all the enlarge/reduce person code does is set a local int that is then processed by something else to actually make the size changes. I wasn't able to find the guts of the draconic enlargement feats to see how they implement size changes, so I can't say for certain  what needs to change, or how, in order to make this stable.
Title: Re: PRC 3.5 b2 and NWNX question.
Post by: xwarren on October 22, 2011, 11:35:49 AM
You're right. It's doing this here:
Code: [Select]
    //do 'simple' size change effects, like the expand/compress psionic powers
    int nSimpleChange = nPRCSizeAll - nPRCSize;
    nStr     += 2 * nSimpleChange;
    nDex     -= 2 * nSimpleChange;
    nACDodge -=     nSimpleChange;
    nHide    -= 4 * nSimpleChange;

I think we should disable 'smiple' size changes from nwnx script - one way is to use nPRCSize instead of nPRCSizeAll and apply the rest as magical bonus/penalty.

BTW PRCGetCreatureSize() function is in prc_inc_nwscript.nss, that's where all size modificators are.