Aller au contenu

Photo

Trigger script and plot


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

#1
McAden

McAden
  • Members
  • 12 messages
I have a script I attached to a trigger.   The purpose of the trigger is to display a cutscene.

The problem I'm having is that the cutscene always triggers over and over again.  I can't step over the trigger because any time I touch it the cutscene triggers.

The cutscene is called using: 
 

  if (!WR_GetPlotFlag(PLT_INTRO, CUTSCENE_PLAYED))
  { 

    WR_SetPlotFlag(PLT_INTRO, CUTSCENE_PLAYED, TRUE);
    CS_LoadCutscene(R"myCutscene.cut"); 
  }

I don't get why the cutscene is constantly called even though I'm setting the plot flag to TRUE.

Modifié par McAden, 14 juillet 2010 - 07:24 .


#2
FergusM

FergusM
  • Members
  • 460 messages
I don't know why your plot isn't working, but the boilerplate for this kind of thing is:



Safe_Destroy_Object(OBJECT_SELF); //try just DestroyObject if that doesn't work, or WR_DestroyObject



This destroys the trigger, so it won't fire again. Of course, make sure you are checking that the person entering the trigger is a player character, etc.

#3
Sunjammer

Sunjammer
  • Members
  • 926 messages
I encountered the same problem with using the Plot flags to guard the cutscene. I've also been using DestroyObject though it feels inelegant.

I trawled the database and, in the few triggers that actually run a cutscene directly, BioWare use DestroyObject or the trigger's TRIGGER_DO_ONCE_A local variable as the guard condition.

In the process I also learned that I don't need to follow CS_LoadCutscene with PlayCutscene because the former is hard wired to pass TRUE into the bPlayImmediately parameter for LoadCutscene.

Modifié par Sunjammer, 14 juillet 2010 - 02:31 .


#4
McAden

McAden
  • Members
  • 12 messages
If I relied on destroying it, would it be added the next time the player enters that scene?

#5
FergusM

FergusM
  • Members
  • 460 messages
No, it's gone for good.

#6
McAden

McAden
  • Members
  • 12 messages
I agree with Sunjammer. It feels quite inelegant.



But, I guess if that's the only real way to do it, so be it. Thanks much for the help guys.

#7
FergusM

FergusM
  • Members
  • 460 messages
Actually, another thing you can try if you're looking for a more elegant solution is:

int bDoOnce = GetLocalInt(OBJECT_SELF, TRIGGER_DO_ONCE_A);
if(!bDoOnce)
{

The trigger variables include do once a and b, as well as counters 1 2 and 3 which can be used for this sort of thing.

EDIT: Eh, Sunjammer already mentioned it.

Modifié par FergusM, 15 juillet 2010 - 08:58 .