Animation/Script question prone/death

I have a quest where a creature is killed, I then spawn in another creature laying there at the same place. Now, I used the prone animation at first, but then I realized the new creature laying there is breathing (naturally), so I added EffectDeath like this:

void Laydown(object oTarget)
{

	PlayCustomAnimationVoid(oTarget,"*proneB",1);
	effect eDeath = EffectDeath(FALSE,FALSE,TRUE);
	ApplyEffectToObject(DURATION_TYPE_PERMANENT,eDeath,oTarget);
	//PlayCustomAnimationVoid(oTarget,"pronedeathB",1);
	SetOrientOnDialog(oTarget, FALSE);
}

The sad thing is that when applying the death effect to the target who is laying on the ground, it plays a short “falling” or “roll around” animation which I don’t like. I just wish the spawned in character to be dead on arrival and not have that short death animation played. Is there any way around this to make it look better?

Can’t you just remove the prone animation and only apply the death effect?

In theory you could have the corpse pre-positioned somewhere else (like in ghost room or zone that the player cannot access") and then teleport the corpse when the need arises.

2 Likes

USe Setscriphidden to have the replacer hiden while it perform the animation after applying to it the DeathEffect. Then unhide it.

That’s how we did it in one of our events in SOAR.

#include "fct_soarscript" 
#include "soar_fct_influence"

object spawnCreatureAtLoc(string sResRef, location lLocation)
{
	return CreateObject(OBJECT_TYPE_CREATURE, sResRef, lLocation, FALSE);
}

/************************************************************************/

void transformVFX(location lLoc1, location lLoc2, location lLoc3, location lLoc4, location lLoc5)
{
	effect eVFX = EffectVisualEffect(VFX_IMP_POLYMORPH);
	
	ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVFX, lLoc1);
	ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVFX, lLoc2);
	ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVFX, lLoc3);
	ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVFX, lLoc4);
	ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVFX, lLoc5);
}

void transformCorpses(object oNPC1, object oNPC2, object oNPC3, object oNPC4, object oNPC5)
{
	object oMonster1 = GetObjectByTag("palkni01");
	object oMonster2 = GetObjectByTag("palkni02");
	object oMonster3 = GetObjectByTag("palkni03");
	object oMonster4 = GetObjectByTag("palkni04");
	object oMonster5 = GetObjectByTag("palkni05");
	
	DestroyObject(oMonster1, 0.0, FALSE);
	DestroyObject(oMonster2, 0.0, FALSE);
	DestroyObject(oMonster3, 0.0, FALSE);
	DestroyObject(oMonster4, 0.0, FALSE);
	DestroyObject(oMonster5, 0.0, FALSE);
	
	SetScriptHidden(oMonster1, TRUE);
	SetScriptHidden(oMonster2, TRUE);
	SetScriptHidden(oMonster3, TRUE);
	SetScriptHidden(oMonster4, TRUE);
	SetScriptHidden(oMonster5, TRUE);
	
	SetScriptHidden(oNPC1, FALSE);
	SetScriptHidden(oNPC2, FALSE);
	SetScriptHidden(oNPC3, FALSE);
	SetScriptHidden(oNPC4, FALSE);
	SetScriptHidden(oNPC5, FALSE);
}

void spawnCorpses(location lLocation1, location lLocation2, location lLocation3, location lLocation4, location lLocation5)
{
	object oCorpse1 = spawnCreatureAtLoc("palkni01_corpse", lLocation1);
	object oCorpse2 = spawnCreatureAtLoc("palkni02_corpse", lLocation2);
	object oCorpse3 = spawnCreatureAtLoc("palkni03_corpse", lLocation3);
	object oCorpse4 = spawnCreatureAtLoc("palkni04_corpse", lLocation4);
	object oCorpse5 = spawnCreatureAtLoc("palkni05_corpse", lLocation5);
	
	effect eDeath = EffectDeath(FALSE, FALSE, TRUE, TRUE);
	ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oCorpse1);
	ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oCorpse2);
	ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oCorpse3);
	ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oCorpse4);
	ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oCorpse5);
	
	
	ChangeInfluenceSOAR(GetObjectByTag("korgan"),20);
	ChangeInfluenceSOAR(GetObjectByTag("edwin"),20);
	ChangeInfluenceSOAR(GetObjectByTag("viconi"),20);	
	
	float fTransformDelay = 2.0;
	DelayCommand(fTransformDelay, transformVFX(lLocation1, lLocation2, lLocation3, lLocation4, lLocation5));
	DelayCommand(fTransformDelay, transformCorpses(oCorpse1, oCorpse2, oCorpse3, oCorpse4, oCorpse5));
}

void main()
{
	location lLocation1 = GetLocalLocation(OBJECT_SELF, "Locpalkni01");
	location lLocation2 = GetLocalLocation(OBJECT_SELF, "Locpalkni02");
	location lLocation3 = GetLocalLocation(OBJECT_SELF, "Locpalkni03");
	location lLocation4 = GetLocalLocation(OBJECT_SELF, "Locpalkni04");
	location lLocation5 = GetLocalLocation(OBJECT_SELF, "Locpalkni05");
		
	DelayCommand(1.0, spawnCorpses(lLocation1, lLocation2, lLocation3, lLocation4, lLocation5));
	DelayCommand(7.0, ExecuteScript("palkni_aftermath", OBJECT_SELF));
}
2 Likes

Thank you for your suggestions! I took your advice to heart and did my own version of it all which seem to work quite well, I think. I wanted the spawned in character to lie like it does when with the prone animation, but I wanted the character to actually be dead, so here’s my take on it (only part of the script is shown here):

void ScriptHide(object oTarget)
{

	SetScriptHidden(oTarget,FALSE);

}

void Laydown(object oTarget)
{

	PlayCustomAnimationVoid(oTarget,"*proneB",1);
	
	effect eFreeze = EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION);
           eFreeze = SupernaturalEffect(eFreeze);
               
	SetOrientOnDialog(oTarget, FALSE);
	effect eDeath = EffectDeath();
				      		   			   
    DelayCommand(0.5f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,eFreeze,oTarget));
	DelayCommand(0.8f, ApplyEffectToObject(DURATION_TYPE_INSTANT,eDeath,oTarget));
	DelayCommand(1.0,ScriptHide(oTarget));
	
}
1 Like