////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Name: Item_Induced_Dialog
//
//Description: Uses an NPC's onPerception script to have it initiate it's conversation file with a PC if the PC has a certain item in his posession. In this //example a scroll is used.
//
//Notes: Place the following in the NPC onPerception script.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



object oSeen = GetLastPerceived();
object oScroll = GetItemPossessedBy(oSeen, "ITEM_TAG");
object oNPC = GetObjectByTag("NPC_TAG");

void main()
{

if(GetIsPC(oSeen) &&
GetLocalInt(oSeen,"Dlg_Init_" + GetTag(oNPC)) == FALSE &&
!IsInConversation(oNPC))

{
if (oScroll != OBJECT_INVALID)
{
AssignCommand(oSeen,ClearAllActions());
AssignCommand(oNPC,ClearAllActions());
AssignCommand(oNPC,ActionMoveToObject(oSeen));
AssignCommand(oNPC,ActionStartConversation(oSeen));
}
}
}