Jump to content

OnHit Event delay , unknown reason .


SugarSteak

Recommended Posts

Holle Guys , poor English hope you don't mind . :pinch:

 

Situation description :

For my a combat MOD http://www.nexusmods.com/skyrim/mods/58717 , I am making a new version .
When I am during the test, I found the OnHit Event script on NPC appeared about one or two seconds delay for no reason, but it will be run immediately without delay on the player.

 

The part of related delay code :

  Quote

 

Event OnEffectStart(Actor akTarget, Actor akCaster)
PlayerRef = Game.GetPlayer()
HitTarget = akTarget
RegisterForSingleUpdate(1.0)
RegisterForAnimationEvent(HitTarget,"StaggerStart")
RegisterForAnimationEvent(HitTarget,"StaggerStop")
RegisterForAnimationEvent(HitTarget,"WeaponSwing")
RegisterForAnimationEvent(HitTarget,"AttackStop")
EndEvent
  Quote
;These are the delay code
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If !(akSource as Spell || akSource as Explosion || akSource as Ingredient || akSource as Potion || akSource as Enchantment )
If HitTarget.IsDead()==false
Debug.SendAnimationEvent(HitTarget,"AttackStop")
Debug.SendAnimationEvent(HitTarget,"BlockStop")
Debug.SendAnimationEvent(HitTarget,"StaggerStart")
EndIf
EndIf
EndEvent

 

A part of log show:

  Quote

 

[None]._CM_OnHitScript.OnEffectFinish() - "_CM_OnHitScript.psc" Line ?

[01/11/2015 - 02:17:01AM] Error: Unable to call RegisterForSingleUpdate - no native object bound to the script object, or object is of incorrect type
stack:
[None]._CM_OnHitScript.RegisterForSingleUpdate() - "<native>" Line ?
[None]._CM_OnHitScript.OnEffectStart() - "_CM_OnHitScript.psc" Line ?
[01/11/2015 - 02:17:01AM] Error: Unable to call RegisterForAnimationEvent - no native object bound to the script object, or object is of incorrect type
stack:
[None]._CM_OnHitScript.RegisterForAnimationEvent() - "<native>" Line ?
[None]._CM_OnHitScript.OnEffectStart() - "_CM_OnHitScript.psc" Line ?
[01/11/2015 - 02:17:01AM] warning: Assigning None to a non-object variable named "::temp7"
stack:
[None]._CM_OnHitScript.OnEffectStart() - "_CM_OnHitScript.psc" Line ?
[01/11/2015 - 02:17:01AM] Error: Unable to call RegisterForAnimationEvent - no native object bound to the script object, or object is of incorrect type

These error repeated a lots , don't know if these error is the reason for the delay, or perhaps it's just another sign of real causes of delay? Or they are not related ?

 

 

And, In the old version (1.42), there is a almost same script , but no this bug . :confused:

What's the problem >_<

 

 

PS: I can't upload my script , how to do it ?

Edited by SugarSteak
Link to comment
Share on other sites

  Quote

 

 

PS: I can't upload my script , how to do it ?

Copy paste the script code rather than upload it.

 

Use the following, remove the hyphens before posting.

 

[-spoiler]

[-code]

*paste script code here*

[/code-]

[/spoiler-]

 

Should look like the following:

 

  Reveal hidden contents

Edited by IsharaMeradin
Link to comment
Share on other sites

	@IsharaMeradin	 

  Reveal hidden contents

 

Link to comment
Share on other sites

Event OnEffectStart(Actor akTarget, Actor akCaster)

PlayerRef = Game.GetPlayer()
HitTarget = akTarget
Attacker = akTarget
TargetMass = HitTarget.GetActorValue("mass")
BlockSkill = HitTarget.GetActorValue("Block") as Int
GotoState("InitBaseBlockValue")

 

I'm a little confused as to why your HitTarget and the Attacker are both defined as the akTarget. If they are both the same actor, why do you need to define both? Should Attacker=akCaster? I'm pretty new at this; that's why I'm asking.

Link to comment
Share on other sites

wouldn't you want it as

akTarget.RegisterForAnimationEvent(HitTarget,"StaggerStart")
akTarget.RegisterForAnimationEvent(HitTarget,"StaggerStop")
akTarget.RegisterForAnimationEvent(HitTarget,"WeaponSwing")
akTarget.RegisterForAnimationEvent(HitTarget,"AttackStop")
As that is the person you want to have the animation happen to?
I also am somewhat unfamiliar with animation events so I also could be full of crap
Link to comment
Share on other sites

  On 1/16/2015 at 1:55 AM, ThreeTen said:

 

wouldn't you want it as

akTarget.RegisterForAnimationEvent(HitTarget,"StaggerStart")
akTarget.RegisterForAnimationEvent(HitTarget,"StaggerStop")
akTarget.RegisterForAnimationEvent(HitTarget,"WeaponSwing")
akTarget.RegisterForAnimationEvent(HitTarget,"AttackStop")
As that is the person you want to have the animation happen to?
I also am somewhat unfamiliar with animation events so I also could be full of crap

 

 

look here

http://www.creationkit.com/RegisterForAnimationEvent_-_Form

Link to comment
Share on other sites

Lucky, I fix the delay.
It's not the OnHit script caused, Just my a mistake in apply the OnHit script to NPCs .

  Reveal hidden contents

 

 

 

 

:laugh: Thanks for guys' help

Link to comment
Share on other sites

  On 1/14/2015 at 8:37 PM, elezraita said:

Event OnEffectStart(Actor akTarget, Actor akCaster)

 

PlayerRef = Game.GetPlayer()

HitTarget = akTarget

Attacker = akTarget

TargetMass = HitTarget.GetActorValue("mass")

BlockSkill = HitTarget.GetActorValue("Block") as Int

GotoState("InitBaseBlockValue")

 

I'm a little confused as to why your HitTarget and the Attacker are both defined as the akTarget. If they are both the same actor, why do you need to define both? Should Attacker=akCaster? I'm pretty new at this; that's why I'm asking.

Because this script is not only for HIt Event ,but also for dodge 、block etc, in order to I avoid confuse them, I call them different name .

Link to comment
Share on other sites

  • Recently Browsing   0 members

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