Skyrim

1. Create a Global Variable (GV).
a. Object Window > Miscellaneous > Global --> right click in right side pane and select New
b. Assign useful ID name, set Variable Type to short, Value to 1, press OK to save -- you may use any single digit value you want. I just chose to go with 1 because game starts in 1st person and the GV will start with this assigned value. so GV of 1 = 1st person view

2. Create a scripted magic effect
a. Object Window > Magic > Magic Effect --> in right side pane locate AbBlank, right click and choose edit
b. Change the ID name, Change the Name,
c. Press OK to close the form and save it. Then reopen it. -- This is needed to ensure the script will attach to the form.
d. Add the following script to the Papyrus script section

Scriptname abIM_1stPersonViewME_Script extends activemagiceffect
{The script that passes 1st person view from an ability condition into Papyrus}

GlobalVariable Property abIM_1stPersonView Auto
;game starts in 1st person so default will be value of 1 for 1st person and 0 for 3rd person

Event OnEffectStart(Actor akTarget, Actor akCaster)
; Debug.Notification ("IsPC1stPerson = True")
; Debug.Trace ("IsPC1stPerson = True")
abIM_1stPersonView.SetValueInt(1)
EndEvent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
; Debug.Notification ("IsPC1stPerson = False")
; Debug.Trace ("IsPC1stPerson = False")
abIM_1stPersonView.SetValueInt(0)
EndEvent
Feel free to give the script a different name and change the GV name to match the name you gave your GV. You can also drop the Debug messages after initial testing. As you can see I've already commented them out.
e. Assign your GV to the GV property, then press OK to save

3. Create a Spell Ability (the passive things like racial abilities)
a. Object Window > Magic > Spell > Ability --> right click in right pane and select New
b. Assign ID name, give it a name, set Type to Ability, give it a description
c. In Effects box, right click and select New
d. In the new window that pops up, select the Magic Effect created earlier in the drop down labeled Effect
e. In the Conditions box, right click and select New -- If a warning box pops up press Yes to all
f. In the even smaller window that pops up, set Condition Function to IsPC1stPerson and RunOn to Player, press OK to save this window
g. Press OK to save the slightly bigger Effect window
h. Press OK to save the main Ability window

4. To assign effect to player, Create a blank quest
a. Object window > Character > Quest --> right click in right pane and select New
b. Select Quest Data tab, assign an ID name, check Start Game Enabled, check Run Once, leave Type at None so it doesn't show up on your quest log
c. Select Quest Aliases tab, right click in the Aliases box
d. In the box that pops up, assign an Alias Name
e. Under Fill Type select Unique Actor and assign Player from the drop down
f. In Alias Spells, right click select Add and choose the Ability created earlier
g. Press OK to save -- Note if you can't see the OK button, click on the Alias Name field and press Enter to save the form

5. Use the global variables to do something.
Since mod authors make different kinds of mods I cannot go thru this step and be accurate to all. Therefore I will just give a quick script example

{previous script stuff}

Int LocalViewToggleState = 0

{some if statement or function/event}

;if in 1st force third
If abIM_1stPersonView.GetValueInt() == 1
LocalViewToggleState = 1
Game.ForceThirdPerson()
EndIf

{do animation type stuff}

;if local view was switched to third return it to first
If LocalViewToggleState == 1
LocalViewToggleState = 0
Game.ForceFirstPerson()
EndIf

{rest of script}

Article information

Added on

Edited on

Written by

IsharaMeradin

4 comments

  1. IsharaMeradin
    IsharaMeradin
    • premium
    • 281 kudos
    Added a correction (missing step) as reported in the main comment thread & removed the spoiler tags. I hope the post isn't too long for those reading in forum view.
  2. IsharaMeradin
    IsharaMeradin
    • premium
    • 281 kudos
    @mannygt -- now I see what you mean... I formatted the article for display within the forum because it wouldn't allow me to see the article at first from the description page. Thus the spoiler tag made sense....
  3. IsharaMeradin
    IsharaMeradin
    • premium
    • 281 kudos

    Please use tag QUOTE instead of SPOILER <img class=">
    Is much better!

    I disagree. Using QUOTE instead of SPOILER would make an already long post even longer.
  4. mannygt
    mannygt
    • premium
    • 1,499 kudos
    Please use tag QUOTE instead of SPOILER
    Is much better!