NPC Speech/Comments (No Dialog)

Information and Discussion Relating to NWN2 Scripting and Coding

Moderators: Moderator, Developer, DM

User avatar
Darker_Thought
Posts: 490
Joined: Wed Mar 10, 2010 1:23 pm
Location: Sweden!

NPC Speech/Comments (No Dialog)

Unread post by Darker_Thought »

1. How to set up a monolog? In other words I know how to script a conversation but how do you make the npc speak without having a dialog square put up?

2. After one learns to set up a monolog for a npc how do you vary the comments so one can cue up diffrent monologs each time one clicks on the npcs?

(Would be directed to the Administration/DMs/Builders of this server)
3. If NPC's do not have an active heartbeat script or any waypoints upon them how straining would it be to have NPC's in a Guild House for example? Is there any problems with having a NPC with a Dialog script or a monolog script, and if so is there any limits or guidelines for numbers of NPC's and how they should be set up to have minimal impact on the servers resources?

As you may notice this is a question about Guild House implementation and I would like to make the Area as optimal as possible before turning it in. This due to having minimum changes or unexpected "Wait what? We can't have al those in there....) later on.

Thank you on forehand!

Regards: Darker
"NWNScript is what happens when you ask Satan to turn C into a scripting language." - DM Doom
User avatar
gedweyignasia
Custom Content
Posts: 1353
Joined: Sat Nov 23, 2013 11:27 pm
Location: EST/UTC-4

Re: NPC Speech/Comments (No Dialog)

Unread post by gedweyignasia »

1. Use the FloatingTextStringOnCreature or SpeakString. Delay each subsequent line by 5.0f seconds or more.

If you are okay storing the strings as local variables:

Code: Select all

void speakMonologue(object oSpeaker, int nMonologue) {

int numLines = GetLocalInt(oSpeaker,"monologue_" + IntToString(nMonologue) + "_length");

int ctr; // Line counter

for (ctr=0;ctr<numlines;ctr++) {
AssignCommand(oSpeaker,DelayCommand(5.0f * ctr,SpeakString("monologue_" + IntToString(nMonologue) + "_line_" + IntToString(ctr),TALKVOLUME_TALK)));

}

}

Then edit the object's variables in the toolset so that it has for n, m, ... = 1, 2, 3, ...

Code: Select all

monologue_n_length = 3
monologue_n_line_0 = "Hi!"
monologue_n_line_1 = "I'm a friendly NPC!"
monologue_n_line_2 = "But I don't like you. Jerk."
monologue_m_length = 2
monologue_m_line_0 = "I have nothing further to talk to you about today."
monologue_m_line_1 = "Get lost, man! Really. Scram."

2. If you don't want them to repeat something, just make the dialogues progressive. Pick n = 1 for the first monologue, then n=2 for the second, etc. (Use a local integer to keep track, but remember to have a case for when it's the final dialogue!)
User avatar
Darker_Thought
Posts: 490
Joined: Wed Mar 10, 2010 1:23 pm
Location: Sweden!

Re: NPC Speech/Comments (No Dialog)

Unread post by Darker_Thought »

gedweyignasia wrote:1. Use the FloatingTextStringOnCreature or SpeakString. Delay each subsequent line by 5.0f seconds or more.

If you are okay storing the strings as local variables:

Code: Select all

void speakMonologue(object oSpeaker, int nMonologue) {

int numLines = GetLocalInt(oSpeaker,"monologue_" + IntToString(nMonologue) + "_length");

int ctr; // Line counter

for (ctr=0;ctr<numlines;ctr++) {
AssignCommand(oSpeaker,DelayCommand(5.0f * ctr,SpeakString("monologue_" + IntToString(nMonologue) + "_line_" + IntToString(ctr),TALKVOLUME_TALK)));

}

}

Then edit the object's variables in the toolset so that it has for n, m, ... = 1, 2, 3, ...

Code: Select all

monologue_n_length = 3
monologue_n_line_0 = "Hi!"
monologue_n_line_1 = "I'm a friendly NPC!"
monologue_n_line_2 = "But I don't like you. Jerk."
monologue_m_length = 2
monologue_m_line_0 = "I have nothing further to talk to you about today."
monologue_m_line_1 = "Get lost, man! Really. Scram."

2. If you don't want them to repeat something, just make the dialogues progressive. Pick n = 1 for the first monologue, then n=2 for the second, etc. (Use a local integer to keep track, but remember to have a case for when it's the final dialogue!)
I admit though Im not a novice at building areas Im very bad with scripting...So I should copy paste this...and put it where? xD :oops:
"NWNScript is what happens when you ask Satan to turn C into a scripting language." - DM Doom
User avatar
gedweyignasia
Custom Content
Posts: 1353
Joined: Sat Nov 23, 2013 11:27 pm
Location: EST/UTC-4

Re: NPC Speech/Comments (No Dialog)

Unread post by gedweyignasia »

Ummm... It's not quite something ready to be copy/pasted. You'd need to do a little scripting work of your own.
User avatar
Darker_Thought
Posts: 490
Joined: Wed Mar 10, 2010 1:23 pm
Location: Sweden!

Re: NPC Speech/Comments (No Dialog)

Unread post by Darker_Thought »

gedweyignasia wrote:Ummm... It's not quite something ready to be copy/pasted. You'd need to do a little scripting work of your own.
Oooh...wait I got it after moving through the options again :)

Thank you for the help! ^^

Atleast I set up for a single comment...Ill settle for it :P
"NWNScript is what happens when you ask Satan to turn C into a scripting language." - DM Doom
User avatar
Duster47
Retired Staff
Posts: 3727
Joined: Mon Nov 16, 2009 7:57 pm
Location: Florida, USA

Re: NPC Speech/Comments (No Dialog)

Unread post by Duster47 »

A one-liner dialog will not be accepted. Scripts for NPC interactions in non-public guild areas need a really good reason to have a chance at being accepted.

If the NPC is not actually speaking, or a one-liner, I highly recommend simply using the Examine description. Write as much as you want.
PC1 = Nerys, Emissary and Skald of the Greyfox tribe, last seen roaming north near Secomber
PC2 = Valqis Sanejmeh; far away cartographer, Oracle of Nut at chaltin QulDaq, former navigator of the Sea Seeker, Reader of Candlekeep and sometime performer.

Return to “NWN2 Scripting”