Playing FMV (video file) at start/end of scenario

Modding, Map Editor, IES Scripting and Other Questions
Sat42
Posts: 129
Joined: 03 Dec 2018, 18:01
Has thanked: 6 times
Been thanked: 1 time

Playing FMV (video file) at start/end of scenario

Post by Sat42 »

Hey all,

You know how EEII and EEII:AoS have the campaign scenarios come with introductory videos? Something which Age of Empires II also did.

Well forgive my ignorance but how do you make that happen? I want to have FMVs (in this case BIK video files) - in the same style as the official campaigns - play at the start of my scenarios, and maybe even at the end of a scenario when the player wins (like AoEII). I certainly want to learn how to make in-game cinematics as well (like what you see in the "Siege of Troy" scenario), but I don't want to rely on those much as they are harder to do right.

Thanks for any help!

Cheers

User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Playing FMV (video file) at start/end of scenario

Post by Dr.MonaLisa »

I believe it's possible with the .IES scripting: viewtopic.php?f=54&t=1737

Do you have any specific question regarding the function in the "scripting bible"?
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Sat42
Posts: 129
Joined: 03 Dec 2018, 18:01
Has thanked: 6 times
Been thanked: 1 time

Re: Playing FMV (video file) at start/end of scenario

Post by Sat42 »

Haha excellent thanks Dr.MonaLisa! :D

I just found the function and it seems straightforward. I will be making tests later, but a priori, this is it!

Thanks again, I am relieved this is an option as it can really improve storytelling!
Sat42
Posts: 129
Joined: 03 Dec 2018, 18:01
Has thanked: 6 times
Been thanked: 1 time

Re: Playing FMV (video file) at start/end of scenario

Post by Sat42 »

So here's the code for playing a .bik movie at the beginning of your scenario (like EEII official campaigns):

Code: Select all

//If you're all fancy, you can play a .bik movie at the
//beginning of your scenario. Just drop it in the "Movies" folder //and then call it…
StartPlayingCinematic("CinematicEgypt3_Opening_1");
CreateNamedGroup(GROUP_CITIZENS);
AddUnitsByAttributeToGroup(GROUP_CITIZENS, ATTRIBUTE_CITIZEN, HUMAN_PLAYER, kPlayerMode_Self, NULL);
hProtectCitizens = AttachEffectToGroup(GROUP_CITIZENS, "PreventDeletion");
// initial camera, after cinematic
SetCameraDistanceFraction(1, false);
SetCameraHeading(90, false);
SetCameraLookAtArea("areaCameraStart", false);
SetCameraLookAtArea("areaCameraStart", true);
END_INITIALIZATION
I don't yet understand the need for the CreateNamedGroup function...
My main question is: how do you play a .bik cinematic at the end of the scenario? :?:
User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Playing FMV (video file) at start/end of scenario

Post by Dr.MonaLisa »

When you create a named group, you can then select a group and do whatever you like using "do something with selection" functions. Like, "SelectGroup", "MoveSelectionToArea", etc.

To play the .bik at the end, you need to add the cinematic functions in a ONESHOT rule, when some event is triggered.
You can base on the "Boston.ies" script file:

Code: Select all

RULE ruleObj_Five_Universities ONESHOT
  if ( CreateNamedGroup( "tmp" )
			 && AddUnitsByAttributeToGroup( "tmp", "Universities", HUMAN_PLAYER, kPlayerMode_Self, NULL )
			 && ( NumUnitsInGroup( "tmp" ) >= 5 )
			)
		then actionObj_Five_Universities
END_RULE
ACTION actionObj_Five_Universities
SCRIPT WORLD

	DebugOutputString( "Obj_Five_Universities" ); //strictly for testing
	PrintMessage( "You win!" ); //this does work, even though these strings are normally localized in a .utf8 file in the db/ directory.

DoDelay( 3.0 );
STEP

	WinScenario();

END_SCRIPT
END_ACTION
Also check page 25-26+ of EE2 SCRIPTING.doc.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Sat42
Posts: 129
Joined: 03 Dec 2018, 18:01
Has thanked: 6 times
Been thanked: 1 time

Re: Playing FMV (video file) at start/end of scenario

Post by Sat42 »

Many thanks Mona! Very useful stuff :)

I suppose the cinematic functions will automatically cut-off any music or sound playing in-game, so only stuff related to the .bik file is streamed to the player for the duration of the cinematic. That is I guess I will have to put the "WinScenario()" command after a delay (like in that Boston example) equal to the length of the cinematic? Because I suppose you can't play the .bik after the script has ended the scenario in a win for the player.
I will have to see in a small test map, and will report back if I have issues.

Thanks again!
User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Playing FMV (video file) at start/end of scenario

Post by Dr.MonaLisa »

Remember that in the scenario edition, there is a "Victory Conditions" option. For .ies you might need to set to "Script Says So", otherwise it has "normal" conditions, like no units left in game.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Sat42
Posts: 129
Joined: 03 Dec 2018, 18:01
Has thanked: 6 times
Been thanked: 1 time

Re: Playing FMV (video file) at start/end of scenario

Post by Sat42 »

Dr.MonaLisa wrote: 11 Nov 2020, 14:25 Remember that in the scenario edition, there is a "Victory Conditions" option. For .ies you might need to set to "Script Says So", otherwise it has "normal" conditions, like no units left in game.
Good reminder - thanks!

By the way, do you know how to determine the original resolution of the BIK videos used by EEII and EEII:AoS?

I tried getting the info straight out of the BIK files in the movies folder but can't seem to get the resolution details in the properties. Since I still play with a 5:4 monitor 1280x1024, if I take a screenshot in-game when a BIK plays I get a 1280x1024 image but that probably isn't the original video resolution.
User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Playing FMV (video file) at start/end of scenario

Post by Dr.MonaLisa »

You can use the video player, like "PotPlayer": https://potplayer.daum.net/
Then when you play the .bik file in it, you can click the right mouse button and "media info" from the list. it should display resolution and such.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Sat42
Posts: 129
Joined: 03 Dec 2018, 18:01
Has thanked: 6 times
Been thanked: 1 time

Re: Playing FMV (video file) at start/end of scenario

Post by Sat42 »

Thank you once more Mona!

Interesting: with PotPlayer I find that BINK input size is 640x360 and with PotPlayer I don't see the subtitles for the narration like you would in-game - so the subtitles are streamed separately by the game! Anyway I can put my subtitles directly in the video, it's just interesting to see this. Cheers!
Post Reply

Return to “Questions”