//::///////////////////////////////////////////////
//:: Join as Henchman
//:: nw_ch_join.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*

    Adds the current object as a henchman
    to the PC speaking in conversation.
*/
//:://////////////////////////////////////////////
//:: Created By: Brent
//:: Created On: October 22, 2001
//:: Modified By: 69MEH69 07Sep2002 Added Local variable
//:://////////////////////////////////////////////
#include "69_i0_henchman"

void main()
{
    SetAssociateListenPatterns();
    bkSetListeningPatterns();
    // * Companions, come in, by default with Attack Nearest Enemy && Follow Master modes
    SetLocalInt(OBJECT_SELF,"NW_COM_MODE_COMBAT",ASSOCIATE_COMMAND_ATTACKNEAREST);
    SetLocalInt(OBJECT_SELF,"NW_COM_MODE_MOVEMENT",ASSOCIATE_COMMAND_FOLLOWMASTER);

 object oSpeaker = GetPCSpeaker();
 object oMaster = oSpeaker;
 int nHench = GetLocalInt(oSpeaker, "nHench");
 while(GetIsObjectValid(GetHenchman(oMaster)) == TRUE)
 {
    oMaster = GetHenchman(oMaster);
 }
    //SetWorkingForPlayer and SetBeenHired added for ondeath conversation
    SetWorkingForPlayer(GetPCSpeaker());
    SetBeenHired();
    SetLocalObject(OBJECT_SELF, "PCMaster", oSpeaker);
    SetLocalInt(oSpeaker, "nHench", nHench +1);
    AddHenchman(oMaster);
}

