How to check if the camera is in first person or third

Post » Wed Jun 20, 2012 5:38 pm

I'm wanting to use a script to check if the player is in first person, if so, force the camera to third person, play my animation, then put it back to first person when finished.

I looked at the workbench but it looks like it uses a keyword on the ojbect force3rdperson to pull this off and is hard coded.

I found the commands Game.ForceThirdPerson() and Game.ForceFirstPerson() which do what I want, but I have no clue how to test conditions to see what the camera currently is so I can write my script.
User avatar
Jarrett Willis
 
Posts: 3409
Joined: Thu Jul 19, 2007 6:01 pm

Post » Wed Jun 20, 2012 9:12 pm

You don't need to know what camera they are in, just force 3rd person. If they are in 1st, they will go to 3rd. If they are already in 3rd, nothing happens.
User avatar
CHARLODDE
 
Posts: 3408
Joined: Mon Apr 23, 2007 5:33 pm

Post » Wed Jun 20, 2012 2:35 pm

You don't need to know what camera they are in, just force 3rd person. If they are in 1st, they will go to 3rd. If they are already in 3rd, nothing happens.
Well I kind of do, because what if they are in third person already, I don't want to force 1st person upon them when the animation is finished.

If in third person (great don't need to do anything)
else;means they were in first person
force third person
play animation
force first person when anim finished

As you can see, if they are in third person to begin with, I don't want to put them in first person when I'm done playing the animation, I want them to be in the same camera mode they were in. And vice versa, I do not want to force first person players into third person and not put them back to first when my anim is completed.

I want it to behave exactly like work benches do... the game remembers your current position, forces third if it needs to, plays anim, puts the camera back the way it was when your done.
User avatar
Nichola Haynes
 
Posts: 3457
Joined: Tue Aug 01, 2006 4:54 pm

Post » Wed Jun 20, 2012 3:43 pm

Game.GetPlayer().GetAnimationVariableInt(i1stPerson)
User avatar
SamanthaLove
 
Posts: 3565
Joined: Mon Dec 11, 2006 3:54 am

Post » Thu Jun 21, 2012 5:53 am

Game.GetPlayer().GetAnimationVariableInt(i1stPerson)

I tried that like this:

    If Game.GetPlayer().GetAnimationVariableInt(i1stPerson) == 1    Game.ForceThirdPerson()    endif
And I get an error:
variable i1stPerson is undefined
User avatar
Chloe Lou
 
Posts: 3476
Joined: Sat Nov 04, 2006 2:08 am

Post » Wed Jun 20, 2012 10:08 pm

Game.GetPlayer().GetAnimationVariableInt("i1stPerson")
User avatar
CHARLODDE
 
Posts: 3408
Joined: Mon Apr 23, 2007 5:33 pm

Post » Wed Jun 20, 2012 4:16 pm

Game.GetPlayer().GetAnimationVariableInt("i1stPerson")
Yes that has been said already, but how do you use it? I get errors if I just paste that line in. I need it in an if statement.
User avatar
Nick Jase Mason
 
Posts: 3432
Joined: Sun Jul 29, 2007 1:23 am

Post » Wed Jun 20, 2012 10:01 pm

The first statement was wrong: the parameter must be a string so you have to use the " " with "i1stPerson"

Game.GetPlayer().GetAnimationVariableInt("i1stPerson") == 1 (if the player is in first person view)

Since the returned value is a Int, I dont know you only get 0 or 1 (From what I have seen, it 's the case, but I have no other proof than my own testing)
User avatar
Add Me
 
Posts: 3486
Joined: Thu Jul 05, 2007 8:21 am

Post » Thu Jun 21, 2012 12:42 am

The first statement was wrong: the parameter must be a string so you have to use the " " with "i1stPerson"

Game.GetPlayer().GetAnimationVariableInt("i1stPerson") == 1 (if the player is in first person view)

Since the returned value is a Int, I dont know you only get 0 or 1 (From what I have seen, it 's the case, but I have no other proof than my own testing)
Works perfect in an if statement. Thanks!
User avatar
James Potter
 
Posts: 3418
Joined: Sat Jul 07, 2007 11:40 am

Post » Wed Jun 20, 2012 7:00 pm

And I get an error:
variable i1stPerson is undefined
The syntax calls for quotation marks, is what I was saying.
User avatar
celebrity
 
Posts: 3522
Joined: Mon Jul 02, 2007 12:53 pm


Return to V - Skyrim