Aller au contenu

Photo

Post-battle cutscene.


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

#1
Jackson Flynn

Jackson Flynn
  • Members
  • 40 messages

Put simply what is the best way (and by best, I probably mean "simplest" way...) to spark a cutscene at the end of a battle?

 

In a certain exterior area I have a hidden dungeon entrance. Before the party reach it, they are assaulted by an encounter that is sprung as they get closer. The encounter consists of a set number of undead, (about 8 zombies if I recall correctly). Once they are dispatched the party have the option to enter the dungeon, but at least one companion will want to stop this, as it will be a risky distraction from the main quest. It will lead to a multi NPC convo where the player can gain or lose influence/respect with companions based on their decision. 

 

Essentially, what i want is for the last zombie to die, and the camera to track to the dungeon door, then cut to "Caleb" who says that it might be enticing, but let's leave it and come back later eh.. leading to the main part of the convo.

 

Would this work...
If I put a variable on the area, and copy the zombie blueprint adding an OnDeath script that advances the variable by one, and a heartbeat script on the area that fires when the variable hits a specific value equal to the number of zombies?
The heartbeat script would fire the convo.

 

What will happen to the zombies if I replace the generic ondeath script? And if I wanted to add the script to the current ondeath script, what things do I need to be aware of. For example, if I used Lilac Souls SG, what should I copy, and where should I paste... that sort of thing.

 

 

Or, of course, is there a really simple way to do this that I've completely missed?



#2
PJ156

PJ156
  • Members
  • 2 987 messages
You can create an on death script which adds one each time and tests to see if the number of zombies has been reached.

I have used this:

void main()
{

object oPC = GetFirstPC();

//Set the integer to add one each time.

int nInt;
nInt = GetLocalInt(oPC, "01_06_thug");

nInt += 1;

SetLocalInt(oPC, "01_06_thug", nInt);

//debug to show total in game

string oTotal = IntToString(nInt);

SendMessageToPC(oPC, "oTotal");

// Test the integer, is everyone dead yet?

if (GetLocalInt(oPC, "01_06_thug")< 10)
return;


object oTarget;

oTarget = GetObjectByTag("01_ip_06_thug_dead");

AssignCommand(oTarget, ActionStartConversation(oPC, ""));

}

What you need to be careful of is that the npc called is alive when the conversation fires. If Caleb died in the combat then the conversation will fail on his node. I get round this becuase I hahve the default death system so everyone is up after the fight anyway. I make sure the convo is called from an ipoint and there is a delay in the conversation to allow the npc's to stand if required. Your tracking camera shot should do that.

Others have done this much better. If you open up Matt Reiders TWA2 he has a script which resurrects the required npc's for plot critical conversations. You will need to do something like that if you ahve a non standard death system.

PJ

#3
Guest_Iveforgotmypassword_*

Guest_Iveforgotmypassword_*
  • Guests
Most simple with no scripting = put a key on a zombie so they'll all be dead during the fight and no need to worry about who died when or dead companions and set the conversation cutscene on the door using the generic script for door conversations just don't forget to set the conversation nodes to the npc's or you'll be looking at a door.

Of course if somebody kills the key zombie then runs to the door the cutscene will fire but it's highly unlikely and so long as you make the conversation run always until the last line it wont matter if a party member's dead and breaks the conversation.

#4
Guest_Iveforgotmypassword_*

Guest_Iveforgotmypassword_*
  • Guests
