DMC500 Posted January 2, 2018 Posted January 2, 2018 Hi, I'm trying to create spell, that acts like flames. But instead of dealing damage i want this spell to increase some value (like stacking debuffs) and when it reaches certain number NPC will die(for example). In Oblivion it could be done by adding unplayable misc items to npc's inventory, so how can this thing could be achieved in Skyrim? Is there any way to create variable that could be added to any npc but every npc would have their own value of that variable (like arousal level for example)?
Teutonic Posted January 3, 2018 Posted January 3, 2018 How about this? Quote Scriptname SomeSpellScript extends ActiveMagicEffect Event OnEffectStart(Actor akTarget, Actor akCaster) SpellTarget = akTarget Threshhold = 10 ;You can use a different value of course or a variable, like an MCM setting RegisterForSingleUpdate(1.0) EndEvent Event OnUpdate() SomeVariable += 1 ;The math could also be more elaborate than just adding 1, e.g. you could take magic resistance into account If (SomeVariable >= Threshhold) SpellTarget.Kill() EndIf RegisterForSingleUpdate(1.0) EndEvent Actor SpellTarget Int Threshhold Int SomeVariable = 0 This will create a seperate instance for each actor and automatically unregister (and reset the counter) when the effect ends. If you want the counter to persist between casts, you can for example use a faction. Quote Scriptname SomeSpellScript02 extends ActiveMagicEffect Event OnEffectStart(Actor akTarget, Actor akCaster) SpellTarget = akTarget Threshhold = 10 SpellTarget.AddToFaction(SomeFaction) RegisterForSingleUpdate(1.0) EndEvent Event OnUpdate() SpellTarget.ModFactionRank(SomeFaction, 1) If (SpellTarget.GetFactionRank(SomeFaction) >= Threshhold) SpellTarget.RemoveFromFaction(SomeFaction) ;Not sure if dead actors will remain in there, better be safe than sorry. SpellTarget.Kill() EndIf RegisterForSingleUpdate(1.0) EndEvent Actor SpellTarget Int Threshhold Faction Property SomeFaction Auto Alternatively, you could use StorageUtil. Or a thousand other things, probably. I didn't test these, but they compile and should work just fine.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.