Aller au contenu

Photo

MOVIES - IN GAME ACHIEVED !


  • Veuillez vous connecter pour répondre
49 réponses à ce sujet

#1
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi All,

EDIT: SCROLL DOWN PAGE FOR WORKING CODE.

I was trying to figure out a way to get an intro movie made for my module, and I discovered that the "Movie" hook on the module for a "Start Movie" is one of those points that does not work.

And so, I investigated a little further .....

In the process, I found a way to have BIK MOVIES play at *any* time inside the game itself. :)

It required me to do some XML code and some scripting, but now, I have three levers in my test mod and each one starts a different movie!

The only caveat, is that you have to have one XML script per movie, which is a small price to pay for anybody wanting to include as many movies as they need. You have to do this because I don't see any way of passing the movie name into the XML and then use as a variable. The movie file name has to be whatever you call it and enter within the XML code. But that's all that is required.

E.g.

AtariLogo movie is within LBMovie_AtariLogo.xml (Where "AtariLogo" is added as the movie to play.)
Credits movie is within LBMovie_Credits.xml (Where "Credits" is added as the movie to play.)

I thought this info may please some people, so I posted it to see if anybody else is interested.

Cheers,
Lance.
  • BartjeD, PJ156, rjshae et 2 autres aiment ceci

#2
rjshae

rjshae
  • Members
  • 4 485 messages

I'd be interested, 'cause there's a start movie that I want to play and it won't work (as you noted).



#3
Tchos

Tchos
  • Members
  • 5 042 messages

The only caveat, is that you have to have one XML script per movie, which is a small price to pay for anybody wanting to include as many movies as they need.

 

That is a very small price to pay, and this is a great boon.  Someone here was just asking a while ago about playing movies when casting spells.  Can you elucidate further?



#4
PJ156

PJ156
  • Members
  • 2 982 messages

Excellent observation Lance. Being able to switch to a movie will help me with story progression a lot. I will think how to incorporate this.

 

PJ



#5
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hi All,

(Tchos: Yes, I believe I took part in that post, but did not have this idea at the time. EDIT: I found that post: http://forum.bioware...middle-of-game/ )

Anyway, here is my rough starting code, which has been tested as working. NOTE: Having a movie start as you enter an area needs to be carefully managed (I think) because of the amount of other stuff that goes on at time of loading. In my own campaign, I have not yet had a movie start at area load, although, if managed properly, I don't see why it should not work just as well. You can even have scripts fire *after* the movie has finished playing. :)

This fires the Atari Logo movie file (WHICH COMES WITH NWN2) ... simply replace "AtariLogo" with the BIK file you need to play, and make this a unique XML file. This one is called "LBMovie_AtariLogo.xml".

NB: "alpha.tga" is just a very small transparent image so the GUI works as expected. EDIT: Updated this to be a very small "black" image (just kept the same name for simplicity). The difference simply stops the "Game Paused" image from flashing up briefly after the video ends. If you preferred it the old way (with the brief flash of text), then you need to replace this image with a transparent alpha image again.

LINK TO IMAGE: https://dl.dropboxus...47935/alpha.tga
 

<?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("AtariLogo") />

	<!-- 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")/>

And here is the NWN script that is called (gui_lb_movies):-
 

// 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());
}

NOTE: I intend to update this script to work for MP as well. i.e. Movie will be made to fire for one player or all on the server. If just for one player, then make sure SetPause is not set TRUE. (You should get the idea from this anyway.)

Please let me know if anybody has a go with this and gets results they hoped.


Finally, just to have something trigger your movie, this script is attached to a lever, called "MOVIE" and has the name of the movie inside a variable (as detailed in the script):-
 

void main()
{
        object oPlayer = GetLastUsedBy();

        if(GetName(OBJECT_SELF) == "MOVIE")
	{			
		string sMovie = GetLocalString(OBJECT_SELF, "MOVIE");
		
		DisplayGuiScreen(oPlayer,"SCREEN_MOVIE", TRUE, "LBMovie_" + sMovie + ".xml");
		
		SendMessageToPC(oPlayer, "<<< MOVIE PLAYING >>>");		
		return;
	} 
}

