Onhit event : Bool return always False

Post » Thu Jun 21, 2012 11:01 pm

I just want know if player use a powered attack on an object

I use Onhit event but Power attack bool is always false, it's normal?

The script



Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)

debug.messagebox(abPowerAttack)

endvent

User avatar
Peetay
 
Posts: 3303
Joined: Sun Jul 22, 2007 10:33 am

Post » Thu Jun 21, 2012 6:25 pm

anyone know?
User avatar
Big Homie
 
Posts: 3479
Joined: Sun Sep 16, 2007 3:31 pm

Post » Thu Jun 21, 2012 7:55 pm

Did you put this script on the Object that player is striking?
If you put this script on Player, it won't work as you wanted.

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)if(abPowerAttack && akAggressor == player)  debug.Notification("Player used power attack")endifendvent
User avatar
Meghan Terry
 
Posts: 3414
Joined: Sun Aug 12, 2007 11:53 am

Post » Thu Jun 21, 2012 2:44 pm

Yes i put it on the object

( You can take a look on MERP forum, wall spike topic )
User avatar
Kay O'Hara
 
Posts: 3366
Joined: Sun Jan 14, 2007 8:04 pm

Post » Thu Jun 21, 2012 11:07 pm

Yes i put it on the object

( You can take a look on MERP forum, wall spike topic )

Oh, I saw it on MERP forum, but it was 'Finished' so I didn't read carefully, sorry :P
Kinda cool to see horses got pieced when running into spikes
Let me do some quick test tomorrow morning, and I will get right back to you
User avatar
Tinkerbells
 
Posts: 3432
Joined: Sat Jun 24, 2006 10:22 pm

Post » Thu Jun 21, 2012 11:22 pm

The abPowerAttack does work on Actor alone.
When I tried to run the script on Object, it will not detect power attack.

There might be a work around, something like this:

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)if(akAggressor == player)  RegisterForAnimationEvent(player, "PowerAttackStop")endifendventEvent OnAnimationEvent(ObjectReference akSource, string asEventName)if(akSource== player && asEventName == "PowerAttackStop" )  UnRegisterForAnimationEvent(player, "PowerAttackStop")  ;;; Player just used power attack delivered from OnHit eventendifEndEvent

The logic is:
- You get the attack event from onhit
- Check if the PowerAttackStop is fired afterward, this usually happens about 2-4 frames after the strikes
- If PowerAttackStop is fired, deduct addition hitpoint from the spikes
- If the attack already destroy the spikes, let it be :P
User avatar
Krystal Wilson
 
Posts: 3450
Joined: Wed Jan 17, 2007 9:40 am

Post » Thu Jun 21, 2012 10:34 am

Thanks you
User avatar
Rozlyn Robinson
 
Posts: 3528
Joined: Wed Jun 21, 2006 1:25 am


Return to V - Skyrim