Aller au contenu

Photo

Creating triggers to play cutscenes....


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

#1
Doctorbashir

Doctorbashir
  • Members
  • 15 messages
I'm kinda new to this modding thing, I'm starting to get into it but I'm not sure how to create a trigger to start a cutscene when a character walks over it.  I'm pretty sure I need to write a script to do so, but like I said, I'm new to this, wondering if someone could point me in the right direction.

#2
EmeryQuinn

EmeryQuinn
  • Members
  • 35 messages
Link here:

http://social.biowar..._from_a_trigger

Link the script to the trigger you place in your level. Fill in your cutscene info into the script.

Modifié par EmeryQuinn, 08 novembre 2009 - 06:57 .


#3
Doctorbashir

Doctorbashir
  • Members
  • 15 messages
I tried copy/paste that into a new script which I then set as the script for the trigger, replacing the my_cutscene with the name of mine, and when it tries to compile it kicks back this error: E: 02:15:27 - play_cutscene1_script.nss - play_cutscene1_script.nss(15): No right bracket on expression


#4
Dmuse

Dmuse
  • Members
  • 44 messages
The wiki script should be correct. Make sure you have all of the {}'s in your script and make sure the name of your .nss file is valid (should be).



The error is stating just that it is missing a } somewhere.

#5
Doctorbashir

Doctorbashir
  • Members
  • 15 messages
I'm going crazy, copy and pasting the script from the link just always gives me an error on compile, here is a screenshot, can someone give me a clue:

http://img691.images...0/screencap.jpg

#6
Jonathan Epp

Jonathan Epp
  • Members
  • 1 messages

Doctorbashir wrote...

I'm going crazy, copy and pasting the script from the link just always gives me an error on compile, here is a screenshot, can someone give me a clue:

http://img691.images...0/screencap.jpg


Check your {}'s, you're missing a closing brace on your case statement.

If you place the cursor next to a brace and then right-click for the context menu there will be an option called "Go to matching brace". This can be helpful in isolating problems like these.

#7
Doctorbashir

Doctorbashir
  • Members
  • 15 messages
The first bracket after void main () has no corresponding closing bracket, but there is no where in the script(I've tried adding one on every line and at the end) that it keeps it from hanging on that error when I try to compile...

#8
Beerfish

Beerfish
  • Members
  • 23 868 messages
See if this works.



#include "events_h"

#include "global_objects_h"

#include "utility_h"



void main ()

{

event ev = GetCurrentEvent();

int nEventType = GetEventType(ev);

int nEventHandled = FALSE;

switch (nEventType)

{

case EVENT_TYPE_ENTER:

{

object oCreature = GetEventCreator(ev);

if(IsHero(oCreature))

{

resource rCutscene = GetLocalResource(GetModule(), "dr1_cut_intro");

CS_LoadCutscene(rCutscene);

DestroyObject(OBJECT_SELF, 0);

}

break;

}

}

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

{

HandleEvent(ev, RESOURCE_SCRIPT_TRIGGER_CORE);

}

}

#9
Doctorbashir

Doctorbashir
  • Members
  • 15 messages
That compiles fine, though I can't actually get it to do anything after I export and load the module.... Perhaps I don't understand triggers as well as I thought, I'll have to mess with it.

#10
AnTeevY

AnTeevY
  • Members
  • 109 messages
Try:



#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"cut_start.cut");

PlayCutscene();

break;

}



}

}



This works for me (cutscene name is "cut_start"). If it fails to play, it displays a message over the head of your character.

#11
Doctorbashir

Doctorbashir
  • Members
  • 15 messages
Yes! It worked perfectly, thank you so much, it was the only thing I've had any trouble with in the toolset. Thanks again.

#12
Dmuse

Dmuse
  • Members
  • 44 messages
Glad to hear it!

#13
Tyharo

Tyharo
  • Members
  • 17 messages

Dmuse wrote...

The wiki script should be correct. Make sure you have all of the {}'s in your script and make sure the name of your .nss file is valid (should be).

The error is stating just that it is missing a } somewhere.

