Make a corpse out of a creature

Make a corpse out of a creature
The trick is to use the SetIsDestroyable command.

In the creature's OnDeath script, add the following

SetIsDestroyable( FALSE ) ;

then kill the creature. EffectDeath works well in the creature's OnSpawn script

ApplyEffectToObject( DURATION_TYPE_INSTANT, EffectDeath, OBJECT_SELF ) ;

This will leave behind the body of the creature.

"That's fine, but *all* the corpses are face down."

How do I make the corpse face up
Get the Area to kill it.

Bizarre, huh. It seems that if you kill yourself, you are smacking yourself from behind, and end up face down. Whereas if the Area kills you, it is smacking you from the front, and you end up face up. Go figure.

For example, the creature's OnSpawn script:

void main {   object oArea = GetArea( OBJECT_SELF ) ;   SetLocalObject( oArea, "oSubject", o ) ;   SignalEvent( oArea, EventUserDefined( 107 ) ) ;   return ;   }

The Area's OnUserDefined script:

void main {   switch( GetUserDefinedEventNumber ) {       case 107 :           // An AREA killing an OBJECT puts the OBJECT in a face-up position. ApplyEffectToObject( DURATION_TYPE_INSTANT, EffectDeath, GetLocalObject( OBJECT_SELF, "oSubject" ) ) ;           break ;       }    return ;   }

Okay, now how to I bring the corpse back to life
You have to resurrect them

void main {   object oCorpse = GetObjectByTag( "YOUR_TAG" ) ;   int iHeal = GetMaxHitPoints( oCorpse ) - GetCurrentHitPoints( oCorpse ) ;   AssignCommand( oCorpse, SetIsDestroyable( FALSE, TRUE ) ) ;   ApplyEffectToObject( DURATION_TYPE_INSTANT, EffectResurrection, oCorpse ) ;   ApplyEffectToObject( DURATION_TYPE_INSTANT, EffectHeal( iHeal ), oCorpse ) ;   return ;   }

How can I have the corpse only once
Use a local variable. For example, the OnDeath script above becomes:

void main {   if( GetLocalInt( OBJECT_SELF, "bDie" ) ) {       SetIsDestroyable( TRUE ) ;       }    else {       SetIsDestroyable( FALSE ) ;       SetLocalInt( OBJECT_SELF, "bDie", TRUE ) ;       }    return ;   }