Bugfixing pass
Bugfixing pass. Spawn swapovers. Broom!
This commit is contained in:
70
_module/nss/sparky_enter.nss
Normal file
70
_module/nss/sparky_enter.nss
Normal file
@@ -0,0 +1,70 @@
|
||||
/* 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"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetEnteringObject();
|
||||
object oArea = OBJECT_SELF;
|
||||
|
||||
if (GetIsPC(oPC) == TRUE) // Nothing happens if it wasn't a PC entering the area.
|
||||
{
|
||||
//////////////////////////////////////////////// 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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user