Anyone know How to mimic Walking?

Post » Sun Jun 24, 2012 8:43 am

As most people know, animations no longer hold movement data. In the games that used Obscript, forcing the Walking Forward animation caused you to actually move forward. Now, in Skyrim, you can play the animation, but they will sprint in place. Anyone know how to mimic moving? Currently I tried this:
Scriptname TEST extends ActiveMagicEffectEvent OnEffectStart(akTarget)     Debug.SendAnimationEvent(akTarget, "MoveStart") ;Must be called before you do the Sprint Anim.     Debug.SendAnimationEvent(akTarget, "SprintStart")	 akTarget.MoveTo(akTarget, 0, 2, 0) ;Makes him spawn to himself, and then move him on the Y Axis forward.EndEvent

At first, it seems to work, but if the actor is not at the angle of 0, he will start to move sideways, and will not look real.
User avatar
k a t e
 
Posts: 3378
Joined: Fri Jan 19, 2007 9:00 am

Post » Sun Jun 24, 2012 7:41 am

Why not use the math functions?

Spoiler
Scriptname TEST extends ActiveMagicEffectfloat anglezfloat offset = 2float offsetxfloat offsetyEvent OnEffectStart(akTarget)	Debug.SendAnimationEvent(akTarget, "MoveStart")	Debug.SendAnimationEvent(akTarget, "SprintStart")	anglez = akTarget.GetAngleZ()	offsetx = offset * math.sin(anglez)	;i think sin is for x axis, if not, try cos	offsety = offset * math.cos(anglez)	;i think cos is for y axis, if not, try sin	akTarget.MoveTo(akTarget, offsetx, offsety, 0)EndEvent

Also, you could try using the translate function instead of the moveto function:

Spoiler
Scriptname TEST extends ActiveMagicEffectfloat anglezfloat offset = 64float posx1float posx2float poszfloat posy1float posy2Event OnEffectStart(akTarget)	Debug.SendAnimationEvent(akTarget, "MoveStart")	Debug.SendAnimationEvent(akTarget, "SprintStart")	anglez = akTarget.GetAngleZ()	posx1 = akTarget.GetPositionX()	posy1 = akTarget.GetPositionY()	posz = akTarget.GetPositionZ()	posx2 = posx1 + offset * math.sin(anglez)	;i think sin is for x axis, if not, try cos	posy2 = posy1 + offset * math.cos(anglez)	;i think cos is for y axis, if not, try sin	akTarget.TranslateTo(posx2, posy2, posz, 0, 0, 0, 100)    Utility.Wait(5)EndEvent
User avatar
Matt Terry
 
Posts: 3453
Joined: Sun May 13, 2007 10:58 am

Post » Sat Jun 23, 2012 11:48 pm

You could do it with an AI Package ... Setting an X-Marker at the spot you want the NPC to move to, then in the Package, setting his default speed to walk

Have a look at this (long, but worth it) tutorial, by doug, for how packages work (including run and walk)

http://www.youtu.be/pLAJi-JDyXM?hd=1
User avatar
Jordyn Youngman
 
Posts: 3396
Joined: Thu Mar 01, 2007 7:54 am

Post » Sun Jun 24, 2012 8:58 am

Why not use the math functions?

Spoiler
Scriptname TEST extends ActiveMagicEffectfloat anglezfloat offset = 2float offsetxfloat offsetyEvent OnEffectStart(akTarget)	Debug.SendAnimationEvent(akTarget, "MoveStart")	Debug.SendAnimationEvent(akTarget, "SprintStart")	anglez = akTarget.GetAngleZ()	offsetx = offset * math.sin(anglez)	;i think sin is for x axis, if not, try cos	offsety = offset * math.cos(anglez)	;i think cos is for y axis, if not, try sin	akTarget.MoveTo(akTarget, offsetx, offsety, 0)EndEvent

Also, you could try using the translate function instead of the moveto function:

Spoiler
Scriptname TEST extends ActiveMagicEffectfloat anglezfloat offset = 64float posx1float posx2float poszfloat posy1float posy2Event OnEffectStart(akTarget)	Debug.SendAnimationEvent(akTarget, "MoveStart")	Debug.SendAnimationEvent(akTarget, "SprintStart")	anglez = akTarget.GetAngleZ()	posx1 = akTarget.GetPositionX()	posy1 = akTarget.GetPositionY()	posz = akTarget.GetPositionZ()	posx2 = posx1 + offset * math.sin(anglez)	;i think sin is for x axis, if not, try cos	posy2 = posy1 + offset * math.cos(anglez)	;i think cos is for y axis, if not, try sin	akTarget.TranslateTo(posx2, posy2, posz, 0, 0, 0, 100)	Utility.Wait(5)EndEvent

Hmm, none of your scripts seem to work. Anything else?
User avatar
Vera Maslar
 
Posts: 3468
Joined: Wed Sep 27, 2006 2:32 pm

Post » Sun Jun 24, 2012 4:08 am

Do you want to force an NPC to move forward or the player?
User avatar
KU Fint
 
Posts: 3402
Joined: Mon Dec 04, 2006 4:00 pm

Post » Sun Jun 24, 2012 10:20 am

Do you want to force an NPC to move forward or the player?

I want the NPC to move forward.
User avatar
Kelsey Anna Farley
 
Posts: 3433
Joined: Fri Jun 30, 2006 10:33 pm

Post » Sat Jun 23, 2012 10:14 pm

A package would probably be best, then.
I have no experience with this, don't know how reliable or instantaneous the movement would be.
User avatar
jesse villaneda
 
Posts: 3359
Joined: Wed Aug 08, 2007 1:37 pm

Post » Sat Jun 23, 2012 10:49 pm

The answer is in my post up above ... that works.

Unless you cannot use a Scene for what you want to do (then you'll have to explain what you want to do)

Watch the video. Yes, it's an hour of your life, but it will show you a lot of simple things that are great for working out many such situations in a quest. It is particularly good for Packages and so Movement and Actions on NPCs
User avatar
Emily abigail Villarreal
 
Posts: 3433
Joined: Mon Aug 27, 2007 9:38 am

Post » Sun Jun 24, 2012 11:24 am

I agree with what others have said that if you want the NPC to actually walk towards something or someone, an AI package is probably better.

If you actually did want to mimic walking without using the AI package, I'm sorry the scripts I posted didn't work. I posted without trying to compile and didn't realize that the line listening for the event should have been
Event OnEffectStart(Actor akTarget, Actor akCaster)
and also, needed to add ".0" to the float values. When I changed that, the scripts compiled just fine.

I tried it out though, and it didn't look natural at all. I mean, yes, the NPCs did move in the direction they were facing, but not very well.
User avatar
Quick Draw
 
Posts: 3423
Joined: Sun Sep 30, 2007 4:56 am

Post » Sun Jun 24, 2012 4:04 am

-Snip-
User avatar
barbara belmonte
 
Posts: 3528
Joined: Fri Apr 06, 2007 6:12 pm


Return to V - Skyrim