*Derps* Right the current code !
void ExplodeAtLocation(location lTarget, int nDamage)
{int nDamageAfterSave;
// get the first object in the area of effect
object oObject = GetFirstObjectInShape(SHAPE_SPHERE, 7.0, lTarget, FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_DOOR);
while (oObject != OBJECT_INVALID) // if oObject is not invalid, try to damage it!
{ // Each target object makes it's own Reflex save against the original damage (nDamage)
nDamageAfterSave = GetReflexAdjustedDamage(nDamage, oObject, 30, SAVING_THROW_TYPE_FIRE);
if (nDamageAfterSave > 0)
// if target object should suffer any damage, apply it and a fire VFX
{ ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(100, nDamageAfterSave, DAMAGE_TYPE_FIRE), oObject);
ActionCastSpellAtObject(SPELL_COMBUST, oObject, METAMAGIC_ANY, TRUE, 0,
PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_FLAME_M), oObject); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_FIREBALL), lTarget);
}
// get the next object in the area of effect oObject = GetNextObjectInShape(SHAPE_SPHERE, 7.0, lTarget, FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_DOOR);
}
}
// On Damaged script for exploding barrel object
void main()
{location lSource = GetLocation(OBJECT_SELF);
object oPC = GetLastHostileActor();
object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
if (GetDamageDealtByType(DAMAGE_TYPE_FIRE) > 0)
{ DelayCommand(0.1, ExplodeAtLocation(lSource, d20(6)));
PlaySound("zep_explosion");
}
else if (GetStringLeft(GetResRef(oWeapon), 4) == "gun_")
{ DelayCommand(0.1, ExplodeAtLocation(lSource, d20(6)));
PlaySound("zep_explosion");
}
else
{
SendMessageToPC(oPC, "You must use fire or a gun");
}
}
Modifié par JerrodAmolyan, 14 août 2013 - 08:40 .