Jump to content

Please Help: Scripting a Fade to black scene.


Guest Messenjah

Recommended Posts

Guest Messenjah

So, I've written a script for a fade-to-black sequence and based it on the one used for Joanna's scene.

 

Here is the code:

Short myScene

If myScene == 1

	Set Timer to Timer + GetSecondsPassed

		If iStage < 1

			ApplyImageSpaceModifier FadeToBlackPermanent
			DisablePlayerControls
			Set iStage to 1

		Elseif (iStage == 1) && (Timer >= 5)

			myNPC.RemoveScriptPackage
			ApplyImageSpaceModifier BlackSexISFX
			Set iStage to 2

		Elseif (iStage == 2) && (Timer >= 11)

			Set iStage to 3

		Elseif (iStage == 3) && (Timer >= 17)


			Set GameHour to GameHour + 1
			EnablePlayerControls
			Player.CIOS WellRestedSpell
			Set Timer to 0
			Set myScene to 0
			RemoveImageSpaceModifier BlackSexISFX
			ApplyImageSpaceModifier FadeInFromBlack4sISFX
			Return
		Endif
	Endif

The problem is that the player controls never seem to re-enable. The scene fades back in however, but I'm not certain the code is actually executing for the last bit. Any ideas on how to get this to work?

Link to comment
Share on other sites

hm code looks fine.

So these lines execute

RemoveImageSpaceModifier BlackSexISFX
ApplyImageSpaceModifier FadeInFromBlack4sISFX

But control is not enabled?

 

If so...

You need to spam "enableplayercontrols" before controls becomes enabled

try using

If getPlayerControlsDisabled 1 == 0 ; if player movement is NOT disable
  ;stop the scene, unfade black screen
else ; if player movement is disabled
  enableplayercontrols 
endif
Link to comment
Share on other sites

Guest Messenjah

Well, it is weird... I don't know if it executes that line or not? I tried to put a debug message in using showmessage but I never did see the message so I assume note. The screen did seem to fade back in though?

Link to comment
Share on other sites

Post the whole script, if show message isn't working, you have an error or the script is crashing/stopping for some reason. A common mistake is using an int variable with GetSecondsPassed rather than a float, or spell script with a 0 duration.

 

My standard FTB script would be to use a quest with a 1-second delay, with a template like:

int iStage
int iDelay
 
Begin GameMode ; 1 second quest delay
 
    if iDelay > 0
        let iDelay -= 1
        return
    endif
    if iStage == 0
        imod FadeToBlackPermanent
        set iStage to 10
        set iDelay to 5
    elseif iStage == 10
        rimod FadeToBlackPermanent
        StopQuest MyFTBQuest
        return
   endif
 
End
Edited by Hemingway308
Link to comment
Share on other sites

  • Recently Browsing   0 members

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