Jump to content

Using bumping idles as hit reactions


MRWalther

Recommended Posts

Hello readers!

 

I'd like, as title says, to use bumping idles (the ones played when you sprint into another NPC) as hit reactions during combat. So I wrote a script placed in a constant effect ability :

scriptname OnHitRecoilScript extends activemagiceffect  

Actor selfActor
Actor attacker
float headingAngle

Idle Property BumpedFromFront auto
Idle Property BumpedFromLeft auto
Idle Property BumpedFromRight auto
Idle Property BumpedFromBack auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	selfActor = akTarget
EndEvent

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
	attacker = akAggressor as actor
	headingAngle = selfActor.GetHeadingAngle(attacker as objectreference)
        if !abHitBlocked
	     if headingAngle <= 45 && headingAngle >= -45
		     selfActor.PlayIdle(BumpedFromFront)
	     elseif headingAngle < -45 && headingAngle > -135
		     selfActor.PlayIdle(BumpedFromLeft)
	     elseif headingAngle > 45 && headingAngle < 135
		     selfActor.PlayIdle(BumpedFromRight)
	     elseif headingAngle <= -135 || headingAngle >= 135
		     selfActor.PlayIdle(BumpedFromBack)
	     endif
        endif
EndEvent

But the idles don't play. It works with recoil and stagger idles, but not the bumping ones. I've dug a little bit in the idle animations interface: bumping idles have conditions refering to GetLastBumpDirection, so I suppose it's too much restrictive for them to be played simply during a OnHit event. But I also suppose I can't just remove them, otherwise "normal" bumping will be affected.

 

Is there something I'm missing? Will achieving that require to mess with behavior files :sad: ?

Edited by MR.Walther
Link to comment
Share on other sites

You can define your own Idle in the CK, ommiting those conditions. They are probably set meaningful only for NPCs, because the AnimEvents used for the idles are all called "NPC_BumpeFromxxx".

 

But you don't even need the idle definition. Simply call for example Debug.SendAnimationEvent(<actor>, "NPC_BumpedFromRight"). That's equivalent to PlayIdle("BumpedFromRight") without any condition.

Link to comment
Share on other sites

  • 4 months later...

Sorry for the necro, but i've been searching for quite some time for this kind of modification

 

since I'm a noob at using scripts though, could you guys help me in understanding a couple of things:

 

 

1.) For example I want to apply that script on the player, what do I need to do? After spending time on google, I found you can create a perk that can have a constant effect ability spell, which I think is the script mentioned above. Can I use that as a means to implement it for the player?

 

2.) The event specified above is for the hit event; does this also include the stagger event or is it a seperate event altogether??

 

Thanks for any info you guys could give in advance, and again apologies for the necro and the noob questions =/

 

PS: sorry for the triple post, my internet connection was being a retard

Link to comment
Share on other sites

  • Recently Browsing   0 members

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