Hello again
I need help with this spell I am working on. I almost have it…I think
The spell is:
Prismatic Sphere
Caster Level(s): Wiz / Sor 9
Innate Level: 9
School: Abjuration
Descriptor(s): None
Component(s): Verbal, Somatic
Range: Personal
Area of Effect / Target: Self (with effects on the first attacker)
Duration: 1 round / level or until discharged
Additional Counter Spells: Dispel Magic
Save: Reflex partial, Fortitude partial, Will partial (varies by effect)
Spell Resistance: Yes
Description:
Prismatic Sphere surrounds the caster with a radiant multicolored sphere of defensive energy, which unleashes devastating effects on the first creature to successfully strike the caster.
These effects occur in the following sequence:
-
Blinding Light: Creatures with fewer than 8 Hit Dice must succeed on a Reflex save (DC 20) or be blinded for 10 rounds.
-
Elemental Fury: Creatures that attack you must make a Fortitude save (DC 20) or take 1d10 points of damage from each of the following damage types: acid, fire, cold, electrical, sonic, divine, positive, negative, piercing, slashing, and bludgeoning.
-
Instant Death: Creatures must succeed on a Will save (DC 20) or die instantly.
-
Wyvern Poison: On a failed Fortitude save (DC 20), attackers are afflicted with Wyvern Poison, dealing 1d6 Strength damage per round for 6 rounds or until cured.
-
Confusion: Creatures that fail a Will save (DC 20) become confused for 2d10 rounds.
-
Petrification: Creatures must succeed on a Reflex save (DC 20) or be permanently turned to stone.
The sphere dissipates after the first attack, releasing its stored energy.
This spell does not block physical attacks or magic, but its retaliatory effects serve as a potent deterrent to those who dare attack the caster.
Script below that won’t compile:
// Prismatic Sphere
#include "nw_i0_spells"
// VFX Constants for Ion Stones and Globe of Invulnerability
const int VFX_ION_STONE_1;
const int VFX_ION_STONE_2;
const int VFX_ION_STONE_3;
const int VFX_ION_STONE_4;
const int VFX_GLOBE_INVULNERABILITY;
// Forward declaration of helper functions
void ApplyPrismaticSphereEffects(object oAttacker);
void RemovePrismaticSphereVFX(object oCaster);
void Main()
{
object oCaster = OBJECT_SELF;
// Spell duration: 1 turn per caster level (10 rounds per level)
float fDuration = 60.0 * GetCasterLevel(oCaster);
// Apply visual effects to represent the sphere (Ion Stones and Globe of Invulnerability)
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_ION_STONE_1), oCaster, fDuration);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_ION_STONE_2), oCaster, fDuration);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_ION_STONE_3), oCaster, fDuration);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_ION_STONE_4), oCaster, fDuration);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_GLOBE_INVULNERABILITY), oCaster, fDuration);
// Apply a damage shield with 0 damage to detect hits
effect eShield = EffectDamageShield(0, DAMAGE_TYPE_MAGICAL);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eShield, oCaster, fDuration);
// Set up a signal for active sphere
SetLocalInt(oCaster, "PRISMATIC_SPHERE_ACTIVE", TRUE);
// Cleanup the spell effects after the duration
DelayCommand(fDuration, RemoveEffect(oCaster, EffectVisualEffect(VFX_ION_STONE_1)));
DelayCommand(fDuration, RemoveEffect(oCaster, EffectVisualEffect(VFX_ION_STONE_2)));
DelayCommand(fDuration, RemoveEffect(oCaster, EffectVisualEffect(VFX_ION_STONE_3)));
DelayCommand(fDuration, RemoveEffect(oCaster, EffectVisualEffect(VFX_ION_STONE_4)));
DelayCommand(fDuration, RemoveEffect(oCaster, EffectVisualEffect(VFX_GLOBE_INVULNERABILITY)));
DelayCommand(fDuration, RemoveEffect(oCaster, EffectDamageShield(0, DAMAGE_TYPE_MAGICAL)));
// Set the spell as inactive
DelayCommand(fDuration, SetLocalInt(oCaster, "PRISMATIC_SPHERE_ACTIVE", FALSE));
}
void ApplyPrismaticSphereEffects(object oAttacker)
{
// Effect 1: Blind creatures under 8 HD
if (GetHitDice(oAttacker) < 8)
{
if (!MySavingThrow(SAVING_THROW_FORT, oAttacker, 20))
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectBlindness(), oAttacker, RoundsToSeconds(10));
}
}
// Effect 2: Take 1d10 of all damage types
if (!MySavingThrow(SAVING_THROW_FORT, oAttacker, 20))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(d10(), DAMAGE_TYPE_ACID), oAttacker);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(d10(), DAMAGE_TYPE_FIRE), oAttacker);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(d10(), DAMAGE_TYPE_BLUDGEONING), oAttacker);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(d10(), DAMAGE_TYPE_PIERCING), oAttacker);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(d10(), DAMAGE_TYPE_SLASHING), oAttacker);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(d10(), DAMAGE_TYPE_COLD), oAttacker);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(d10(), DAMAGE_TYPE_ELECTRICAL), oAttacker);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(d10(), DAMAGE_TYPE_DIVINE), oAttacker);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(d10(), DAMAGE_TYPE_NEGATIVE), oAttacker);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(d10(), DAMAGE_TYPE_POSITIVE), oAttacker);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(d10(), DAMAGE_TYPE_SONIC), oAttacker);
}
// Effect 3: Will save or die
if (!MySavingThrow(SAVING_THROW_WILL, oAttacker, 20))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oAttacker);
}
// Effect 4: Fortitude save or be poisoned (Wyvern Poison)
if (!MySavingThrow(SAVING_THROW_FORT, oAttacker, 20))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectPoison(POISON_WYVERN_POISON), oAttacker);
}
// Effect 5: Will save or be confused for 2d10 rounds
if (!MySavingThrow(SAVING_THROW_WILL, oAttacker, 20))
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectConfused(), oAttacker, RoundsToSeconds(Random(10) + 2));
}
// Effect 6: Reflex save or be petrified
if (!MySavingThrow(SAVING_THROW_REFLEX, oAttacker, 20))
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectPetrify(), oAttacker);
}
}
void OnPhysicalAttacked()
{
object oAttacker = GetLastDamager();
object oCaster = OBJECT_SELF;
// Check if the sphere is active
if (GetLocalInt(oCaster, "PRISMATIC_SPHERE_ACTIVE"))
{
// Apply all effects to the attacker
ApplyPrismaticSphereEffects(oAttacker);
// Deactivate the sphere
SetLocalInt(oCaster, "PRISMATIC_SPHERE_ACTIVE", FALSE);
}
}