ExplodeObject

From NWN Lexicon


Contents

[edit] ExplodeObject(object, int)

Blow up an object with the given spell.

void ExplodeObject(
    object oOrigin,
    int nSpell = SPELL_FIREBALL
);

[edit] Parameters

oOrigin

The object to slaughter.

nSpell

The SPELL_* to cast. (Default: SPELL_FIREBALL)


[edit] Description

Blow up an object with the given spell. This will actually cast the spell, causing injury to those around the object.



[edit] Remarks

oOrigin can be any valid object.

nSpell is cast, regardless of if the calling object can actually cast the spell or not. The spell is also cast immediately.

A temporary placeable is created at the location of oOrigin and used as the target location in a call to DestroyObject is called.

[edit] Known Bugs

Sadly, in the testing of the sample code below, one oOrigin PC did survive the lighting blast by making their spell resistance roll.

[edit] Requirements

#include " x0_i0_corpses "


[edit] Version

???

[edit] Example

// Kill a player who is foolish enough to use a placeable.  In this example, the placeable is a lever.
// This script goes in the placeables "OnUsed" script event.
 
#include "x0_i0_corpses"
 
void main()
{
    // Who pulled the lever.
    object oFutureCorpse = GetLastUsedBy();
 
    // We are only interested in exploding a player.  *evil cackles*
    if(TRUE == GetIsPC(oFutureCorpse))
    {
        // Feedback on the lever pull.
        FloatingTextStringOnCreature("*" + GetName(oFutureCorpse) + " pulls the lever.*", oFutureCorpse);
 
        // Shake the screen.
        ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), oFutureCorpse);
 
        // Make the player talk.
        AssignCommand(oFutureCorpse, SpeakString("Oh maaaaan, that can't be good..."));
 
        // BOOOOM!
        ExplodeObject(oFutureCorpse, SPELL_CALL_LIGHTNING);
    } 
}

[edit] See Also

functions: 

DestroyObject

constants: 

SPELL_*



author: Mistress

Personal tools
Categories