//:: xov_hen_join // Returns the number of henchmen oPC has. //:: Created by : Xovian //:: Modified By: Xovian 2010 #include"x0_inc_henai" int GetNumHenchman(object oPC) { // Loop through existing henchmen. int nHench = 1; while ( GetHenchman(oPC, nHench) != OBJECT_INVALID ) nHench++; // Henchman nHench does not exist, so there are nHench-1 henchmen. return nHench - 1; } void main() { // Colors for future use in conversation. string RED = ""; string BLUE = ""; string GRAY = ""; string GREEN = ""; string WHITE = ""; string CYAN = ""; string YELLOW = ""; string BLUISHG = ""; string BLUISHR = ""; object oPC = GetPCSpeaker(); object oHenchman = OBJECT_SELF; // Abort if too many henchmen already. if (GetNumHenchman(oPC) >= GetMaxHenchmen()) { ClearAllActions(); SpeakString(RED+"*There are too many in your party, I can't join you.*"); return; } else { // Add and configure the henchman. SetPlotFlag(oHenchman, FALSE); SetIsDestroyable(FALSE, TRUE, TRUE); SetLastMaster(oPC, oHenchman); AddHenchman(oPC, oHenchman); SetPlayerHasHired(oPC, oHenchman, TRUE); SetAssociateListenPatterns(oHenchman); bkSetListeningPatterns(); ForceRest(oHenchman); SetLocalInt(oHenchman, "HenchFired", 0); DelayCommand(1.0, ActionForceFollowObject(oPC, 3.0)); } }