Aller au contenu

Photo

intro cutscene


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

#1
Caldarin V

Caldarin V
  • Members
  • 269 messages
I'm trying to load an adventure, go through character gen, and then play a cutscene.
this runs the chargen okay, but other than that, I get nothing
here's the script


#include "events_h"
#include "global_objects_h"
#include "utility_h"
#include "wrappers_h"
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev); //extract event type from current event
int nEventHandled = FALSE; //keep track of whether the event has been handled
switch(nEventType)
{
case EVENT_TYPE_MODULE_START:
{
PreloadCharGen(); //preloads resources needed for character generation
StartCharGen(GetHero(),0); //initiates character generation
 object oCreature = GetEventCreator(ev);

break;
}
 event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    int bEventHandled = FALSE;
    switch (nEventType)
    {
        case EVENT_TYPE_ENTER:
        {
            object oCreature = GetEventCreator(ev);
            if(GetObjectActive(OBJECT_SELF)
               && IsPartyMember(oCreature))
            {
                resource rCutscene = R"recruitment.cut";
                CS_LoadCutscene(rCutscene);
                SetObjectActive(OBJECT_SELF, FALSE);
            }
         }
         break;
    }
}
if (!nEventHandled) //If this event wasn't handled by this script, let the core script try
{
HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);

}
}

#2
Proleric

Proleric
  • Members
  • 2 350 messages
According to the wiki, EVENT_TYPE_ENTER is only sent to AOEs, areas and triggers, so it will never be received by your module event script.

One way of starting a cutscene immediately is to place a trigger around the start location. The trigger event script starts the cutscene.

I imagine you can do the same thing in the area event script, too.

#3
Craig Graff

Craig Graff
  • Members
  • 608 messages
Generally we like to avoid putting triggers around the start location, since the order of events isn't particularly reliable in that case. Instead, cutscenes are generally started from EVENT_TYPE_AREALOAD_SPECIAL in the area script.

#4
stockinator

stockinator
  • Members
  • 10 messages
i tried to use the same script as Caladrin, except replaced EVENT_TYPE_ENTER with EVENT_TYPE_AREALOAD_SPECIAL, and it still doesn't work. although i did get rid of the character creation. here is what i have:



#include "events_h"

#include "global_objects_h"

#include "utility_h"

#include "wrappers_h"

void main()

{

event ev = GetCurrentEvent();

int nEventType = GetEventType(ev); //extract event type from current event

int nEventHandled = FALSE; //keep track of whether the event has been handled

switch(nEventType)

{

case EVENT_TYPE_MODULE_START:

{

object oCreature = GetEventCreator(ev);



break;

}

event ev = GetCurrentEvent();

int nEventType = GetEventType(ev);

int bEventHandled = FALSE;

switch (nEventType)

{

case EVENT_TYPE_AREALOAD_SPECIAL:

{

object oCreature = GetEventCreator(ev);

if(GetObjectActive(OBJECT_SELF)

&& IsPartyMember(oCreature))

{

resource rCutscene = R"opening.cut";

CS_LoadCutscene(rCutscene);

SetObjectActive(OBJECT_SELF, FALSE);

}

}

break;

}

}

if (!nEventHandled) //If this event wasn't handled by this script, let the core script try

{

HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);



}

}





please please help, i've been stumped for days

#5
Apolyon6k

Apolyon6k
  • Members
  • 175 messages
stockinator, where do you start that script?
I use a script for the module that uses EVENT_TYPE_MODULE_START for my intro and after chargen I use a script for the area which starts another cutscene in EVENT_TYPE_AREALOAD_SPECIAL.
Both in the same script wouldn't work afaik.

so you both need two separate scripts, one for the module start( with chargen, intro or other module specific lines) and one for the area that is your starting area. Keep in mind that simple cutscenes only work in one area unless you use bink movies.

The cutscene loaded in EVENT_TYPE_MODULE_START will play before or after chargen depending on the order in the script. The cutscene loaded in EVENT_TYPE_AREALOAD_SPECIAL will play everytime you enter that area unless you prevent that with ie. a plot flag.

Modifié par Apolyon6k, 21 janvier 2011 - 06:27 .


#6
TimelordDC

TimelordDC
  • Members
  • 923 messages
First off, that script won't compile because you are redeclaring the same variables again. Check your compile log.



Second, events get passed only to the respective object that is relevant to that event. So, EVENT_TYPE_MODULE_START would be fired to your module, which has to be intercepted by your module script. EVENT_TYPE_AREALOAD_SPECIAL gets sent to your area which should be intercepted by your area script.



As Apolyon stated above, you need to split the code into 2 different scripts and assign them to the module and area.

#7
stockinator

