Author Sticky: Post Working Scripts Here
Calidarien Posted: Wednesday, 26 June 03:47AM
Just some minor fixes to my exploding object script. If you haven't tried it yet with a room full of goblins, you should; it's a good laugh. 

1. Script Name: cal_explode
2. What It Does: Caller explodes after a delay and damages nearby objects for 2d6 fire damage (Reflex save DC 15)
3. Notes: My current use for this script is an OnDeath call that makes it annoying to be standing next to creatures you kill
4. The Script Itself:

NWScript:
//Script: cal_explode

//Author: Albert Shih (Calidarien)

//Version: v1.0, 2002-06-25

//Usage: Caller explodes after a delay and damages nearby objects for 2d6 fire

//  damage (Reflex save DC 15)

//Notes:

// v1.0: Release version

//

void ExplodeAtLocation(location lTarget, int nDamage, int nSaveDC = 15, float fRadius = 3.) {

  ApplyEffectAtLocation( DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_FIREBALL), lTarget);

  object oObject = GetFirstObjectInShape(SHAPE_SPHERE, fRadius, lTarget);

  do {

    int nDamageAfterSave = GetReflexAdjustedDamage(nDamage, oObject, nSaveDC);

    ApplyEffectToObject( DURATION_TYPE_INSTANT, EffectDamage(nDamageAfterSave, DAMAGE_TYPE_FIRE), oObject);

   } while ((oObject = GetNextObjectInShape(SHAPE_SPHERE, fRadius, lTarget)) != OBJECT_INVALID);

}

//

void main()

{

  location lSource = GetLocation(OBJECT_SELF);

  DelayCommand(3., ExplodeAtLocation(lSource, d6(2)));

}