Jump to content

CameraCommands by Alenet


mem4ob4

Recommended Posts

Link-> CameraCommands by Alenet

If you like screwing with the camera in oblivion, this plugin can really add to your tool box.

Pay attention to the requirements though.

 

It only took a little bit of time to create a "see through another actors eye" type of touch spell.

 

 

 

scn scndsightspellscript

float iRVz      ;faceing angle of victim (target)
float iRPz      ;faceing angle of player
float iRdif     ;used to rotate camera to facing of victim
float iOdif     ;used to offset camera to stay infront of victim face
float iOy       ; y coord for offset
float iOx       ; x coord for offset
ref vict        ; victim (target) reference

Begin ScriptEffectStart
    set vict to GetSelf
    if vict == 0
        Dispel scndsightspell
        return
    endif
    if vict.IsActor == 0
        Dispel scndsightspell
        return
    endif
end

Begin ScriptEffectUpdate
    if vict.GetDistance Player > 5000
        ;cancel it all
        CameraReset
        Message "Your vision snaps to normal"
        Dispel scndsightspell
        return
    else

        set iRVz to vict.GetAngle z
        set iRPz to player.GetAngle z
        ;adjust rotation for actor facing
        set iRdif to iRPz - iRVz
        CameraRotate 0 0 iRdif
        ;adjust offset to infront of actor face
        set iOdif to iRVz - iRPz
        if iOdif < 0
            set iOdif to 360.00 + iOdif
        endif
        ;printC "dif %.4f" iOdif
        if iOdif == 0 || iOdif == 360
            set iOy to 15
            set iOx to 0
        elseif iOdif == 90
            set iOy to 0
            set iOx to 15
        elseif iOdif == 180
            set iOy to -15
            set iOx to 0
        elseif iOdif == 270
            set iOy to 0
            set iOx to -15
        elseif iOdif < 90
            set iOy to ( dcos iOdif ) * 15.00
            set iOx to ( dsin iOdif ) * 15.00
        elseif iOdif < 180
            set iOdif to iOdif - 90.00
            set iOy to ( dsin iOdif ) * 15.00
            set iOx to ( dcos iOdif ) * 15.00
            set iOy to iOy - ( iOy * 2.00 )
        elseif iOdif < 270
            set iOdif to iOdif - 180.00
            set iOy to ( dcos iOdif ) * 15.00
            set iOx to ( dsin iOdif ) * 15.00
            set iOy to iOy - ( iOy * 2.00 )
            set iOx to iOx - ( iOx * 2.00 )
        else
            set iOdif to iOdif - 270.00
            set iOy to ( dsin iOdif ) * 15.00
            set iOx to ( dcos iOdif ) * 15.00
            set iOx to iOx - ( iOx * 2.00 )
        endif
        CameraMove iOx iOy 0 vict
    endif
end

Begin ScriptEffectFinish
    CameraReset
    Message "Your vision returns to normal"
end

 

 

 

Anyone else have an interesting effect with this plugin?

Mem

(ps: thanks fejeena)

Link to comment

Yes, I saw his other mod. It is showing what his camera commands can do for the PC  :)

 

This script works for human and canine (should be any actor). You will be at doggie height. You can still move your Player around with normal movement controls (and auto-walk) so you can see what doggie sees as he follows behind you.

I have also noted that if you cast this on a second actor before time ends on first actor target, it will go to second actor after time on first actor expires. There is a lot of other testing to do but this is non-adult thread.

 

Mem

Link to comment

You need to have or create animations, then you can set a token on the ref on which you want to apply the animation and pickup the animation with the pickidle command. Then rotating or moving the camera. Anyway it is not possible to roll an actor, it can be done only by an animation. You can roll only the camera by my plugin.

Link to comment

V2 does have some really nice features Alenet.

 

The above script needed updating and I used the CameraRotateToPosition and CameraMoveToPosition.

 

 

 

scn scndsightspellscript

ref vict
float iVx
float iVy
float iVz
float iVzscale
float iVa
float iPa
float iAa
float iOdif
float iOx
float iOy
float iNose

