You are here

Conversation basics (for Noobs)

9 posts / 0 new
Last post
TheSpiralsOfDanu
Conversation basics (for Noobs)

Hi All

I have a noob question about conversations files and the editor.

I have created a conversation file. It is fairly basic, and there is no plot or journal entries associated with it.

However, I want there to be three different sorts of conversation, with script changing each time the PC returns.

So under the "Root" there are three headers, and the conversation setps from there, and they are ordered in the way depending on the PC interacts.

 

However, during testing, the NPC only runs through the first conversation. It doesn't matter how many times the PC goes back, it never gets on to the second or third steps.

 

I'm guessing there should be some "check" script on "when text appears", but I'm not sure how to write it.

Any ideas?

Thank you in advance.

  • up
    50%
  • down
    50%
TheBarbarian

You can click the red hat button next to Edit in the "Text appears when..." tab to open the Script Wizard, which will generate simple bits of code for you, to help you get started. Set, and check, the value of a variable.

Also, I suspect you will appreciate LilacSoul's Script Generator. :-)

  • up
    100%
  • down
    0%
TheSpiralsOfDanu

Cheers for the suggestion. I had  look at the wizard (red hat icon), and yes it does bring up a "check for...", but it is for things like abilities, race, class etc.

Not how many times they're had a convo all ready.

  • up
    50%
  • down
    50%
Tarot Redhand

Have a look at this project. I am not pointing you to that project in the hope that you will download it. Instead I want you to have a look at the third comment on that project because there are half a dozen links in that comment that will be of use to you. Once you have got the things linked to there, get back to us and I'll see to helping you.

TR

  • up
    100%
  • down
    0%
TheSpiralsOfDanu

Cheers for the headsup Tarot.

Where should I start?

  • up
    50%
  • down
    50%
Tarot Redhand

First look at the chapter on conversations in the toolset manual. You won't necessarily need to understand all the minutiae of it all at once but it is a good idea to read through it anyway. Then have a look in the Lexicon. There is a good beginners tutorial on scripting by Celowin. You'll find it via the contents under Lyceum/Tutorial/Beginning Scripting. The first three chapters cover the minimum of what you'll end up needing to know for creating a module. For your conversation you might find that the script generator to be of some use because it can create Text Appears when scripts for you.

Remember though, if you have any problems or you don't understand anything (NwN wise anyway) just come back here and ask. On the whole we're a reasonably friendly bunch (even if my avatar is a feline assassin wink).

TR

  • up
    100%
  • down
    0%
TheSpiralsOfDanu

Cheers for the headsup Tarot.

That was really useful, you want my scripts and how I solved it?

 

  • up
    50%
  • down
    50%
Tarot Redhand

Post it in here so we can all see your solution.

TR

  • up
    100%
  • down
    0%
TheSpiralsOfDanu

Ok, we imagine that every time the PC talks to a NPC, the NPC remembers and the conversation changes a little bit. In this instance, I have a 3 step conversation.

 

Each root is in descending order. So the third encounter is the first root, the second in the middle, and the first one at the bottom.

We then create three scripts based on this template

void main()
{
string sName = GetName(GetPCSpeaker());
SetLocalInt(OBJECT_SELF, sName+"talked", 1);
}
 
The second script changes "1" to "2" and the third changes "1" to "3".
 
Go into the conversation editor, and append each script to dialogue root on "Actions Taken..."
The effect is the the system is now counting how many times you have spoken to the NPC. This is a generic script and works for multiple NPCs.
 
Next create  another template based on:
 
int StartingConditional()
{
string sName = GetName(GetPCSpeaker());
int nTest1 = GetLocalInt(OBJECT_SELF, sName+"talked");
if(nTest1!=1) return FALSE;
else return TRUE;
}
 
Create a second version where "=1" becomes "=2"
 
The original script =1, is appended to "Text appears when..." on the middle root.
The second script =2, appended to the top root.
 
The first script tells the system to start counting, and the second script tells the system what action to perform at each count.
 
I'm pretty sure we could do some cool stuff, like "=10" "Dear <FirstName> when do you keep bothering me with the same questions?"
 
In short, TA DA!!!
I know it's not amazing, but I'm quietly chuffed with this, as it adds a Virtual Intelligence aspect to some NPCs. 

 

  • up
    100%
  • down
    0%