anidamo Posted April 20, 2012 Share Posted April 20, 2012 Hi there, I'm currently trying to create a mod to make the player character use the same head tracking functionality NPCs use when they're talking to you. Currently the player character just stares straight ahead, ignoring NPCs who are speaking to him and it kinda ruins the immersion if you enjoy playing in third person. Ideally, the player character should turn their head to look at any NPC currently talking to him and maybe glance at nearby NPCs or objects within a certain range. I've never modded Skyrim or a Bethesda game before but I do write mobile phone apps for a living so it wasn't too difficult to get the gist of things. Digging through the API reference I see several methods that look relevant: Actor.SetHeadTracking, Actor.SetLookAt, Actor.ClearLookAt Unfortunately I couldn't get these to do what I wanted. Now, I know how to program, but I don't know much about the CK itself, so I'm not sure if I'm just doing something wrong in the editor or just not understanding some elements of Papyrus, or if the issue is something else, but any assistance would be appreciated. I started off by adding a new script to the Player actor in the CK, and writing the following code: Scriptname PlayerHeadTracking extends ObjectReference Actor Property lydiaRef Auto Actor Property pcRef Auto bool isEnabled Event OnInit() Debug.Notification("Loaded plugin.") RegisterForSingleUpdate(5) EndEvent Event OnUpdate() if isEnabled == true Debug.Notification("Clearing look target.") pcRef.ClearLookAt() Else Debug.Notification("Looking at target.") pcRef.SetHeadTracking(true) pcRef.SetLookAt(lydiaRef) EndIf isEnabled = !isEnabled RegisterForSingleUpdate(5) EndEvent I basically wanted to try getting the head tracking part down before worrying about the other bits (where to attach the script, who to look at, etc.) so I made this simple script that simply alternates between looking at Lydia and clearing the target every 5 seconds. Unfortunately, it doesn't work. I get all of the relevant notification messages so the script is running, but the SetLookAt function doesn't appear to do anything. I have swapped the references (making Lydia look at the player) and it works fine, so I don't think I'm making any issues with the editor, but I'm not certain. Perhaps I have to do something special with the player actor to be able to "modify" him? I'm not sure. I suspect it might actually have something to do with the idle animation... the default idle animation for the player has them glance around at nothing in particular, not using head tracking, just as part of the general idle animation. NPCs don't seem to do this... they're always moving their head to look at another actor or object it seems. I wonder if the player character has a different idle animation that overrides any head movement I might set, and if so, would there be a way to remove such an animation? Any ideas? Link to comment Share on other sites More sharing options...
TheAtomicCafe Posted April 20, 2012 Share Posted April 20, 2012 Hi there, I'm currently trying to create a mod to make the player character use the same head tracking functionality NPCs use when they're talking to you. Currently the player character just stares straight ahead, ignoring NPCs who are speaking to him and it kinda ruins the immersion if you enjoy playing in third person. Ideally, the player character should turn their head to look at any NPC currently talking to him and maybe glance at nearby NPCs or objects within a certain range. I've never modded Skyrim or a Bethesda game before but I do write mobile phone apps for a living so it wasn't too difficult to get the gist of things. Digging through the API reference I see several methods that look relevant: Actor.SetHeadTracking, Actor.SetLookAt, Actor.ClearLookAt Unfortunately I couldn't get these to do what I wanted. Now, I know how to program, but I don't know much about the CK itself, so I'm not sure if I'm just doing something wrong in the editor or just not understanding some elements of Papyrus, or if the issue is something else, but any assistance would be appreciated. I started off by adding a new script to the Player actor in the CK, and writing the following code: Scriptname PlayerHeadTracking extends ObjectReference Actor Property lydiaRef Auto Actor Property pcRef Auto bool isEnabled Event OnInit() Debug.Notification("Loaded plugin.") RegisterForSingleUpdate(5) EndEvent Event OnUpdate() if isEnabled == true Debug.Notification("Clearing look target.") pcRef.ClearLookAt() Else Debug.Notification("Looking at target.") pcRef.SetHeadTracking(true) pcRef.SetLookAt(lydiaRef) EndIf isEnabled = !isEnabled RegisterForSingleUpdate(5) EndEvent I basically wanted to try getting the head tracking part down before worrying about the other bits (where to attach the script, who to look at, etc.) so I made this simple script that simply alternates between looking at Lydia and clearing the target every 5 seconds. Unfortunately, it doesn't work. I get all of the relevant notification messages so the script is running, but the SetLookAt function doesn't appear to do anything. I have swapped the references (making Lydia look at the player) and it works fine, so I don't think I'm making any issues with the editor, but I'm not certain. Perhaps I have to do something special with the player actor to be able to "modify" him? I'm not sure. I suspect it might actually have something to do with the idle animation... the default idle animation for the player has them glance around at nothing in particular, not using head tracking, just as part of the general idle animation. NPCs don't seem to do this... they're always moving their head to look at another actor or object it seems. I wonder if the player character has a different idle animation that overrides any head movement I might set, and if so, would there be a way to remove such an animation? Any ideas? Hey there...I tried your script and can't seem to make it work either. Whomever get's this working is going to be a Superstar!People have been clamoring for months on getting their player to seem less lifeless. I'm beginning to wonder if this isn't a character look issue but a skeletal one (having to do with the bones associated with the characters' rig). Link to comment Share on other sites More sharing options...
masterofshadows Posted April 20, 2012 Share Posted April 20, 2012 I hope you get this sorted! When you create your character you can click drag his head to move it around; and that's the last time his head will ever move! I like to take cool screenshots but it's very annoying that the player never looks at anything. A dragon could be perched right above him but he will never even glance at it. :facepalm: Link to comment Share on other sites More sharing options...
TheAtomicCafe Posted May 4, 2012 Share Posted May 4, 2012 I came across this:ShowHeadTrackTarget (SHeadT) Show the head track target if set from look function Now if I can only find out what this Look Function is! What this does as a console command is set any persons (NPC and player alike to have no head animations) I basically states: (player name) is looking at (NPC Name)...BUT THE PLAYER ISN'T LOOKING AT ANYTHING!! MODDER RAGE!!!I don't seen any references to this anywhere. Any idea? Link to comment Share on other sites More sharing options...
strazytski Posted July 1, 2012 Share Posted July 1, 2012 (edited) :psyduck: why was this idea abandoned! I Want this and I say this must be created.I will see if I can poke some people and see if someone has a idea for this. :geek: Edited July 1, 2012 by strazytski Link to comment Share on other sites More sharing options...
masterofshadows Posted July 1, 2012 Share Posted July 1, 2012 good luck! i still hold out hope that this will someday be fixed. Link to comment Share on other sites More sharing options...
JanusForbeare Posted July 1, 2012 Share Posted July 1, 2012 People have been clamoring for months on getting their player to seem less lifeless. I definitely did my share of that. I would definitely download a mod that resolved this issue. I wonder if a looping, interruptible scene could be used? I initially was looking at using scenes to drive Atvir's banter dialogue, and I seem to recall that dialogue actions within a scene can be set to headtrack the conversation partner. If you made the player the speaker, gave them a blank line of dialogue (not sure if that part is possible, but the player has an actor reference, so it might be), and assigned an alias as the conversation partner (scripted to be filled with the nearest NPC) you might be able to get some headtracking going. Very theoretical though. Link to comment Share on other sites More sharing options...
Rabbit1251 Posted July 1, 2012 Share Posted July 1, 2012 I fervently support this idea. There are many small things in the Skyrim game that bother me, but this is by far the biggest. Rabbit Link to comment Share on other sites More sharing options...
LittleBaron Posted July 1, 2012 Share Posted July 1, 2012 The player will not do anything you want him/her to do unless they are made AI Driven. Link to comment Share on other sites More sharing options...
fore Posted July 2, 2012 Share Posted July 2, 2012 There is NO headtracking for the PC, AI driven or not. I made a test with the upcoming FNIS 3.0 which will have a headtracking option. Usually, for the NPCs, headtracking is on by default. So if an animation gets the "off" option, I have to raise an event "Headtracking Off" in the behavior file when the animation starts, and "Headtracking On", when the animation ends. Not raising the events lets the NPC move the head, but not the PC. I made a test with an additional "Headtracking On" when starting the animation, but again the PC did not move his head a bit. Therefore it also will not be possible to make it work via a script, scripts do nothing but raise events. It might be somewhere deep in the behaviors. But I could not find anything in the 2 most likely behavior files. I would think, headtracking is purely engine, and cannot be changed by data files or scripting (except NPC on/off). If anything, then SKSE, but I don't know what they are able to see. Link to comment Share on other sites More sharing options...
Recommended Posts