Jump to content

FadeToBlack script help please :)


Recommended Posts

I'm working on a scene that's going to be pretty close to the end of a mod I'm working on. I need the scene to fade to black at a certain point, due to a lot of enabling and disabling that'll be going on in the background.

 

The idea here is an ascended being is destroying an entire village with a spell.

 

 

In this scene, the NPC casts a spell, the next phase is a 5 second timer that then sets the next stage of the quest, which in turn, enables a trigger box where the player will already be standing.

 

The script on this newly enabled trigger box is what I'm having issues with...

 

I want the screen to go black, set the quest to next stage, which will disable all the buildings, enable the destroyed version and kill all of the nearby NPCs (I have the quest papyrus to enable/disable/kill working fine).

 

I just can't figure out the script to put onto the trigger box.

 

The most recent script I tried is made up of pieces of scripts that I found here on the forum, but will not compile:

 

Quest Property Three Auto
Actor Property PlayerREF Auto
ImageSpaceModifier Property FadeToBlack auto
ImageSpaceModifier Property FadeFromBlack auto


Event OnTriggerEnter(ObjectReference akActionRef)
If akActionRef == PlayerREF
Function DoFadeOut(float time)
    FadeToBlack.Apply()
    Utility.Wait(time)
    Game.FadeOutGame(False,True,50, 1)
EndFunction
Three.SetStage(64)
Function DoFadeIn(float time)
    Game.FadeOutGame(False,True,0.1, 0.1)
   FadeToBlack.PopTo(FadeFromBlack)
EndFunction
EndIf
EndEvent

Errors:

1. Mismatched input 'Function' expecting ENDIF

2. require (...)+ loop did not match anything at input ')'

3. function variable time already defined in the containing script

4. missing EOF at 'EndIf'

 

 

 

Any and all help is appreciated.

 

Also the Image Space Modifier properties, I used them because the similar script on the forums did as well, but I have no clue what to set for those properties. Any advice on that is also appreciated!

 

Link to comment
Share on other sites

Easy method.

 

use a quest stage

 

create an Image Space Modifier property that points to the fade to black imod (or copy one and alter settings).

 

In your chosen quest stage, generate a script by typing Utility.Wait(0.5)

 

open script and add an image space modifier property. ..name it and then point it to a chosen fade to black imod.

 

Now in your quest stage tab, add the script

 

MyImodname.Apply()

 

 

 

Note: take a peek at thieves guild quests. Image space mods are used to make player unconscious whilst being moved to a new location.

 

Hope this helps

Link to comment
Share on other sites

Thank you very, very much! I wasn't aware this type of script could go into quests :P I almost always make a trigger enabled for the more complicated scripts lol

 

Have to go for awhile, will check out the CK wiki page when I get home in a couple of hours.

 

Thank you again :)

Link to comment
Share on other sites

An issue I currently see is having your functions defined within your If statement within the event. Move both functions outside the Event block. Then call your functions within the Event block and give each your time interval (don't see time used in either function currently).

 

Not immediately sure what ImageSpaceModifier has for functions without the CK page : http://www.creationkit.com/ImageSpaceModifier_Script

 

Looks like you might want to use the apply and remove functions for the ImageSpaceModifier properties, and have the game Utility.wait (time) in between the apply and remove calls.

Link to comment
Share on other sites

Don't forget FadeOutGame() in addition to imagespacemodifiers. If using ENB, screen won't fade completely to black without it.

 

This is a good reference:

http://forums.nexusmods.com/index.php?/topic/951896-improved-cutscenes-with-cinematic-camera-fades-and-more/

 

Edited to add:

Looking at your script again, I see you're using a timed wait function to wait while other things happen. I would use modevents instead, and call the modevent when your other functions are finished. Or, if not using SKSE, put the black screen in your other functions.

 

Scripts can take very different times to execute on different people's computers. Especially if they (as yours inevitably does with what you're doing) call delayed functions, which are tied to framerate.

Edited by jayne2132
Link to comment
Share on other sites

Don't forget FadeOutGame() in addition to imagespacemodifiers. If using ENB, screen won't fade completely to black without it.

 

This is a good reference:

http://forums.nexusmods.com/index.php?/topic/951896-improved-cutscenes-with-cinematic-camera-fades-and-more/

 

Edited to add:

Looking at your script again, I see you're using a timed wait function to wait while other things happen. I would use modevents instead, and call the modevent when your other functions are finished. Or, if not using SKSE, put the black screen in your other functions.

 

Scripts can take very different times to execute on different people's computers. Especially if they (as yours inevitably does with what you're doing) call delayed functions, which are tied to framerate.

Proof that we are all have something to learn. Never heard of fade out game before.

 

Top Banana

Link to comment
Share on other sites

  • 1 year later...

Here's a pure script solution I put together based on the CarriageSystemScript:

; Fades the screen to black and holds it there.  Call FadeFromBlack() to reverse it.
Function FadeToBlackAndHold() global
    ImageSpaceModifier FadeToBlackImod = Game.GetFormFromFile(0x0f756d, "Skyrim.esm")\
        as ImageSpaceModifier
    ImageSpaceModifier FadeToBlackHoldImod = Game.GetFormFromFile(0x0f756e, "Skyrim.esm")\
        as ImageSpaceModifier
    FadeToBlackImod.Apply()
    Utility.Wait(2)
    FadeToBlackImod.PopTo(FadeToBlackHoldImod)
EndFunction

; Fades the screen from black back to normal.  Reverses the effects of FadeToBlackAndHold().
Function FadeFromBlack() global
    ImageSpaceModifier FadeToBlackHoldImod = Game.GetFormFromFile(0x0f756e, "Skyrim.esm")\
        as ImageSpaceModifier
    ImageSpaceModifier FadeToBlackBackImod = Game.GetFormFromFile(0x0f756f, "Skyrim.esm")\
        as ImageSpaceModifier
    Utility.Wait(2)
    FadeToBlackHoldImod.PopTo(FadeToBlackBackImod)
    FadeToBlackHoldImod.Remove()
EndFunction
Edited by sevencardz
Link to comment
Share on other sites

  • Recently Browsing   0 members

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