BeginConversation(string, object)

From NWN Lexicon
Revision as of 19:20, 28 December 2020 by Jasperre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Attempts to start a conversation immediately.

int BeginConversation(
    string sResRef = "",
    object oObjectToDialog = OBJECT_INVALID


If this is not specified, the default dialog file will be used. (Default: "")
If this is not specified, the object that triggered the event will be used. (Default: OBJECT_INVALID)


This function is normally used at the (logical) end of an OnConversation script to start the desired conversation. It can be used elsewhere, but ActionStartConversation() may be more appropriate.

If sResRef is unspecified, the engine refers to the properties of the object executing this command. If there is a conversation property set, that conversation will be used.

By default, the function uses the triggering object of the containing event (ie; GetLastSpeaker) as the second parameter.


Either the executing object or the oObjectToDialog must be a PC.




// This script goes in an NPC's OnConversation event. It chooses a different 
// conversation file depending on the area the NPC is found in.
void main()
    // Get the area tag
    string sAreaTag = GetTag(GetArea(OBJECT_SELF));
    // Declare a variable for the conversation ResRef
    string sConversation;
    // Assign the right conversation by area
    if (sAreaTag == "isk_a_rangersrest")
        sConversation = "rangers_potboy";
    else if (sAreaTag == "isk_a_goldengoblin")
        sConversation = "ggoblin_thief";
    else if (sAreaTag == "isk_a_sewer1")
        sConversation = "assassin_servant";
    // Start the appropriate conversation.

See Also

functions:  ActionStartConversation
events:  OnConversation Event

 author: Iskander Merriman, editor: Jeremy Spilinek