Begin ScriptEffectStart
    set vict to GetSelf
    if vict == 0
        Dispel scndsightspell
        return
    endif
    if vict.IsActor == 0
        Dispel scndsightspell
        return
    endif
end

Begin ScriptEffectUpdate
    if vict.GetDistance Player > 8000
        ;cancel it all
        CameraReset
        Message "Your vision snaps to normal"
        Dispel scndsightspell
        return
    else
        set iVx to vict.GetPos x
        set iVy to vict.GetPos y
        set iVz to vict.GetPos z
        ;----------------
        ; figure height, check for human or specific creature
        ;----------------
        set iVzscale to vict.getScale ; get victs height
        set iVzscale to ( iVzscale * ( 115 - ( vict.IsSneaking * 20 ) ) )
        set iVz to iVz + iVzscale
        set iNose to 20.00
        if vict.GetIsCreature
            if vict.GetCreatureType == 0 ;dog etc.
                set iVz to vict.GetPos z
                set iVz to iVz + 60
                set iNose to 55.00
            elseif vict.GetCreatureType == 4 ;horse
                set iVz to vict.GetPos z
                set iVz to iVz + 125
                set iNose to 105.00
            else
               ;other
            endif
        endif
        ;----------------
        ;adjust rotation for actor facing
        ;----------------
        set iVa to vict.GetAngle z
        set iPa to player.GetAngle z
        set iAa to iVa - iPa
        set iAa to iAa - ( iAa * 2 )
        if iPa >= 180
            set iAa to iAa - iPa
        else
            set iAa to iAa + ( 360 - iPa )
        endif
        CameraRotateToPosition 0 0 iAa
        ;----------------
        ;figure offset for front face
        ;----------------
        set iOdif to iAa
        if iOdif < 0
            set iOdif to 360.00 + iOdif
        endif
        if iOdif == 0 || iOdif == 360
            set iOy to iNose
            set iOx to 0.00
        elseif iOdif == 90
            set iOy to 0.00
            set iOx to -iNose
        elseif iOdif == 180
            set iOy to -iNose
            set iOx to 0.00
        elseif iOdif == 270
            set iOy to 0.00
            set iOx to iNose
        elseif iOdif < 90 ; 1q
            set iOx to ( dsin iOdif ) * iNose
            set iOy to ( dcos iOdif ) * iNose
            set iOx to iOx - ( iOx * 2.00 )
        elseif iOdif < 180
            set iOdif to iOdif - 90.00
            set iOx to ( dcos iOdif ) * iNose
            set iOy to ( dsin iOdif ) * iNose
            set iOy to iOy - ( iOy * 2.00 )
            set iOx to iOx - ( iOx * 2.00 )
        elseif iOdif < 270
            set iOdif to iOdif - 180.00
            set iOx to ( dsin iOdif ) * iNose
            set iOy to ( dcos iOdif ) * iNose
            set iOy to iOy - ( iOy * 2.00 )
        else
            set iOdif to iOdif - 270.00
            set iOy to ( dcos iOdif ) * iNose
            set iOx to ( dsin iOdif ) * iNose
        endif
        set iVx to iVx + iOx
        set iVy to iVy + iOy
        CameraMoveToPosition iVx iVy iVz
    endif
end

Begin ScriptEffectFinish
    CameraReset
    Message "Your vision returns to normal"
end

 

 

 

It has been giving me a lot of fun :)

 

Mem

Link to comment
  • 2 weeks later...
  • 2 months later...

Quick question for Alenet

 

I've been trying to use this plugin to bind the camera to the head node of an npc to create a fake first person for them. Is there a way to directly attach the camera to the head bone of an npcs skeleton? Logic Dragon manages to do it for the player in his enhanced camera mod, and it allows for a "fake first person" mode where third person animations can be played in what looks just like first person.

A good example can be seen in this pic http://static-1.nexusmods.com/15/mods/101/images/44337-3-1384141698.jpgwhere the player is playing an eating animation in fake first person. I basically wanted to replicate this but for an npc.

Thanks for this great plugin.

Link to comment
  • 1 month later...

V2 does have some really nice features Alenet.

 

