long refID ;call it anything you like, this is a string that is set to whatever creatures/npcs you want later in the scriptlong tmp ;temporary/junk refsetx refID to xGetRef "creature_or_npc_ID"set tmp to xGetCombat refIDif ( tmp ) ;combat is detected refID->AddSpell "spell_ID"else ;not in combat refID->RemoveSpell "spell_ID"endif;continue to do this for all your creatures/npcs
long npcRef ;change the variables to whatever you wantlong tmpifx ( npcRef ) setx npcRef to xNextRef npcRef ;finds the next NPC or creature in the cellelse setx npcRef to xFirstNPC ;finds the first NPC or creature in the cellendifif ( npcRef == 0 ) ;end of list or empty cell returnendifsetx tmp to npcRef->xRefTypeif ( tmp != 1598246990 ) ;if not type NPC if ( tmp != 1095062083 ) ;if not type Creature return endifendif;now do something like I wrote above to add and remove spells. You'll have to use those numbers again to check if it's an npc or creature