Set a local variable on a PC
From NWNWiki
There are many ways to set a local variable on a PC. The most common method is setting it from a conversation to keep track of quests or to keep track of where the conversation is leading to, etc.
[edit] The Script
[edit] Actions Take
This is a simple script that would be placed in the "Actions Take" script node of the PC's response line that the player chooses. For example: PC - "Yes, I accept your Quest".
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC,"Quest_Taken",1);
}
You can set the name of the "Quest_Taken" to anything you want and you can set the number 1, to anything you want. This way you can keep track of what part of the quest the PC is on by using the same "Quest_Taken" name and increment the number by 1 each time. This also sets the variable on the PC object, so he/she carries it with him/her, so to speak.
[edit] Text appears When
To check and see if the PC has that variable set from a conversation, you would need a script in the "Text appears When" script node on the line you want displayed in the conversation if the PC has that quest.
int StartingConditional()
{
object oPC = GetPCSpeaker();
if(GetLocalInt(oPC,"Quest_Taken") == 1)
return TRUE;
return FALSE;
}
This will return TRUE and the Text will display if the PC speaking has the Variable "Quest_Taken" set to 1.
