Aller au contenu

Photo

[SOLVED] Cutscene on Leaving Area?


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

#1
Qutayba

Qutayba
  • Members
  • 1 295 messages
I want a cutscene to play as the player leaves an area, so it needs to come before the next area loads.  My first attempt was to put

CS_LoadCutscene(R"wh_cs_ravenwatch.cut");


inside the area script under "case EVENT_TYPE_EXIT:"  That didn't seem to work, so my current attempt is to put a script on the area transition placeable, so that it will play the cutscene before firing the area transition.

#include "placeable_h"
#include "events_h"
#include "global_objects_h"
#include "utility_h"
#include "wrappers_h"

#include "plt_wh_prodigy"

void main()
{
    event ev     = GetCurrentEvent();
    int   nEvent = GetEventType(ev);
    int bEventHandled = FALSE;

    switch (nEvent)
        {
        case EVENT_TYPE_PLACEABLE_ONCLICK:
            {
                {
                if (!WR_GetPlotFlag(PLT_WH_PRODIGY, CAVE_ENTERED))
                    {
                    CS_LoadCutscene(R"wh_cs_ravenwatch.cut");
                    WR_SetPlotFlag(PLT_WH_PRODIGY, CAVE_ENTERED,TRUE);
                }
                Placeable_DoAreaTransition(OBJECT_SELF);
                break;
            }
        }
    if (!bEventHandled) //If this event wasn't handled by this script, let the core script try
    {
        HandleEvent(ev, RESOURCE_SCRIPT_TRIGGER_CORE);
    }
}


The placeable doesn't play the cutscene, but instead goes ahead and performs the area transition (at least I didn't break that!).  Is there something wrong with this script, or is this not the best way to do what I want to do?

Modifié par Qutayba, 08 mars 2010 - 10:18 .


#2
Craig Graff

Craig Graff
  • Members
  • 608 messages
First off, you would need to set bEventHandle to TRUE so you don't pass the event on to the core script (which for some strange reason you have set to TRIGGER_CORE rather than PLACEABLE_CORE). Next, you'd probably be better off just using a plot flag (and associated plot script) to immediately jump the player after the cutscene plays. Something like:
CS_LoadCutscene(R"wh_cs_ravenwatch.cut", PLT_WH_PRODIGY, CAVE_ENTERED);
You would also get rid of the fofollowing line, of course:
WR_SetPlotFlag(PLT_WH_PRODIGY, CAVE_ENTERED,TRUE);

Then in your wh_prodigy.nss script file, have:
case CAVE_ENTERED:
{
    UT_DoAreaTransition("destination_area", "destination_waypoint");
    break;
}

Another bit of advice - name your plot flags with a prefix that indicates which plot they are from so they don't get misused or conflict when you have to include multiple plot files in the same script. So WH_PRODIGY_CAVE_ENTERED, in this case.

#3
hunharibo

hunharibo
  • Members
  • 126 messages
Or you could actually create a trigger right before (or under) the area transition placeable. Make your cutscene play when entering the trigger then make your cutscene fire a script when it ends to initiate the area transition.

#4
Qutayba

Qutayba
  • Members
  • 1 295 messages
Wunderbar! Works great. I apparently did a little cutting and pasting from a trigger script, which would explain the strange ending command. For the time being, I put the area transition command in my cutscene script. However, using plot scripts appears more useful in the long run, since I could consolidate several cleanup scripts into one. Thanks for the help.