Cheers,
Lance.


  • -Semper-, BartjeD, Tchos et 2 autres aiment ceci

#6
Tchos

Tchos
  • Members
  • 5 042 messages

Please let me know if anybody has a go with this and gets results they hoped.

 

Flawless victory.  I copied the code into appropriate files, changing names as needed and adding the missing void main() and oPlayer declaration in the lever script, and I ended up with a lever that plays the Trinity opening movie every time I pull the lever.  Events in the game pause while the movie is playing, which is good.  The movie stops playing if I hit escape.  Also good.  Everything goes back to normal once the movie is done, either by letting it play out or by hitting escape.  Great work!


  • BartjeD et GCoyote aiment ceci

#7
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Flawless victory.  I copied the code into appropriate files, changing names as needed and adding the missing void main() and oPlayer declaration in the lever script, and I ended up with a lever that plays the Trinity opening movie every time I pull the lever.  Events in the game pause while the movie is playing, which is good.  The movie stops playing if I hit escape.  Also good.  Everything goes back to normal once the movie is done, either by letting it play out or by hitting escape.  Great work!


Hi Tchos,

Thanks for checking your end ... Great news indeed!

I will also edit the lever script (above) in case people do not understand about the void bit. (It was copied from a larger lever test script.) EDIT: I also just made the alpha.tga file available from a link in that post too.

Note: If you ever intend to use this in a MP environment, you need to do some extra scripting I guess, but overall, hopefully this will suit most needs.

By the way, have you tried making a movie play on AREA LOAD? The only reason I say this is because I *think* there may be some issues if an area loading is doing a lot of work (like when entering a module for the first time). As I say, I have not yet tested this, but a workaround (if one is required) would be to make sure only a very small (non eventful) area is loaded with movie before then passing on to the actual area.

Thanks again for the feedback!

Cheers,
Lance.

EDIT: Now, believe it or not, I only just learned about the Spell Resistance bug! I am going to look at having a dedicated feat apply to the PC or monster subject to any equipment with the ability on it when equipped/unequipped.

#8
psiiijay

psiiijay
  • Members
  • 258 messages

 I never used XML before so - I just copy it into a txt file and rename it to "LBMovie_AtariLogo.xml"? it doesn't compile and I don't know if it needs to.. 

 

The other 2 files are nss files that needed compiling and that's it right?

 

I did this and put "gui_lb_movies.nss" and the other firing script in my override folder along with the "alpha.tga" (not in the module).

Oh and I used a spell feat to fire the movie instead of a lever.. And... Nothing happened.. I guess I could fire a script as a feat and put the files I did in the override - So there must be something else I'm doing wrong.. Help? :)  



#9
Tchos

Tchos
  • Members
  • 5 042 messages

EDIT: I also just made the alpha.tga file available from a link in that post too.
Note: If you ever intend to use this in a MP environment, you need to do some extra scripting I guess, but overall, hopefully this will suit most needs.
By the way, have you tried making a movie play on AREA LOAD?

 

In my test, I created a 100x100 transparent alpha.tga for the purpose.  I expect the engine scales it up to the screen size, and I don't know if making it too small is better than making it unnecessarily big.

 

I don't plan on building things for multiplayer in any foreseeable future, so no matter on that.

 

I haven't tried doing it on an area load, but I suppose it would have the same troubles that firing a conversation on an area load would have.  I use the CreateIPSpeaker function for that, and use the system included there, and one could modify the system to fire one of these movies instead of a conversation.

 

 I never used XML before so - I just copy it into a txt file and rename it to "LBMovie_AtariLogo.xml"? it doesn't compile and I don't know if it needs to.. 

 

I did this and put "gui_lb_movies.nss" and the other firing script in my override folder along with the "alpha.tga" (not in the module).

 

XML doesn't need compiling, and doesn't need to be made in the toolset at all, and probably shouldn't be, since the toolset probably appends an .NSS extension, making it not work.

 

I put everything in my module folder when I ran my test, not in override.



