Choose Your Language

Wednesday 8 August 2018

NWN2 Movies (In Game)


I was asked by Kamal to remind people how I managed to play BIK movies inside a NWN2 module, as opposed to just playing as an intro at the start of a module. Here is what I found from an old post of mine at the forums:-

IMPORTANT: ONLY WORKS IN OUTDOOR AREAS

Therefore, if you wish to have a movie within an interior area, you will need to jump to an outdoor area prior any movie starts and then move back to an interior if required. This can be handled by careful timing of scripts.

The naming structure of files is quite strict here due to the way the XML works. Here is the clearest example I can give you to work, using a movie called "MYINTROMOVIE.BIK" as an example:-

1) CREATE UNIQUE XML FILE (EVERY MOVIE REQUIRES OWN XML FILE)

Create XML file, in this example: "MYINTROMOVIE.xml" This is a simple text file in Notepad (not compiled) as follows ... and NOTE the name of the movie in this file .....

<?xml version="1.0" encoding="utf-8"?>
<!-- Main Menu definition -->
<UIScene name="SCREEN_MOVIE" x=0 y=0 idleexpiretime="0.1"  priority="SCENE_INGAME" fullscreen=true scriptloadable=true  backoutkey=true
    OnBackout=UIObject_MISC_ExecuteServerScript("gui_lb_movies")
    OnAdd0=UIScene_Misc_SetPauseState("true")
    OnAdd1=UIButton_Input_ShowMovie("MYINTROMOVIE") />
<!-- Define the MOVIE background -->
<UIIcon name="MOVIE_ALPHA" img="alpha.tga" x=0 y=0 width=PARENT_WIDTH height=PARENT_HEIGHT scalewithscene=true
    OnMouseEnter=UIObject_MISC_ExecuteServerScript("gui_lb_movies")/>

2) USE DEDICATED MOVIE SCRIPT

THE FOLLOWING GUI SUPPORT SCRIPT MUST BE CALLED: "gui_lb_movies" and should be compiled in the toolset. There are NO CHANGES in this script at all. It is the supporting script the system uses.
// MOVIE SCRIPT

void CloseMovieScreen()
{
     object oPC = GetFirstPC();

     while(oPC != OBJECT_INVALID)
     {
          CloseGUIScreen(oPC, "SCREEN_MOVIE");

          oPC = GetNextPC();
     }
}

void main()
{
     SetPause(FALSE);
     DelayCommand(0.01, CloseMovieScreen());
}
3) CREATE THE MOVIE CALL SCRIPT (EXAMPLE)

You can give the activation script any name you want and (as an example) attach it to a lever's OnUsed hook. HOWEVER, NOTE the name inside ....
void main()
{
     object oPlayer = GetLastUsedBy();
     DisplayGuiScreen(oPlayer,"SCREEN_MOVIE", TRUE, "MYINTROMOVIE.xml");
     SendMessageToPC(oPlayer, "<<< MOVIE PLAYING >>>");
}
4) MAKE SURE ALPHA IMAGE IS PRESENT

DO NOT FORGET to put alpha.tga image into your folders too: DOWNLOAD alpha.tga (Zipped)

No comments: