void DoMindDrain (object oTarget); void main() { int nEvent = GetUserDefinedEventNumber(); if (nEvent == 50) { SpeakString("*The fungus reacts to your presence*"); // Do the spell effect //Declare major variables object oCaster = OBJECT_SELF; effect eExplode = EffectVisualEffect(VFX_FNF_GAS_EXPLOSION_NATURE); effect eEffect = EffectVisualEffect(VFX_IMP_POISON_S); effect eMirv = EffectVisualEffect(VFX_DUR_MIRV_ACID); effect eCessate = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE); effect eConfusion = EffectConfused(); effect eLink=EffectLinkEffects(eCessate,eConfusion); effect eDur=EffectVisualEffect(VFX_DUR_MIND_AFFECTING_DISABLED); eLink=EffectLinkEffects(eDur,eLink); eLink=ExtraordinaryEffect(eLink); float fDelay; float fDist; int nSave; float fDuration; ///Get the spell target location as opposed to the spell target. location lTarget = GetLocation(OBJECT_SELF); //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, 40.0, lTarget, TRUE, OBJECT_TYPE_CREATURE); //Cycle through the targets within the spell shape until an invalid object is captured. while (GetIsObjectValid(oTarget)) { if (!GetIsFriend(oTarget)) { //Fire cast spell at event for the specified target SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_CONFUSION)); // Do the Mirv ApplyEffectToObject(DURATION_TYPE_INSTANT, eMirv, oTarget); //Get the distance between the explosion and the target to calculate delay // * recalculate appropriate distances fDist = GetDistanceBetween(OBJECT_SELF, oTarget); fDelay = fDist/(3.0 * log(fDist) + 2.0); //Adjust the damage based on the Reflex Save, Evasion and Improved Evasion. nSave = FortitudeSave(oTarget,18,SAVING_THROW_TYPE_POISON); //Set the damage effect if(nSave == 0) { // choose a duration fDuration=RoundsToSeconds(d6()+2); // Apply effects to the currently selected target. DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget,fDuration)); //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, eEffect, oTarget)); } // Do mind drain 60 seconds later DelayCommand(60.0, DoMindDrain (oTarget)); } //Select the next target within the spell shape. oTarget = GetNextObjectInShape(SHAPE_SPHERE, 40.0, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE); } } } void DoMindDrain (object oTarget) { effect eEffect = EffectVisualEffect(VFX_IMP_POISON_L); effect eCessate = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE); effect eConfusion = EffectAbilityDecrease(ABILITY_INTELLIGENCE,d4(2)); effect eLink=EffectLinkEffects(eCessate,eConfusion); eLink=ExtraordinaryEffect(eLink); float fDuration; int nSave = FortitudeSave(oTarget,15,SAVING_THROW_TYPE_POISON); //Set the damage effect if(nSave == 0) { FloatingTextStringOnCreature("The spore from the fungus continues to infect you",oTarget); fDuration=TurnsToSeconds(d6()+2); // Apply effects to the currently selected target. ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget,fDuration); //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. ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget); } }