Jump to content

Player-unique animations


Dlesang

Recommended Posts

I made a body with some exaggerated proportions. Now I'm altering animations to prevent limbs from clipping through body parts. I got my Idle standing animation to play in game. However, I don't know how to make it player-unique. Currently all NPCs stand with their arms away from their sides. Looks fine with my body, but with normal bodies, it looks uncomfortable.


I've seen NPCs using unique animations before. I believe it has something to do with the animation selector in the NPC menu in the editor. I need help setting it up so I can select my animation without selecting the vanilla one too.
Edited by Dlesang
Link to comment
Share on other sites

The only way to get an actor to use different animations than others is via the skeleton path. Most (and I'm not even sure if it's all) animations are searched for within the same folder the skeleton resides.

That's why the famous mod Mayu's Animation Overhaul (MAO) created a new folder for NPC-only animations, put a skeleton inside, and made all Vanilla NPCs use this skeleton (and as such animations) instead of the one found inside "_male".

 

However, as you can see, you can only do this to NPCs, not to the player. And any NPC you don't alter to use the skeleton from the other location will use the same the player does, and as such also the same animations, of course.

 

With the help of a recent OBSE there's also another approach to achieve the same result, but this time NPCs are unaffected and you just redirect the player to use a different skeleton + set of animations.

Though last time I checked a similar function to switch the 1st person skeleton was still missing and the approach itself was still more or less worked on at all.

 

The function is available to play around with in scripts, but if I'm not mistaken, its effects won't stay in a savegame and have to be re-applied after each game start (=Oblivion execution).

It's been a long while and I was only playing around with the function in console, switching to my unique dragon skeleton and set of customized animations, so I didn't have to 'replace' any skeletons and animations anymore in a future approach. I can't remember the name anymore, but I'll see if I can't search it up again and post it here.

Link to comment
Share on other sites

Just to add to what Drake has said, I've experimented with a very simple OnEquip script that set the skeleton path when equipping a particular weapon and it did work. What I was using it for was to change the position of the dagger and the quiver on my Na'vi race. I had thought that it could be applied to a quest script for the race or just the player, but I never got around to trying that. The down side of something like this is that there are so many animations needing to be edited that what starts as a simple idea becomes a very large and time consuming project.

Link to comment
Share on other sites

The only way to get an actor to use different animations than others is via the skeleton path. Most (and I'm not even sure if it's all) animations are searched for within the same folder the skeleton resides.

That's why the famous mod Mayu's Animation Overhaul (MAO) created a new folder for NPC-only animations, put a skeleton inside, and made all Vanilla NPCs use this skeleton (and as such animations) instead of the one found inside "_male".

 

However, as you can see, you can only do this to NPCs, not to the player. And any NPC you don't alter to use the skeleton from the other location will use the same the player does, and as such also the same animations, of course.

 

With the help of a recent OBSE there's also another approach to achieve the same result, but this time NPCs are unaffected and you just redirect the player to use a different skeleton + set of animations.

Though last time I checked a similar function to switch the 1st person skeleton was still missing and the approach itself was still more or less worked on at all.

 

The function is available to play around with in scripts, but if I'm not mistaken, its effects won't stay in a savegame and have to be re-applied after each game start (=Oblivion execution).

It's been a long while and I was only playing around with the function in console, switching to my unique dragon skeleton and set of customized animations, so I didn't have to 'replace' any skeletons and animations anymore in a future approach. I can't remember the name anymore, but I'll see if I can't search it up again and post it here.

 

Could you direct me to this obse code, or share it here? I've never been able to get obse scripts to work. My knowledge of scripting in general is very lacking. I do have ideas I'd like to try, but it'd require a much greater knowledge of scripting than I have.

Link to comment
Share on other sites

OBSE coding is a rather straight-forward process. If you know Vanilla scripting, you also know OBSE scripting.

It's just a rather huge collection of brand new functions and variable/object types with which one can achieve results otherwise impossible to create with regular ObScript alone.

 

The function I'm talking of is as of yet undocumented, if I'm not mistaken, as it was still worked on, last time I heard from Scruggs about it.

It can, however, already be used to switch the 3rd person player skeleton and set of animations on-the-fly at any time from ingame.

 

I myself was only using it in console so far. I was panning to create some scripts for my race to make the change apply each time you start or load a game with a dragon race player. But all of a sudden my free time died and took my modding progress with it, and up to today I wasn't able to even give it a try.

 

I located the old PM from Scruggs informing about its existance a long time back. Here's the details:

(skeletonUpdated:bool) SetPlayerSkeletonPath newPath:string
Path should be relative to Data\Meshes\ and include the ".nif" suffix.

A few caveats:
1. The function won't do anything if called when the game is in first-person view. Call it in third, then switch back and forth between 1st and 3rd as you wish.
2. This will almost certainly remain an undocumented and unsupported cmd when 0018 goes final. After sufficient testing if we're all satisfied with it I can roll an 0018b with official support, but for now any mod using it should be considered beta.
3. It may or may not work/have disastrous side effects/etc.

