Quick tutorial: I'm pretty layman so don't take this to a C++ class or anything. Teacher would probably laugh.
If you ever want to see how to use a function almost all of them have some level of description attached to them. On the right side of the script editor you can see four buttons. Make sure 'Function' is pressed down. Then type the function in the search box you want to look up. You should be able to access any functions that are with NWN, and any that are part of any 'Include' files that your script uses. So open the 'nwnx_funcs' script and type 'NWNXFuncs' in the search box, and then select a function from the list that populates. On the bottom of the screen in that big box where the error message hounds me (GRR!) you will see a bit of a description of the function. Some are REALLY well documented. Others... not so much. If you know what your reading it makes it a lot easier.
// Changes a base ability score iAbility (ABILITY_STRENGTH, ABILITY_DEXTERITY, etc) by iValue
void NWNXFuncs_ModAbilityScore(object oCreature, int iAbility, int iValue, int bAdjustCurrentHitPoints = 1)
The // basically means this is information for scripters, and has nothing to do with the script when it compiles. In this case it's a pretty straight forward description on what this function is.
void : There is a lot more that goes into it, especially about not returning data, but for our purposes it just indicates that this does something rather than define something. Those are other things, like object, int, vector and such... but irrelevant for the moment.
NWNXFuncs_ModAbilityScore : This is what you type to call the function. Probably a more technical term for it, but I just call it the function 'Name'.
( ) : Everything in here helps tell the NWNXFuncs_ModAbilityScore what it is supposed to do. It's all the variables and other nonsense that you use to define EXACTLY what to do.
object oCreature : This indicates to the function what object this should apply to. Objects can be just about anything, but for this function its really for creatures. I mean placeables don't have ability scores anyway...
int iAbility : This indicates the ability score you want to change. There are two types of integers for all intents and purposes, again I'm pretty layman here. There are numbers like 1, 2, -5... whatever. Then there are constants, like ABILITY_STRENGTH, which really indicate a number but are easier to remember then trying to memorize a bunch of freaking numbers.
int iValue : Another integer. This one describes how much change you want to happen. This will be a number, like 1, 2, 3, -1... etc etc
int bAdjustCurrentHitPoints = 1 : This is a bit trickier because it's not exactly clear by the description. However if you look up NWNXFuncs_SetAbilityScore you find a description.
// bAdjustCurrentHitPoints is only used when Constitution is set: if false a potential increase in hitpoints
// will only affect oCreature's maximum hit points. The missing hit points can be regained the normal way: resting,
// healing, regeneration, etc.
That makes more sense now. If you are changing Constitution scores you will want to set this to 1 to affect the players current hit points, otherwise set it to 0 to only affect maximum hit points. Remember, for the most part 1 is TRUE, 0 is FALSE. You could actually write 'TRUE' in there if you want if its easier for you.
So reading this description you can write your function in. First you'll want to get your object, which I'm going to assume is the player entering the server. You can do this with:
object oPC = GetEnteringObject();
object: defines what kind of data this returns.
oPC : o for object type, PC for player character. The name isn't that important. You could write 'ScrubbyPants' and come to the same effect. oPC is just used often because it is clear to read.
= GetEnteringObject(); : This means that you are getting the object that is entering.
In english...
Get the object that enters and name it oPC
Then write your onEnter script.
#include "nwnx_funcs"
void main()
{
object oPC = GetEnteringObject();
NWNXFuncs_ModAbilityScore(oPC, ABILITY_STRENGTH, 2, 0);
}
Reading the NWNX function in english: Modify the ability score of strength by 2 points on the object named oPC. Do not affect current hit points.
For a conversation like you indicate all you have to do is change how you get the player as an object. NWN has a real easy way to do this. It's GetPCSpeaker.
#include "nwnx_funcs"
void main()
{
object oPC = GetPCSpeaker();
NWNXFuncs_ModAbilityScore(oPC, ABILITY_STRENGTH, 2, 0);
}
See the difference?
Now on another note I would be careful sticking this in a conversation as is. Player could potentially just repeat the conversation and keep modifying their strength up by two points, but I'm sure you can find a way around that.
Hope this helps!