The above script needed updating and I used the CameraRotateToPosition and CameraMoveToPosition.

 

 

 

scn scndsightspellscript

ref vict
float iVx
float iVy
float iVz
float iVzscale
float iVa
float iPa
float iAa
float iOdif
float iOx
float iOy
float iNose

Begin ScriptEffectStart
    set vict to GetSelf
    if vict == 0
        Dispel scndsightspell
        return
    endif
    if vict.IsActor == 0
        Dispel scndsightspell
        return
    endif
end

Begin ScriptEffectUpdate
    if vict.GetDistance Player > 8000
        ;cancel it all
        CameraReset
        Message "Your vision snaps to normal"
        Dispel scndsightspell
        return
    else
        set iVx to vict.GetPos x
        set iVy to vict.GetPos y
        set iVz to vict.GetPos z
        ;----------------
        ; figure height, check for human or specific creature
        ;----------------
        set iVzscale to vict.getScale ; get victs height
        set iVzscale to ( iVzscale * ( 115 - ( vict.IsSneaking * 20 ) ) )
        set iVz to iVz + iVzscale
        set iNose to 20.00
        if vict.GetIsCreature
            if vict.GetCreatureType == 0 ;dog etc.
                set iVz to vict.GetPos z
                set iVz to iVz + 60
                set iNose to 55.00
            elseif vict.GetCreatureType == 4 ;horse
                set iVz to vict.GetPos z
                set iVz to iVz + 125
                set iNose to 105.00
            else
               ;other
            endif
        endif
        ;----------------
        ;adjust rotation for actor facing
        ;----------------
        set iVa to vict.GetAngle z
        set iPa to player.GetAngle z
        set iAa to iVa - iPa
        set iAa to iAa - ( iAa * 2 )
        if iPa >= 180
            set iAa to iAa - iPa
        else
            set iAa to iAa + ( 360 - iPa )
        endif
        CameraRotateToPosition 0 0 iAa
        ;----------------
        ;figure offset for front face
        ;----------------
        set iOdif to iAa
        if iOdif < 0
            set iOdif to 360.00 + iOdif
        endif
        if iOdif == 0 || iOdif == 360
            set iOy to iNose
            set iOx to 0.00
        elseif iOdif == 90
            set iOy to 0.00
            set iOx to -iNose
        elseif iOdif == 180
            set iOy to -iNose
            set iOx to 0.00
        elseif iOdif == 270
            set iOy to 0.00
            set iOx to iNose
        elseif iOdif < 90 ; 1q
            set iOx to ( dsin iOdif ) * iNose
            set iOy to ( dcos iOdif ) * iNose
            set iOx to iOx - ( iOx * 2.00 )
        elseif iOdif < 180
            set iOdif to iOdif - 90.00
            set iOx to ( dcos iOdif ) * iNose
            set iOy to ( dsin iOdif ) * iNose
            set iOy to iOy - ( iOy * 2.00 )
            set iOx to iOx - ( iOx * 2.00 )
        elseif iOdif < 270
            set iOdif to iOdif - 180.00
            set iOx to ( dsin iOdif ) * iNose
            set iOy to ( dcos iOdif ) * iNose
            set iOy to iOy - ( iOy * 2.00 )
        else
            set iOdif to iOdif - 270.00
            set iOy to ( dcos iOdif ) * iNose
            set iOx to ( dsin iOdif ) * iNose
        endif
        set iVx to iVx + iOx
        set iVy to iVy + iOy
        CameraMoveToPosition iVx iVy iVz
    endif
end

Begin ScriptEffectFinish
    CameraReset
    Message "Your vision returns to normal"
end

 

 

 

It has been giving me a lot of fun :)

 

Mem

 

Mem, I found a nice ring resource from strotis, and was wondering if you would be ok with me putting your script into making a Ring of Second Sight.

Link to comment

Well, my ambitions have changed a little bit. I'm now hoping to make a ring that will give a summon spell for a raven, then give the raven a "spy" ability. Ever see The Crow? Kind of like that, except I also need to figure out how to be able to control the raven too. A side project to help me get better with scripting. Will be my first real mod, instead of just modifying someone elses or the one patch I made.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use