Having some issues with fade to black

So I’m working on a small little module to get my bariing on the toolset and a issue making the screen fade to black.

What I want to happen is for the pc to click on a bed and have the screen fade to black for two seconds before fading back in. But I must be doing something wrong because it’s not working.

Please post the script fragment that’s not working.

Oh yeah here.

void main()
{

ActionDoCommand(FadeToBlack(OBJECT_SELF, FADE_SPEED_MEDIUM)) ;

ActionWait(2.0) ;

ActionDoCommand(FadeFromBlack(OBJECT_SELF, FADE_SPEED_MEDIUM)) ;

}

Again I’m still new at this.

Assuming this is an OnUsed script, OBJECT_SELF is the bed. FadeToBlack works for creatures, so you need to do it this way…

void main()
{
     object oPC = GetLastUsedBy();
     FadeToBlack(oPC, FADE_SPEED_MEDIUM);
     DelayCommand(2.0, FadeFromBlack(oPC, FADE_SPEED_MEDIUM));
}

If that doesn’t work, you’ll need to use AssignCommand to assign the Fade commands to the PC like so…

AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionDoCommand(FadeToBlack(oPC)));
AssignCommand(oPC, ActionDocommand(ActionWait(2.0)));
AssignCommand(oPC, ActionDoCommand(FadeFromBlack(oPC)));

EDIT - Fixed script (ty @jimdad55 ) and as mentioned below, make sure the Useable flag is checked.

1 Like

Thanks but neither of those worked.

I click on the bed and nothing happens.

Can’t believe I’m saying this as I’m the world’s worst scripter but two things to try

  1. In bed properties make sure you tick Useable.

  2. In that first script from @Pstemarie try removing one of the brackets after the first FADE_SPEED_MEDIUM in the line that starts FadeToBlack. I think there is one too many

1 Like

Thank you that worked.

No problem.

Sits and waits for @Tarot_Redhand to pass by and offer effusive praise for grasshopper . . . . :grinning:

May do once I recover from the shock… :joy_cat:

TR

1 Like