#include "nw_i0_generic"

//Put this OnDeath
void main()
{

object oPC = GetLastKiller();

while (GetIsObjectValid(GetMaster(oPC)))
   {
   oPC=GetMaster(oPC);
   }

if (!GetIsPC(oPC)) return;

int DoOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));

if (DoOnce==TRUE) return;

SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);

object oCaster = GetObjectByTag("InvisShadowUrn");
AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_DARKNESS, oPC, METAMAGIC_ANY, TRUE, 7, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));

object oTarget;
object oSpawn;
location lTarget;
oTarget = GetWaypointByTag("WP_ShadowUrn");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "nw_shfiend", lTarget);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
oTarget = oSpawn;

oTarget = GetWaypointByTag("WP_ShadowUrn");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "nw_shfiend", lTarget);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
oTarget = oSpawn;

oTarget = GetWaypointByTag("WP_ShadowUrn");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "nw_shfiend", lTarget);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
oTarget = oSpawn;

}

