Help with refining a script

Post » Sat Aug 17, 2013 5:32 am

Two problems with this and I'm not sure how to fix either of them and I've tried a bunch of stuff now.

The first is the OnHit event notification fires but the target remains in the animation and I suspect it's still restrained as well. Not sure why though, the variable is set to something else when hit so it shouldn't stay in the animation.

The second problem is that if the target is using a spell, the target doesn't go into the animation but it will stay restrained. While it's restrained it will continuously fire concentration spells like flames wherever it was facing and stay in that position. Looks quite funny but I'd like to fix this.

Spoiler
Scriptname AceFearScript extends ActiveMagicEffectActor Property PlayerRef autoKeyword Property ActorTypeNPC autoIdle Property IdleCower auto Float EffectStarted Event OnEffectStart(Actor akTarget, Actor akCaster)	If akTarget.IsHostileToActor(akCaster) && !akTarget.IsDead()		EffectStarted = 1                Utility.Wait(0.2)		While  EffectStarted == 1			akTarget.SetRestrained()			Debug.Notification("We're in the effect") 			Debug.SendAnimationEvent(akTarget,"IdleCowering")		EndWhile 	ElseIf !akTarget.IsHostileToActor(akCaster) && !akTarget.IsDead() 		Debug.Notification("Target is not hostile") 	EndIfendeventEvent OnEffectFinish(Actor akTarget, Actor akCaster)	EffectStarted = 0 	akTarget.SetRestrained(false) 	Debug.SendAnimationEvent(akTarget,"IdleStop")	Debug.Notification("Effect finished")	EndEventEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)	Actor akTarget	EffectStarted = 0	If EffectStarted == 0		Debug.Notification("The spell has been broken")		akTarget.SetRestrained(false)		Debug.SendAnimationEvent(akTarget,"IdleStop")	EndIfEndEvent
User avatar
Logan Greenwood
 
Posts: 3416
Joined: Mon Jul 30, 2007 5:41 pm

Return to V - Skyrim