PDA

View Full Version : How to make a cutscene play every time you are in an area?


SithRevan
08-09-2006, 08:18 PM
I was wondering would it be possible to make a cutscene play everytime you go to a specific area, and if so how could I do something like that?

Darth333
08-09-2006, 08:23 PM
It's possible using the OnEnter event to fire it up.

SithRevan
08-09-2006, 08:36 PM
Actually, what I want to do is make it so that every time I warp to a certain level it will play it's cutscene, would that be possible to do?

Fiestainabox
08-09-2006, 09:11 PM
I'm pretty sure its what darth 333 said, onEnter scripts run everytime you enter a module. Your working on a warp band right? I think some of the enter scripts are in "onModuleLoad" value, try switching the onModuleLoad Script with the Onenter value and it'll start everytime.

SithRevan
08-09-2006, 09:18 PM
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

stoffe
08-09-2006, 11:56 PM
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. :)

SithRevan
08-10-2006, 01:47 AM
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!

stoffe
08-10-2006, 07:09 AM
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("MyCutsceneHasFired")) {
SetGlobalBoolean("MyCutsceneHasFired", TRUE);

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

DelayCommand(1.1, AssignCommand(oPC, ActionStartConversation(oPC, "mycutscene")));
}
}
}


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.)

SithRevan
08-10-2006, 01:17 PM
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?