Jump to content

Take a look at my nif file? Cant play animation in game.


cypher2012

Recommended Posts

Hey guys, would anyone mind taking a look at my nif file to see why my animation can't be played in game?

 

The animation works properly in nifskope.

 

In creation kit, I can preview the animation and it acts like it's play, but the model in the preview doesn't seem to be moving.

[Edit] Animation now plays properly in creation kit preview.

 

I've created an 'Activator' object with the nif.

 

I have the following script attached to a button, with the variable being a reference to the train activator object placed in the world:

Scriptname CMR:CMR_TestButton extends ObjectReference

ObjectReference Property AnimationObject Auto

Event OnActivate(ObjectReference akActionRef)
    if(AnimationObject.PlayGamebryoAnimation("TrainAnimation"))
        Debug.MessageBox("PlayGamebryoAnimation returned true.")
    else
	Debug.MessageBox("PlayGamebryroAnimation returned false.")
	if(AnimationObject.PlayAnimation("TrainAnimation"))
	    Debug.MessageBox("PlayAnimation returned true.")
	else
	    Debug.MessageBox("PlayAnimation returned false.")
	endif
    endif	
EndEvent

Here is a brief screenshot of the nif file. I've attached a link to download the actual nif file.

 

 

 

 

https://drive.google.com/open?id=0B3fNHFFEy8SKVkQ0RmJYT09VQ0E

Edited by cypher2012
Link to comment
Share on other sites

So after making that last edit to the nif file, it was actually okay in the end.

 

Turns out half of the problem was the script. I don't know why, but it just wouldn't work the way I had it. I've now made the button reference the actual trains script instead of just ObjectReference. It now just calls a function in the trains script that plays the animation itself.

Scriptname CMR:CMR_TestButton extends ObjectReference

CMR:CMR_TrainActivateAnimation Property AnimationObject Auto

Event OnActivate(ObjectReference akActionRef)
	AnimationObject.StartAnimation()
EndEvent
Scriptname CMR:CMR_TrainActivateAnimation extends ObjectReference

Function StartAnimation()
	if(PlayGamebryoAnimation("TrainAnimation"))
		Debug.MessageBox("Self PlayGamebryoAnimation returned true.")
	else
		Debug.MessageBox("Self PlayGamebryroAnimation returned false.")
		if(PlayAnimation("TrainAnimation"))
			Debug.MessageBox("Self PlayAnimation returned true.")
		else
			Debug.MessageBox("Self PlayAnimation returned false.")
		endif
	endif
EndFunction
Link to comment
Share on other sites

  • Recently Browsing   0 members

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