EZ Respawner by VorpalBlade
Respawns creatures thoughout your module with no extra work for each instance.
Notes: If you want a customized creature/NPC to respawn with the same
properties, you must create a template of
it with the Tag and the ResRef being the same.
Create an invisable placeable and give it a Name and Tag of "Respawner". Then
place it anywhere in your module.
Add this line to main() in your Default OnSpawn script "nw_c2_default9":
void main()
{
.
.
.
// Do not touch existing script!
.
.
.
// Add this line.
SetLocalLocation(OBJECT_SELF, "spawnpoint", GetLocation(OBJECT_SELF));
}
Add this to your default OnDeath script "nw_c2_default7":
// Declare this before main() so we can use it later.
void RespawnObject(int nType, string sTemp, location lRespawn);
void main()
{
.
.
.
// Do not touch existing script!
.
.
.
// Declare the variables we need
location lSpawn;
object oRespawner;
string sTemplate;
// Assign the variables with the in data needed.
lSpawn = GetLocalLocation(OBJECT_SELF, "spawnpoint");
oRespawner = GetObjectByTag("Respawner");
// Use tag as template name
sTemplate = GetTag(OBJECT_SELF);
// Send Respawn command to the respawner so it will execute even
// after this object is dead and buried
// Set at a 5 min spawn.
AssignCommand(oRespawner, DelayCommand(300.0, RespawnObject(OBJECT_SELF,
sTemplate, lSpawn)));
}
// The command to be placed in the respawner's command queue.
void RespawnObject(int nType, string sTemp, location lRespawn)
{
CreateObject(nType, sTemp, lRespawn);
}