Jump to content

Fade to black with an activator


JkKILER

Recommended Posts

Hey everyone, not sure if anyone knows how to do this, but I want to make the following happen:

1. Player activates a switch

2. Shows a chem effect such as a chem wearing off

3. fades to black

4. player wakes up in another room

 

I only really need the help with the fade to black part

Any help is appreciated!

Link to comment
Share on other sites

I suggest you become familiar with these script commands:

 

DisablePlayerControls ;turn off player controls, don't want him moving while we script the effects
PipboyRadioOff ;turn off radio in case other sounds are to be played during the sequence

imod ;play an image space modifier such as 'fade to black' or 'fade from black'

moveto ;moves players and NPC to new location like an XMarker

EnablePlayerControls ;Lets the player move again

 

Note: When moving the player during a scripted sequence such as you are describing, you may need to also script any and all followers to move or 'freeze' as well. If you want them frozen for a while, I like to use the SetUnconscious command. Though, determining which NPCs are followers from a script require using FOSE commands.

Edited by pkleiss
Link to comment
Share on other sites

Gotcha thanks a ton, one last question, does the script need to be an effect script? or can it be an object?

Also, what effect is the one when chems wear off?

Edited by JkKILER
Link to comment
Share on other sites

I think the chem wearing off is an effect shader, not an image space modifier like fade to black. Effects are played with PMS (play magic shader) and removed with SMS (Stop magic shader) commands.

 

You will probably want this to be an object script or quest script, but not an effect script. Here is a sample script I made that does much of what you want...

SCN UCACEFireTrapTriggerScript

Float fTimer                                                            ;staged timer time variable
Float mTimer                                                        ;timer for moving followers
Short pFireRes                                                        ;Stores player's fire resistance
Short fStage                                                            ;staged timer stage variable
Short DoOnce                                                        ;ensures trap only fires once
Short CheckFollowers                                            ;when set to 1, will move followers
Short NPCCount                                                    ;holds the number of followers
Ref rCurRef                                                            ;holds the ref in actor walking


Begin OnTriggerEnter Player
    If DoOnce == 0
        Set pFireRes to player.GetBaseAV FireResist   ;Store players fire resistance
        player.SetAv FireResist 25                    ;temporarily give Player 30% fire resistance
        UCACEFireTrap.enable                          ;start the fire trap
        player.moveto UCACEFireTrapPlayerXM           ;ensure player is facing the right direction
        DisablePlayerControls 1 1 1 1 1 1 1           ;turn off player controls
        PipboyRadioOff                                ;turn off radio if its on
        Set fTimer to 3                               ;Stage 0 lasts for 3 seconds
        Set DoOnce to 1                               ;trap can only be set off once
    Endif
End

Begin GameMode
    If fTimer < 0 && DoOnce == 1
        If fStage == 0                               ;start stage 0 - player falls down
            Set UCMain.PlayerFalldown to 1           ;used for AI package conditions
            player.addscriptpackage UCACEPlayerFallsDownPackage    ;make the player fall down
            Set CheckFollowers to 1                 ;Turns on the follower move section
            Set fTimer to 3                         ;Next stage lasts for 3 seconds
            Set fStage to 1                         ;Setup next stage
            Return                                  ;used for efficiency
        ElseIf fStage == 1                     ;starts stage 1 - starts sentrybot stuff
            UCACEFireTrap.disable                   ;turn off fire trap
            UCACESentryBot01Ref.enable             ;enable sentrybot
            UCACESentryBot01Ref.evp                ;set sentrybot AI to move to player
            player.SetAv FireResist pFireRes       ;Restore player fire resist after fire trap
            Set fTimer to 25                      ;Next stage lasts 25 seconds as SB has some dialogue
            Set fStage to 2                             ;setup stage 2
            Return                                      ;used for efficiency
        ElseIf fStage == 2                       ;start stage 2 - player passes out and screen fades to white
            imod FadetoWhiteISFX                 ;fade screen to white
            Set fTimer to 3                      ;Next stage lasts 3 seconds
            Set fStage to 3                      ;setup stage 3
            Return                               ;used for efficiency
        ElseIf fStage ==3                        ;start stage 3 - player move and cleanup
            Player.moveto ACECellBlockMarker0     ;move player to his prison cell
            Set fTimer to 1                       ;Next stage lasts for 1 second
            Set fStage to 4                       ;setup stage 4
        ElseIf fStage ==4                  ;Stage 4 - return player to normal operation
            player.removeallItems UCACEGunCabinet02Ref 1    ;player is stripped of his items
            Set UCMain.PlayerFalldown to 0             ;used for AI Package selection
            UCACESentryBot01Ref.evp    
            player.removescriptpackage UCACEPlayerFallsDownPackage   ;player can get up
            Player.evp                                      ;not sure if this is needed
            imod FadeInFromWhiteISFX                        ;fade back to normal
            EnablePlayerControls                      ;player controls are active again
            Set fStage to 5                            ;ensure no stages are run twice
            Set DoOnce to 2                               ;stop staged timer sequence
        Endif    
    Else
        Set fTimer to fTimer - GetSecondsPassed
        If (player.getAV Health <= (player.GetbaseAV Health * 0.9))
            ;player health check goes here to prevent player from dying from flames
        Endif
    Endif

    If CheckFollowers == 1                             ;follower move section
    set rCurRef to GetFirstRef 200 0 0                 ;All actors
        Label 10
        if rCurRef                                ;Is it an actor, and is it a follower
            if (rCurRef.GetPackagetarget == player) && (rCurRef.GetCurrentAIpackage == 1)
                rCurRef.DamageAV Fatigue -300               ;knock out followers
                set rCurRef to GetNextRef
                Goto 10
            else
                set rCurRef to GetNextRef
                Goto 10
            Endif
        Endif
        Set mTimer to 3                     ;wait 3 seconds before moving the followers
        Set CheckFollowers to 2             ;setup next stage for moving followers
        Return                              ;end this iteration now
    ElseIf CheckFollowers == 2 && mTimer <= 0       ;Start stage 2 of move followers
        set rCurRef to GetFirstRef 200 0 0          ;All actors
        Label 20
        if rCurRef
            if (rCurRef.GetPackagetarget == player) && (rCurRef.GetCurrentAIpackage == 1)
                Set NPCCount to NPCCount + 1
                rCurRef.SetUnconscious 1
                If NPCCount == 1
                    rCurRef.moveto ACECellBlockMarker1
                Elseif NPCCount == 2
                    rCurRef.moveto ACECellBlockMarker2
                Elseif NPCCount == 3
                    rCurRef.moveto ACECellBlockMarker3
                Elseif NPCCount == 4
                    rCurRef.moveto ACECellBlockMarker4
                Elseif NPCCount == 5
                    rCurRef.moveto ACECellBlockMarker5
                Elseif NPCCount == 6
                    rCurRef.moveto ACECellBlockMarker6
                Elseif NPCCount == 7
                    rCurRef.moveto ACECellBlockMarker7
                Elseif NPCCount == 8
                    rCurRef.moveto ACECellBlockMarker8
                Endif
                set rCurRef to GetNextRef
                Goto 20
            else
                set rCurRef to GetNextRef
                Goto 20
            Endif
        Endif
        Set Checkfollowers to 3
    Endif
    If mTimer > 0
        Set mTimer to mTimer - GetSecondsPassed
    Endif
End

This script runs on a trigger as an object script and does a bit more than what you want, like relocating up to 8 followers into individual (jail) cells.

Edited by pkleiss
Link to comment
Share on other sites

  • Recently Browsing   0 members

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