RATDOG/_module/nss/spawn_chk_custom.nss
Jaysyn904 310b26f555 PnP Enhancements continue
PnP Enhancements continue.  Fixed some quest logic, made some of the quests reward the entire party instead of the player that turns it in.  Updated Warrior's Guild.  Colored Wilderness map for the hell of it. Full compile.
2022-11-19 00:37:42 -05:00

133 lines
3.4 KiB
Plaintext

//
// Spawn Check - Custom
//
#include "pqj_inc"
//void main (){}
int ParseFlagValue(string sName, string sFlag, int nDigits, int nDefault);
int ParseSubFlagValue(string sName, string sFlag, int nDigits, string sSubFlag, int nSubDigits, int nDefault);
object GetChildByTag(object oSpawn, string sChildTag);
object GetChildByNumber(object oSpawn, int nChildNum);
object GetSpawnByID(int nSpawnID);
void DeactivateSpawn(object oSpawn);
void DeactivateSpawnsByTag(string sSpawnTag);
void DeactivateAllSpawns();
void DespawnChildren(object oSpawn);
void DespawnChildrenByTag(object oSpawn, string sSpawnTag);
//
//
int SpawnCheckCustom(object oSpawn)
{
// Initialize Values
int nSpawnCheckCustom = GetLocalInt(oSpawn, "f_SpawnCheckCustom");
// Block Spawn by Default
int nProcessSpawn = FALSE;
//
// Only Make Modifications Between These Lines
// -------------------------------------------
// Check 00
if (nSpawnCheckCustom == 0)
{
// Example, Allow Spawn
nProcessSpawn = TRUE;
}
//
//
if (nSpawnCheckCustom == 1)
{
if (GetIsDawn() == TRUE || GetIsDay() == TRUE)
{
nProcessSpawn = TRUE;
SetLocalInt(oSpawn, "SpawnProcessed", FALSE);
}
else
{
int nSpawnProcessed = GetLocalInt(oSpawn, "SpawnProcessed");
if (nSpawnProcessed == FALSE)
{
nProcessSpawn = TRUE;
SetLocalInt(oSpawn, "SpawnProcessed", TRUE);
}
}
}
//
// Reproducing Predators
if (nSpawnCheckCustom == 10)
{
int nChildren = GetLocalInt(oSpawn, "ChildrenSpawned");
if (nChildren >= 10)
{
int nHappy = 0;
int nPredators;
int nNth = 1;
object oPredator = GetNearestObject(OBJECT_TYPE_CREATURE, oSpawn, nNth);
while (oPredator != OBJECT_INVALID)
{
if (GetLocalInt(oPredator, "Predator") == TRUE)
{
nPredators++;
if (GetLocalInt(oPredator, "CurrentHungerState") > 0)
{
nHappy++;
}
}
nNth++;
oPredator = GetNearestObject(OBJECT_TYPE_CREATURE, oSpawn, nNth);
}
SendMessageToAllDMs("There are " + IntToString(nPredators) + " Predators Alive.");
if (nHappy >= 2)
{
nProcessSpawn = TRUE;
}
}
else
{
nProcessSpawn = TRUE;
}
if (nProcessSpawn == TRUE)
{
SendMessageToAllDMs("A Predator is Born!");
}
}
//
//:: Checks for stage 1 or lower for the "Spider's Captive quest"
if (nSpawnCheckCustom == 50)
{
//:: Initialize major variables
object oArea = GetArea(OBJECT_SELF);
object oPC = GetFirstObjectInArea(oArea);
//:: Cycle through PCs in Area
while (oPC != OBJECT_INVALID)
{
//:: Check quest stage
if ( RetrieveQuestState("spiders", oPC) <= 1 )
{
nProcessSpawn = TRUE;
//SendMessageToPC(oPC, "Spawn Processed");
SetLocalInt(oSpawn, "SpawnProcessed", TRUE);
}
oPC = GetNextObjectInArea(oArea);
}
}
//:: Checks for stage 1 or lower for the "Spider's Captive quest"
// -------------------------------------------
// Only Make Modifications Between These Lines
//
// Return whether Spawn can Proceed
return nProcessSpawn;
}