BeginConversation(string, object)

Attempts to start a conversation immediately.

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

Parameters

sResRef

If this is not specified, the default dialog file will be used. (Default: "")

oObjectToDialog

If this is not specified the person that triggered the event-triggering object will be used. (Default: OBJECT_INVALID)


Description

This function is normally used at the (logical) end of an OnDialog script to start up 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 as the second parameter.



Remarks

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


Version

1.22

Example

// This script in an NPC's onConversation chooses a different 
// conversation file depending on the area the NPC's found in.
void main() {
  // Get the area name
  string sAreaName = GetTag(GetArea(OBJECT_SELF));
  // Declare a variable for the conversation ResRef
  string sConversation;
  // Assign the right conversation by area
  if ("isk_a_rangersrest" ==  sAreaName)
    sConversation = "rangers_potboy";
  else if ("isk_a_goldengoblin" ==  sAreaName)
    sConversation = "ggoblin_thief";
  else if ("isk_a_sewer1" ==  sAreaName)
    sConversation = "assassin_servant";

  // Start the appropriate conversation.
  BeginConversation(sConversation);
}

See Also

functions: ActionStartConversation
categories: Action on Object Functions | Conversation Functions
events: OnConversation Event


 author: Iskander Merriman, editor: Jeremy Spilinek