Help with OnDeath cast Fireball

I’m working on trying to create a goblin “suicide bomber.” The basic idea is that he’s a weak fighter and easily killed. But when he dies he explodes and does massive damage in the area.

So I want to use an OnDeath script that casts a Fireball spell at his location.

Any help would be appreciated.

My Dark Energy module has a custom creature Autognome Tanker whose OnDeath script does exactly that.

(The original by Shemsu-Heru was presumably lost when Bioware discontinued their hosting site, but no matter).

How about “nw_s3_balordeth”?


@Proleric Is that Autognome different to the one found in

Custom Content Challenge September 2013: Arcane Space Stuff?


Ah! So the model, at least, wasn’t lost… very good to hear.

I’m guessing that CCC might well include the script in question, though the Dark Energy version works, too.

I downloaded the module. But when I t tried to open it in the toolset I got an error message because it seems to be tied to a previous version of the CEP.

Could you just post a copy of the script in question? Thanks.

The module works with the latest CEP 2.67, though it only requires 2.65 or later.

You will need to install CEP 2 correctly to work with many modules, not just mine.

However, I will look for the script when I’m back at my desk.

The creature has a local integer “explode” set to 1.

The following lines are added to the end of the standard OnDeath script nw_c2_default7:

    if (GetLocalInt(OBJECT_SELF, "explode"))

The function definition is

// Explode on death

void bh_explode(int nVFX = VFX_FNF_FIREBALL)
//Goes in OnDeath for the creature
//Script:  xph_dth_bozak
//Author:  Jesse Williams (Xepherys)
//Version: v0.2, 2002-06-21
//Usage:   Caller explodes and damages nearby objects for d6 fire damage
//Notes:   modified version of cal_explode by Albert Shih.
//         Attempt at true representation of Bozak Draconian Death Throes

   location lSelf = GetLocation(OBJECT_SELF);
   object oChar = GetFirstObjectInShape(SHAPE_SPHERE, 5.0, lSelf);
   int    nDamage;

    EffectVisualEffect(nVFX), lSelf, 1.5f);

   do {
        if (oChar != OBJECT_SELF)
          if (!GetPlotFlag(oChar))
            if (!GetIsDead(oChar))
              location lChar = GetLocation(oChar);
              nDamage = d6(1);

              ApplyEffectToObject( DURATION_TYPE_INSTANT,
                                   EffectDamage(nDamage, DAMAGE_TYPE_FIRE), oChar);

                                   EffectVisualEffect(VFX_FNF_FIREBALL), lChar, 1.5f);
      } while ((oChar = GetNextObjectInShape(SHAPE_SPHERE, 10.0, lSelf))
               != OBJECT_INVALID);

I left comments in that credit earlier authors.

Beware of placing too many exploding creatures within the explosion zone - the chain reaction (as one explosion kills the next exploder) is quite amusing, but pretty soon the engine has a nervous breakdown.

1 Like

The first one needs to be in a radius of 5.0, all the others within 10.0? Anyway, the first is probably OBJECT SELF, so it will work …

The first two conditions:

if (oChar != OBJECT_SELF)

useless, as condition 3 will match as well

if (!GetPlotFlag(oChar))

questionable, if plot is set, the script won’t do damage, but why skip the vfx?

Finally, the script does not respect a dodge bonus or magic resistance, as the original bio-script I mentioned above does.

Sorry, I can’t resist … :slight_smile:

1 Like

@Mmat I suspect I just copied it from the Autognome version, and found it works well enough.

I haven’t tried nw_s3_balordeth.

Yup, it works well enough. I just felt the pressing urge to mention some things. :slight_smile:

It doesn’t do much damage but Ravenna would be happy to get her dodge bonus …

I haven’t tried nw_s3_balordeth.

But others, including the OP might have a look.


I finally got a chance to sit down and work on this. I tested both Proleric’s script and Mmat’s suggestion of the Balor death script.

I decided to go with the Balor script. The reasons being:

1 - simplicity, because all I had to do was copy the Balor death script and lower the damage number.
2 - I wanted to include the Dodge bonus / magic resistance factor.

Thanks for all the help! It was really appreciated! :grinning: