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

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

Post by Sat42 »

Copy that!

Yeah I am totally designing this for SinglePlayer only, you know me :)

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 »

Just to confirm: you can indeed call the PlayBink function in the script's Rule and Action (specifically in the Action part of course) for the victory condition to play a .bik movie at the end of your scenario!

There is one thing of note: I had noticed previously when playing the official EEII and EEII:AoS scenarios that, when a .bik video plays at the end of a scenario, you often still hear the environmental sounds of the map in the background - which is sometimes compounded by the fact that the game will loop sounds of vehicles or similar which were moving at the moment the video starts and such sounds will be heard throughout the entire duration of the movie, and it is to the point where sometimes if I wanted to actually hear the narrator's voice I'd have to reload and just before victory move my camera away to some quiet part of the map!

Am I really the only one who cares about this sort of thing? (don't answer that! :P )

So here is a trick I've tested which will guarantee no parasitic sounds playing during your .bik movie playback:

within the Action section of your Rule and Action for victory (or anything else, really), do this:

Code: Select all

ACTION actionYOUWIN
SCRIPT WORLD
DoDelay(fDelay);

STEP
	PrintMessage( "You win! Now enjoy this awesome video without sound interference from the map!" );
	
	DoDelay( 3.0 );
STEP

	 CreateDialogBox("tx_futuretextWX", "tx_futuretextYZ", true);
	 
	PlayBink("your_awesome_movie.bik"); 

STEP
	WinScenario();

END_SCRIPT
END_ACTION
	
Yes I know, you'll need to provide some valid tx_futuretext entry in the TextsSource (Unofficial Patch Files -> EXEGeneratorData) which you need to back up as it is rewritten by 1.5 updates etc. CreateDialogBox doesn't work if you don't provide valid text entries (but the actual associated text to be displayed can remain empty of characters, if you wish).
If someone knows of another way of achieving this, do tell! But since making new tx_futuretext entries is no issue I would say this method is acceptable (especially since there are very few of us interested in this sort of thing!).

EDIT: to be clear, the reason why CreateDialogBox eliminates environmental sounds from the map is because it pauses the game. PlayBink automatically cuts off in-game music playback, but not sounds. If there is another way of getting the game to pause just before calling the .bik video, I'm all ears!
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 »

Hi Sat42. Thanks for posting the solution.

When you wrote it, I remembered that in my "Planes" scenario I used some "hotkeys" trick to disable the "Guard" button (because it could be too easy for players).

In the code it looks this way:

Code: Select all

RULE AntiGuard
if (bGuardlingLockaed && bAntiGuard && GetElapsedGameTime() > 3 && HasWidgetBeenSelected("unit_action_guard"))
  then AntiGuardAction
END_RULE
ACTION AntiGuardAction
SCRIPT WORLD
bAntiGuard = false;
STEP
CallNamedEventHandler("UIUnitCommand_Attack","");
RemoveWidgetListenForSelection("unit_action_guard");
PrintMessage("SYSTEM: Sorry, due to scenario OOS problems, guarding units has been disabled :(");
AddWidgetListenForSelection("unit_action_guard", true);
bAntiGuard = true;
END_SCRIPT
END_ACTION
As you can see, the function used is:

Code: Select all

CallNamedEventHandler("UIUnitCommand_Attack","");
It's to undo selection the recently clicked Guard button. I wonder if this could be replaced with some "Pause" button widget. It then should be possible to simulate the Pause button without displaying any dialog box. Tip: if you want to try this solution, search for: "UIUnitCommand_Attack" in db.zip and see in the similar files if there's something related to the pause widget / button. You can click CTRL+O in game to open the Debug Menu (or whatever it's called) and check the name of the widget under the mouse cursor.
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 »

Hey Mona! Thanks for the idea and tip - I will try to see if I can find such a "Pause" button widget 8-)
Post Reply

Return to “Questions”