Jump to content

Home

How to make a cutscene play every time you are in an area?


SithRevan

Recommended Posts

In the script I am using it doesn't have and "OnModuleLoad" tag, I am actually using a script that will make it start a new module (e.g. "StartNewModule"), but with that "OnEnter" tag you may have given me an idea, so thanks!:D

 

Update: Okay now I am not sure how to use the "OnEnter" event in a script so if somebody could help me that would be greatly appreciated!:D

Link to comment
Share on other sites

In the script I am using it doesn't have and "OnModuleLoad" tag, I am actually using a script that will make it start a new module (e.g. "StartNewModule"), but with that "OnEnter" tag you may have given me an idea, so thanks!:D

 

Update: Okay now I am not sure how to use the "OnEnter" event in a script so if somebody could help me that would be greatly appreciated!:D

 

The OnEnter event of an area fires every time a character (any character, not just party members) transition to or are spawned into the area (including when a savegame loads). The script file to run when this event occurs is set in the .ARE file of the area in the OnEnter field.

 

The OnModuleLoad script is set in the module.ifo file of the module in the Mod_OnModLoad. This only fires once while the module is loading. Be warned however that the player character does not yet exist in the game area in the module when this is running (i.e. GetFirstPC() won't return a valid object), unlike the area's OnEnter event, so if you try to run cutscenes from the Module load event it may work a bit oddly unless they are delayed. :)

Link to comment
Share on other sites

Well I found the scripts, both of them but I need to know what I am supposed to do with them, if you could help me again it would be extremely appreciated, thanks!

 

That depends on what you want to do. :) If, for example you have a cutscene handled by the DLG file mycutscene.dlg, you could add something like this to the OnEnter script of the area to make that cutscene trigger the first time the player enters that area:

 

void main() {
   object oPC = GetFirstPC();
   if ((GetEnteringObject() == oPC) && !GetLoadFromSaveGame()) {
       if (!GetGlobalBoolean("[color=Yellow]MyCutsceneHasFired[/color]")) {
           SetGlobalBoolean("[color=Yellow]MyCutsceneHasFired[/color]", TRUE);

           NoClicksFor(1.0);
           SetGlobalFadeOut();
           SetFadeUntilScript();
           DelayCommand(1.0, SetGlobalFadeIn(1.0, 1.0));

           DelayCommand(1.1, AssignCommand(oPC, ActionStartConversation(oPC, "[color=Red]mycutscene[/color]")));
       }
   }
}

 

Where the yellow parts is the name of a global variable that keeps track of if the cutscene has fired (you could also use a LocalBoolean set on the Area to keep track of it if you don't want to create new globals). The red part is the name of the DLG file that handles the cutscene. (If the area already has an OnEnter script you'll have to insert the content of the main() method above at the appropriate place instead.)

Link to comment
Share on other sites

I'm not exactaly sure where to put this inside of the script, so here it is...

 

// Prototypes
void sub1();

void sub1() {
object oT3m4 = GetObjectByTag("t3m4", 0);
if (GetIsObjectValid(oT3m4)) {
	AurPostString("destroying t3 off the map", 5, 15, 10.0);
	DestroyObject(oT3m4, 0.0, 0, 0.0, 0);
}
SetNPCSelectability(8, 0);
object oPC = GetFirstPC();
effect efNext = GetFirstEffect(oPC);
while (GetIsEffectValid(efNext)) {
	if ((GetEffectType(efNext) == 27)) {
		RemoveEffect(oPC, efNext);
	}
	efNext = GetNextEffect(oPC);
}
SetGlobalFadeIn(0.0, 2.0, 0.0, 0.0, 0.0);
}

void main() {
object oEntering = GetEnteringObject();
if ((GetEnteringObject() == GetFirstPC())) {
	if ((GetGlobalNumber("101PER_Sion_Arrives") > 0)) {
		PlayRoomAnimation("101PERzc", 1);
	}
	else {
		PlayRoomAnimation("101PERzc", 2);
	}
	if (GetLoadFromSaveGame()) {
		SetGlobalFadeOut(0.0, 0.0, 0.0, 0.0, 0.0);
		SetFadeUntilScript();
		DelayCommand(2.0, SetGlobalFadeIn(1.0, 1.0, 0.0, 0.0, 0.0));
		return;
	}
	if (GetGlobalBoolean("PER_TURNINTO_T3M4")) {
		SetGlobalBoolean("PER_TURNINTO_T3M4", 0);
		DelayCommand(0.1, sub1());
	}
	if ((GetGlobalNumber("105PER_T3_End") == 1)) {
		SetGlobalFadeIn(0.0, 1.0, 0.0, 0.0, 0.0);
		SetGlobalNumber("105PER_T3_End", 2);
		object oAtton = GetObjectByTag("Atton", 0);
		DelayCommand(0.5, AssignCommand(oAtton, ClearAllActions()));
		DelayCommand(0.5, AssignCommand(oAtton, ActionStartConversation(oEntering, "101Atton", 0, 0, 1, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0)));
	}
	object oWP_wakeup_donnie = GetObjectByTag("WP_wakeup_donnie", 0);
	if ((GetIsObjectValid(oWP_wakeup_donnie) && GetLocalBoolean(oWP_wakeup_donnie, 29))) {
		PlayRoomAnimation("101per2b", 3);
	}
	else {
		if ((0 == GetGender(oEntering))) {
			SetGlobalBoolean("000_PLAYER_GENDER", 1);
			return;
		}
		SetGlobalFadeOut(0.0, 0.0, 0.0, 0.0, 0.0);
		SetFadeUntilScript();
	}
}
}

 

can you give me any tips on where to put it?

 

EDIT: Where would you put the script in your post in this script?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...