Aller au contenu

Photo

Scripting the end of a conversation to start a cinematic


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

#1
Schnipsy2

Schnipsy2
  • Members
  • 8 messages
I have a conversation where a new character is introduced, and the player receives an offer to join the new character as he walks back to his camp. I have the cutscene of said walking already finished, and only need to find out how to start the cutscene when the conversation ends. I read the tutorials and watched some videos, and know how to link the two, I just don't know what to type. Any help greatly appreciated

Modifié par Schnipsy2, 01 janvier 2010 - 04:46 .


#2
Craig Graff

Craig Graff
  • Members
  • 608 messages
Are you asking how to associate a script with a plot flag, or what function to use to play a cutscene (or both, or neither)?

#3
Schnipsy2

Schnipsy2
  • Members
  • 8 messages
I don't know how to make a script that will run the cutscene when the dialogue is completed. My biggest problem is what I should type in the script.

#4
ShadowAvatar87

ShadowAvatar87
  • Members
  • 8 messages
I recently figured this out myself. Here's the script I use:
</cod></cod>
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "plt_items"
#include "plt_main"



void main()
{
          int flag_value2 = WR_GetPlotFlag(PLT_MAIN, SHERIFF);
        {
            WR_SetPlotFlag(PLT_MAIN, SHERIFF, 1, TRUE); 
            object oHero = GetHero();
              
  resource rCutscene = R"attack.cut";
  CS_LoadCutscene(rCutscene);
  PlayCutscene(oHero);


 } }

Then what you do is go under the scripting section of one of the lines of your conversation, find the action section, then set the script. When the conversation ends it should fire. You're going to have to change some things in the script to match yours (PLT_MAIN to PLT_whatever, SHERIFF to whatever, attack.cut to whatever etc.)

Hope this helps.             

Modifié par ShadowAvatar87, 02 janvier 2010 - 04:35 .


#5
Schnipsy2

Schnipsy2
  • Members
  • 8 messages
thnx I will try it out

Modifié par Schnipsy2, 02 janvier 2010 - 04:38 .


#6
Schnipsy2

Schnipsy2
  • Members
  • 8 messages
Shadowavatar we posted at the same time so I didnt see yours until I finished mine...
thnx though that helps alot. I will try it out and see what happens!

Modifié par Schnipsy2, 02 janvier 2010 - 04:41 .


#7
Craig Graff

Craig Graff
  • Members
  • 608 messages

ShadowAvatar87 wrote...

I recently figured this out myself. Here's the script I use:

#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "plt_items"
#include "plt_main"

void main()
{
          int flag_value2 = WR_GetPlotFlag(PLT_MAIN, SHERIFF);
        {
            WR_SetPlotFlag(PLT_MAIN, SHERIFF, 1, TRUE); 
            object oHero = GetHero();
              
  resource rCutscene = R"attack.cut";
  CS_LoadCutscene(rCutscene);
  PlayCutscene(oHero);
 } }      

I'm not really sure where to begin... There are many things wrong with the above script. It will work, sort of, but most of it isn't really doing anything and you definitely aren't doing what you think you are with the plot flags.
To start a cutscene with a script attached to a conversation node all you need is this:
[dascript]
#include "utility_h"
void main()
{
  resource rCutscene = R"attack.cut";
  CS_LoadCutscene(rCutscene);
}  
[/dascript]
If you want to associate it with a plot flag, then you will need to create a plot file ("my_plot.plo"), create a main flag with a unique name in the manner of MY_PLOT_CUTSCENE_RUN. Then associate a new script with the plot* ("my_plot.nss").Then do the following:
- In the new blank script click on the Templates button in the upper right corner of the script editor.
- Double-click Custon plot events.txt in the templates list - this will insert the template into the blank script.
- Change the line //#include "PLOT_NAME_GOES_HERE" to
#include "plt_my_plot"
and replace the first
        switch(nFlag)
        {

        }
with
[dascript]
        switch(nFlag)
        {
            case MY_PLOT_CUTSCENE_RUN:
            {
                resource rCutscene = R"attack.cut";
                CS_LoadCutscene(rCutscene);
                break;
            }
        }
[/dascript]
- Back in your conversation, select my_plot from the Plot drop down and MY_PLOT_CUTSCENE_RUN from the Flag dropdown.
- Export your plot file, your plot script and your conversation.

* To make a new plot script:
- With the plot file open, click inthe Plot field of the Object Inspector
- click on the ... (elipsis)
- Select the folder where you would like to have the script
- Click the New button (to the left of the OK button)
- Name your plot script the same as your plot file (e.g. "my_plot")
- Click OK
- Open the new script by right-clicking the Script field of the Object Inspector and selecting Open Resource

Modifié par Craig Graff, 04 janvier 2010 - 10:48 .


#8
ShadowAvatar87

ShadowAvatar87
  • Members
  • 8 messages
Good call there on most of it not doing the thing he asked for. I realize the includes are a bit excessive, but I tend to just copy and paste that block into any new script I make. As for the plot flag aspect I forgot that it was somewhat unrelated to his needs. In my game I used that script to trigger the plot flag in addition to loading a cutscene. I did this because my conversation was short, and the scripting area for all the lines were used up with other flags.



I've got almost no formal training in programming (a class in java is about it), so I've just been cobbling together scripts posted on this forum and the wiki. My solutions usually aren't the most elegant I'm sure, but if it compiles and runs I consider it a victory. I just posted it because I hadn't seen an answer to that posted here yet, and my script did work.

#9
Schnipsy2

Schnipsy2
  • Members
  • 8 messages
Thank you Craig. This worked and was much easier to follow than anything on the wiki.

#10
Ogre78

Ogre78
  • Members
  • 26 messages
Very good thread, and very useful, thx!