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:
199
_module/nss/jw_orcg9_trb_sc.nss
Normal file
199
_module/nss/jw_orcg9_trb_sc.nss
Normal file
@@ -0,0 +1,199 @@
|
||||
void main()
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"nDone")!=2)
|
||||
{
|
||||
|
||||
SetLocalString(OBJECT_SELF, "group01_1", "jw_orc1");
|
||||
SetLocalString(OBJECT_SELF, "group01_2", "jw_orc2");
|
||||
SetLocalString(OBJECT_SELF, "group01_3", "jw_orc3");
|
||||
SetLocalString(OBJECT_SELF, "group01_4", "jw_orc4");
|
||||
SetLocalString(OBJECT_SELF, "group01_5", "jw_orc5");
|
||||
SetLocalString(OBJECT_SELF, "group01_6", "jw_orc7");
|
||||
|
||||
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"nDone",2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
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 = 10;
|
||||
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
|
||||
sMobtype="group01";
|
||||
|
||||
|
||||
|
||||
/// 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