Jump to content

Triggering Killmove in papyrus


Recommended Posts

So this script works on rare instances. (The commented out Debug.SendAnimationEvent(Self, "KillMove1HMDecap")) works every time, but is buggy as all get out. Just results in the head popping off if I hit the NPC anywhere and the body ragdolling like a mad man.

 

So this NPC is essential on purpose so they cant die with the exception to bladed weapons and specifically in a decapitation. I added the wait in there because initially without it, it never worked and I wondered if it required the animation for the attack to end first. After adding the wait the first time I tested it, it worked. The kill move properly executed. But I was dismayed when I tested it a few more times and the NPC just dropped dead with no kill move.

 

So I am not sure if I am missing something to kind of force this to happen, there is clearly a reason it doesn't proc in most situations so Im not sure how to set the stage to ensure it happens. Does the health level matter? or is there a better event other than OnHit I should do this? Im pretty sure something is just interrupting the animation for some reason.

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
  bool abBashAttack, bool abHitBlocked)
  Actor PlayerRef = Game.GetPlayer()
  
  If (Self.GetActorValuePercentage("health") < 10)
      if (akSource.haskeyword(WeapTypeSword) || akSource.haskeyword(WeapTypeGreatSword) || akSource.haskeyword(WeapTypeWarAxe) || akSource.haskeyword(WeapTypeBattleAxe))
          if(Self.IsEssential() == true)
              wait(1) 
              PlayerRef.PlayIdleWithTarget(KillMove, Self)
              ;Debug.SendAnimationEvent(Self, "KillMove1HMDecap")
              Self.GetActorBase().SetEssential(false)             
              Self.KillEssential(PlayerRef)
          endif    
          
      endIf
  endIf
 
EndEvent


			
				


	Edited  by tsdobbi
	
	

			
		
  • Thanks 1
Link to comment
Share on other sites

I got it to work.

 

So I figured it out. I needed to add a wait AFTER the animation. I think before the animation was essentially getting interrupted by the death animation being triggered when the on hit would finish. Tested it about 20 times and it works every time now.

 PlayerRef.PlayIdleWithTarget(KillMove, Self)
 wait(3) 
  • Thanks 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...