HoS_PRC8/_mod/_module/nss/prison_oe.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

60 lines
1.9 KiB
Plaintext

void fnSetAppearance(object oNPC)
{ // PURPOSE: make single NPC appear as many NPCs
int nR=d6();
// race - default = human
if (nR==4) SetCreatureAppearanceType(oNPC,APPEARANCE_TYPE_HALFLING);
else if (nR==5) SetCreatureAppearanceType(oNPC,APPEARANCE_TYPE_ELF);
else if (nR==6) SetCreatureAppearanceType(oNPC,APPEARANCE_TYPE_DWARF);
else if (nR==7) SetCreatureAppearanceType(oNPC,APPEARANCE_TYPE_GNOME);
else if (nR==8) SetCreatureAppearanceType(oNPC,APPEARANCE_TYPE_HALF_ORC);
// phenotype
nR=d4();
if (nR==4) SetPhenoType(PHENOTYPE_BIG,oNPC);
} // fnSetAppearance()
void fnCreatePrisoners()
{
int nPop=d4()+2;
int nN=1;
object oPrisoner;
object oWP=GetWaypointByTag("POST_PRISONERS");
string sRes;
if (GetIsObjectValid(oWP))
{ // waypoint found
while(nN<=nPop)
{ // create a prisoner
sRes="prisoner";
if (d4()==1) sRes="prisoner2";
oPrisoner=CreateObject(OBJECT_TYPE_CREATURE,sRes,GetLocation(oWP));
if (GetIsObjectValid(oPrisoner)) fnSetAppearance(oPrisoner);
nN++;
} // create a prisoner
} // waypoint foind
} // fnCreatePrisoners();
void main()
{
object oPC=GetEnteringObject();
object oPG=GetNearestObjectByTag("MUNICIPALPG",oPC,1);
int nHour=GetLocalInt(GetModule(),"nPrisonGuardHour");
object oWP=GetWaypointByTag("POST_MUNICIPALPG");
if (nHour!=GetTimeHour()&&GetIsPC(oPC)&&GetIsObjectValid(oWP))
{ //
if (GetIsObjectValid(oPG)==FALSE)
{ // create new guard
oPC=CreateObject(OBJECT_TYPE_CREATURE,"municipalprisong",GetLocation(oWP));
SetLocalInt(GetModule(),"nPrisonGuardHour",GetTimeHour());
} // create new guard
} //
if (GetIsPC(oPC))
{ // see about prisoners
oPG=GetNearestObjectByTag("PRISONERS",oPC,1);
if (GetIsObjectValid(oPG)==FALSE)
{ // create prisoners
fnCreatePrisoners();
} // create prisoners
} // see about prisoners
}