abPreventRemoval

Post » Thu Oct 31, 2013 8:48 pm

So I'm trying to improve my "silence" effect script. Originally, it worked by repeatedly casting InterruptCast() on a target. However this causes the AI to derp; they keep trying to cast spells instead of taking out their weapons to attack. So to compensate, I'm trying to force them to equip their weapons using abPreventRemoval in EquipItem or EquipItemEx to well, try to prevent them from removing their weapon. The parameter doesn't seem to work at all though. Actors will briefly equip their fists but then take their spells out afterwards.

I tried a simple EquipItem(Unarmed, true) on non spell casting targets and get the same results: the target will briefly equip their fists, but then go back to using their weapon. I don't believe its directly related to the fists weapon, as I also forced an NPC to wield a dagger in their inventory and got similar results.

Has anyone gotten this parameter to work for NPCs?

Also, for the silence effect, I don't set their magicka to 0, as this prevents magicka draining effects (lightning or similar effects) to not actually take effect. I also don't want to change the actors combat style, as that's an actorbase function and will affect anyone sharing the same actorbase (although this situation may be unlikely). But, I'd still like a way to stop NPCs from derping when silenced... :/

User avatar
Emily Shackleton
 
Posts: 3535
Joined: Sun Feb 11, 2007 12:36 am

Post » Thu Oct 31, 2013 2:16 pm

I have been planning to make a silence effect myself for an enchantment soon, and was just going to go with the 0 magicka strategy, but you raise a good point about draining spells.

Hmm. Can't really think of any other methods off the top of my head that could achieve a silence effect besides what you've mentioned. If the abPreventRemoval or a similar strategy wont work, perhaps you could set magicka to zero, and then also have an OnHit() event that checks for magicka draining magic effects on any incoming spells or enchantments (using getNthEffectMagicEffect() and getNthEffectMagnitude()), and if it finds them, then it could add magicka to the attacker? This might not account for modded spells that use their own MGEFs, of course, but it could perhaps serve as a halfway-decent workaround.

User avatar
Shae Munro
 
Posts: 3443
Joined: Fri Feb 23, 2007 11:32 am


Return to V - Skyrim