How to run a spell on all npcs after loading?

Post » Sun Jan 20, 2013 12:30 pm

I need help for my little spell script that should reset all npcs that have the spell attached after loading the savegame.
The spell should only performed once. It is needed to fix some behavior of my mod Realistic Body System.

here is the papyrus script i made, it starts if a cell is entered:

Scriptname RBSCorrectNPCs extends activemagiceffectfunction resetWeight(actor target)if (target.IsDead()== false)  Utility.SetINIBool("bUseFaceGenPreprocessedHeads:General", false)  target.SetDontMove(true)  target.QueueNiNodeUpdate()  target.Resurrect()  target.SetAllowFlying(false)  target.SetDontMove(false)  Utility.SetINIBool("bUseFaceGenPreprocessedHeads:General", true)endifendFunctionEvent OnEffectStart(Actor akTarget, Actor akCaster)float random = Utility.RandomFloat(0.5, 4.0)Utility.Wait(random)resetWeight(akTarget)EndEvent

It works, but if a reenter a cell it is performed again. An even better way would be that it will be perfomed without beeing in cell, but i guess that is not possible, right?
So i need to be sure that the script is only performed once per npc.
User avatar
Leanne Molloy
 
Posts: 3342
Joined: Sat Sep 02, 2006 1:09 am

Return to V - Skyrim