Initial Commit
Initial Commit [v1.32PRC8]
This commit is contained in:
148
_module/nss/ip_areaenter.nss
Normal file
148
_module/nss/ip_areaenter.nss
Normal file
@@ -0,0 +1,148 @@
|
||||
//#include "rd_spawnzones"
|
||||
#include "rd_questinc"
|
||||
|
||||
void ClearSecondArea(object oPC);
|
||||
int CanClearArea(int iLevel);
|
||||
void ClearArea(string sArea);
|
||||
|
||||
void main()
|
||||
{
|
||||
int iLevel;
|
||||
string sTag;
|
||||
location lLoc;
|
||||
object oGuard;
|
||||
object oPC;
|
||||
int iMinLevel;
|
||||
int iMaxLevel;
|
||||
|
||||
oPC = GetEnteringObject();
|
||||
|
||||
if (GetIsPC(oPC))
|
||||
{
|
||||
if (GetLocalInt(OBJECT_SELF,"EN4_SetupZone") == 0 && GetLocalInt(OBJECT_SELF,"AdventureZone") > 0)
|
||||
SetupZone(oPC);
|
||||
|
||||
CheckZone(oPC);
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"Spawned") == 0)
|
||||
{
|
||||
iLevel = GetHitDice(oPC);
|
||||
iLevel = ZoneLevel(OBJECT_SELF,iLevel);
|
||||
|
||||
DelayCommand(0.1,ClearSecondArea(oPC));
|
||||
|
||||
RespawnCampsAE(GetEnteringObject(),0, iLevel, GetLocalInt(OBJECT_SELF,"SpecialSpawn"));
|
||||
RespawnMobsAE(GetEnteringObject(),0, iLevel);
|
||||
SetTrapsAndDoors(GetEnteringObject());
|
||||
SetLocalInt(OBJECT_SELF,"Spawned",1);
|
||||
SetLocalInt(OBJECT_SELF,"RandomEncounter",1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ClearSecondArea(object oPC)
|
||||
{
|
||||
if (CanClearArea(24))
|
||||
{
|
||||
ClearArea("RW1");
|
||||
ClearArea("AM1");
|
||||
ClearArea("DW1");
|
||||
ClearArea("ED1");
|
||||
ClearArea("OF1");
|
||||
}
|
||||
}
|
||||
|
||||
int CanClearArea(int iLevel)
|
||||
{
|
||||
int iResult;
|
||||
|
||||
iResult = TRUE;
|
||||
object oPC = GetFirstPC();
|
||||
while (GetIsObjectValid(oPC) == TRUE)
|
||||
{
|
||||
if (GetHitDice(oPC) < iLevel)
|
||||
iResult = FALSE;
|
||||
oPC = GetNextPC();
|
||||
}
|
||||
return iResult;
|
||||
}
|
||||
|
||||
void ClearArea(string sArea)
|
||||
{
|
||||
int iIndex;
|
||||
int iIndex2;
|
||||
string sTag;
|
||||
object oWP;
|
||||
object oMob;
|
||||
|
||||
iIndex = 1;
|
||||
|
||||
sTag = sArea + "_C" + IntToString(iIndex) + "_Boss";
|
||||
oWP = GetObjectByTag(sTag);
|
||||
|
||||
if (GetIsObjectValid(oWP))
|
||||
SetLocalInt(GetArea(oWP),"Spawned",0);
|
||||
|
||||
while (GetIsObjectValid(oWP))
|
||||
{
|
||||
oMob = GetObjectByTag(sTag + "_S");
|
||||
if (GetIsObjectValid(oMob))
|
||||
{
|
||||
AssignCommand(oMob,SetIsDestroyable(TRUE));
|
||||
DestroyObject(oMob,0.5);
|
||||
}
|
||||
|
||||
iIndex2 = 1;
|
||||
sTag = sArea + "_C" + IntToString(iIndex) + "_T1_" + IntToString(iIndex2);
|
||||
oWP = GetObjectByTag(sTag);
|
||||
while (GetIsObjectValid(oWP))
|
||||
{
|
||||
oMob = GetObjectByTag(sTag + "_S");
|
||||
if (GetIsObjectValid(oMob))
|
||||
{
|
||||
AssignCommand(oMob,SetIsDestroyable(TRUE));
|
||||
DestroyObject(oMob,0.5);
|
||||
}
|
||||
iIndex2++;
|
||||
sTag = sArea + "_C" + IntToString(iIndex) + "_T1_" + IntToString(iIndex2);
|
||||
oWP = GetObjectByTag(sTag);
|
||||
}
|
||||
|
||||
iIndex2 = 1;
|
||||
sTag = sArea + "_C" + IntToString(iIndex) + "_T2_" + IntToString(iIndex2);
|
||||
oWP = GetObjectByTag(sTag);
|
||||
while (GetIsObjectValid(oWP))
|
||||
{
|
||||
oMob = GetObjectByTag(sTag + "_S");
|
||||
if (GetIsObjectValid(oMob))
|
||||
{
|
||||
AssignCommand(oMob,SetIsDestroyable(TRUE));
|
||||
DestroyObject(oMob,0.5);
|
||||
}
|
||||
iIndex2++;
|
||||
sTag = sArea + "_C" + IntToString(iIndex) + "_T2_" + IntToString(iIndex2);
|
||||
oWP = GetObjectByTag(sTag);
|
||||
}
|
||||
|
||||
iIndex2 = 1;
|
||||
sTag = sArea + "_C" + IntToString(iIndex) + "_T3_" + IntToString(iIndex2);
|
||||
oWP = GetObjectByTag(sTag);
|
||||
while (GetIsObjectValid(oWP))
|
||||
{
|
||||
oMob = GetObjectByTag(sTag + "_S");
|
||||
if (GetIsObjectValid(oMob))
|
||||
{
|
||||
AssignCommand(oMob,SetIsDestroyable(TRUE));
|
||||
DestroyObject(oMob,0.5);
|
||||
}
|
||||
iIndex2++;
|
||||
sTag = sArea + "_C" + IntToString(iIndex) + "_T3_" + IntToString(iIndex2);
|
||||
oWP = GetObjectByTag(sTag);
|
||||
}
|
||||
|
||||
iIndex++;
|
||||
sTag = sArea + "_C" + IntToString(iIndex) + "_Boss";
|
||||
oWP = GetObjectByTag(sTag);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user