So, I'm assuming I missed something and I have no idea about damage numbers so a a little help there would be appreciated. Here's what I have so far...
// jw_suicide_acd_de
//
// a suicide bomber explodes in acid on death
// JSH-OEI 5/10/07
// EPF 7/13/07 - moving to global
// Modified by MokahTGS 7-21-2015
#include "NW_I0_SPELLS"
void main()
{
//Declare major variables
object oPC = GetFirstPC();
object oCaster = OBJECT_SELF;
int nMetaMagic = GetMetaMagicFeat();
int nDamage;
float fDelay;
effect eExplode = EffectNWN2SpecialEffectFile("sp_vitriolic_hit");
effect eVis = EffectVisualEffect(VFX_IMP_ACID_L);
effect eDam;
//Get the spell target location as opposed to the spell target.
location lTarget = GetLocation(OBJECT_SELF);
//Limit Caster level for the purposes of damage
//Apply the fireball explosion at the location captured above.
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lTarget);
//Declare the spell shape, size and the location. Capture the first target object in the shape.
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR);
//Cycle through the targets within the spell shape until an invalid object is captured.
while (GetIsObjectValid(oTarget))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_VITRIOLIC_SPHERE));
//Get the distance between the explosion and the target to calculate delay
fDelay = GetDistanceBetweenLocations(lTarget, GetLocation(oTarget))/50;
//Adjust the damage based on the Reflex Save, Evasion and Improved Evasion.
nDamage = GetReflexAdjustedDamage(100, oTarget, 30, SAVING_THROW_TYPE_ACID);
//Set the damage effect
eDam = EffectDamage(nDamage, DAMAGE_TYPE_ACID);
if(nDamage > 0)
{
// Apply effects to the currently selected target.
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
//This visual effect is applied to the target object not the location as above. This visual effect
//represents the flame that erupts on the target not on the ground.
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
}
//Select the next target within the spell shape.
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR);
}
SendMessageToPC(oPC, "A formian drone has exploded, sending acid spraying in all directions.");
ExecuteScript("nw_c2_default7", OBJECT_SELF);
}
This also does nothing as far as the behavior of a suicide bomber, which is what I want. I'm also looking for scripts making the creature run at the player or nearest player party member and self detonate or in this case just die.