Hi there, I've been experimenting with unique powers and tag-based scripting, checking out what I can do with it for later mods.
Currently I have a something that is supposed to be an AOE damage spell, activated by an item tagged "spellstorm". However, it isn't firing; when I attempt to use it in my testing mod, nothing happens. Strangely, when I then pick up or drop the item that activates my other test power (a single-damage spell), THAT spell fires on the object I tried to use Spellstorm on.
So I tried Spellstorm on a crate, nothing happens, I pick up the wand of Slaying, and suddenly the Slaying spell triggers on the crate.
The script names are identical to the corresponding item's tag, and I for sure have tag-based scripting set up in the test mod. I have both items activated through the Activate Item (Long Range) spell due to, well, the extra range. Here's the code of the Spellstorm spell:
// SPELLSTORM - Artifact Power
//
// Creates a colossal explosion of magical energy
// Deals 2d4/level magical damage to all targets
// Minimum 30d4 damage / Maximum damage 50d4
// Knockdown for 3 seconds, no saving throw, immunity applies
// Fortitude Save DC48 to avoid being Stunned for 2 rounds
//
void main()
{
object oTarget;
object oPC = GetItemActivator();
effect eDamage;
location lTarget = GetItemActivatedTargetLocation();
// Limit level range to between 15-25
// Multiply by 2 to conform with damage formula
int nLevel = GetHitDice(oPC)*2;
if (nLevel < 30)
{ nLevel = 30; }
else if (nLevel > 50)
{ nLevel = 50; }
// Great Thunderclap VFX at target location
ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_MYSTICAL_EXPLOSION),lTarget);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_ELECTRIC_EXPLOSION),lTarget);
// Large sphere radius, LOS not required, targets creatures placeables and doors
oTarget = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_COLOSSAL,lTarget,FALSE,OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
while (GetIsObjectValid(oTarget))
{
if(GetIsEnemy(oTarget,oPC) == TRUE && oTarget != oPC)
{
// 2d4 Magical damage per caster level, minimum 30d4, maximum 50d4. Bypasses resistances and immunities
eDamage = EffectDamage(d4(nLevel),DAMAGE_TYPE_MAGICAL,DAMAGE_POWER_ENERGY);
// Knocks down targets for 3 seconds unless immune, similar to Hellball
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oTarget, 3.0f);
// Fortitude Save DC 48 to avoid being Stunned for 2 rounds
if (FortitudeSave(oTarget, 48, SAVING_THROW_TYPE_SPELL, OBJECT_SELF) == 0)
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectStunned(), oTarget, RoundsToSeconds(2));
}
// Power Word Stun VFX on each target
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_PWSTUN), oTarget);
// Apply damage
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget);
// Cycle to next target
oTarget = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_COLOSSAL,lTarget,FALSE,OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
}
}
}
I don't know what the problem is (being a newbie to NWN scripting though not programming)... Could anyone shed some light on the issue?
======= EDIT ========
Okay, for some reason the script decided to just start working. Hooray
'>
I have one more issue though: how do I make it so the spell shows the player how much damage was done to each target? As it is now, the damage is never shown... (and was only shown when it hits the player)
Modifié par Tyreska, 21 février 2011 - 05:03 .