generated from ShadowMario/FNF-PsychEngine
-
Notifications
You must be signed in to change notification settings - Fork 11
Video Cutscenes
Joalor64 edited this page Jun 15, 2024
·
4 revisions
The video formats currently supported are .mp4
, .webm
, and .swf
.
To play an .mp4
/.webm
video, you'll need a simple .lua
script (and, of course, your video).
Here is an example script:
playVideo = true;
function onStartCountdown()
if isStoryMode and not seenCutscene then
if playVideo then --Video cutscene plays
startVideo('your_video_here', 'type'); --Play video file from "videos/" folder, type can be 'mp4' or 'webm'
playVideo = false;
return Function_Stop; --Prevents the song from starting naturally
end
end
return Function_Continue; --Played video, now the song can start normally
end
Here's an example script for if you want dialogue after:
playVideo = true;
playDialogue = true;
function onStartCountdown()
if isStoryMode and not seenCutscene then
if playVideo then --Video cutscene plays first
startVideo('your_video_here', 'type'); --Play video file from "videos/" folder
playVideo = false;
return Function_Stop; --Prevents the song from starting naturally
elseif playDialogue then --Once the video ends it calls onStartCountdown again. Play dialogue this time
startDialogue('dialogue', 'music'); --"music" is the dialogue music file from "music/" folder
playDialogue = false;
return Function_Stop; --Prevents the song from starting naturally
end
end
return Function_Continue; --Played video and dialogue, now the song can start normally
end
Alternatively, you can use this code to play videos:
startVideo('video', 'type');
For .swf
, it's mostly the same thing, but with a flash file.
Example script:
playMovie = true;
function onStartCountdown()
if isStoryMode and not seenCutscene then
if playMovie then --Cutscene plays first
startMovie('flash'); --Play flash file from "flash/" folder
playMovie = false;
return Function_Stop; --Prevents the song from starting naturally
end
end
return Function_Continue; --Played cutscene, now the song can start normally
end
Example script with dialogue:
playMovie = true;
playDialogue = true;
function onStartCountdown()
if isStoryMode and not seenCutscene then
if playMovie then --Cutscene plays first
startMovie('flash'); --Play flash file from "flash/" folder
playMovie = false;
return Function_Stop; --Prevents the song from starting naturally
elseif playDialogue then --Once the video ends it calls onStartCountdown again. Play dialogue this time
startDialogue('dialogue', 'music'); --"music" is the dialogue music file from "music/" folder
playDialogue = false;
return Function_Stop; --Prevents the song from starting naturally
end
end
return Function_Continue; --Played cutscene and dialogue, now the song can start normally
end