Page 2 of 2

Re: Cutscene Design

Posted: Fri Jan 02, 2009 12:57 pm
by trufun202
To finish out this thread, I did end up going Falco's route. I have a separate Lua script for each cutscene, and once turned on, the engine calls the UpdateCutscene() method each frame. I use the filmTicks variable to keep track what events have occurred.

Here's the script for my cutscene:

Code: Select all

function UpdateCutscene(timeSinceLastFrame)

	filmTicks = 0
	filmTime = 0

	if not IsNull("FilmTicks") then
		filmTicks = tonumber(GetValue("FilmTicks"))
	end

	if not IsNull("FilmTime") then
		filmTime = tonumber(GetValue("FilmTime"))
	end

	filmTime = filmTime + timeSinceLastFrame
		
	if filmTicks == 0 then
		--************************************************
		--Scene 1 - Aleid
		--************************************************
		filmTicks = 1
		
		--Hide Kelesis
		SetEntityVisible("Kelesis", false)
		
		--start the subtitles
		subTitle = CreateSubTitleManager(5)
		subTitle:AddLine("Years ago, in the Kingdom of Aleid,");
		subTitle:AddLine("the Valley of Life was the only source of water.")
		subTitle:AddLine("People of Aleid were tormented by the evil Golvellius,")
		subTitle:AddLine("and the valley soon became overrun with demons.")
		subTitle:AddLine("The Valley of Doom was soon feared by all.")
		subTitle:AddLine("Kelesis, a brave, young warrior,")
		subTitle:AddLine("defeated Golvellius, and rescued Princess Rena.")
		subTitle:AddLine("The Kingdom of Aleid was once again at peace.")
		subTitle:AddLine("A beautiful fountain was built in the name of Kelesis,")
		subTitle:AddLine("and it became their new source of water.")
		subTitle:AddLine("However, people began to fall ill...")
		subTitle:AddLine("What was once a source of life,")
		subTitle:AddLine("became a poison to the people of Aleid.")
		subTitle:AddLine("The fountain's blue water turned to blood red.")
		subTitle:AddLine("")
		subTitle:AddLine("Because of the poison...")
		subTitle:AddLine("Even those who were once trusted,")
		subTitle:AddLine("became filled with evil and hate.")
		subTitle:AddLine("The poison continued to spred")
		subTitle:AddLine("lakes, rivers, and oceans all became blood red.")
		subTitle:AddLine("This evil must be stopped.")
		subTitle:AddLine("Our hero, Kelesis, has made his return,")
		subTitle:AddLine("and will save Aleid from...")
		subTitle:AddLine("The Scarlet Fountain.")
		subTitle:Show()
		
		--Start the first scene
		MoveCameraToPosition(1550, 175, 700, 750, 93, 700, 0.03)
	elseif filmTicks == 1 and filmTime >= 60 then
		--************************************************
		--Scene 2 - Fade to Black
		--************************************************
		filmTicks = 2
		FadeOutToBlack()
	elseif filmTicks == 2 and filmTime >= 85 then
		--************************************************
		--Scene 3 - The Scarlet Fountain
		--************************************************
		filmTicks = 3
		ChangeEntityMaterial("fountain", "Fountain_RedMaterial", 1)
		FadeInFromBlack()
		EnableCameraTwist()
		EnableMotionBlur()
		EnableMotionBlur()
		EnableCameraSway(10, 25)
	elseif filmTicks == 3 and filmTime >= 100 then
		--************************************************
		--Scene 4 - The Wise Woman
		--************************************************
		filmTicks = 4
		ResetMoveCameraToPosition()
		MoveCameraToPosition(915, 90, 675, 915, 90, 675, 0)
		FadeInFromWhite()
		DisableCameraTwist()
		DisableCameraSway()		
		EnableCameraTwist()
		EnableCameraZoom(0.03)
		EnableMotionBlur()
	elseif filmTicks == 4 and filmTime >= 112 then
		--************************************************
		--Scene 4 - The Wise Woman INVERT
		--************************************************
		filmTicks = 5
		EnableInvert()
	elseif filmTicks == 5 and filmTime >= 115 then
		--************************************************
		--Scene 5 - Landscape
		--************************************************
		filmTicks = 6
		DisableCameraTwist()
		DisableCameraZoom()
		DisableMotionBlur()
		DisableInvert()
		ResetMoveCameraToPosition()
		MoveCameraToPosition(315, 82, 750, 315, 82, 500, 0.03)
	elseif filmTicks == 6 and filmTime >= 130 then
		--************************************************
		--Scene 6 - Kelesis & the fountain
		--************************************************
		filmTicks = 7
		ResetMoveCameraToPosition()
		MoveCameraToPosition(831, 100, 700, 831, 81, 700, 0.04)
		SetEntityVisible("Kelesis", true)
		SetEntityPosition("Kelesis", 830, 85, 700);
		SetEntityYaw("Kelesis", 180);
		kelesis = GetKelesis()
		kelesis:PlayAnimation("BattleStance")
		FadeInFromWhite()		
	end
	
	--Save everything back to the engine
	SetValue("FilmTicks", tostring(filmTicks))
	SetValue("FilmTime", tostring(filmTime))
end

Re: Cutscene Design

Posted: Fri Jan 02, 2009 2:43 pm
by Falco Girgis
I'm glad that you posted that. It works out very elegantly, and I'm sure that making that might have even been fun. :)

Re: Cutscene Design

Posted: Fri Jan 02, 2009 3:13 pm
by trufun202
GyroVorbis wrote:I'm glad that you posted that. It works out very elegantly, and I'm sure that making that might have even been fun. :)
Yeah it was actually alot of fun! It was cool to take my storyboard sketches, write the lua script, and watch each scene come to life.

The more and more stuff I get into Lua, the closer I'm getting to making an actual "game" outta this. :mrgreen:

Re: Cutscene Design

Posted: Fri Jan 02, 2009 3:42 pm
by Falco Girgis
trufun202 wrote:The more and more stuff I get into Lua, the closer I'm getting to making an actual "game" outta this. :mrgreen:
Ditto.