104 lines
2.9 KiB
Plaintext
104 lines
2.9 KiB
Plaintext
|
|
void fnPurgeCreatures(object oPC)
|
|
{
|
|
int nN;
|
|
object oOb;
|
|
nN=1;
|
|
oOb=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oPC,nN,CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_NOT_PC);
|
|
while(oOb!=OBJECT_INVALID)
|
|
{ // traverse]
|
|
if (GetLocalInt(oOb,"bGithSpawn")) DelayCommand(0.2,DestroyObject(oOb));
|
|
nN++;
|
|
oOb=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oPC,nN,CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_NOT_PC);
|
|
} // traverse
|
|
} // fnPurgeCreatures()
|
|
|
|
void fnSpawn(string sResRef)
|
|
{
|
|
object oWP;
|
|
int nR=d6();
|
|
object oCreature;
|
|
oWP=GetWaypointByTag("SPAWN_GITHZ"+IntToString(nR));
|
|
if (oWP!=OBJECT_INVALID)
|
|
{ // found
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,sResRef,GetLocation(oWP));
|
|
SetLocalInt(oCreature,"bGithSpawn",TRUE);
|
|
} // found
|
|
} // fnSpawn
|
|
|
|
|
|
void fnSpawnDayCreatures(object oPC)
|
|
{
|
|
int nL;
|
|
int nR;
|
|
nL=1;
|
|
while(nL<13)
|
|
{ // spawn 12
|
|
nR=d100();
|
|
if (nR<21) fnSpawn("githzeraiman");
|
|
else if (nR<41) fnSpawn("githzeraiwoman");
|
|
else if (nR<57) fnSpawn("githzeraiman2");
|
|
else if (nR<71) fnSpawn("githzeraiwoma001");
|
|
else if (nR<79) fnSpawn("githzeraiman3");
|
|
else if (nR<86) fnSpawn("githzeraiwoman3");
|
|
else if (nR<91) fnSpawn("githzeraiman004");
|
|
else if (nR<96) fnSpawn("githzeraiwoma002");
|
|
else { fnSpawn("githzeraiman5"); }
|
|
nL++;
|
|
} // spawn 12
|
|
fnSpawn("githzeraiman7");
|
|
fnSpawn("githzeraiwoma5");
|
|
} // fnSpawnDayCreatures()
|
|
|
|
void fnSpawnNightCreatures(object oPC)
|
|
{
|
|
int nL;
|
|
int nR;
|
|
nL=1;
|
|
while(nL<7)
|
|
{ // spawn 6
|
|
nR=d100();
|
|
if (nR<21) fnSpawn("githzeraiwoma5");
|
|
else if (nR<41) fnSpawn("githzeraiwoman6");
|
|
else if (nR<57) fnSpawn("githzeraiman3");
|
|
else if (nR<71) fnSpawn("githzeraiman5");
|
|
else if (nR<79) fnSpawn("githzeraiwoman7");
|
|
else if (nR<86) fnSpawn("githzeraiman6");
|
|
else if (nR<91) fnSpawn("githzeraiman7");
|
|
else if (nR<96) fnSpawn("githzeraiman2");
|
|
else { fnSpawn("githzeraiwoma001"); }
|
|
nL++;
|
|
} // spawn 6
|
|
fnSpawn("githzeraiwoman7");
|
|
} // fnSpawnNightCreatures()
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
void main()
|
|
{
|
|
object oPC=GetEnteringObject();
|
|
object oArea=OBJECT_SELF;
|
|
object oOb;
|
|
int nN;
|
|
int nLastSpawnTime;
|
|
if (GetIsPC(oPC))
|
|
{ // PC
|
|
ExecuteScript("area_visit",OBJECT_SELF);
|
|
oOb=GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC,oPC,1);
|
|
if (oOb==OBJECT_INVALID)
|
|
{ // first PC this trip to enter the area
|
|
nN=1;
|
|
if (GetIsNight()||GetIsDusk()) nN=2;
|
|
nLastSpawnTime=GetLocalInt(oArea,"nLastSpawnTime");
|
|
if (nN!=nLastSpawnTime)
|
|
{ // time for a new spawn
|
|
SetLocalInt(oArea,"nLastSpawnTime",nN);
|
|
fnPurgeCreatures(oPC);
|
|
if (nN==1) fnSpawnDayCreatures(oPC);
|
|
else { fnSpawnNightCreatures(oPC); }
|
|
} // time for a new spawn
|
|
} // first PC this trip to enter the area
|
|
} // PC
|
|
}
|
|
////////////////////////////////////////////////////////////////////////////////
|