Jaysyn904 7b9e44ebbb Initial upload
Initial upload.  PRC8 has been added.  Module compiles, PRC's default AI & treasure scripts have been integrated.  Started work on top hak for SLA / Ability / Scripting modifications.
2024-03-11 23:44:08 -04:00

180 lines
3.9 KiB
Plaintext

void main()
{
object oPC=GetEnteringObject();
if ((!GetIsPC(oPC))&&(!GetIsPC(GetMaster(oPC))))
{
return;
}
int nCurrentMinute = (GetCalendarYear()-1)*12*28*24 +
(GetCalendarMonth()-1)*28*24 +
(GetCalendarDay()-1)*24 +
GetTimeHour();
int nLastSpawnMinute = GetLocalInt(OBJECT_SELF,"LAST_SPAWN_MINUTE");
// spawn delay is in real time minutes for some reason
int nSpawnDelay = 0;
if (nCurrentMinute > (nLastSpawnMinute + nSpawnDelay))
{
SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",0);
}
//return if time has not passed yet
if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0)
{
//SendMessageToAllDMs("Timer not yet done "+IntToString(nLastSpawnMinute)+" "+IntToString(nCurrentMinute));
return;
}
string sCounter;
int nIdx;
object oMob;
int nMobsexist=0;
string sMob="sMob";
string sCheckstring;
int nRandom;
string sMobtype;
int nMobnumber;
// every trigger has a spawnpoint which is its own tag plus _SP
object oSpawnpoint=GetWaypointByTag(GetTag(OBJECT_SELF)+"_SP");
location lLoc=GetLocation(oSpawnpoint);
int nNumber=GetLocalInt(OBJECT_SELF,"nNumber");
// nNumber is the number of mobs spawned last time;
// if this is not the first time we have done it, check if any of our mobs are there
if (nNumber>0)
{
// start counting through the mobs
for (nIdx=1; nIdx<=nNumber; nIdx++)
{
sCheckstring=sMob+IntToString(nIdx);
// cycle through the local objects
if (GetIsObjectValid(GetLocalObject(OBJECT_SELF,sCheckstring)))
{
// if one is valid, set nMobsexist to 1
nMobsexist=1;
}
}
// if any of the old mobs still exist, return
if (nMobsexist==1)
{
// reset the counter, as players have entered the area while mobs are still present, and return
SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);
SetLocalInt(OBJECT_SELF,"LAST_SPAWN_MINUTE",nCurrentMinute);
//SendMessageToAllDMs("I have a mob already");
return;
}
}
// a player has entered, no existing mobs exist and the timer is not yet complete. Therefore, make mobs.
// choose what type of mob to create
nRandom=Random(13);
switch (nRandom)
{
case 0: sMobtype="jw_aby_ghoul";
nMobnumber=4;
break;
case 1: sMobtype="jw_bandead_lord";
nMobnumber=4;
break;
case 2: sMobtype="jw_baneguard_lord";
nMobnumber=4;
break;
case 3: sMobtype="jw_blood_fiend";
nMobnumber=2;
break;
case 4: sMobtype="jw_cloaker";
nMobnumber=3;
break;
case 5: sMobtype="jw_deathbringer";
nMobnumber=1;
break;
case 6: sMobtype="jw_ghoul_ravager";
nMobnumber=5;
break;
case 7: sMobtype="jw_mohrg";
nMobnumber=4;
break;
case 8: sMobtype="jw_night_hag";
nMobnumber=4;
break;
case 9: sMobtype="nightwalker";
nMobnumber=2;
break;
case 10: sMobtype="jw_shade";
nMobnumber=4;
break;
case 11: sMobtype="jw_vilewight";
nMobnumber=5;
break;
case 12: sMobtype="jw_zombie_lord";
nMobnumber=4;
break;
}
/// set the number of mobs we are making
SetLocalInt(OBJECT_SELF,"nNumber",nMobnumber);
//SendMessageToAllDMs("Making my mobs now");
// start making the mobs
for (nIdx=1; nIdx<=nMobnumber; nIdx++)
{
// create the mob
oMob=CreateObject(OBJECT_TYPE_CREATURE,sMobtype,lLoc,FALSE);
// make the mob act like an encounter creature
SetLocalInt(oMob,"norw",2);
// make the mob our new local object
sCheckstring=sMob+IntToString(nIdx);
SetLocalObject(OBJECT_SELF,sCheckstring,oMob);
}
//set the time
SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);
SetLocalInt(OBJECT_SELF,"LAST_SPAWN_MINUTE",nCurrentMinute);
// that is it
}