stockinator
  • Members
  • 10 messages
thanks guys. one other question, really nooby im sorry, but how do i call a script from another script?

#8
stockinator

stockinator
  • Members
  • 10 messages
here is my script now, as i want to play the cutscene when the module starts, not when you enter the area. It still isn't working.





#include "events_h"

#include "global_objects_h"

#include "utility_h"

#include "wrappers_h"

void main()

{

event ev = GetCurrentEvent();

int nEventType = GetEventType(ev); //extract event type from current event

int nEventHandled = FALSE; //keep track of whether the event has been handled

switch(nEventType)

{

case EVENT_TYPE_MODULE_START:

{



resource rCutscene = R"opening.cut";

CS_LoadCutscene(rCutscene);

SetObjectActive(OBJECT_SELF, FALSE);





break;

}

}

if (!nEventHandled) //If this event wasn't handled by this script, let the core script try

{

HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);



}

}


#9
Proleric

Proleric
  • Members
  • 2 350 messages
You can't start a cutscene until you've loaded the area. It would be like opening a play before you've decided which theatre and actors to use.  So the code has to go in the area event script for the initial area. You don't need to check whether the object is active or who created the event, but you probably need a plot flag to stop the cutscene happening every time the area is entered.

HandleEvent and DelayEvent can be used to start another script. If the second script doesn't care what event is occuring, you can use Event(EVENT_TYPE_INVALID) in those functions as a dummy entry to satisfy the syntax.

Modifié par Proleric1, 22 janvier 2011 - 12:32 .


#10
stockinator

stockinator
  • Members
  • 10 messages
ok, so i've made two scripts, the first being:

#include "events_h"

#include "global_objects_h"

#include "utility_h"

#include "wrappers_h"

void main()

{

event ev = GetCurrentEvent();

int nEventType = GetEventType(ev); //extract event type from current event

int nEventHandled = FALSE; //keep track of whether the event has been handled

switch(nEventType)

{

case EVENT_TYPE_MODULE_START:

{

HandleEvent(ev, RESOURCE_SCRIPT_OPENING_CUT);

break;

}

}

if (!nEventHandled) //If this event wasn't handled by this script, let the core script try

{

HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);



}

}







the second being:



#include "events_h"

#include "global_objects_h"

#include "utility_h"

#include "wrappers_h"

void main()

{

event ev = GetCurrentEvent();

int nEventType = GetEventType(ev); //extract event type from current event

int nEventHandled = FALSE; //keep track of whether the event has been handled

switch(nEventType)

{

case EVENT_TYPE_AREALOAD_SPECIAL:

{



resource rCutscene = R"opening.cut";

CS_LoadCutscene(rCutscene);

SetObjectActive(OBJECT_SELF, FALSE);





break;

}

}

if (!nEventHandled) //If this event wasn't handled by this script, let the core script try

{

HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);



}

}





i haven't put the plotflags in yet, ill do that later, This still doesn't seem to work, and yes i'm a total noob at this, but how does it know which area im loading with AREALOAD_SPECIAL?

#11
Proleric

Proleric
  • Members
  • 2 350 messages
Unfortunately, that chain of scripts won't work.

To capture an area event like EVENT_TYPE_AREALOAD_SPECIAL, you need to set the Script property of the area itself in the Object Inspector.

You can have a unique script for each area, so that there's no ambiguity, or you can check which area has loaded, as in the following example:
[quote]
// Crown of Creation - Area Event Script
//
// Adaram 24-Jan-2010
// Modified by Proleric 17-Mar-2010
//
// Events handled :
//    - Special  : Partypicker disabled when necessary
//
// Extract for illustration purposes
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "2da_constants_h"
#include "design_tracking_h"
#include "world_maps_h"
#include "sys_areabalance"
#include "achievement_core_h"
#include "plt_cocpt_despair"
void main()
{
    event  ev            = GetCurrentEvent();
    int    nEventType    = GetEventType(ev);
    int    bEventHandled = FALSE;
    object oArea         = OBJECT_SELF;
    string sArea         = GetTag(oArea);
    object oPC           = GetHero();
    switch(nEventType)
    {
       case EVENT_TYPE_AREALOAD_SPECIAL:
         {
           if (sArea == "coc330ar_heart_of_darkness")
             if (!WR_GetPlotFlag(PLT_COCPT_DESPAIR, COC_DESPAIR_EXIT_PROLOG)) 
               {             
                 CS_LoadCutscene(R"coc330cs_intro.cut", PLT_COCPT_DESPAIR, COC_DESPAIR_EXIT_PROLOG);
                 PlayCutscene();
               }
           break;
         }
    }
    if (!bEventHandled)
    {
        HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);
    }
}
[/quote]