Hello Everybody,
Here's the script,
//Spawns Attackers by the number of attackers that exsist untill
//Bell is destroyed
#include "x0_i0_destroy"
void main()
{
object oPC = GetFirstPC();
object oNPCa = GetObjectByTag("RoyalMilitia02");
object oNPCb = GetObjectByTag("RoyalMilitia03");
object oNPCc = GetObjectByTag("RoyalMilitia05");
object oCapt = GetObjectByTag("MilitiaCaptain"); // In another area
object oSound = GetObjectByTag("AlarmBellGill01");
object oBell = OBJECT_SELF;
object oDoor = GetObjectByTag("DrGillMainDk");
int nType = OBJECT_TYPE_CREATURE;
string sTemp = "royalmilitia003";
location lLoc = GetLocation(GetWaypointByTag("WpSpRoyMil"));
if(GetIsDead(oCapt))
{
SoundObjectSetVolume(oSound,0);
SetPlotFlag(oBell,FALSE);
DestroyObject(oBell,2.0);
}
else
{
if(GetLocalInt(oBell,"Intruder")==1) // Int set by doors or other NPCs
{
if(GetLocked(oDoor))
{
SetLocked(oDoor,FALSE);
ActionOpenDoor(oDoor);
DeleteLocalInt(oNPCa,"Waylay");
DeleteLocalInt(oNPCb,"Waylay");
DeleteLocalInt(oNPCc,"Waylay");
DelayCommand(2.0,SoundObjectSetVolume(oSound,127));
}
else
{
if(CountAllObjectsInAreaByTag("RoyalMilitia04",OBJECT_SELF) < 2)
{
// Spawn Attackers
CreateObject(nType,sTemp,lLoc,FALSE);
}
}
}
else
{
//Do Nothing
}
}
}
and here's the problem.
I first tested this script without the GetIsDead Condition. Worked Fine.
After, The Bell rings, and the Spawn fires twice and stops working(after the spawns are killed and there corpes are destroyed). Entering the other area and killing oCapt, stops the ringing and destroys the bell.
Ed