////:://////////////////////////////////////////////// //:: Custom User Defined Event //:: FileName //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* */ //::////////////////////////////////////////////// //:: Created By: //:: Created On: //::////////////////////////////////////////////// #include "NW_I0_GENERIC" #include "NW_I0_SPELLS" #include "jw_privates_inc" #include "prc_inc_spells" void JumpToWeakestEnemy(object oTarget) { SetVictim(OBJECT_INVALID); object oTargetVictim = ChooseTarget(); // * won't jump if closer than 4 meters to victim if ((GetDistanceToObject(oTargetVictim) > 4.0) && (GetObjectSeen(oTargetVictim) == TRUE)) { ClearAllActions(); effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD); ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF); // SpeakString("Jump to " + GetName(oTargetVictim)); DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF)); DelayCommand(0.3,ActionJumpToObject(oTargetVictim)); DelayCommand(0.5,ActionAttack(oTargetVictim)); } } void main() { ExecuteScript("prc_npc_userdef", OBJECT_SELF); int nUser = GetUserDefinedEventNumber(); if(nUser == 1001) //HEARTBEAT { } else if(nUser == 1002) // PERCEIVE { } // * During Combat try teleporting around else if (GetUserDefinedEventNumber() == 1003) { // * if random OR heavily wounded then teleport to next enemy if ((Random(100) < 80)) { JumpToWeakestEnemy(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY)); } } else if(nUser == 1004) // ON DIALOGUE { } else if(nUser == 1005) // ATTACKED { } else if(nUser == 1006) // DAMAGED { } else if(nUser == 1007) // DEATH { //Declare major variables object oCaster = OBJECT_SELF; int nMetaMagic = PRCGetMetaMagicFeat(); int nDamage; float fDelay; location llocation = GetLocation(OBJECT_SELF); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_PULSE_COLD), llocation); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_FROST_L), llocation); effect eVis = EffectVisualEffect(VFX_IMP_FROST_S); effect eDam; //Get the spell target location as opposed to the spell target. location lTarget = GetLocation(OBJECT_SELF); //Limit Caster level for the purposes of damage //Apply the fireball explosion at the location captured above. ///Declare the spell shape, size and the location. Capture the first target object in the shape. object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR); //Cycle through the targets within the spell shape until an invalid object is captured. while (GetIsObjectValid(oTarget)) { if(GetIsReactionTypeHostile(oTarget)) { //Fire cast spell at event for the specified target SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_ICE_STORM)); //Get the distance between the explosion and the target to calculate delay fDelay = GetDistanceBetweenLocations(lTarget, GetLocation(oTarget))/20; if (!PRCDoResistSpell(OBJECT_SELF, oTarget, FloatToInt(fDelay))) { //Adjust the damage based on the Reflex Save, Evasion and Improved Evasion. nDamage = PRCGetReflexAdjustedDamage(d4(2), oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_COLD); //Set the damage effect eDam = EffectDamage(nDamage, DAMAGE_TYPE_COLD); 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)); } } } //Select the next target within the spell shape. oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR); } } else if(nUser == 1008) // DISTURBED { } }