Jump to content

Recommended Posts

Posted

Hi guys,

 

I'm trying to create an ActiveMagicEffect where whenever the player mounts on a horse, some stats change. I'm having trouble getting my mod to recognize when the player is using a horse.

 

Here is my attempt so far. The player successfully acquires the spell and is registered for some animation, but when I hop on a horse, nothing happens. I've tried with other animations, such as sprinting, but it seems to never pickup the OnAnimationEvent. I feel that I may be completely off or going about this the wrong way. Any help?

 

ScriptName HLMSpellScript extends activemagiceffect

{Manages HLMSpell}

 

Event OnEffectStart(Actor akTarget, Actor akCaster)

if akTarget == Game.getPlayer()

;RegisterForUpdate(5.0)

Debug.Trace("Player acquired spell")

RegisterForEvents()

endif

EndEvent

 

Event OnAnimationEvent(ObjectReference akSource, string asEventName)

Debug.Trace("OnAnimationEvent for HorseEnter")

if asEventName == "HorseEnter"

Debug.Trace("Player got on horse")

EndIf

EndEvent

 

bool isRegisteredForEvents = false

 

function RegisterForEvents()

Debug.Trace("Player registering for animation")

isRegisteredForEvents = True

RegisterForAnimationEvent(Game.GetPlayer(), "HorseEnter")

Debug.Trace("Player registered for animation")

endfunction

Posted

OnAnimationEvent seems to be totally unreliable, to say the least. Several modder have confirmed same problems.

 

In another thread I read a comment saying that "triggered" events will work, while "notified" events will not (this refers to the type of nodes in the behavior that is raising the particular event). But even with that background I was not able to raise one of the events I wanted.

Posted

Thank you for the response fore. I will look into trigger events as you say.

 

Does anyone have any other suggestions or anything to add to fore's trigger events?

Posted (edited)
  Quote
I'm having trouble getting my mod to recognize when the player is using a horse.

 

For anyone else's reference, the solution to this problem was remarkably simple. It could be done by using RegisterForSingleUpdate and then looking for Player.IsOnMount() under OnUpdate().

Edited by Qazwox
  • Recently Browsing   0 members

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