Detecting PC startstop movement

Post » Sun Nov 18, 2012 12:14 pm

I am looking for an efficient way to detect if the player starts or stops moving. I know
i could poll the players location, but that seems innefficient.Is there a better way?
User avatar
~Sylvia~
 
Posts: 3474
Joined: Thu Dec 28, 2006 5:19 am

Post » Sun Nov 18, 2012 2:26 pm

You could use RegisterForAnimationEvent() and see if any of the animation events for the character fire. You will need to use ConvertHKX on the animation files, and look in the behavior files for the actor. For example:
moveStartmoveStop

... are two events that you can listen for. However, I do not know if those ones actually fire. In my testing some don't show up when you output the current eventName from the OnAnimationEvent() block.

As for animation variables you can use GetAnimationVariableInt/Float/Bool on the character to determine if he is in motion. For example these may help:
SpeedDirectionTurnDeltaSpeedWalkSpeedRun
... Those are floats.

For example in my footprints mod I listen for FootLeft and FootRight. Those only fire when the player is moving so you could use those as well, but there are more "continuous" methods available to you like the animation variables.

http://www.gamesas.com/topic/1360112-full-dump-of-all-animation-variables/
http://www.creationkit.com/RegisterForAnimationEvent_-_Form
http://www.creationkit.com/OnAnimationEvent_-_Form
http://www.creationkit.com/GetAnimationVariableFloat_-_ObjectReference
User avatar
Captian Caveman
 
Posts: 3410
Joined: Thu Sep 20, 2007 5:36 am

Post » Sun Nov 18, 2012 11:42 am

I am looking for an efficient way to detect if the player starts or stops moving. I know
i could poll the players location, but that seems innefficient.Is there a better way?
As jonwd7 mentioned, RegisterForAnimationEvent is ideal, when you can find events that actually fire. I have found pretty good performance though with the animation variables too and they seem to cover areas the animation events don't. So I usually have to use both. Not ideal, but it works. Here's another thread with some more information: http://www.gamesas.com/index.php?showtopic=1394671
User avatar
Celestine Stardust
 
Posts: 3390
Joined: Fri Dec 01, 2006 11:22 pm

Post » Sun Nov 18, 2012 5:33 pm

there's also at least a condition function for this, named getismoving or ismoving or stg like that
User avatar
N3T4
 
Posts: 3428
Joined: Wed Aug 08, 2007 8:36 pm

Post » Sun Nov 18, 2012 8:45 am

there's also at least a condition function for this, named getismoving or ismoving or stg like that
Yeah, good point: http://www.creationkit.com/IsMoving. My guess is that it's using animation variables too.
User avatar
Sammykins
 
Posts: 3330
Joined: Fri Jun 23, 2006 10:48 am


Return to V - Skyrim