The actual command line I issued in console every time was:

 

SetPlayerSkeletonPath "characters\DrakeDragonRace\_male\skeleton.nif"

Needless to say "DrakeDragonRace" was the race folder for my dragons, and "DrakeDragonRace/_male" contained both, my custom skeleton and a full set of Vanilla animations and custom replacements of mine.

Whenever an animation file is missing, its animation can't be played, and as such its action will not be available ingame either. Leave out attack animations and you won't be able to swing a sword, no matter how often you hammer the attack button!

 

Getting OBSE scripts working ingame as well as compileable in the CS without errors about unknown function names, you need to 1) start the game via the "obse_loader.exe" and 2) start the CS via "obse_loader.exe -editor" as well.

What OBSE does is pretty simple actually. The loader executes the game or editor, locates its code parts after loaded into memory, inserts its changes and code extensions into it (this is called "hook"-ing into the code), then exits itself. It's like altering the source code, it just does this after the code was already loaded into system memory for execution, because the original source of the game or editor must not be modified or it becomes illegal.

(And that's also why I always must chuckle internally when someone complains about OBSE causing performance issues, slow-downs or lag, because when you're inside the game OBSE has already terminated itself long ago.)

Link to comment
Share on other sites

  • 3 weeks later...

I'm not sure if I understood what you said.

 

But here's what I'm getting.

 

I'd need a script that'd set the player skeleton path to say, "characters/eclipse/_male/skeleton.nif" I'm not very knowledgeable with scripting. I've tried using OBSE scripts in the editor before but they don't seem to work. I just tested the console command, and it worked fine. :D

 

How may I use OBSE scripts in the editor?

Link to comment
Share on other sites

 

How may I use OBSE scripts in the editor?

That's what my last paragraph was about. The same as you need to start the game through "obse_loader.exe" everytime when you want your OBSE-using mods to work, you will also need to start the CS via "obse_loader.exe -editor" everytime, or it will not recognize the OBSE code elements when compiling a script and throw an error. Most people make a shortcut to the OBSE loader on their desktop and add the "-editor" to it themselves in the run program line.

 

As for the actual script itself, I never got around to give it a try myself up to now. Like you I was only using the command line in the console to play around with it.

But as this command has to be called everytime the 'game' (as in the program, not a game session) gets started over again, I reckon it will need some sort of GameMode and/or MenuMode script for a "start game enabled" Quest and include something along the line of "GetGameLoaded" and "GetGameRestarted" to detect these events and trigger the switch accordingly.

 

I don't really know which 'condition' you will use to determine if it should be switched or not (It's only affecting the player, alright, but it surely should not 'always' switch the animation everytime your plugin is active. Maybe it should only switch while you're wearing a certain item, or you must be of a certain race for it to happen?), but these two put into a condition will make it so you can check for this at the appropriate times where it's needed.

 

A very primitive example script would likely look like:

 

scn SomeFancyScriptname
 
short doSwitch ; set this to 1 by any arbitrary condition check of your choosing
 
Begin GameMode ; GameMode should suffice for now. If not, just add a copy of this code into MenuMode.
 
    If (GetGameLoaded == 1 || GetGameRestarted == 1) ; will only be true once, no do-once condition required
        If (doSwitch == 1)
            SetPlayerSkeletonPath "characters\eclipse\_male\skeleton.nif"
        EndIf
    EndIf
 
End

Not able to test it ingame, so no warranties on functioning without errors, bugs or weaknesses. But you should get the idea.

Link to comment
Share on other sites

There's another option besides using the scripts which is to use the TES4Edit. If you go to the MAO release page at nexus, you will find the tutorial one of the users made.

Link to comment
Share on other sites

I tried this last night, but removed the doonce function because I thought it'd cause a problem. However, doing so caused the game to play, then stop for several seconds, the play for several seconds, then stop again, etc.

 

Soooo I added the doonce function and it works fine now. Hooray! :D Thanks!

Link to comment
Share on other sites

Huh, and I guess you also learned something important about 'unneccesary function calls' during this process.

 

This function is quite computationally expensive and takes its time to execute.

The script execution stops until the function is done, and as there are no 'parallel' processes in the game, basically Oblivion itself stops until the function is done.

Calling this function without a doonce condition like those GetGameLoaded/Restarted checks or similar will make it get called every single run of the script.

 

You were lucky this wasn't an Object script but only a Quest script, I take it. Quest scripts by default have a relatively high frame skip before they run again, whereas Object scripts run every single frame.

Calling this function each run, which might very well take its couple 'seconds' to finish, you can literally switch measuring your framerate from "Frames Per Second" over to "Seconds Per Frame"!

 

In your case it was stopping for several seconds while the function was executed, then playing for several seconds until the next run of this script, and then all over again. You won't have had even remotely as much luck, would this be done in an Object script instead.

 

But oh well, the 'hilarity' of the attempt put aside, everything seems to be working now. :sweat:

Glad I was of some help.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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