SetIsDestroyable(int, int, int)

From NWN Lexicon
Jump to: navigation, search

Sets whether an object is destroyable.

void SetIsDestroyable(
    int bDestroyable,
    int bRaiseable = TRUE,
    int bSelectableWhenDead = FALSE
);

Parameters

bDestroyable
If this is FALSE, the caller does not fade out on death, but sticks around as a corpse.
bRaiseable
If this is TRUE, the caller can be raised via resurrection. (Default: TRUE)
bSelectableWhenDead
If this is TRUE, the caller is selectable after death. (Default: FALSE)

Description

Sets the destroyable status of the caller.

If bDestroyable is FALSE, the body does not fade away and the corpse is left; otherwise the body fades away.

If bRaiseable is TRUE the caller of this function can be raised via resurrection.

If bSelectableWhenDead is TRUE, then when the caller of this function is dead, players when moving their mouse over the corpse will see the name of the creature.

Remarks

If bSelectableWhenDead is set to TRUE, it does not mean that the corpse will be lootable by clicking on it to see its inventory. Creatures drop their inventory as loot only when they disintegrate.

This cannot be used on a PC or a placeable. Also note that it must be assigned to a target, since it has no parameter to specify a target. There is also no way to check if they are destroyable.

If you set an object to be undestroyable (which, according to the documentation, only affects what happens upon death) the object will also be unaffected by DestroyObject(). It is therefore important to only set SetIsDestroyable(TRUE) at the moment of the object's death.

Version

1.28

Example

// In the OnSpawn of a creature - this makes them, basically,
// eyecandy and will make them undestroyable and kill them.
// - It won't be selectable or raiseable either.
 
void main()
{
    object oSelf = OBJECT_SELF;
 
    // Set to Undestroyable, unraiseable, unselectable
    SetIsDestroyable(FALSE, FALSE, FALSE);
 
    // Apply a death effect as so we die
    effect eDeath = EffectDeath();    
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oSelf);
}

See Also



 author: Tom Cassiotis, editor: Jasperre, additional contributor(s): Tim Fletcher