#10
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

I never used XML before so - I just copy it into a txt file and rename it to "LBMovie_AtariLogo.xml"? it doesn't compile and I don't know if it needs to.. [/size]
 
The other 2 files are nss files that needed compiling and that's it right?[/size]
 
I did this and put "[/size]gui_lb_movies.nss" and the other firing script in my override folder along with the "alpha.tga" (not in the module).[/size]
Oh and I used a spell feat to fire the movie instead of a lever.. And... Nothing happened.. I guess I could fire a script as a feat and put the files I did in the override - So there must be something else I'm doing wrong.. Help? :)  

Hi,

Keep the testing simple at this stage and try to fire the movie from a simple placeable lever. Once you know it works, then move onto other means.

The XML is a simple text script (simply copy and paste the code into a blank text file). And you are correct that the other two scripts are done in the toolset and need to be compiled.

Other than that, it should all work as mentioned.

As I say, try using a simple lever first .. and then try the spell route.

Let me know how it goes,
Regards,
Lance.

#11
psiiijay

psiiijay
  • Members
  • 258 messages

Ok, Do I need to script something or just drop the 2 .nss files and .tga in the module folder and xml in the ui costume folder and add a lever? 



#12
Tchos

Tchos
  • Members
  • 5 042 messages

You can put everything into the module folder, except perhaps the BIK movie itself, which probably needs to be in the movies folder.  Nothing needs to go in UI\custom.  You also need to compile the scripts.  NSS is uncompiled, NCS is compiled.

 

You also need to put the lever script in the On Used slot of the lever object.  Also look at the lever script to see what name and local variables the script requires.  I removed the name check and hardcoded the movie name into my test script rather than name the lever "MOVIE" and put the movie name in a local variable.



#13
psiiijay

psiiijay
  • Members
  • 258 messages

So you do need to change a variable in the script itself?

Tchos - Can you please try it in the override and fire it through a spell please? I think I'm missing something anyways because I see no reason it shouldn't work like that..

I'm still gonna try working it through the module.

btw- does it get you into loading screen before uploading the movie or does it start it right away?



#14
psiiijay

psiiijay
  • Members
  • 258 messages

As I though - It didn't work with the lever also.. 

Tchos can you post your modified movie specific scripts please?



#15
Tchos

Tchos
  • Members
  • 5 042 messages

There is no loading.  The movie begins instantly.

 

As you requested, this is my version of the script that goes in the lever's On Used slot:

void main()
{
	object oPlayer = GetLastUsedBy();
	DisplayGuiScreen(oPlayer,"SCREEN_MOVIE", TRUE, "Movie_Trinity.xml");
	SendMessageToPC(oPlayer, "<<< MOVIE PLAYING >>>");		
	return;
}

Notice I put the exact name of the XML file that it should fire (Movie_Trinity.xml), so that there doesn't need to be any variable on the lever.  You will need to change the name as appropriate to match whatever you named your XML.

 

Creating new spells is not really in my experience, so I must decline to test it by casting a spell.  And if it works in the module, as it does, then it would also work in the override.



#16
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hi Tchos/psiiijay,
 
First, thanks Tchos for helping psiiijay. :)

MOST IMPORTANT:-

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:-

You have a movie you want to play called: "MYINTROMOVIE.BIK" Here is what you would do for such a movie with that name:-

XML file which you can call for ease of reference: "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")/>

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());
}

Finally, the simplest script to activate this is as Tchos says (edited for the example movie):

 

You can give this script any name you want and attach it to a levers OnUsed hook. HOWEVER, NOTE the name inside ....
 

void main()
{
object oPlayer = GetLastUsedBy();
DisplayGuiScreen(oPlayer,"SCREEN_MOVIE", TRUE, "MYINTROMOVIE.xml");
SendMessageToPC(oPlayer, "<<< MOVIE PLAYING >>>");
return;
}

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


Let me know if this works for you,
Cheers,
Lance.



#17
psiiijay

psiiijay
  • Members
  • 258 messages

Guys, thanks for all the help!

 

