LoT_PRC8/_module/nss/xov_hen_join.nss
Jaysyn904 ec287507a1 Initial upload
Initial upload.
2023-09-25 21:32:17 -04:00

52 lines
1.5 KiB
Plaintext

//:: 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 = "<có >";
string BLUE = "<c ó>";
string GRAY = "<c°°°>";
string GREEN = "<c ó >";
string WHITE = "<cóóó>";
string CYAN = "<c óó>";
string YELLOW = "<cóó >";
string BLUISHG = "<c °°>";
string BLUISHR = "<c °ó>";
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));
}
}