This is what I used when I wanted a companion to stay alive for a conversation ( she's the kim bit ) Claudius33 wrote it for me.

//By Claudius33 2/10/2012 )//
void main()
{
object oPC = GetFirstPC();
object oKim = GetObjectByTag("kim");
object oTarget;
oTarget = GetObjectByTag("purpc_monkup");
AssignCommand(oPC, ClearAllActions(TRUE));
AssignCommand(oKim, ClearAllActions(TRUE));
ForceRest(oPC);
ForceRest(oKim);
AssignCommand(oKim, ActionJumpToObject(oPC));
DelayCommand(0.1f, AssignCommand(oPC, ActionStartConversation(oTarget, "dead_troll",FALSE,FALSE,TRUE,FALSE)));
}

I just stuck it on the creature's on death bit and purpc_monkup was an npc that was safe elsewhere so the conversation wouldn't break if he was dead.

#5
andysks

andysks
  • Members
  • 1 654 messages

Done such things, and I found that the best way to do it is not wait from the last zombie to die but make them a group and wait so that the whole group dies together. ginc_group contains all these functions, which are pretty straightforward. Now, if you can/want to actually control the killing sequence, and the last one will  always be the last, then you only need one script to put on his OnDeath.

 

In both cases, the best function hands down is CreateIPSpeaker. it takes care of everything. say your convo is called "after_zombie", and the NPC to talk the line "bob".

The OnDeath of the last zombie would have #include "ginc_group" and just one line:

 

CreateIPSpeaker("bob", "after_zombie", GetLocation(GetFirstPC()));

 

That's all it takes. If you decide to group them, remember to call their death script together with the grouping and leave the OnDeath slot as the default. Example portion of a script I use as a client enter somewhere:

 

object oFactionMember = GetObjectByTag("c_faction_pig_galacod");
object oPC = GetFirstPC();

 

FactionToGroup(oFactionMember, "GOBLINOIDS", FALSE,FALSE);
GroupOnDeathBeginConversation("GOBLINOIDS", "c_malerin", "after_first_wave");

 

With that the PC enter the area, the neutral goblins get grouped and told that when they die the "c_malerin" has to initiate the convo "after_first_wave". Plus earlier than their death I can set them all hostile or whatever.



#6
Tchos

Tchos
  • Members
  • 5 079 messages

What Andy says is what I strongly recommend.  There is nothing simpler and more robust.  He's describing two different methods there, though, so let me explain further.

 

Using either of these methods means that you don't need to worry about being in combat or anything else stopping the conversation from firing.  It will fire, and only after they're all dead.

 

To use these, you need to set up one thing.  After that, it's simplicity in itself.  The script wants to define the group leader with a particular script, or use a default.  Check your On Module Load script for the lines:

    // set up custom ipspeaker script
    SetGlobalString(CAMPAIGN_STRING_CUSTOM_IPSPEAKER , "ka_get_party_leader");

 

If you have that, then you'll need a script called ka_get_party_leader.  I recommend just removing that line, and the script will use the default party leader.  My ka_get_party_leader says this:

#include "x2_inc_switches"
void main()
{
	object oPC = GetFirstPC();
	object oLeader = GetFactionLeader(oPC);

	SetLocalObject(GetModule(), CAMPAIGN_STRING_CUSTOM_IPSPEAKER, oLeader);
}

Don't use the On Death method if you want the whole group to be dead for the convo to fire.  Simply create the group as described above, and use the GroupOnDeathBeginConversation line (requires including "ginc_group" in your script).  That takes care of everything, including making sure the intended speakers are alive, and that no one's in combat, and many other things that could otherwise stop a conversation.  Nothing else needed to do.



#7
andysks

andysks
  • Members
  • 1 654 messages

Tchos can I have some clarification on this? I haven't done the things you describe, but the function works for me. Why is that, and why and how is the ka_get_party:leader needed/used? My mod_load is a copy of the MotB one, with the appropriate lines commented out, and the line you describe is searching for the spirit eater. This is commented out of course, but no further work was done from me to make CreateIPSpeaker to work...



#8
Tchos

Tchos
  • Members
  • 5 079 messages

As long as there is no such line, or it is commented out, it'll fall back on an alternative default function to determine the party leader, and there'll be no problem.  The only time it matters is if you use a module load script that you copied from somewhere that does specify a special script, and you don't have that script.  It'll just silently fail and you won't know why, so I explained it here.