RATDOG/_module/nss/dungeon_enter.nss
Jaysyn904 c0e04f09c3 Updated Tar Lake interior
Updated Tar Lake interior.  Added Water Breathing to Amulet of Water Breathing.  Updated tar mephit.
2023-08-18 23:16:27 -04:00

86 lines
3.0 KiB
Plaintext

/* Generic area onEnter script for streamlined addition of Sparky Spawner variables
Created By: The Amethyst Dragon (www.amethyst-dragon.com/nwn)
Can be used for the onEnter script for all areas of a module. If you already
have your own area enter script, you can add just the includes and the
"Sparky Spawner Section" of code.
This causes the area to check to see if Sparky variables are set on the area.
If not, it searches for the Encounter Variables placeable object in the area
to find out which variables to add to the area, then runs the Sparky spawning
code.
If no such variables or placeable are present in the area, it skips any further
Sparky code from running.
*/
#include "sparky_inc"
#include "sparky_enc"
#include "X0_I0_PARTYWIDE"
#include "spawn_functions"
void main()
{
object oPC = GetEnteringObject();
object oArea = OBJECT_SELF;
//:: Nothing happens if it wasn't a PC entering the area.
if (GetIsPC(oPC) == TRUE)
{
//:: Records that the PC has entered Rappan Athuk at least once.
SetLocalInt(oPC, "bEnteredDungeon", 1);
//:: Fires any NESS spawners
ExecuteScript("ra_onareaenter");
//////////////////////////////////////////////// Sparky Spawner Section
if (GetLocalInt(oArea, "sparkyloaded") != 1)
{
//:: Find encounters-holding placeable
object oEncVars = GetFirstObjectInArea(oArea);
while (oEncVars != OBJECT_INVALID)
{
if (GetTag(oEncVars) == "sparky_variables") { break; }
oEncVars = GetNextObjectInArea(oArea);
}
if (oEncVars != OBJECT_INVALID)
{
LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc01"));
LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc02"));
LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc03"));
LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc04"));
LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc05"));
LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc06"));
LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc07"));
LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc08"));
LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc09"));
LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc10"));
DestroyObject(oEncVars, 1.0);
}
SetLocalInt(oArea, "sparkyloaded", 1);
}
int iDisabled = GetLocalInt(oArea, "iSparkyDisabled");
int iAlreadySpawned = GetLocalInt(oArea, "iSparkySpawned");
if (GetIsDM(oPC))
{
SendMessageToPC(oPC, "Sparky spawns are " + (iDisabled ? "OFF" : "ON"));
return;
}
if (iAlreadySpawned || iDisabled)
{
return;
}
SpawnEncounters(oArea);
//////////////////////////////////////////////// End Sparky Section
}
}