But the actual error is somewhere else.

From the wiki:

IsPlayer(oCreature)

IsPlayer -> IsHero

The wiki should be correct yes, but I guess it isn't? :)

Modifié par Tyharo, 09 novembre 2009 - 03:59 .


#14
Tyharo

Tyharo
  • Members
  • 17 messages
I could put my question here I guess, having problems with a trigger too.
I don't want it to play a cutscene but make a journal entry/update instead.

In my area I have placed a trigger wich has a script in it called 'trigger_test'.
This is in trigger_test:

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

void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
int nEventHandled = FALSE;
Log_Events("", ev);

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

if(IsHero(oCreature))
{
WR_SetPlotFlag(PLT_KILL_LEONARD, LEONARD_FOUND, TRUE);
}
break;
}
}
if (!nEventHandled) //If this event wasn't handled by this script, let the core script try
{
HandleEvent(ev, RESOURCE_SCRIPT_TRIGGER_CORE);
}
}

It doesn't give any errors, but it doesn't trigger my journal to update either.
I included the plotfile and I also checked the names regarding the updating of the plot, but it doesn't do anything.
Seems I am missing something.

Maybe it has to do with this:
When I open up my area and click on the trigger added to it, you see in the right lower corner some info regarding it.
Like active (wich is set to TRUE), Importance (wich is set to Critical) etc.
There isn't filled out a name in the name box, and can't change that either.
Also no variables set.
Maybe the problem is somewhere over there?

Modifié par Tyharo, 09 novembre 2009 - 05:30 .


#15
nametab

nametab
  • Members
  • 70 messages
I've had the same problem as Doctorbashir, the script just wouldn't compile. After reading this thread and fixing the script it compiles but doesn't really do anything. The cutscene will not play in-game and I even tried the script with the floating text appearing if there's a problem with the scene. The floating text did appear but I just don't know what to make that cutscene play in the game and I've used all of the scripts mentioned here.

#16
st4rdog

st4rdog
  • Members
  • 104 messages

nametab wrote...

I've had the same problem as Doctorbashir, the script just wouldn't compile. After reading this thread and fixing the script it compiles but doesn't really do anything. The cutscene will not play in-game and I even tried the script with the floating text appearing if there's a problem with the scene. The floating text did appear but I just don't know what to make that cutscene play in the game and I've used all of the scripts mentioned here.

This one definately works:

#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"1cutscene.cut");
            PlayCutscene();
            break;  
        }
    }   
}

Change 1cutscene.cut.

Modifié par st4rdog, 10 novembre 2009 - 03:21 .


#17
Tyharo

Tyharo
  • Members
  • 17 messages
The trigger to update my journal works now, I just forgot to export the trigger after changing stuff.

The script I wrote worked fine afterall, I already couldn't find what the hell would be wrong with that.

It was just me forgetting to export the trigger.


#18
nametab

nametab
  • Members
  • 70 messages

st4rdog wrote...

nametab wrote...

I've had the same problem as Doctorbashir, the script just wouldn't compile. After reading this thread and fixing the script it compiles but doesn't really do anything. The cutscene will not play in-game and I even tried the script with the floating text appearing if there's a problem with the scene. The floating text did appear but I just don't know what to make that cutscene play in the game and I've used all of the scripts mentioned here.

This one definately works:

#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"1cutscene.cut");
            PlayCutscene();
            break;  
        }
    }   
}

Change 1cutscene.cut.


You, kind sir, are a genius! Thank you very much for your help.

#19
st4rdog

st4rdog
  • Members
  • 104 messages
It's just AnTeevY's script reformatted :)

#20
nametab

nametab
  • Members
  • 70 messages
Nevertheless it's overjoying to see something you've been working on for 2 days actually work. I just had to add DestroyObject to your script to avoid the cutscene looping until the player leaves the trigger area but it finally works. So, again, thank you :)

#21
Ginggis Khan

Ginggis Khan
  • Members
  • 71 messages
Review all the material (scripts etc) from the DEMO module it has a LOT of helpful information.