How to create a "corpse"?

That is, an NPC that starts out dead, lying prone on the floor - not a corpse placement.

This must be some really basic stuff, so forgive my incompetence, but yeah, I’m not seeing any way to reduce HP past 1 when editing an NPC, and I can’t really think of anything else except scripting (which I don’t know the first thing about).

Thanks in advance.

Built in function for that x2_spn_dead. This is that function so you can see what it does -

//:: Default: On Spawn In Die
//:: x2_spn_dead
//:: Copyright (c) 2001 Bioware Corp.
    Spawns in the creature dead - and doesn't get
    rid of the body...
//:: Created By: Keith Warner
//:: Created On: Nov 19/02

void main()
    SetIsDestroyable(FALSE, TRUE, TRUE);
    effect eDamage = EffectDamage(500);
    effect eDeath = EffectDeath();
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, OBJECT_SELF);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, OBJECT_SELF);

In the creatures properties/scripts use the OnSpawn event and copy and paste x2_spn_dead into the text box.


That worked perfectly - thank you!

By the way, is there also a way to make an NPC the opposite of prone? Uhh… supine?

Howdy, Mr Dementor,
Yes, “supine” is indeed the word.
The trick to achieving this is to get the AREA to kill the NPC, rather than anything else.
Two small scripts are needed; one for the NPC and one for the area itself.

// faceup_npc_spwn.nss
// Must be used with faceup_area_ud.nss
// This script goes in the NPC's OnSpawn handler.

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

// faceup_area_ud.nss
// Must be used with faceup_npc_spwn.nss
// This script goes in the Area's UserDefined handler.

void main()
switch (GetUserDefinedEventNumber())
case 107:
ApplyEffectToObject (DURATION_TYPE_INSTANT, EffectDeath(), GetLocalObject(OBJECT_SELF, "oSubject"));

The snag is remembering to set the second script on EVERY area where you want such corpses!
Hope this works - it has been many years since I last used it!
Mr T

1 Like

Plain AssignCommand works too. Here’s a mix of your and @Tarot_Redhand’s answers:

// to-be-corpse's OnSpawn script
void main()
    object oSelf = OBJECT_SELF;
    object oArea = GetArea(oSelf);

    SetIsDestroyable(FALSE, TRUE, TRUE);

    AssignCommand(oArea, ApplyEffectToObject(
        DURATION_TYPE_INSTANT, EffectDeath(), oSelf));

I think the EffectDeath is enough. EDIT: module as the killer works too.

1 Like

Worked like a charm. Much obliged, everyone!