FANDOM


Make a corpse out of a creature Edit

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 Edit

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 Edit

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 Edit

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
    ;
    }

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.