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.
This commit is contained in:
264
_module/nss/jw_custom_spn_te.nss
Normal file
264
_module/nss/jw_custom_spn_te.nss
Normal file
@@ -0,0 +1,264 @@
|
||||
void main()
|
||||
{
|
||||
|
||||
// register individual mobs
|
||||
|
||||
string sMob1="group01"; // RESREF OF MOB 1;
|
||||
int MinMob1=1; // minimum number of mobs
|
||||
int MaxMob1=3; // Maximum number of mobs
|
||||
|
||||
string sMob2="group01"; // RESREF OF MOB 2;
|
||||
int MinMob2=1; // minimum number of mobs
|
||||
int MaxMob2=3; // Maximum number of mobs
|
||||
|
||||
string sMob3="group01"; // RESREF OF MOB 3;
|
||||
int MinMob3=1; // minimum number of mobs
|
||||
int MaxMob3=3; // Maximum number of mobs
|
||||
|
||||
string sMob4="group01"; // RESREF OF MOB 4;
|
||||
int MinMob4=1; // minimum number of mobs
|
||||
int MaxMob4=3; // Maximum number of mobs
|
||||
|
||||
string sMob5="group02"; // RESREF OF MOB 5;
|
||||
int MinMob5=1; // minimum number of mobs
|
||||
int MaxMob5=3; // Maximum number of mobs
|
||||
|
||||
string sMob6="group02"; // RESREF OF MOB 6;
|
||||
int MinMob6=6; // minimum number of mobs
|
||||
int MaxMob6=6; // Maximum number of mobs
|
||||
|
||||
// register groups
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"nDone")!=2)
|
||||
{
|
||||
|
||||
SetLocalString(OBJECT_SELF, "group01_1", "NW_SKELETON");
|
||||
SetLocalString(OBJECT_SELF, "group01_2", "NW_GHOUL");
|
||||
SetLocalString(OBJECT_SELF, "group01_3", "NW_MUMMY");
|
||||
SetLocalString(OBJECT_SELF, "group01_4", "NW_WRAITH");
|
||||
//SetLocalString(OBJECT_SELF, "group01_5", "NW_LICH003");
|
||||
/*
|
||||
# Orcs 1
|
||||
*/
|
||||
SetLocalString(OBJECT_SELF, "group02_1", "NW_ORCA");
|
||||
SetLocalString(OBJECT_SELF, "group02_2", "NW_ORCB");
|
||||
SetLocalString(OBJECT_SELF, "group02_3", "NW_OrcChiefA");
|
||||
SetLocalString(OBJECT_SELF, "group02_4", "NW_ORCCHIEFB");
|
||||
SetLocalString(OBJECT_SELF, "group02_5", "NW_ORCWIZA");
|
||||
SetLocalString(OBJECT_SELF, "group02_6", "NW_ORCWIZB");
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"nDone",2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
object oPC=GetEnteringObject();
|
||||
|
||||
if ((!GetIsPC(oPC))&&(!GetIsPC(GetMaster(oPC))))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int nCurrentMinute = (GetCalendarYear()-1)*12*28*24*60 +
|
||||
(GetCalendarMonth()-1)*28*24*60 +
|
||||
(GetCalendarDay()-1)*24*60 +
|
||||
(GetTimeHour()-1)*60+GetTimeMinute();
|
||||
int nLastSpawnMinute = GetLocalInt(OBJECT_SELF,"LAST_SPAWN_MINUTE");
|
||||
|
||||
// spawn delay is in real time minutes for some reason
|
||||
|
||||
int nSpawnDelay = 8;
|
||||
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 nMobMax; // maximum number of mobs
|
||||
int nMobMin; // minimum number of mobs
|
||||
|
||||
// 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(6);
|
||||
|
||||
switch (nRandom)
|
||||
{
|
||||
case 0: sMobtype=sMob1;
|
||||
nMobMax=MaxMob1;
|
||||
nMobMin=MinMob1;
|
||||
break;
|
||||
|
||||
case 1: sMobtype=sMob2;
|
||||
nMobMax=MaxMob2;
|
||||
nMobMin=MinMob2;
|
||||
break;
|
||||
|
||||
case 2: sMobtype=sMob3;
|
||||
nMobMax=MaxMob3;
|
||||
nMobMin=MinMob3;
|
||||
break;
|
||||
|
||||
case 3: sMobtype=sMob4;
|
||||
nMobMax=MaxMob4;
|
||||
nMobMin=MinMob4;
|
||||
break;
|
||||
|
||||
case 4: sMobtype=sMob5;
|
||||
nMobMax=MaxMob5;
|
||||
nMobMin=MinMob5;
|
||||
break;
|
||||
|
||||
case 5: sMobtype=sMob6;
|
||||
nMobMax=MaxMob6;
|
||||
nMobMin=MinMob6;
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
/// set the number of mobs we are making
|
||||
if (GetStringLeft(sMobtype,5)=="group")
|
||||
{ // this is the section for making groups
|
||||
|
||||
|
||||
int nMobnumber=0;
|
||||
int nIdx=1;
|
||||
int nValid=TRUE;
|
||||
string sGroupname=GetStringLeft(sMobtype,7);
|
||||
string sResRef;
|
||||
|
||||
|
||||
|
||||
while (nValid==TRUE)
|
||||
{
|
||||
sMobtype=sGroupname+"_"+IntToString(nIdx);
|
||||
sResRef=GetLocalString(OBJECT_SELF,sMobtype);
|
||||
|
||||
|
||||
|
||||
if (sResRef=="")
|
||||
{
|
||||
nValid=FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// create the mob
|
||||
oMob=CreateObject(OBJECT_TYPE_CREATURE,sResRef,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);
|
||||
nIdx=nIdx+1;
|
||||
}
|
||||
}
|
||||
|
||||
//set the time
|
||||
SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);
|
||||
SetLocalInt(OBJECT_SELF,"LAST_SPAWN_MINUTE",nCurrentMinute);
|
||||
SetLocalInt(OBJECT_SELF,"nNumber",nIdx);
|
||||
|
||||
}
|
||||
|
||||
|
||||
else { // this is the section for making individual mobs
|
||||
// choose how many mobs to create
|
||||
int nRandomnumber=Random((nMobMax-nMobMin)+1);
|
||||
int nMobnumber=nMobMin+nRandomnumber;
|
||||
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user