noctara Posted March 26, 2012 Share Posted March 26, 2012 (edited) Hello everyone, Disclaimer: I tried to set up a certain cameraview for a playeranimation. However I couldn't find any way changing the camera angles and distances.As a result I decided to work on a script which allows a npc to take over the control of the playercamera (got a little help from sinderions bones here :biggrin: )With this in mind, there are probably quite a few fields of application for this kind of function. Some examples just out of my mind: - mindcontrol spells for enhanced magic and/ or unique bossfights- controlling a follower or your spouse for certain activities (might add some immersion not sure :confused:)- setting up scenes with the player as an actor (and the camera detached)- setting up a certain view for furnitureanimations 2 more things before I start:a) I am not an experienced modder, so I apologize if some more veteran modders find any flaws in the scripts or better ways to achieve similar results.b) This is probably just one way to get to the results described above. Here are my findings (as I couldn't find much info on this topic and I thought it might help someone): General approach: 1. a new actor (cameraman)2. a Quest (triggered on script event with 4 Aliases: - SpawnMarker for cameraman (normal xmarker, filltype forced ref)- player (filltype scriptevent ref1)- cameraman (create to object "Spawnmarker")- optional: marker to which the camera is moving (xmarkerheading, filltype forced ref) 3. an eventscript triggering the keyword in order to start the quest- this script also includes a variable defining the player as an actor (in order to fill the alias with an actor)3. a new SM-Event-Questnode (on scriptevent, calling for the keyword)4. calling the camera-start-function (defined in the questscript) via fragment on stage 05. calling the camera-end-function via fragment on stage 10 Scripts:Questscript Scriptname TestMod02TestScript extends Quest import game ReferenceAlias Property AliasTestMod02CameraStop01 AutoReferenceAlias Property AliasTestMod02CameraMarker AutoReferenceAlias Property AliasTestMod02PlayerActor AutoReferenceAlias Property AliasTestMod02CameraMan AutoKeyword Property TestMod02PlayerCharacter auto Function CameraRunning() Actor TestMod02PlayerActor = (TestMod02CameraMan as ObjectReference) as ActorActor TestMod02CameraMan = (TestMod02playerActor as ObjectReference) as Actor AliasTestMod02PlayerActor.GetActorReference().SetPlayerControls(false) Game.ForceThirdPerson() AliasTestMod02CameraMan.GetActorRef().EnableAI(false) AliasTestMod02CameraMan.GetActorReference().SetPlayerControls(true) Game.SetCameraTarget(AliasTestMod02CameraMan.GetActorReference()) Game.ForceFirstPerson() ;-----------------Now you should have control over the CameraMan (need to enable player control)--------------;-----------------the following part could be defined in your questscript-------------------------------------;-----------------just need to add the aliases to your quest (filltype external)------------------------------ Game.DisablePlayerControls(true, true, true, true, true, true, true, true, 0) AliasTestMod02CameraMan.GetActorRef().SetAlpha(0) AliasTestMod02CameraMan.GetActorRef().MoveTo(AliasTestMod02CameraMarker.getref(), abMatchRotation = true) AliasTestMod02CameraMan.GetActorRef().TranslateToRef(AliasTestMod02CameraStop01.getref(), 10.0, 0.0) EndFunction Function CameraEnd() Actor TestMod02PlayerActor = (TestMod02playerActor as ObjectReference) as ActorActor TestMod02CameraMan = (TestMod02CameraMan as ObjectReference) as Actor AliasTestMod02CameraMan.GetActorReference().SetPlayerControls(false) Game.ForceThirdPerson() AliasTestMod02PlayerActor.GetActorReference().SetPlayerControls(true) Game.SetCameraTarget(AliasTestMod02PlayerActor.GetActorReference()) Game.ForceFirstPerson() Game.EnablePlayerControls() EndFunction EventScript Scriptname TestMod02TestActivator extends ObjectReference import debugimport keyword Keyword Property TestMod02PlayerCharacter auto Event onActivate(ObjectReference AKActionRef) Actor TestMod02PlayerActor TestMod02PlayerActor = (game.getplayer() as ObjectReference) as Actor TestMod02PlayerCharacter.SendStoryEvent(akRef1 = TestMod02PlayerActor) Trace("CameraActivator triggered") endEvent CameramanScript Scriptname TestMod02CameraManScript extends ReferenceAlias{script for CameraMan} Event OnTranslationComplete()getowningquest().setstage(10)EndEvent Kudos go to Sinderions Bones who was giving very helpfull advice :thumbsup: Edit: I would like to stress, that I am not the first one who got this to workhttp://forums.bethsoft.com/topic/1348962-setplayercontrols-and-papyrus/ Edited March 27, 2012 by noctara Link to comment Share on other sites More sharing options...
AurelTristen Posted March 26, 2012 Share Posted March 26, 2012 Sounds amazing. You should post videos of some of the stuff you've pulled off with it! Also sounds like something that could eventually develop into a coop play mode if the right minds got together. I know there is that multiplayer mod out there, but last I checked, other players were nude T posed people flying around the map like a nightmare o_O. Link to comment Share on other sites More sharing options...
SinderionsBones Posted March 26, 2012 Share Posted March 26, 2012 Glad you got some implementations working. If I jump back into the mod I was originally working on this with I'll definitely use it :D In addition to the uses you mention (the scenes seeing the player from a detached camera is my favorite) I was planning on putting up a small play related quest (sort of like the one in tribunal), and it would be great to see it from the audience instead of first person while doing it. Do any of the functions that cause an npc to look at things cause the camera to turn there? It sounds like you took care of that, but I couldn't tell for sure. As if you didn't have a cool thing going, how about this: A chain of linked points for the camera to follow. Using: http://www.creationkit.com/GetNthLinkedRef_-_ObjectReferenceuse http://www.creationkit.com/CountLinkedRefChain_-_ObjectReference and, if you have control over the direction the camera is pointing, you could have it follow this path as a preprogrammed route to spice up the scene :D If you wanted to get fancy, you could even attach a script to the individual markers with custom property values and ask the next marker how fast to move and any other values you could think of as the camera is finishing it's translation. as in Currentmarkerref = Startmarkerref.GetNthLinkedref(currentmarkernumber)Cameraspeed = (Currentmarkerref as CameraMarkerScript).CameraSpeedvalue;then use that value for your translateto Either way good to see it's working out. What was the original thing you were working on again? I forget lol Link to comment Share on other sites More sharing options...
noctara Posted March 27, 2012 Author Share Posted March 27, 2012 (edited) Well, for the camera, to point into specific directions: - I used the moveto(match rotation) for the initial rotationdirection after changing to the control of the cameraman (for some reason he doesn't care about xmarkerheadings)- I also used the translatetoref() function in order to move to a xmarkerheading... what happens is, the camera does a neat little curve ending exactly in the determined rotation of the marker (you can change the movement and rotation speed as well in this function)- if you want to spice it up maybe u could try the translatetospline() function... never tried it though As for your idea about beeing part of the audience: - maybe u could try the setlookat() function - from my understanding the setcameratarget() function also should do what u wanted to achieve.... however I yet have to get this function actually doing what i want :whistling: One more thing i figured is, when u change the control u better use a ImageSpaceModifier (for a sec or two)... otherwise it looks a bit "clumsy" when the camera is switching the actors and the third/firstperson. It happens fast enough, so its not easy to recognise... but it just looks a bit "clumsy" PS: I am just working on an interactive furniture where i wanted to have a certain camera pov when playing the animations. I have a coffin (as a bed) for vampirecharacters and wanted the player to see the animations and effects when he/she is getting out. I didnt touch the modelling part yet (have quite a lot of respect of how complex the whole modelling stuff looks)... so far i used the nmcoffin as a dummy. Edited March 27, 2012 by noctara Link to comment Share on other sites More sharing options...
Recommended Posts