It works 100% ( :))))))))))) :D  :D  )

 

But only with a lever for now.. I need to check and see if it could be used with spells and such and from the override and not a single module (no reason why not but it didn't work when I tried)..

 

I'll start exploring..  Lance Botelle YOU ARE A GENIUS!!!



#18
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Guys, thanks for all the help!
 
It still doesn't work.. I named the xml "AtariLogo.xml" then edited my lever script: DisplayGuiScreen(oPlayer,"SCREEN_MOVIE", TRUE, "AtariLogo.xml");
 
I put everything in the module folder but still won't work..
Is there a way you could upload a folder of a tiny module that has everything running so I could see if the prob is with my system maybe?


EDIT: Good to see you have it working now ... I don't see why it should not work from any call in script. :)

OK, let me ask you something first ...
 
1) Do you have the movie file "AtariLogo.bik" in the following location?:

C:\Program Files (x86)\Atari\Neverwinter Nights 2\Movies

2) And in your XML file, does it say in the following line:

OnAdd1=UIButton_Input_ShowMovie("AtariLogo")

Just checking a few things first ... :)



Cheers,
Lance.



#19
psiiijay

psiiijay
  • Members
  • 258 messages

Ok, so like you guys said, it works 100% with spells and feats also  - which means I can add HUGE final fantasy like summons and grand spells to the game! (just need to change the last movie firing script to object oPlayer = GetLastPC(); )

 

Lance Q - Is the alpha.tga the one that appears if I let the screen open for a few seconds after the clip is done? The one that says "missing...." with lots of colors? 



#20
Tchos

Tchos
  • Members
  • 5 042 messages

Don't forget PS:T-style grand spells, like Rune of Torment, Conflagration, the Mechanus Cannon, and of course Celestial Host!



#21
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Ok, so like you guys said, it works 100% with spells and feats also  - which means I can add HUGE final fantasy like summons and grand spells to the game! (just need to change the last movie firing script to object oPlayer = GetLastPC(); )
 
Lance Q - Is the alpha.tga the one that appears if I let the screen open for a few seconds after the clip is done? The one that says "missing...." with lots of colors?


Hi psiiijay,

I have replied to you in your PM to me. Hopefully, you have the new alpha.tga to do your job as well now. :)
 
 

Don't forget PS:T-style grand spells, like Rune of Torment, Conflagration, the Mechanus Cannon, and of course Celestial Host!


Hi Tchos,

OK, I look forward to a whole bank of bik files (dedicated to NWN2 spells) in the near future from custom content makers. ;)

If only .... :)

Cheers,
Lance.

ATTENTION ALL
=============

UPDATED:


NB: "alpha.tga" is just a very small transparent image so the GUI works as expected. EDIT: Updated this to be a very small "black" image (just kept the same name for simplicity). The difference simply stops the "Game Paused" image from flashing up briefly after the video ends. If you preferred it the old way (with the brief flash of text), then you need to replace this image with a transparent alpha image again.

LINK TO NEW BLACK IMAGE: https://dl.dropboxus...47935/alpha.tga



#22
Tchos

Tchos
  • Members
  • 5 042 messages

Note: Users of my UI mod will not have the "game paused" text on the screen, as it is disabled.  I considered it enough that "Game paused" also appears in the chat box, and doesn't need to be on the screen, where it gets in the way of screenshots (if you want to have the interface visible in the screenshots).



#23
psiiijay

psiiijay
  • Members
  • 258 messages

You disabled the pausing of the game from the xml when the clip runs?

Btw - has anybody tried running the clips form the override? everything works except the tga file for some reason is not called by the xml and so it gives an error "2d missing textures" any solution for override users?



#24
Tchos

Tchos
  • Members
  • 5 042 messages

No, I didn't disable the pausing, and I'm not talking about the scripts here -- my UI mod (not connected to this, but many people use it) disables the text "GAME PAUSED" from appearing in the middle of the screen.  The game still pauses, and it still says "Game paused" in the chat box.



#25
psiiijay

psiiijay
  • Members
  • 258 messages

Nice add on - link please?