Jump to content

Tracking Actor movement via Script?


Hæretic

Recommended Posts

Posted

I have a piece of armor that should play sounds when the actor is moving. First I considered footsteps but they overwrite the normal footsteps and the armor in question is no footwear.

 

So the only solution left is attaching a script to the armor that constantly updates and checks if the actor is currently moving.

The problem I have is I can't find any function to get the actors current movement speed.

There is a condition for movement speed I could put on a spell that gets fired on the actor every update and the script checks if the spell was successfully cast but that looks just overly complicated...

Did I miss anything?

Posted

Nicked from Weightmorphs. Might be what you are looking for? - with removal of the bits you don't want and a check to see if the player/target is actually wearing the armour and some added play sound code:-

 

 

 

Event OnAnimationEvent(ObjectReference akSource, string asEventName)
	If akSource == PlayerRef
		If asEventName == "FootLeft" || asEventName == "FootRight"
			ChangeWeight(-0.0005 * MultLoss, False)
		ElseIf asEventName == "FootSprintLeft" || asEventName == "FootSprintRight"
			ChangeWeight(-0.001 * MultLoss, False)
		ElseIf asEventName == "JumpUp"
			ChangeWeight(-0.002 * MultLoss, False)
		EndIf
	EndIf
EndEvent

 

 

 

(Unless I'm totally getting the wrong end of this stick :shy: )

  • 2 weeks later...
Posted

Nicked from Weightmorphs. Might be what you are looking for? - with removal of the bits you don't want and a check to see if the player/target is actually wearing the armour and some added play sound code:-

 

 

 

Event OnAnimationEvent(ObjectReference akSource, string asEventName)
	If akSource == PlayerRef
		If asEventName == "FootLeft" || asEventName == "FootRight"
			ChangeWeight(-0.0005 * MultLoss, False)
		ElseIf asEventName == "FootSprintLeft" || asEventName == "FootSprintRight"
			ChangeWeight(-0.001 * MultLoss, False)
		ElseIf asEventName == "JumpUp"
			ChangeWeight(-0.002 * MultLoss, False)
		EndIf
	EndIf
EndEvent

 

 

 

(Unless I'm totally getting the wrong end of this stick :shy: )

 

This looks very promising, I never thought about using animation events to get the actor's movement state, nice idea!

I will try to get it to work that way and come back with the results. Thanks a lot  :)

Posted

Alright, animation events do work to track movement partly!

I had to attach the script to a magic effect because apparently, object references do not receive anim events.

For some reason only the jump and foot events work, things like moveStart or SneakStart do not work...

It would be nice to have these events too, to play sounds when the actor starts moving for instance but with the footsteps events I am a lot closer to what I want to achieve than before!

Once again thanks for the Help  :lol:

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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