Aller au contenu

Photo

Trigger and cutscene


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

#1
ladyofpayne

ladyofpayne
  • Members
  • 3 107 messages
I need to do: PC got to trigger and cutscene starts. But I can't do it- I create trigger, put it in area, but I can't write in "scripts" which cutscene I need to do- there is no my triigger, but in triggers it has a green mark.  

#2
Sunjammer

Sunjammer
  • Members
  • 926 messages
You need to add the script to the template (in the palette) rather than the instance (in the actual area).

If it is an approach that you might use a lot in your module it could be worth while creating a generic "cutscene trigger" that you can configure using the local variables. That way you only need 1 trigger and 1 script regardless of the number of cutscenes. I think I have an example kicking about if you are interested.

#3
ladyofpayne

ladyofpayne
  • Members
  • 3 107 messages
Please can you send me a code of working cutscene script. I am trying to write it, but int don't work here- all I get is the word Test and Test.

Here is my code

#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"

void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
Log_Events("", ev);
switch(nEventType) {
case EVENT_TYPE_ENTER:
{
object oHero = GetHero();
DisplayFloatyMessage(oHero, "Test", FLOATY_MESSAGE, 16777215, 2.f);
CS_LoadCutscene(R"tutorial.cut");
PlayCutscene();
break;
}
}
}

Modifié par ladyofpayne, 25 décembre 2011 - 05:26 .


#4
Sunjammer

Sunjammer
  • Members
  • 926 messages
As you can see from the example below you're not doing anything wrong. The example does has some extra code to restrict triggering to party members; to destroy the trigger after it's been entered; and to set a plot flag when it has finished playing, however the core functionality of the two is the same.

#include "events_h"
#include "utility_h"

void main()
{
    int bEventHandled;

    // decompose event
    event evCurrent = GetCurrentEvent();
    int nEventType = GetEventType(evCurrent);

    //--------------------------------------------------------------------------
    //  Handle Events
    //--------------------------------------------------------------------------

    switch(nEventType)
    {
        case EVENT_TYPE_ENTER:
        {
            object oCreature = GetEventCreator(evCurrent);

            if(IsPartyMember(oCreature))
            {
                // make the trigger inactive to prevent a recurrence
                DestroyObject(OBJECT_SELF);

                // load and run the cutscene
                string sPlotGuid = GetPlotGUID("mb1cor100_outlaws");
                CS_LoadCutscene(R"mb1cor100cs_outlaws_attack.cut", sPlotGuid, 0);
                PlayCutscene();

                // flag the event as handled
                bEventHandled = TRUE;
            }
            break;
         }
    }

    //--------------------------------------------------------------------------
    //  Unhandled Events
    //--------------------------------------------------------------------------

    if(!bEventHandled)
    {
        HandleEvent(evCurrent, RESOURCE_SCRIPT_TRIGGER_CORE);
    }
}

The fact you are getting the debug messages indicates that your script is running so that would tend to indicate the issue lies with the cutscene rather than the script (which is more Dahlia's area than mine). Just to check a couple of basic things: has the cutscene been exported and do you the resource name correct in the script?

Modifié par Sunjammer, 27 décembre 2011 - 02:45 .


#5
ladyofpayne

ladyofpayne
  • Members
  • 3 107 messages
Where I must write the name of my cutscene?

#6
DahliaLynn

DahliaLynn
  • Members
  • 1 387 messages
In your own script you need to insert your cutscene name here:

CS_LoadCutscene(R"tutorial.cut");

Remember to include the *.cut extension. 


*Edited for clarity

Modifié par DahliaLynn, 27 décembre 2011 - 10:26 .


#7
ladyofpayne

ladyofpayne
  • Members
  • 3 107 messages
I write this code, Sunjammer. It don't work here.
I test my module with hero Jorian.

Modifié par ladyofpayne, 28 décembre 2011 - 11:54 .