Jump to content

Script Problems


ImInTheMastersArmy

Recommended Posts

To pass out, you'll need to create a custom AI Package that uses a custom idle like the LooseMQ08PlayerCaptured idle used when the player gets gassed and passes out in Raven Rock (or you can damage his fatigue stat, but that regenerates). Then you'll need to apply that package to the player with the script command: player.addscriptpackage NameOfYourPackageGoesHere.

 

The entire script will probably need to be a staged timer, with each stage (or action) taking a specific amount of time. You can fade to white (or black) using the imod (image space modifier) command in one stage and fade back in another. In between, you'll want to do one of two things: either move the player to a new but similar cell with the blood and key, or place those objects in the same cell, but mark them as initially disabled, then enable them while the player is knocked out.

 

I won't write the script for you, but I will post a script I wrote that does much of what you want (just not the enable stuff)...

 

This script was placed on a trigger object. It made the player fall to the ground after tripping a fire trap. While on the ground, a sentry bot came by and spoke before the player fell unconscious. While unconscious, the player along with all of his followers were placed in individual jail cells and all his items were moved to a locker. Then the player woke.

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 25% 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

;        player.setalert 1

        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
Link to comment
Share on other sites

  • Recently Browsing   0 members

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