Initial upload
Initial upload. PRC8 has been added. Module compiles, PRC's default AI & treasure scripts have been integrated. Started work on top hak for SLA / Ability / Scripting modifications.
This commit is contained in:
101
_module/nss/gz_pkeg_detonate.nss
Normal file
101
_module/nss/gz_pkeg_detonate.nss
Normal file
@@ -0,0 +1,101 @@
|
||||
#include "NW_I0_SPELLS"
|
||||
void main()
|
||||
{
|
||||
if (GetLocalInt(OBJECT_SELF,"GZ_OBJECT_DETONATING") == TRUE)
|
||||
return; // prevent recursions
|
||||
int nArmed=GetLocalInt(OBJECT_SELF,"armed");
|
||||
SetLocalInt(OBJECT_SELF,"GZ_OBJECT_DETONATING",TRUE);
|
||||
location lLoc = GetLocation(OBJECT_SELF);
|
||||
ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SCREEN_SHAKE),lLoc);
|
||||
ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SCREEN_BUMP),lLoc);
|
||||
effect eBoom = EffectVisualEffect(VFX_FNF_FIREBALL,FALSE);
|
||||
ApplyEffectAtLocation(DURATION_TYPE_INSTANT,eBoom, lLoc);
|
||||
effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M);
|
||||
effect eDam;
|
||||
float fDelay;
|
||||
float fDistance;
|
||||
int nDamage;
|
||||
int nKDC = 20;
|
||||
effect eFall = EffectKnockdown();
|
||||
//From here we use a modified version of Noel Borstad's fireball script
|
||||
effect eDest = EffectDeath();
|
||||
DelayCommand(0.3f,ApplyEffectToObject(DURATION_TYPE_INSTANT,eDest,OBJECT_SELF));
|
||||
PlaySound("sim_explsun");
|
||||
//Declare the spell shape, size and the location. Capture the first target object in the shape.
|
||||
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, 10.0, lLoc, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
|
||||
//Cycle through the targets within the spell shape until an invalid object is captured.
|
||||
|
||||
while (GetIsObjectValid(oTarget))
|
||||
{
|
||||
|
||||
|
||||
if (GetTag(oTarget)=="jw_blowsup")
|
||||
{
|
||||
SetPlotFlag(oTarget,FALSE);
|
||||
fDelay = GetDistanceBetweenLocations(lLoc, GetLocation(oTarget))/20;
|
||||
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
|
||||
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(TRUE), oTarget));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!GetPlotFlag(oTarget))
|
||||
{
|
||||
//Fire cast spell at event for the specified target
|
||||
//SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_FIREBALL));
|
||||
//Get the distance between the explosion and the target to calculate delay
|
||||
fDelay = GetDistanceBetweenLocations(lLoc, GetLocation(oTarget))/20;
|
||||
fDistance=GetDistanceBetweenLocations(lLoc, GetLocation(oTarget));
|
||||
if (fDistance<1.0)
|
||||
{
|
||||
fDistance=1.0;
|
||||
}
|
||||
//Roll damage for each target, but doors are always killed
|
||||
if (GetObjectType(oTarget) == OBJECT_TYPE_DOOR)
|
||||
{
|
||||
nDamage = GetCurrentHitPoints(oTarget)+1;
|
||||
}
|
||||
else
|
||||
if (GetTag(oTarget) =="gz_obj_pkeg")
|
||||
{
|
||||
nDamage = d6(2); // lower chance to destroy other powerderkeg
|
||||
// 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));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
nDamage = (d6(3)*nArmed)+5;
|
||||
nDamage=nDamage/FloatToInt(fDistance);
|
||||
//Adjust the damage based on the Reflex Save, Evasion and Improved Evasion.
|
||||
nDamage = GetReflexAdjustedDamage(nDamage, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_FIRE);
|
||||
//Set the damage effect
|
||||
eDam = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
|
||||
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));
|
||||
}
|
||||
if (fDistance<5.0)
|
||||
{
|
||||
if(FortitudeSave(oTarget,nKDC,SAVING_THROW_FORT)==0)
|
||||
{
|
||||
//Apply the VFX impact and effects
|
||||
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFall, oTarget, RoundsToSeconds(1)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Select the next target within the spell shape.
|
||||
}
|
||||
oTarget = GetNextObjectInShape(SHAPE_SPHERE, 10.0, lLoc, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user