I have a creature that the player fights. When this creature dies I am using a script like this on the OnDeath:
void PlayCustomAnimationVoid(object oObject, string sAnimation, int iLoop = 0, float fSpeed = 1.f)
{
PlayCustomAnimation(oObject, sAnimation, iLoop, fSpeed);
}
void Laydown(object oTarget)
{
PlayCustomAnimationVoid(oTarget,"*proneB",1);
SetOrientOnDialog(oTarget, FALSE);
}
void DoAllTheStuff()
{
object oPC = GetFirstPC();
SendMessageToPC(oPC,"Death script is running");
object oDead = OBJECT_SELF;
location lDead = GetLocation(OBJECT_SELF);
CreateObject(OBJECT_TYPE_CREATURE,"malvrik",lDead);
object oMalvrik = GetObjectByTag("malvrik");
DelayCommand(0.2,Laydown(oMalvrik));
}
void main()
{
AssignCommand(GetModule(), DoAllTheStuff());
//ExecuteScript("nw_c2_default7", OBJECT_SELF);
}
I can confirm that the script is running. Now, the problem is that the other object called “malvrik” isn’t spawned in. I think this is due to the game having problem with the dead creature and not being able to find the location of the dead creature since it’s now dead. However, I can’t come up with a way to solve this. I need the location of the creature when it dies. How does one accomplish this? Do I need to check the location when the creature is almost dead perhaps, and spawn a waypoint there and then use that waypoint as reference for spawning in the new object called “malvrik”?