Begin AI_Attack Short HasSpell Float HasWeaponDrawn Float HasHealth Float Timer long AIRef ;change the variables to whatever you want long tmp ifx ( AIRef ) setx AIRef to xNextRef AIRef ;finds the next NPC or creature in the cell else setx AIRef to xFirstNPC ;finds the first NPC or creature in the cell endif if ( AIRef == 0 ) ;end of list or empty cell return endif setx tmp to AIRef->xRefType if ( tmp != 1598246990 ) ;if not type NPC if ( tmp != 1095062083 ) ;if not type Creature return endif endif xSetRef AIRef set HasSpell to ( Getspell, "Ai Realistic Striking" ) If ( HasSpell != 1 ) if ( MenuMode == 0 ) AIRef->Addspell, "Ai Realistic Striking" elseif ( MenuMode == 1 ); AIRef->Removespell, "Ai Realistic Striking" endif endifend
It gets the job done, however it makes Morrowind crash nearly every time you try to re-load a game with the mod enabled if this script was running when saving. Does anyone know of a method to prevent the crashing yet still have the script add that spell to all NPCs and Creatures near the player?