Thank you for posting, much appreciated. After considering the suggestions and experimenting the following workaround works though I hate scripting it.
When I want the fool toon to use his melee weapons I use a script that extends Actor ont he toon to remove all his spells. When i want him to use spells i add them back. One thing I learned: the toon CANNOT start life with the spell already assigned. If he does, he will cast the spell EVEN IF REMOVED. So it must be added during the fight.
Do you know what is a pain though?? I am using the On Hit event on the toon to add or remove spells. So when he gets hit he loses his spells. When he gets hit again he gains them back. See the problem? In a melee fight he will be gaining them and losing them every second. Not good.
So I had to write a script. See below. When the fool is hit, he will be given the spell. a random time is picked , and when expired and hit again, he will lose the spell. a random time is picked again, and after that time if hit he will regain the spell. The logic being that if he is still getting hit he needs to try something else. But he will not just toggle back on forth on every hit.
But this script can be further enhanced with other events, such as IsUnconscious, IsAlarmed, IsAlerted, IsBleedingOut, IsInCombat, IsSprinting, IsRunning, IsSwimming. And then different spells or weapons given or taken depending on what the status are. On Hit will also let me check any attribute so if fool is half low on health I can select a different spell to use, or weapon, or scripted summon. See/ But more work that I was counting on.
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, \ Bool abBashAttack, Bool abHitBlocked) If cool == 1 If Self.HasSpell(DKDeathCoilSpellUnholy07) Self.RemoveSpell(DKDeathCoilSpellUnholy07) Debug.Notification("Removed!") cool = 5 RegisterForSingleUpdate(Utility.RandomInt(30, 90)) EndIf EndIf If cool == 0 If !Self.HasSpell(DKDeathCoilSpellUnholy07) Self.AddSpell(DKDeathCoilSpellUnholy07) Debug.Notification("Added!") cool = 6 RegisterForSingleUpdate(Utility.RandomInt(30, 90)) EndIf EndIf EndEventEvent OnUpdate() If cool == 5 ;self.addspell(DKDeathCoilSpellUnholy07) Debug.Notification("Added!") cool = 0 EndIf If cool == 6 ;self.removespell(DKDeathCoilSpellUnholy07) Debug.Notification("Removed!") cool = 1 EndIf EndEvent