Jump to content

make NPC play multiple animations during conversation


Maylle

Recommended Posts

Hi again,

 

So how could I go about letting a custom NPC play multiple animations during conversations? I have an NPC attached to a wallLeanMarker, so he is leaned against the wall with arms crossed during the whole conversation. Is there a way to let him go through several animations (e.g. making gestures, stand up straight, lean back again etc.) during conversations ?

 

Just point me in the right direction and I'm already happy :]

 

Thanks,

- Maylle

Link to comment
Share on other sites

Not all animations allow you to do that from my experience and so far I've only tried to get NPC or player play multiple animations using furniture or trigger boxes. For those you can mix, you can get multiple animations through scripting, using "playIdle" or "sendAnimationEvent" and adding some waiting time between the two to allow first animation to end before casting the following one. It's mostly a matter of finding the right sequence while you're trying them. If your NPC is attached to your leanWall marker, it could work with a trigger box.

 

The best way would probably be to create a scene in a quest though or create a package - but I can't help you there 'cause I have not tried that yet.

Link to comment
Share on other sites

Furniture animation (and that's what WallLean technically is) are a little tricky. They usually consist of 3 animations (enter, loop, exit), and you cannot simply add them up without running the exit one. You might be able to trick it by calling simple animations while the NPC is leaning. But I think that will be glitchy at best.

 

So give it a try, using some AnimEvents from the "LOOSE" section of the CK animation area. I would also recommend sendAnimationEvent, since it bypasses unecessary overhead in the engine. So try one of those

 

SendAnimationEvent("IdleWave")

SendAnimationEvent("IdleApplaud2") ; IdleApplaud3, IdleApplaud4, IdleApplaud2

SendAnimationEvent("IdleSalute")

But the "right way" to do it is with FNIS and it's furniture Animation. There you can use ANY animation you have. Define a furniture animation in your own FNIS based mod, and define a wallLean furniture animation like
fu -a,k MyWallLeanEnter ..\Wall_IdleBackEnter.hkx
+ -k MyWallLeanLoop1 ..\Wall_IdleBackLoop.hkx
+ -k MyWallLeanLoop2 ..\IdleWave.hkx
+ MyWallLeanLoop3 MyCustomAnimation.hkx
+ -a,k MyWallLeanExit ..\Wall_IdleBackExit.hkx

This will create a set of AnimEvents ("MyWall...") which you can use for your purpose. Replace the standard WallLean animation definition in the CK (caution: this is tricky already in standard) with the AnimEvents created by FNIS. This will look like the standard animation in standard situations. But for your special case you can run through the different loop animations with SendAnimationEvent("MyWallLeanLoop1") , or Loop2, or Loop3, or ..., or ...

 

Link to comment
Share on other sites

Hi Fore,

 

The question was not from me but I always appreciate your advices. Using furniture anims, I have a question for you if I may. I've been adding the isWritingChair keyword to a furniture marker which of course plays fine, but every so often when exiting the chair, my char's first person camera gets stuck, it can only move on the Z axis while X and Y do not respond. Jumping, of course, gets rid of this. I was wondering if you knew what hard-coded functions are attached to the jump key to systematically get rid of animations leftovers? I've tried adding a small script to the furniture marker to "enablePlayerControls" and "ClearLookAt", but obviously that's not it, 1st person camera remains stuck, never the 3rd person POV though. I was wondering why that is...

Link to comment
Share on other sites

Thank you all so much for your help - what I don't understand is why is it so hard to find a decent list of the animations that are available? Even the CK-Wiki describes everything about the sendAnimationEvent() and playAnimation / playIdle() functions...except a list of the animations we can use. How is one supposed to learn anything in this matter if we already have to spend hours to even find any resources to learn from? http://static.zenimax.com/forums.bethsoft.com/public/style_emoticons/default/biggrin.png

 

Anyway, I now went through the list in the "animations" tab of the NPC-window to see which ones I wanted, wrote down their names and after a quite some guesswork (many of the Idles in the NPC's animation list are called differently in the list when you define the Idle properties *facepalm*) I now call the animations with playIdle() calls and wait() calls in between if I want to use multiple animations in a row.

Now the only issue left is that, at the beginning of the conversation the NPC is leaned against the wall (via the wallLeanMarker) and this seems to be preventing him from playing my animations.

@Hoamaii's suggestions sounds good...will look into using some kind of trigger + travel-procedure setup. The FNIS-way sounds very interesting too, but, frankly, I still feel like I'm too fresh at all this and that approach seems rather complicated. "Getting it to work" over "doing it right" for now, will definitely look into this in the next days since it does sound powerful.

 

Thanks again!

- Maylle

Edited by Maylle
Link to comment
Share on other sites

@Hoamaii:

I have almost never looked into 1st person behaviors. But it sure sounds like a behavior problem. Usually these kind of things happen, when an AnimEvent is received too early or too late due to some unplanned situation. If so, engine methods supposedly will not help. Try with SAE(Idleforcedefaultstate). That'S always the magic word when it comes to resetting character behaviors.

 

@Maylle:

It's not a matter of "getting it to work" vs. "doing it right". The first part is "MAYBE you can get something to work which is glitchy AT BEST". And since I didn't know at which level of modding you are I thought I mention it here. Digging in some areas even without success is often the start of a modder career. That's how I started years ago.

Animations (except replacers) are not meant to be modded. Beth has not provided anything to support adding new animations, or changing the behavior of existing. With the introduction of HBT as their development tool to implement animation behavior, they have locked out all modders from doing reasonable things in this area. FNIS is a hack, but the only current way for allowing different mods add new animations at the same time.

 

But what you see in the CK are not animation files. You either see AnimEvents (created by HBT or FNIS) or Idle Object definitions (created by CK based on AnimEvents). And only for simple idles there is a one-on-one relation between animation files and AnimEvents.

 

In order to view animation files you have to extract them from their bsa's. Then you can either replace another game file that you know what it does (like mt_idle.hkx) and watch the result in-game. Or you can use FNIS Spells, and replace it's files, so you can cast the animation on either the player or any NPC.

Link to comment
Share on other sites

@ Fore: thanks a lot for the tip, Fore, you're right, it IS a magic word. I had to call it onTriggerLeave from a trigger box attached to the furniture marker though, for some reason I don't understand OnSit or onGetUp don't seem to work with chairs for me. I should have asked you earlier ;).

 

One more question if I may: do you know what exactly "IdlePlayOnceThenPickNewIdle" does? I guess it's used by NPCs for patrol animations but I was wondering if we could use it with the player.

 

I did not know either that Bethesda had not provided support to mod animations. Basically, I've been tempering with Vanilla anims in the CK, and whatever I do anyway I can't get to modding animobjects - other than replacing textures, everything else, including something "as simple" as adding a layer of soup in the animobjetSilverBowl01 ends up crashing my game. I have not quite given up but I'm having a hard time figuring out how they are attached on the corresponding animations. Anyway, thanks again, Fore. Cheers!

 

@ Maylle: if you want to get a series of animations to work beginning with the WallLean anim, you're probably better off getting rid of the WallLean Furniture marker to start with and calling IdleWallLeanStart and IdleChairExitStart from the same script you're playing the rest of your animations from. "ExitWallLean" is just an ID, it does not work with SAE, many Vanilla animations simply use "IdleChairExitStart" to exit a furniture, even if it is not a chair ;).

Link to comment
Share on other sites

for some reason I don't understand OnSit or onGetUp don't seem to work with chairs for me.

I didn't use them yet. But instead of onGetUp you can prpbably register for "IdleFurnitureExit". That is triggered by all furniture animations at the end of the exit animation

 

One more question if I may: do you know what exactly "IdlePlayOnceThenPickNewIdle" does? I guess it's used by NPCs for patrol animations but I was wondering if we could use it with the player.

If patrol animations means standing idles then it might be true. This is the initial AnimEvent which put a character into mt_idle.hkx. Then a PickNewIdle is sent, which initiates an alternate animation of the same type. Thisway the different standing, sitting, cheering, ... idles are played.

 

I did not know either that Bethesda had not provided support to mod animations.

Why do you think there is the need for a tool like FNIS? :D

 

whatever I do anyway I can't get to modding animobjects - other than replacing textures, everything else, including something "as simple" as adding a layer of soup in the animobjetSilverBowl01 ends up crashing my game. I have not quite given up but I'm having a hard time figuring out how they are attached on the corresponding animations. Anyway, thanks again, Fore. Cheers!

I have no idea, why your animObjects crash. I have never made one myself. But I know they NiStringExtraData for one bone of the actor's skeleton. And at runtime, with a specific AnimEvent AnimObjectLoad, they are attached to the skeleton. So there is nothing attached to any animation. In fact, with the help of FNIS, you can use any AnimObject with any Animation. Provided there is this matching bone. So one of my FNIS tests is a wave animation with a sword in the hand.

Link to comment
Share on other sites

@ Fore: many thanks for your kind explanations :). It struck me today why "OnSit" wouldn't work, I was stupidly trying to use it on a furniture ref rather than an actor when it is an actor function... :blush: It was quite an effort for me to learn scripting from scratch and now that I'm much more efficient with it, I make stupid mistakes for not thinking twice...

 

I know that FNIS is a great tool, I played with it a lot - now I'm more modding than playing really, first learnt 3D modeling, then scripting, hopefully I'll get to animations someday :). I suspect my animobjects crash for 2 possible reasons: 1. I tweaked them directly in Nifskope importing a second mesh rather than doing it the "clean" way with 3DS, 2. I was probably using the wrong kind of BS property - when it crashes the CK, I know something is wrong with the textures...

 

Thanks again - in a couple of posts from you, I've learnt helpful tips!.. Cheers!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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