Jump to content

Getting idle animation to play with script?


Jokerine

Recommended Posts

Hello all! I'm having a bit of an issue with a mod I'm working on. I'm trying to get an NPC to use the SpecialIdleNVGuitar idle animation. Sounds easy enough, but I swear, I cannot get it to work. I see there was an idle marker made for it, but it is unused, and despite making a copy of it and changing a bunch of settings, my NPC just won't play the guitar animation... In the animation preview window, the animation plays alright, so I'm not sure of what I'm doing wrong.

 

So, I figure I could use a script to force the NPC to play the stupid animation already. I've read that there is a PlayIdle command that I figure could work, but I can't get the script to compile, and most information on Google about this is to get the player to use the animations, not NPCs. Does anybody know how the script would need to be in order to force the NPC to play SpecialIdleNVGuitar on a loop?

 

Look forward to any replies, thanks for reading! :)

Link to comment
Share on other sites

There's more than a method to invoke an animation. The easier is by PlayIdle

 

PlayIdle name_of_the_animation

 

If you can play it correctly in game, using the same command by console, then you're ok.

If it doesn't work, you probably must declare it on the Idle Animations menu, under Gameplay, where you also can set if it must loop. Unless the .kf file requires to be modified to work, but that requires some knowledge on animations.

Link to comment
Share on other sites

Thanks for the reply. I Did say in the OP that I have read about PlayIdle and I was wondering if someone could help me write a script with it, because my attempts failed to compile. I'll see if I can get my char to play the animation with the console and see if the name's right.

 

EDIT: The animation does play when I use the console to make my character use it (SpecialIdleNVGuitar). Could anybody help me with some kind of script to force an NPC to use it then? :)

Edited by Jokerine
Link to comment
Share on other sites

The script is exactly like the console command:

PlayIdle name_of_the_animation

 

But I can't write down the whole script if I don't know the whole scene, it depends by exactly what it has to do, when, etc.

 

Anyway if the npc does nothing than playing guitar, then I suggest to not use a script but use an AI package or use a condition in the Animation Idle menu.

Link to comment
Share on other sites

But, that's what I said - I cannot get the NPC to use an idle marker that has been linked to the animation already (an idle marker already exists in the GECK, I can't remember what it was called but it had "guitar" in the name), for some reason. He just stands there :( I tried with both a travel and use item at packages pointing at the idle marker, which was made a persistent reference, with no results. All I want is for the NPC to play the idle indefinitely, that's all :) So the script would just be like this, then?

scn scriptname
ActorRef.playidle SpecialIdleNVGuitar
end

I think that was the script I made earlier that the GECK wouldn't let me compile. Would it have to be an object or quest script? I'm really at a loss of what to do... I appreciate the responses by the way. I really want to make this work :)

Link to comment
Share on other sites

Well, my ears sure are red now - that was easier than I thought it would be. Many thanks, kudo to you :) One last question, if I may - I see the idle has no sound attached to it. Could there be a way to have a sound play while the idle is on, or while the NPC is not in combat? I have used PlaySound in several scripts in the past, so I know my way around that one, but I'm not sure of how I could make it so it only plays when there are no enemies around.

 

But, if not, I can live with the music playing all the time. Thanks again - I was going nuts with this silly guy not playing the guitar! You're a life saver :)

Link to comment
Share on other sites

If the guy stops playing the guitar because there's a fight (he takes aggro), then I find that the best way would be adding a :Sound Textdata, which requires to modify the .kf of the animations. But it would require some knowledge on animations.

 

You can use workarounds by script, sure, but... it wouldn't be very smart in my opinion.

i.e. a confused solution could be using a playsound when NPCRef.IsInCombat == 0

Link to comment
Share on other sites

  • Recently Browsing   0 members

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