LoT_PRC8/_module/nss/xov_hen_join.nss

52 lines
1.5 KiB
Plaintext
Raw Normal View History

2023-09-25 21:32:17 -04:00
//:: 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 <20>>";
string GRAY = "<c<><63><EFBFBD>>";
string GREEN = "<c <20> >";
string WHITE = "<c<><63><EFBFBD>>";
string CYAN = "<c <20><>>";
string YELLOW = "<c<><63> >";
string BLUISHG = "<c <20><>>";
string BLUISHR = "<c <20><>>";
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));
}
}